@@ -242,7 +242,6 @@ PatchKernel::PatchKernel(const PatchKernel &other)
242
242
m_boxMaxCounter(other.m_boxMaxCounter),
243
243
m_adjacenciesBuildStrategy(other.m_adjacenciesBuildStrategy),
244
244
m_interfacesBuildStrategy(other.m_interfacesBuildStrategy),
245
- m_spawnStatus(other.m_spawnStatus),
246
245
m_adaptionMode(other.m_adaptionMode),
247
246
m_adaptionStatus(other.m_adaptionStatus),
248
247
m_dimension(other.m_dimension),
@@ -329,7 +328,6 @@ PatchKernel::PatchKernel(PatchKernel &&other)
329
328
m_boxMaxCounter(std::move(other.m_boxMaxCounter)),
330
329
m_adjacenciesBuildStrategy(std::move(other.m_adjacenciesBuildStrategy)),
331
330
m_interfacesBuildStrategy(std::move(other.m_interfacesBuildStrategy)),
332
- m_spawnStatus(std::move(other.m_spawnStatus)),
333
331
m_adaptionMode(std::move(other.m_adaptionMode)),
334
332
m_adaptionStatus(std::move(other.m_adaptionStatus)),
335
333
m_id(std::move(other.m_id)),
@@ -419,7 +417,6 @@ PatchKernel & PatchKernel::operator=(PatchKernel &&other)
419
417
m_boxMaxCounter = std::move (other.m_boxMaxCounter );
420
418
m_adjacenciesBuildStrategy = std::move (other.m_adjacenciesBuildStrategy );
421
419
m_interfacesBuildStrategy = std::move (other.m_interfacesBuildStrategy );
422
- m_spawnStatus = std::move (other.m_spawnStatus );
423
420
m_adaptionMode = std::move (other.m_adaptionMode );
424
421
m_adaptionStatus = std::move (other.m_adaptionStatus );
425
422
m_id = std::move (other.m_id );
@@ -523,14 +520,11 @@ void PatchKernel::initialize()
523
520
// Set interfaces build strategy
524
521
setInterfacesBuildStrategy (INTERFACES_NONE);
525
522
526
- // Set the spawn as unneeded
523
+ // Set the adaption as dirty
527
524
//
528
- // Specific implementation will set the appropriate status during their
529
- // initialization.
530
- setSpawnStatus (SPAWN_UNNEEDED);
531
-
532
- // Set the adaption as clean
533
- setAdaptionStatus (ADAPTION_CLEAN);
525
+ // Setting the adaptation as dirty guarantees that, at the first patch
526
+ // updated, all the data structures will be properly initialized.
527
+ setAdaptionStatus (ADAPTION_DIRTY);
534
528
535
529
#if BITPIT_ENABLE_MPI==1
536
530
// Initialize communicator
@@ -645,12 +639,6 @@ std::vector<adaption::Info> PatchKernel::update(bool trackAdaption, bool squeeze
645
639
// Finalize alterations
646
640
mergeAdaptionInfo (finalizeAlterations (trackAdaption, squeezeStorage), adaptionData);
647
641
648
- // Spawn
649
- bool spawnNeeed = (getSpawnStatus () == SPAWN_NEEDED);
650
- if (spawnNeeed) {
651
- mergeAdaptionInfo (spawn (trackAdaption), adaptionData);
652
- }
653
-
654
642
// Adaption
655
643
bool adaptionDirty = (getAdaptionStatus (true ) == ADAPTION_DIRTY);
656
644
if (adaptionDirty) {
@@ -689,33 +677,7 @@ void PatchKernel::simulateCellUpdate(const long id, adaption::Marker marker, std
689
677
*/
690
678
std::vector<adaption::Info> PatchKernel::spawn (bool trackSpawn)
691
679
{
692
- std::vector<adaption::Info> spawnData;
693
-
694
- #if BITPIT_ENABLE_MPI==1
695
- // This is a collevtive operation and should be called by all processes
696
- if (isPartitioned ()) {
697
- const auto &communicator = getCommunicator ();
698
- MPI_Barrier (communicator);
699
- }
700
- #endif
701
-
702
- // Check spawn status
703
- SpawnStatus spawnStatus = getSpawnStatus ();
704
- if (spawnStatus == SPAWN_UNNEEDED || spawnStatus == SPAWN_DONE) {
705
- return spawnData;
706
- }
707
-
708
- // Spawn the patch
709
- spawnData = _spawn (trackSpawn);
710
-
711
- // Finalize patch alterations
712
- finalizeAlterations (true );
713
-
714
- // Spwan is done
715
- setSpawnStatus (SPAWN_DONE);
716
-
717
- // Done
718
- return spawnData;
680
+ return adaption (trackSpawn);
719
681
}
720
682
721
683
/* !
@@ -1347,23 +1309,9 @@ void PatchKernel::write(VTKWriteMode mode)
1347
1309
*/
1348
1310
PatchKernel::SpawnStatus PatchKernel::getSpawnStatus () const
1349
1311
{
1350
- // There is no need to check the spawn status globally because the spawn
1351
- // status will always be the same on all the processes.
1352
-
1353
- return m_spawnStatus;
1312
+ return SPAWN_UNNEEDED;
1354
1313
}
1355
1314
1356
- /* !
1357
- Set the current spawn status.
1358
-
1359
- \param status is the spawn status that will be set
1360
- */
1361
- void PatchKernel::setSpawnStatus (SpawnStatus status)
1362
- {
1363
- m_spawnStatus = status;
1364
- }
1365
-
1366
-
1367
1315
/* !
1368
1316
Checks if the patch supports adaption.
1369
1317
@@ -1472,10 +1420,6 @@ bool PatchKernel::isDirty(bool global) const
1472
1420
assert (isDirty || m_alteredInterfaces.empty ());
1473
1421
}
1474
1422
1475
- if (!isDirty) {
1476
- isDirty |= (getSpawnStatus () == SPAWN_NEEDED);
1477
- }
1478
-
1479
1423
if (!isDirty) {
1480
1424
isDirty |= (getAdaptionStatus (false ) == ADAPTION_DIRTY);
1481
1425
}
@@ -5237,24 +5181,6 @@ void PatchKernel::restoreInterfaces(std::istream &stream)
5237
5181
setAdaptionMode (previousAdaptionMode);
5238
5182
}
5239
5183
5240
- /* !
5241
- Generates the patch.
5242
-
5243
- Default implementation is a no-op function.
5244
-
5245
- \param trackSpawn if set to true the changes to the patch will be tracked
5246
- \result Returns a vector of adaption::Info that can be used to track
5247
- the changes done during the spawn.
5248
- */
5249
- std::vector<adaption::Info> PatchKernel::_spawn (bool trackSpawn)
5250
- {
5251
- BITPIT_UNUSED (trackSpawn);
5252
-
5253
- assert (false && " The patch needs to implement _spawn" );
5254
-
5255
- return std::vector<adaption::Info>();
5256
- }
5257
-
5258
5184
/* !
5259
5185
Prepares the patch for performing the adaption.
5260
5186
@@ -8341,9 +8267,6 @@ bool PatchKernel::dump(std::ostream &stream) const
8341
8267
utils::binary::write (stream, 0 );
8342
8268
#endif
8343
8269
8344
- // Spawn status
8345
- utils::binary::write (stream, m_spawnStatus);
8346
-
8347
8270
// Adaption information
8348
8271
utils::binary::write (stream, m_adaptionMode);
8349
8272
utils::binary::write (stream, m_adaptionStatus);
@@ -8442,9 +8365,6 @@ void PatchKernel::restore(std::istream &stream, bool reregister)
8442
8365
utils::binary::read (stream, dummyHaloSize);
8443
8366
#endif
8444
8367
8445
- // Spawn status
8446
- utils::binary::read (stream, m_spawnStatus);
8447
-
8448
8368
// Adaption information
8449
8369
utils::binary::read (stream, m_adaptionMode);
8450
8370
utils::binary::read (stream, m_adaptionStatus);
0 commit comments