120 Add the reconstruction of the halo and the writing of the checkpoint
123 All action sets are guarded by the checkpoint's is<Name>Active(),
124 i.e. the tasks do no work in plot phases without checkpoint. The
125 writing task is the last one, so it moves the checkpoint on to its
129 if self.
_solver.auxiliary_variables:
130 raise NotImplementedError(
131 f
"Solver {self._solver.name}: checkpoints do not cover auxiliary variables yet."
134 "Create checkpoint task graph for Finite Volume scheme over block-structured meshes"
140 "_patch_overlap_current_time_step",
143 f
"Solver {self._solver.name} has no attribute {attribute}. "
144 "WriteCheckpoint assumes the numerical scheme has added this field "
145 "to the solver immediately upon construction."
151 self.
_solver._add_checkpoint_meta_data_to_solver()
153 Access = peano4.api.taskgraph.Task.DataAccess
159 + self.
_solver.grid_selector.createCellGuard()
163 self.
_solver._get_default_includes() + self.
_solver.user_solver_includes
167 name=f
"{self._solver.name}_{self.name}_Reconstruct",
168 entity=peano4.api.taskgraph.Task.GridEntity.CELL,
169 may_spawn_background_tasks=
False,
172 name=f
"{self._solver.name}_{self.name}_Write checkpoint",
173 entity=peano4.api.taskgraph.Task.GridEntity.CELL,
174 may_spawn_background_tasks=
False,
176 plot.add_task(reconstruction_task)
177 plot.add_task(write_checkpoint_task)
180 reconstruction_task.use_cell(self.
_solver._patch, Access.READ_AND_WRITE)
181 reconstruction_task.use_cell(self.
_solver._patch_with_halo, Access.WRITE)
182 reconstruction_task.use_face(
183 self.
_solver._patch_overlap_current_time_step, Access.READ_AND_WRITE
185 reconstruction_task.add_action_set(
186 toolbox.blockstructured.api.ReconstructPatchWithHalo(
188 patch_overlap=self.
_solver._patch_overlap_current_time_step,
189 reconstructed_patch=self.
_solver._patch_with_halo,
191 add_assertions_to_halo_exchange=
False,
192 additional_includes=includes,
198 interpolation = getattr(self.
_solver.numerical_scheme,
"interpolation",
None)
199 if interpolation
is not None:
200 reconstruction_task.add_action_set(
201 toolbox.blockstructured.api.InterpolateHangingFaces(
202 self.
_solver._patch_overlap_current_time_step,
203 scheme=interpolation,
205 additional_includes=includes,
209 ApplyDirichletBoundaryConditions.add_task_to_time_step(
214 name_suffix=f
" for {self.name}",
215 additional_guard=is_active,
219 write_checkpoint_task.add_dependency(reconstruction_task)
220 write_checkpoint_task.use_cell(
221 self.
_solver._patch_with_halo, Access.READ_AND_DISCARD
223 write_checkpoint_task.add_action_set(
225 is_active_predicate=is_active,
228 patch=self.
_solver._patch_with_halo,
229 dataset_name=self.
_solver._patch_with_halo.name,
230 description=
", ".join(self.
_solver.variable_names_per_entry())
231 or self.
_solver._unknown_identifier(),
232 guard=self.
_solver.grid_selector.createCellGuard(),
233 additional_includes=
"""
234#include "../repositories/SolverRepository.h"
238 time_stamp_evaluation=
"0.5*(repositories::getMinTimeStamp()+repositories::getMaxTimeStamp())",
239 patch_scaling=self.
_solver._patch_with_halo.dim[0]
241 metadata_evaluation=
"repositories::"
242 + self.
_solver.get_name_of_global_instance()
243 +
".toCheckpointMetaData()",
248 plot.visualise(title=
"Plot task graph for {}".format(self.
_solver.name))
250 plot.log_as_text(title=
"Plot task graph for {}".format(self.
_solver.name))