124 Add the reconstruction of the halo and the writing of the checkpoint
127 All action sets are guarded by the checkpoint's is<Name>Active(),
128 i.e. the tasks do no work in plot phases without checkpoint. The
129 writing task is the last one, so it moves the checkpoint on to its
133 if self.
_solver.auxiliary_variables:
134 raise NotImplementedError(
135 f
"Solver {self._solver.name}: checkpoints do not cover auxiliary variables yet."
138 "Create checkpoint task graph for fourth-order Finite Differences with Runge-Kutta over block-structured meshes"
144 "_patch_overlap_current_time_step",
147 f
"Solver {self._solver.name} has no attribute {attribute}. "
148 "WriteCheckpoint assumes the numerical scheme has added this field "
149 "to the solver immediately upon construction."
155 self.
_solver._add_checkpoint_meta_data_to_solver()
157 Access = peano4.api.taskgraph.Task.DataAccess
163 + self.
_solver.grid_selector.createCellGuard()
167 self.
_solver._get_default_includes() + self.
_solver.user_solver_includes
171 name=f
"{self._solver.name}_{self.name}_Reconstruct",
172 entity=peano4.api.taskgraph.Task.GridEntity.CELL,
173 may_spawn_background_tasks=
False,
176 name=f
"{self._solver.name}_{self.name}_Write checkpoint",
177 entity=peano4.api.taskgraph.Task.GridEntity.CELL,
178 may_spawn_background_tasks=
False,
180 plot.add_task(reconstruction_task)
181 plot.add_task(write_checkpoint_task)
184 reconstruction_task.use_cell(self.
_solver._patch, Access.READ_AND_WRITE)
185 reconstruction_task.use_cell(self.
_solver._patch_with_halo, Access.WRITE)
186 reconstruction_task.use_face(
187 self.
_solver._patch_overlap_current_time_step, Access.READ_AND_WRITE
189 reconstruction_task.add_action_set(
190 toolbox.blockstructured.api.ReconstructPatchWithHalo(
192 patch_overlap=self.
_solver._patch_overlap_current_time_step,
193 reconstructed_patch=self.
_solver._patch_with_halo,
195 add_assertions_to_halo_exchange=
False,
196 additional_includes=includes,
201 reconstruction_task.add_action_set(
202 toolbox.blockstructured.api.InterpolateHangingFaces(
203 self.
_solver._patch_overlap_current_time_step,
204 scheme=self.
_solver.numerical_scheme.interpolation,
206 additional_includes=includes,
211 ApplyDirichletBoundaryConditions.add_task_to_time_step(
216 name_suffix=f
" for {self.name}",
217 relative_time_step_size=0.0,
218 additional_guard=is_active,
222 write_checkpoint_task.add_dependency(reconstruction_task)
223 write_checkpoint_task.use_cell(
224 self.
_solver._patch_with_halo, Access.READ_AND_DISCARD
226 write_checkpoint_task.add_action_set(
228 is_active_predicate=is_active,
231 patch=self.
_solver._patch_with_halo,
232 dataset_name=self.
_solver._patch_with_halo.name,
233 description=
", ".join(self.
_solver.variable_names_per_entry())
234 or self.
_solver._unknown_identifier(),
235 guard=self.
_solver.grid_selector.createCellGuard(),
236 additional_includes=
"""
237#include "../repositories/SolverRepository.h"
241 time_stamp_evaluation=
"0.5*(repositories::getMinTimeStamp()+repositories::getMaxTimeStamp())",
242 patch_scaling=self.
_solver._patch_with_halo.dim[0]
244 metadata_evaluation=
"repositories::"
245 + self.
_solver.get_name_of_global_instance()
246 +
".toCheckpointMetaData()",
251 plot.visualise(title=
"Plot task graph for {}".format(self.
_solver.name))
253 plot.log_as_text(title=
"Plot task graph for {}".format(self.
_solver.name))