12def create_copy_task(name, source_patch, target_solver, auxiliary_copies):
15 Create the task that fills the auxiliary variables of a solver with data of another solver
17 The task copies source_patch into the auxiliary variables auxiliary_copies of
18 target_solver (interpolating piecewise linearly if the patches differ in
19 size), projects them onto the faces, restricts them on hanging faces, and
20 rolls the faces over. The solver then reconstructs the halo of the
21 auxiliary variables from the faces. The task is the one place that writes
22 new face data of the auxiliary variables. It keeps the source patch alive,
23 i.e. the solver that owns it can still read it afterwards. The caller adds the
24 task to a graph and wires it.
29 @param source_patch: peano4.api.datamodel.Patch
30 The data to copy, i.e. the persistent patch of the producing solver,
31 or its input of a Runge-Kutta stage.
33 @param target_solver: exahype2.api.Solver
34 Holds the auxiliary variables. It needs a numerical scheme already.
36 @param auxiliary_copies: exahype2.api.AuxiliaryVariables
37 The auxiliary variables of the target solver.
39 @return peano4.api.taskgraph.Task
42 Access = peano4.api.taskgraph.Task.DataAccess
44 includes = target_solver._get_default_includes() + target_solver.user_solver_includes
45 cell_guard = target_solver.grid_selector.createCellGuard()
46 face_guard = target_solver.grid_selector.createFaceGuard()
49 name=name, entity=peano4.api.taskgraph.Task.GridEntity.CELL
51 task.use_cell(source_patch, Access.READ_AND_WRITE)
52 task.use_cell(auxiliary_copies.patch, Access.READ_AND_WRITE)
53 task.use_face(auxiliary_copies.patch_overlap_update, Access.TEMPORARY)
54 task.use_face(auxiliary_copies.patch_overlap_current_time_step, Access.READ_AND_WRITE)
56 CopyPatchWithLinearInterpolation(
57 source_patch=source_patch,
58 target_patch=auxiliary_copies.patch,
60 additional_includes=includes,
64 actionsets.ProjectPatchOntoFaces(
65 auxiliary_copies.patch,
66 auxiliary_copies.patch_overlap_update,
72 toolbox.blockstructured.api.RestrictHangingFaces(
73 auxiliary_copies.patch_overlap_update,
74 scheme=target_solver.numerical_scheme.restriction,
75 clear_guard=face_guard,
76 additional_includes=includes,
80 actionsets.RollOverUpdatedFace(
81 auxiliary_copies.patch_overlap_current_time_step,
82 auxiliary_copies.patch_overlap_update,