Initialize cached sync runtime in derived evolvers
This commit is contained in:
@@ -784,6 +784,8 @@ bssn_class::bssn_class(double Couranti, double StartTimei, double TotalTimei,
|
||||
xc(0), yc(0), zc(0), xr(0), yr(0), zr(0), trigger(0), dTT(0), dumpid(0),
|
||||
#endif
|
||||
a_lev(a_levi), maxl(maxli), decn(decni), maxrex(maxrexi), drex(drexi),
|
||||
sync_cache_pre(0), sync_cache_cor(0), sync_cache_rp_coarse(0), sync_cache_rp_fine(0),
|
||||
sync_cache_restrict(0), sync_cache_outbd(0),
|
||||
CheckPoint(0)
|
||||
// CheckPoint(0)
|
||||
{
|
||||
@@ -1409,6 +1411,38 @@ bssn_class::bssn_class(double Couranti, double StartTimei, double TotalTimei,
|
||||
|
||||
//================================================================================================
|
||||
|
||||
void bssn_class::Initialize_Level_Runtime()
|
||||
{
|
||||
if (!GH)
|
||||
{
|
||||
if (ErrorMonitor && ErrorMonitor->outfile)
|
||||
ErrorMonitor->outfile << "Initialize_Level_Runtime called before GH is initialized" << endl;
|
||||
MPI_Abort(MPI_COMM_WORLD, 1);
|
||||
}
|
||||
|
||||
if (!ConstraintRefreshLevels)
|
||||
{
|
||||
ConstraintRefreshLevels = new int[GH->levels];
|
||||
for (int il = 0; il < GH->levels; il++)
|
||||
ConstraintRefreshLevels[il] = 0;
|
||||
}
|
||||
|
||||
if (!sync_cache_pre)
|
||||
sync_cache_pre = new Parallel::SyncCache[GH->levels];
|
||||
if (!sync_cache_cor)
|
||||
sync_cache_cor = new Parallel::SyncCache[GH->levels];
|
||||
if (!sync_cache_rp_coarse)
|
||||
sync_cache_rp_coarse = new Parallel::SyncCache[GH->levels];
|
||||
if (!sync_cache_rp_fine)
|
||||
sync_cache_rp_fine = new Parallel::SyncCache[GH->levels];
|
||||
if (!sync_cache_restrict)
|
||||
sync_cache_restrict = new Parallel::SyncCache[GH->levels];
|
||||
if (!sync_cache_outbd)
|
||||
sync_cache_outbd = new Parallel::SyncCache[GH->levels];
|
||||
}
|
||||
|
||||
//================================================================================================
|
||||
|
||||
|
||||
|
||||
//================================================================================================
|
||||
@@ -1439,9 +1473,6 @@ void bssn_class::Initialize()
|
||||
}
|
||||
}
|
||||
GH = new cgh(0, ngfs, Symmetry, pname, checkrun, ErrorMonitor);
|
||||
ConstraintRefreshLevels = new int[GH->levels];
|
||||
for (int il = 0; il < GH->levels; il++)
|
||||
ConstraintRefreshLevels[il] = 0;
|
||||
if (checkrun)
|
||||
CheckPoint->readcheck_cgh(PhysTime, GH, myrank, nprocs, Symmetry);
|
||||
else
|
||||
@@ -1477,13 +1508,7 @@ void bssn_class::Initialize()
|
||||
Setup_Black_Hole_position();
|
||||
}
|
||||
|
||||
// Initialize sync caches (per-level, for predictor and corrector)
|
||||
sync_cache_pre = new Parallel::SyncCache[GH->levels];
|
||||
sync_cache_cor = new Parallel::SyncCache[GH->levels];
|
||||
sync_cache_rp_coarse = new Parallel::SyncCache[GH->levels];
|
||||
sync_cache_rp_fine = new Parallel::SyncCache[GH->levels];
|
||||
sync_cache_restrict = new Parallel::SyncCache[GH->levels];
|
||||
sync_cache_outbd = new Parallel::SyncCache[GH->levels];
|
||||
Initialize_Level_Runtime();
|
||||
}
|
||||
|
||||
//================================================================================================
|
||||
@@ -1762,6 +1787,18 @@ bssn_class::~bssn_class()
|
||||
sync_cache_rp_fine[i].destroy();
|
||||
delete[] sync_cache_rp_fine;
|
||||
}
|
||||
if (sync_cache_restrict)
|
||||
{
|
||||
for (int i = 0; i < GH->levels; i++)
|
||||
sync_cache_restrict[i].destroy();
|
||||
delete[] sync_cache_restrict;
|
||||
}
|
||||
if (sync_cache_outbd)
|
||||
{
|
||||
for (int i = 0; i < GH->levels; i++)
|
||||
sync_cache_outbd[i].destroy();
|
||||
delete[] sync_cache_outbd;
|
||||
}
|
||||
|
||||
delete GH;
|
||||
#ifdef WithShell
|
||||
|
||||
Reference in New Issue
Block a user