@@ -242,97 +242,6 @@ namespace Dune
242
242
}
243
243
}
244
244
245
- // / \brief seperate overlap and ghost cells
246
- void seperateOverlapAndGhostCells (const CpGrid& grid, const std::vector<int >& cell_has_well,
247
- std::vector<int >& part_type, int layers)
248
- {
249
-
250
- auto lid = grid.localIdSet ();
251
- auto gid = grid.globalIdSet ();
252
- part_type.resize (grid.numCells (), 0 );
253
-
254
- for (auto it = grid.leafbegin <0 >(); it != grid.leafend <0 >(); ++it) {
255
- auto elem = *it;
256
-
257
- if (elem.partitionType () == InteriorEntity) {
258
- auto id = lid.id (elem);
259
-
260
- part_type[id] = 1 ;
261
-
262
- for (CpGrid::LeafIntersectionIterator iit = elem.ileafbegin (); iit != elem.ileafend (); ++iit) {
263
- auto inter = *iit;
264
- if ( inter.neighbor () ) {
265
- auto nab = inter.outside ();
266
- int nab_lid = lid.id (nab);
267
- if (nab.partitionType () != InteriorEntity && part_type[nab_lid] == 0 ) {
268
- int nab_gid = gid.id (nab);
269
-
270
- if ( cell_has_well[nab_gid] == 1 ) {
271
- part_type[nab_lid] = layers + 1 ;
272
- }
273
- else {
274
- part_type[nab_lid] = 2 ;
275
- }
276
- }
277
- }
278
- }
279
- }
280
- }
281
-
282
- int layer = 2 ;
283
- while (layer < layers + 1 ) {
284
- for (auto it = grid.leafbegin <0 >(); it != grid.leafend <0 >(); ++it) {
285
-
286
- auto elem = *it;
287
- int id = lid.id (elem);
288
- bool isLayer = part_type[id] == layer || part_type[id] == layers + 1 ;
289
-
290
- if (elem.partitionType () != InteriorEntity && isLayer) {
291
- for (CpGrid::LeafIntersectionIterator iit = elem.ileafbegin (); iit != elem.ileafend (); ++iit) {
292
-
293
- auto inter = *iit;
294
- if ( inter.neighbor () ) {
295
-
296
- auto nab = inter.outside ();
297
- int nab_gid = gid.id (nab);
298
- int nab_lid = lid.id (nab);
299
-
300
- if (nab.partitionType () != InteriorEntity && part_type[nab_lid] == 0 ) {
301
- if (cell_has_well[nab_gid] == 1 ) {
302
- part_type[nab_lid] = layers + 1 ;
303
- }
304
- else {
305
- part_type[nab_lid] = layer + 1 ;
306
- }
307
- }
308
- }
309
- }
310
- }
311
- /*
312
- else if (elem.partitionType() != InteriorEntity && part_type[id] == layers + 1) {
313
- int gid_e = gid.id(elem);
314
- bool isWell = cell_has_well[gid_e] == 1;
315
- if ( isWell ) {
316
- for (CpGrid::LeafIntersectionIterator iit = elem.ileafbegin(); iit != elem.ileafend(); ++iit) {
317
- auto inter = *iit;
318
- if ( inter.neighbor() ) {
319
-
320
- auto nab = inter.outside();
321
- int nab_gid = gid.id(nab);
322
- int nab_lid = lid.id(nab);
323
- if (nab.partitionType() != InteriorEntity) {
324
- part_type[nab_lid] = layers + 1;
325
- }
326
- }
327
- }
328
- }
329
- }
330
- */
331
- }
332
- layer++;
333
- }
334
- }
335
-
336
245
// / \brief Adds cells to the overlap that just share a point with an owner cell.
337
246
void addOverlapCornerCell (const CpGrid& grid, int owner,
338
247
const CpGrid::Codim<0 >::Entity& from,
@@ -499,9 +408,7 @@ void addOverlapLayer(const CpGrid& grid, int index, const CpGrid::Codim<0>::Enti
499
408
auto ownerSize = exportList.size ();
500
409
const CpGrid::LeafIndexSet& ix = grid.leafIndexSet ();
501
410
std::map<int ,int > exportProcs, importProcs;
502
-
503
- std::vector<std::tuple<int ,int ,char >> ghostList;
504
-
411
+
505
412
for (CpGrid::Codim<0 >::LeafIterator it = grid.leafbegin <0 >();
506
413
it != grid.leafend <0 >(); ++it) {
507
414
int index = ix.index (*it);
@@ -544,7 +451,7 @@ void addOverlapLayer(const CpGrid& grid, int index, const CpGrid::Codim<0>::Enti
544
451
// Remove duplicate cells in overlap layer.
545
452
auto newEnd = std::unique (ownerEnd, exportList.end (), overlapEqual);
546
453
exportList.resize (newEnd - exportList.begin ());
547
-
454
+
548
455
for (const auto & entry: importList)
549
456
importProcs.insert (std::make_pair (std::get<1 >(entry), 0 ));
550
457
// count entries to send
@@ -596,24 +503,24 @@ void addOverlapLayer(const CpGrid& grid, int index, const CpGrid::Codim<0>::Enti
596
503
597
504
MPI_Waitall (requests.size (), requests.data (), statuses.data ());
598
505
599
- // -------------- Communicate overlap type
506
+ // Communicate overlap type
600
507
++tag;
601
508
std::vector<std::vector<int > > typeBuffers (importProcs.size ());
602
- auto tbuffer = typeBuffers.begin ();
509
+ auto partitionTypeBuffer = typeBuffers.begin ();
603
510
req = requests.begin ();
604
511
605
512
for (auto && proc: importProcs)
606
513
{
607
- tbuffer ->resize (proc.second );
608
- MPI_Irecv (tbuffer ->data (), proc.second , MPI_INT, proc.first , tag, cc, &(*req));
609
- ++req; ++tbuffer ;
514
+ partitionTypeBuffer ->resize (proc.second );
515
+ MPI_Irecv (partitionTypeBuffer ->data (), proc.second , MPI_INT, proc.first , tag, cc, &(*req));
516
+ ++req; ++partitionTypeBuffer ;
610
517
}
611
518
612
519
for (const auto & proc: exportProcs)
613
520
{
614
521
std::vector<int > sendBuffer;
615
522
sendBuffer.reserve (proc.second );
616
-
523
+
617
524
for (auto t = ownerEnd; t != exportList.end (); ++t) {
618
525
if ( std::get<1 >(*t) == proc.first ) {
619
526
if ( std::get<2 >(*t) == AttributeSet::copy)
@@ -622,21 +529,20 @@ void addOverlapLayer(const CpGrid& grid, int index, const CpGrid::Codim<0>::Enti
622
529
sendBuffer.push_back (1 );
623
530
}
624
531
}
625
-
626
532
MPI_Send (sendBuffer.data (), proc.second , MPI_INT, proc.first , tag, cc);
627
533
}
628
534
629
535
std::inplace_merge (exportList.begin (), ownerEnd, exportList.end ());
630
536
MPI_Waitall (requests.size (), requests.data (), statuses.data ());
631
- // ------------------------------
632
-
537
+
538
+ // Add the overlap layer to the import list on each process.
633
539
buffer = receiveBuffers.begin ();
634
- tbuffer = typeBuffers.begin ();
540
+ partitionTypeBuffer = typeBuffers.begin ();
635
541
auto importOwnerSize = importList.size ();
636
-
542
+
637
543
for (const auto & proc: importProcs)
638
544
{
639
- auto pt = tbuffer ->begin ();
545
+ auto pt = partitionTypeBuffer ->begin ();
640
546
for (const auto & index : *buffer) {
641
547
642
548
if (*pt == 0 ) {
@@ -648,7 +554,7 @@ void addOverlapLayer(const CpGrid& grid, int index, const CpGrid::Codim<0>::Enti
648
554
++pt;
649
555
}
650
556
++buffer;
651
- ++tbuffer ;
557
+ ++partitionTypeBuffer ;
652
558
}
653
559
std::sort (importList.begin () + importOwnerSize, importList.end (),
654
560
[](const std::tuple<int ,int ,char ,int >& t1, const std::tuple<int ,int ,char ,int >& t2)
0 commit comments