@@ -242,7 +242,6 @@ PatchKernel::PatchKernel(const PatchKernel &other)
242242 m_boxMaxCounter(other.m_boxMaxCounter),
243243 m_adjacenciesBuildStrategy(other.m_adjacenciesBuildStrategy),
244244 m_interfacesBuildStrategy(other.m_interfacesBuildStrategy),
245- m_spawnStatus(other.m_spawnStatus),
246245 m_adaptionMode(other.m_adaptionMode),
247246 m_adaptionStatus(other.m_adaptionStatus),
248247 m_dimension(other.m_dimension),
@@ -329,7 +328,6 @@ PatchKernel::PatchKernel(PatchKernel &&other)
329328 m_boxMaxCounter(std::move(other.m_boxMaxCounter)),
330329 m_adjacenciesBuildStrategy(std::move(other.m_adjacenciesBuildStrategy)),
331330 m_interfacesBuildStrategy(std::move(other.m_interfacesBuildStrategy)),
332- m_spawnStatus(std::move(other.m_spawnStatus)),
333331 m_adaptionMode(std::move(other.m_adaptionMode)),
334332 m_adaptionStatus(std::move(other.m_adaptionStatus)),
335333 m_id(std::move(other.m_id)),
@@ -419,7 +417,6 @@ PatchKernel & PatchKernel::operator=(PatchKernel &&other)
419417 m_boxMaxCounter = std::move (other.m_boxMaxCounter );
420418 m_adjacenciesBuildStrategy = std::move (other.m_adjacenciesBuildStrategy );
421419 m_interfacesBuildStrategy = std::move (other.m_interfacesBuildStrategy );
422- m_spawnStatus = std::move (other.m_spawnStatus );
423420 m_adaptionMode = std::move (other.m_adaptionMode );
424421 m_adaptionStatus = std::move (other.m_adaptionStatus );
425422 m_id = std::move (other.m_id );
@@ -523,14 +520,11 @@ void PatchKernel::initialize()
523520 // Set interfaces build strategy
524521 setInterfacesBuildStrategy (INTERFACES_NONE);
525522
526- // Set the spawn as unneeded
523+ // Set the adaption as dirty
527524 //
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);
534528
535529#if BITPIT_ENABLE_MPI==1
536530 // Initialize communicator
@@ -645,12 +639,6 @@ std::vector<adaption::Info> PatchKernel::update(bool trackAdaption, bool squeeze
645639 // Finalize alterations
646640 mergeAdaptionInfo (finalizeAlterations (trackAdaption, squeezeStorage), adaptionData);
647641
648- // Spawn
649- bool spawnNeeed = (getSpawnStatus () == SPAWN_NEEDED);
650- if (spawnNeeed) {
651- mergeAdaptionInfo (spawn (trackAdaption), adaptionData);
652- }
653-
654642 // Adaption
655643 bool adaptionDirty = (getAdaptionStatus (true ) == ADAPTION_DIRTY);
656644 if (adaptionDirty) {
@@ -689,33 +677,7 @@ void PatchKernel::simulateCellUpdate(const long id, adaption::Marker marker, std
689677*/
690678std::vector<adaption::Info> PatchKernel::spawn (bool trackSpawn)
691679{
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);
719681}
720682
721683/* !
@@ -1347,23 +1309,9 @@ void PatchKernel::write(VTKWriteMode mode)
13471309*/
13481310PatchKernel::SpawnStatus PatchKernel::getSpawnStatus () const
13491311{
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;
13541313}
13551314
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-
13671315/* !
13681316 Checks if the patch supports adaption.
13691317
@@ -1472,10 +1420,6 @@ bool PatchKernel::isDirty(bool global) const
14721420 assert (isDirty || m_alteredInterfaces.empty ());
14731421 }
14741422
1475- if (!isDirty) {
1476- isDirty |= (getSpawnStatus () == SPAWN_NEEDED);
1477- }
1478-
14791423 if (!isDirty) {
14801424 isDirty |= (getAdaptionStatus (false ) == ADAPTION_DIRTY);
14811425 }
@@ -5237,24 +5181,6 @@ void PatchKernel::restoreInterfaces(std::istream &stream)
52375181 setAdaptionMode (previousAdaptionMode);
52385182}
52395183
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-
52585184/* !
52595185 Prepares the patch for performing the adaption.
52605186
@@ -8341,9 +8267,6 @@ bool PatchKernel::dump(std::ostream &stream) const
83418267 utils::binary::write (stream, 0 );
83428268#endif
83438269
8344- // Spawn status
8345- utils::binary::write (stream, m_spawnStatus);
8346-
83478270 // Adaption information
83488271 utils::binary::write (stream, m_adaptionMode);
83498272 utils::binary::write (stream, m_adaptionStatus);
@@ -8442,9 +8365,6 @@ void PatchKernel::restore(std::istream &stream, bool reregister)
84428365 utils::binary::read (stream, dummyHaloSize);
84438366#endif
84448367
8445- // Spawn status
8446- utils::binary::read (stream, m_spawnStatus);
8447-
84488368 // Adaption information
84498369 utils::binary::read (stream, m_adaptionMode);
84508370 utils::binary::read (stream, m_adaptionStatus);
0 commit comments