8from .Helper
import write_file
10from .Overwrite
import Overwrite
12from .Jinja2TemplatedHeaderFile
import Jinja2TemplatedHeaderFile
16 default_overwrite =
True
29 Included actions is a list of qualified actions which are used
41 self.
d[
"OPEN_NAMESPACE"] =
""
42 self.
d[
"CLOSE_NAMESPACE"] =
""
43 self.
d[
"FULL_QUALIFIED_CLASSNAME"] =
""
45 self.
d[
"OPEN_NAMESPACE"] +=
"namespace " + i +
"{\n"
46 self.
d[
"CLOSE_NAMESPACE"] +=
"}\n"
47 self.
d[
"FULL_QUALIFIED_CLASSNAME"] += i +
"::"
48 self.
d[
"CLASSNAME"] = classname
49 self.
d[
"FULL_QUALIFIED_CLASSNAME"] += classname
50 self.
d[
"INCLUDE_GUARD"] = (
51 "_" + self.
d[
"FULL_QUALIFIED_CLASSNAME"].replace(
"::",
"_").upper() +
"_H_"
53 self.
d[
"INCLUDES"] =
""
54 self.
d[
"ATTRIBUTES"] =
""
57 self.
d[
"INCLUDES"] +=
'#include "'
58 self.
d[
"INCLUDES"] += action.replace(
"::",
"/")
59 self.
d[
"INCLUDES"] +=
'.h"\n'
60 self.
d[
"ATTRIBUTES"] +=
" "
61 self.
d[
"ATTRIBUTES"] += action
62 self.
d[
"ATTRIBUTES"] +=
" _actionSet"
64 self.
d[
"ATTRIBUTES"] +=
"; \n"
66 subdirectories = set()
68 self.
d[
"MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS"] =
""
69 self.
d[
"MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS"] =
""
70 self.
d[
"MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_PICK_ENTRY"] =
""
71 self.
d[
"MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS_PICK_ENTRY"] =
""
73 if cells.index(cell) != 0:
74 self.
d[
"MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS"] +=
","
75 self.
d[
"MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS"] +=
","
76 self.
d[
"MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_PICK_ENTRY"] +=
","
77 self.
d[
"MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS_PICK_ENTRY"] +=
","
78 self.
d[
"MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS"] += (
80 "repositories::DataRepository::_"
81 + cell.get_logical_type_name()
82 +
"Stack.getForPop( " +
84 "repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->top(0)"
86 self.
d[
"MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS"] += (
88 "repositories::DataRepository::_"
89 + cell.get_logical_type_name()
90 +
"Stack.getForPop( " +
92 "repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->top(1)"
94 self.
d[
"MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_PICK_ENTRY"] += (
96 "repositories::DataRepository::_"
97 + cell.get_logical_type_name()
98 +
"Stack.getForPop( " +
100 "repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->top(0)"
102 self.
d[
"MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS_PICK_ENTRY"] += (
104 "repositories::DataRepository::_"
105 + cell.get_logical_type_name()
106 +
"Stack.getForPop( " +
108 "repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->top(1)"
110 if cell.subdirectory:
111 subdirectories.add(cell.subdirectory)
113 self.
d[
"MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_CELL_EVENT"] = self.
d[
114 "MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS"
116 self.
d[
"MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS_CELL_EVENT"] = self.
d[
117 "MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS"
120 self.
d[
"MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS"] =
""
121 self.
d[
"MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS"] =
""
122 self.
d[
"MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY"] =
""
123 self.
d[
"MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_PICK_ENTRY"] =
""
125 if faces.index(face) != 0:
126 self.
d[
"MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS"] +=
","
127 self.
d[
"MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS"] +=
","
128 self.
d[
"MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY"] +=
","
130 "MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_PICK_ENTRY"
132 self.
d[
"MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS"] += (
133 "peano4::datamanagement::FaceEnumerator<"
134 + face.get_full_qualified_type()
137 "repositories::DataRepository::_"
138 + face.get_logical_type_name()
139 +
"Stack.getForPop( " +
141 "repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->top(TwoTimesD-1) )"
143 self.
d[
"MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS"] += (
144 "peano4::datamanagement::FaceEnumerator<"
145 + face.get_full_qualified_type()
148 "repositories::DataRepository::_"
149 + face.get_logical_type_name()
150 +
"Stack.getForPop( " +
152 "repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->top(TwoTimesD*2-1) )"
154 self.
d[
"MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY"] += (
155 "peano4::datamanagement::FaceEnumerator<"
156 + face.get_full_qualified_type()
159 "repositories::DataRepository::_"
160 + face.get_logical_type_name()
161 +
"Stack.getForPop( " +
163 "repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->top(TwoTimesD-1) )(pick)"
165 self.
d[
"MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_PICK_ENTRY"] += (
166 "peano4::datamanagement::FaceEnumerator<"
167 + face.get_full_qualified_type()
170 "repositories::DataRepository::_"
171 + face.get_logical_type_name()
172 +
"Stack.getForPop( " +
174 "repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->top(TwoTimesD*2-1) )(pick)"
176 if face.subdirectory:
177 subdirectories.add(face.subdirectory)
179 self.
d[
"MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS"] =
""
180 self.
d[
"MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS"] =
""
181 self.
d[
"MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY"] =
""
182 self.
d[
"MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY"] =
""
183 for vertex
in vertices:
184 if vertices.index(vertex) != 0:
185 self.
d[
"MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS"] +=
","
186 self.
d[
"MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS"] +=
","
188 "MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY"
191 "MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY"
193 self.
d[
"MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS"] += (
194 "peano4::datamanagement::VertexEnumerator<"
195 + vertex.get_full_qualified_type()
197 vertex.subnamespace +
198 "repositories::DataRepository::_"
199 + vertex.get_logical_type_name()
200 +
"Stack.getForPop( " +
201 vertex.subnamespace +
202 "repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->top(TwoPowerD-1) )"
204 self.
d[
"MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS"] += (
205 "peano4::datamanagement::VertexEnumerator<"
206 + vertex.get_full_qualified_type()
208 vertex.subnamespace +
209 "repositories::DataRepository::_"
210 + vertex.get_logical_type_name()
211 +
"Stack.getForPop( " +
212 vertex.subnamespace +
213 "repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->top(TwoPowerD*2-1) )"
215 self.
d[
"MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY"] += (
216 "peano4::datamanagement::VertexEnumerator<"
217 + vertex.get_full_qualified_type()
219 vertex.subnamespace +
220 "repositories::DataRepository::_"
221 + vertex.get_logical_type_name()
222 +
"Stack.getForPop( " +
223 vertex.subnamespace +
224 "repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->top(TwoPowerD-1) )(pick)"
226 self.
d[
"MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY"] += (
227 "peano4::datamanagement::VertexEnumerator<"
228 + vertex.get_full_qualified_type()
230 vertex.subnamespace +
231 "repositories::DataRepository::_"
232 + vertex.get_logical_type_name()
233 +
"Stack.getForPop( " +
234 vertex.subnamespace +
235 "repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->top(TwoPowerD*2-1) )(pick)"
237 if vertex.subdirectory:
238 subdirectories.add(vertex.subdirectory)
240 self.
d[
"DATAREPOSITORY_INCLUDES"] =
""
242 for subdir
in subdirectories:
243 self.
d[
"INCLUDES"] =
"#include \"../" + subdir +
"repositories/DataRepository.h\"\n" + self.
d[
"INCLUDES"]
244 self.
d[
"DATAREPOSITORY_INCLUDES"] +=
"#include \"../../" + subdir +
"repositories/DataRepository.h\"\n"
246 self.
d[
"DATAREPOSITORY_INCLUDES"] =
"#include \"../repositories/DataRepository.h\"\n"
249 headerfile_template = (
250 os.path.realpath(__file__)
251 .replace(
".pyc",
".template.h")
252 .replace(
".py",
".template.h")
254 md = self.
mkSubDict([
"ATTRIBUTES",
"INCLUDES"])
263 header.generate(overwrite, directory)
266 TemplateConstructor =
"""
268{{FULL_QUALIFIED_CLASSNAME}}::{{CLASSNAME}}(int spacetreeId):
269 _spacetreeId( spacetreeId ) {{MAPPING_INITIALISATION_LIST}}
279 self.
d[
"MAPPING_INITIALISATION_LIST"] =
""
281 self.
d[
"MAPPING_INITIALISATION_LIST"] +=
", _actionSet"
282 self.
d[
"MAPPING_INITIALISATION_LIST"] += str(
285 self.
d[
"MAPPING_INITIALISATION_LIST"] +=
"(spacetreeId)"
290peano4::grid::TraversalObserver* {{FULL_QUALIFIED_CLASSNAME}}::clone(int spacetreeId) {
291 return new {{CLASSNAME}}(spacetreeId);
296 TemplateBeginTraversal =
"""
298void {{FULL_QUALIFIED_CLASSNAME}}::beginTraversal( const tarch::la::Vector<Dimensions,double>& x, const tarch::la::Vector<Dimensions,double>& h ) {
299 logTraceInWith2Arguments( "beginTraversal(...)", x, h );
301 // Invoke beginTraversal() on the actions
303{{MAPPING_BEGIN_TRAVERSAL_CALLS}}
306 // Fill call stacks with dummies which represent level 0 such that we can
307 // call standard action routines on level 1 with parents. Without these
308 // statements, a top(1) call would raise an assertion.
310{{INITIAL_PUSH_TO_OUTPUT_STREAMS}}
311 logTraceOutWith2Arguments( "beginTraversal(...)", x, h );
317 self.
d[
"MAPPING_BEGIN_TRAVERSAL_CALLS"] =
""
319 self.
d[
"MAPPING_BEGIN_TRAVERSAL_CALLS"] +=
" _actionSet"
320 self.
d[
"MAPPING_BEGIN_TRAVERSAL_CALLS"] += str(
323 self.
d[
"MAPPING_BEGIN_TRAVERSAL_CALLS"] +=
".beginTraversal();\n"
325 self.
d[
"INITIAL_PUSH_TO_OUTPUT_STREAMS"] =
""
326 for cell
in self.
cells:
327 self.
d[
"INITIAL_PUSH_TO_OUTPUT_STREAMS"] += (
330 "repositories::DataRepository::_"
331 + cell.get_logical_type_name()
332 +
"Stack.getForPush( " +
334 "repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->push( "
335 + cell.get_full_qualified_type()
340 for face
in self.
faces:
342 "INITIAL_PUSH_TO_OUTPUT_STREAMS"
343 ] +=
" for (int i=0; i<TwoTimesD; i++) {\n"
344 self.
d[
"INITIAL_PUSH_TO_OUTPUT_STREAMS"] += (
347 "repositories::DataRepository::_"
348 + face.get_logical_type_name()
349 +
"Stack.getForPush( " +
351 "repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->push( "
352 + face.get_full_qualified_type()
355 self.
d[
"INITIAL_PUSH_TO_OUTPUT_STREAMS"] +=
" }\n"
360 "INITIAL_PUSH_TO_OUTPUT_STREAMS"
361 ] +=
" for (int i=0; i<TwoPowerD; i++) {\n"
362 self.
d[
"INITIAL_PUSH_TO_OUTPUT_STREAMS"] += (
364 vertex.subnamespace +
365 "repositories::DataRepository::_"
366 + vertex.get_logical_type_name()
367 +
"Stack.getForPush( " +
368 vertex.subnamespace +
369 "repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->push( "
370 + vertex.get_full_qualified_type()
373 self.
d[
"INITIAL_PUSH_TO_OUTPUT_STREAMS"] +=
" }\n"
378 TemplateEndTraversal =
"""
380void {{FULL_QUALIFIED_CLASSNAME}}::endTraversal( const tarch::la::Vector<Dimensions,double>& x, const tarch::la::Vector<Dimensions,double>& h ) {
381 logTraceInWith2Arguments( "endTraversal(...)", x, h );
382 {{MAPPING_END_TRAVERSAL_CALLS}}
383 {{FINAL_POP_FROM_INPUT_STREAMS}}
384 logTraceOutWith2Arguments( "endTraversal(...)", x, h );
390 self.
d[
"MAPPING_END_TRAVERSAL_CALLS"] =
""
392 self.
d[
"MAPPING_END_TRAVERSAL_CALLS"] +=
" _actionSet"
393 self.
d[
"MAPPING_END_TRAVERSAL_CALLS"] += str(
396 self.
d[
"MAPPING_END_TRAVERSAL_CALLS"] +=
".endTraversal();\n"
398 self.
d[
"FINAL_POP_FROM_INPUT_STREAMS"] =
""
399 for cell
in self.
cells:
400 self.
d[
"FINAL_POP_FROM_INPUT_STREAMS"] += (
403 "repositories::DataRepository::_"
404 + cell.get_logical_type_name()
405 +
"Stack.getForPop( " +
407 "repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->pop();\n"
411 for face
in self.
faces:
413 "FINAL_POP_FROM_INPUT_STREAMS"
414 ] +=
" for (int i=0; i<TwoTimesD; i++) {\n"
415 self.
d[
"FINAL_POP_FROM_INPUT_STREAMS"] += (
418 "repositories::DataRepository::_"
419 + face.get_logical_type_name()
420 +
"Stack.getForPop( " +
422 "repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->pop();\n"
424 self.
d[
"FINAL_POP_FROM_INPUT_STREAMS"] +=
" }\n"
429 "FINAL_POP_FROM_INPUT_STREAMS"
430 ] +=
" for (int i=0; i<TwoPowerD; i++) {\n"
431 self.
d[
"FINAL_POP_FROM_INPUT_STREAMS"] += (
433 vertex.subnamespace +
434 "repositories::DataRepository::_"
435 + vertex.get_logical_type_name()
436 +
"Stack.getForPop( " +
437 vertex.subnamespace +
438 "repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->pop();\n"
440 self.
d[
"FINAL_POP_FROM_INPUT_STREAMS"] +=
" }\n"
445 TemplatePrepareTraversal =
"""
447void {{FULL_QUALIFIED_CLASSNAME}}::prepareTraversal() {
448 logTraceIn( "prepareTraversal(...)" );
449 {{MAPPING_PREPARE_TRAVERSAL_CALLS}}
450 logTraceOut( "prepareTraversal(...)" );
456 self.
d[
"MAPPING_PREPARE_TRAVERSAL_CALLS"] =
""
458 self.
d[
"MAPPING_PREPARE_TRAVERSAL_CALLS"] +=
" "
459 self.
d[
"MAPPING_PREPARE_TRAVERSAL_CALLS"] += action
460 self.
d[
"MAPPING_PREPARE_TRAVERSAL_CALLS"] +=
"::prepareTraversal();\n"
465 TemplateUnprepareTraversal =
"""
467void {{FULL_QUALIFIED_CLASSNAME}}::unprepareTraversal() {
468 logTraceIn( "unprepareTraversal(...)" );
469 {{MAPPING_UNPREPARE_TRAVERSAL_CALLS}}
470 logTraceOut( "unprepareTraversal(...)" );
476 self.
d[
"MAPPING_UNPREPARE_TRAVERSAL_CALLS"] =
""
478 self.
d[
"MAPPING_UNPREPARE_TRAVERSAL_CALLS"] +=
" "
479 self.
d[
"MAPPING_UNPREPARE_TRAVERSAL_CALLS"] += action
480 self.
d[
"MAPPING_UNPREPARE_TRAVERSAL_CALLS"] +=
"::unprepareTraversal();\n"
486 self, output_file, template, reverse_order=False, manual_dict=None
490 Takes the specified template file, iterates over actions and pastes
491 the template into the output file once per action. Per action, the dictionary's
492 entries are updated. Otherwise, the dictionary remains unchanged.
496 Handle on output file
501 local_actions.reverse()
503 for action
in local_actions:
504 if manual_dict
is None:
505 self.
d[
"ACTIVE_ACTION_SET"] =
"_actionSet" + str(
508 self.
d[
"ACTIVE_ACTION_SET_FULL_QUALIFIED_NAME"] = action
509 if output_file
is not None:
510 output_file.write(jinja2.Template(template).render(**self.
d))
512 return jinja2.Template(template).render(**self.
d)
514 manual_dict[
"ACTIVE_ACTION_SET"] =
"_actionSet" + str(
517 manual_dict[
"ACTIVE_ACTION_SET_FULL_QUALIFIED_NAME"] = action
518 if output_file
is not None:
519 output_file.write(jinja2.Template(template).render(**manual_dict))
521 return jinja2.Template(template).render(**manual_dict)
523 TemplateGetGridControlEvents_Prologue =
"""
525std::vector< peano4::grid::GridControlEvent > {{FULL_QUALIFIED_CLASSNAME}}::getGridControlEvents() const {
526 std::vector< peano4::grid::GridControlEvent > result;
529 TemplateGetGridControlEvents_MappingCall =
"""
531 const std::vector< peano4::grid::GridControlEvent > actionResult = {{ACTIVE_ACTION_SET}}.getGridControlEvents();
532 result.insert(result.begin(),actionResult.begin(),actionResult.end());
536 TemplateGetGridControlEvents_Epilogue =
"""
546 **{
"FULL_QUALIFIED_CLASSNAME": self.
d[
"FULL_QUALIFIED_CLASSNAME"]}
559 TemplateEnterCell_Prologue =
"""
560void {{FULL_QUALIFIED_CLASSNAME}}::enterCell( const peano4::grid::GridTraversalEvent& event ) {
561 logTraceInWith2Arguments( "enterCell(...)", _spacetreeId, event.toString() );
564 TemplateLoadCell_VertexLoad =
"""
565 // Load vertex {{logical_type_name}}
566 std::function<bool ()> loadVertex{{logical_type_name}} =
568 auto view = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->pushBlock( TwoPowerD );
569 for (int i=0; i<TwoPowerD; i++) {
570 int inVertexStack = event.getVertexDataFrom(i);
571 int outVertexStackPosition = event.getVertexDataTo(i);
572 logDebug("loadCell(...)", "vertex stack " << inVertexStack << "->pos-" << outVertexStackPosition );
574 peano4::datamanagement::VertexMarker marker(event,outVertexStackPosition);
576 bool dataResidesOnIntermediateStack =
577 not peano4::grid::PeanoCurve::isInOutStack(inVertexStack)
579 inVertexStack!=peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
581 inVertexStack!=peano4::grid::TraversalObserver::CreateOrDestroyHangingGridEntity
583 inVertexStack!=peano4::grid::TraversalObserver::NoData;
584 bool dataResidesOnInputStack =
585 peano4::grid::PeanoCurve::isInOutStack(inVertexStack)
587 ::peano4::grid::loadPersistently( {{full_qualified_type}}::loadStoreComputeFlag(
589 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
591 bool initialiseStackContentForNewData =
592 ::peano4::grid::computeOnData( {{full_qualified_type}}::loadStoreComputeFlag(
594 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
597 inVertexStack==peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
599 inVertexStack==peano4::grid::TraversalObserver::CreateOrDestroyHangingGridEntity
602 if ( dataResidesOnIntermediateStack or dataResidesOnInputStack ) {
605 "load data of vertex {{name}} with " << marker.x(outVertexStackPosition) << " x " << marker.h() <<
606 ": " << ::peano4::grid::toString( {{full_qualified_type}}::loadStoreComputeFlag(
608 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
611 assertion4( not {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,inVertexStack))->empty(), event.toString(), peano4::datamanagement::VertexMarker(event).toString(), _spacetreeId, inVertexStack);
612 {{full_qualified_type}} data = std::move( {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,inVertexStack))->pop() );
614 if ( peano4::grid::PeanoCurve::isInOutStack(inVertexStack) ) {
615 assertionVectorNumericalEquals7( data.getDebugX(), marker.x(outVertexStackPosition), event.toString(), data.getDebugX(), marker.toString(), inVertexStack, i, outVertexStackPosition, _spacetreeId );
616 assertionVectorNumericalEquals6( data.getDebugH(), marker.h(), event.toString(), data.getDebugX(), marker.toString(), inVertexStack, i, _spacetreeId );
619 view.set(outVertexStackPosition,data);
621 else if ( initialiseStackContentForNewData ) {
622 {{full_qualified_type}} data;
626 "initialise meta data of new vertex {{name}} with " << marker.x(outVertexStackPosition) << " x " << marker.h() <<
627 ": " << ::peano4::grid::toString( {{full_qualified_type}}::loadStoreComputeFlag(
629 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
632 data.setDebugX( marker.x(outVertexStackPosition) );
633 data.setDebugH( marker.h() );
635 view.set(outVertexStackPosition,data);
641 "initialise meta data of unused vertex {{name}} with " << marker.x(outVertexStackPosition) << " x " << marker.h() <<
642 ": " << ::peano4::grid::toString( {{full_qualified_type}}::loadStoreComputeFlag(
644 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
647 view.get(outVertexStackPosition).setDebugX( marker.x(outVertexStackPosition) );
648 view.get(outVertexStackPosition).setDebugH( marker.h() );
655 tasks.push_back( new tarch::multicore::TaskWithoutCopyOfFunctor(
656 tarch::multicore::Task::DontFuse,
657 tarch::multicore::Task::DefaultPriority,
658 loadVertex{{logical_type_name}}
663 TemplateEnterCell_VertexMappingCall =
"""
664 // Handle vertex {{logical_type_name}}
666 peano4::datamanagement::VertexMarker marker(event);
668 for (int i=0; i<TwoPowerD; i++) {
669 int inVertexStack = event.getVertexDataFrom(i);
670 int pick = event.getVertexDataTo(i); // the vertex position
674 logDebug( "enterCell(...)", inVertexStack << "->" << pick << " (is-local=" << marker.isLocal() << ")" );
677 inVertexStack==peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
681 // Take care about the coarse grid accesses: Faces and cells are not yet loaded.
682 // Therefore we don't use the usual shift of @f$ 2 \cdot 2d @f$ or @f$ 2 \cdot 2^d @f$
683 // but only half of it.
684 {{ACTIVE_ACTION_SET}}.createPersistentVertex(
686 ,{{MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY}}
687 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
689 {{ACTIVE_ACTION_SET}}.touchVertexFirstTime(
691 ,{{MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY}}
692 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
696 inVertexStack==peano4::grid::TraversalObserver::CreateOrDestroyHangingGridEntity
700 {{ACTIVE_ACTION_SET}}.createHangingVertex(
702 ,{{MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY}}
703 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
707 peano4::grid::PeanoCurve::isInOutStack(inVertexStack)
711 {{ACTIVE_ACTION_SET}}.touchVertexFirstTime(
713 ,{{MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY}}
714 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
721 TemplateLoadCell_FaceLoad =
"""
722 // Load face {{logical_type_name}}
723 std::function<bool ()> loadFace{{logical_type_name}} =
725 auto view = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->pushBlock( TwoTimesD );
726 for (int i=0; i<TwoTimesD; i++) {
727 int inFaceStack = event.getFaceDataFrom(i);
728 int outFaceStackPosition = event.getFaceDataTo(i);
729 logDebug("loadCell(...)", "face stack " << inFaceStack << "->pos-" << outFaceStackPosition );
731 peano4::datamanagement::FaceMarker marker(event,outFaceStackPosition);
733 bool dataResidesOnIntermediateStack =
734 not peano4::grid::PeanoCurve::isInOutStack(inFaceStack)
736 inFaceStack!=peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
738 inFaceStack!=peano4::grid::TraversalObserver::CreateOrDestroyHangingGridEntity
740 inFaceStack!=peano4::grid::TraversalObserver::NoData;
741 bool dataResidesOnInputStack =
742 peano4::grid::PeanoCurve::isInOutStack(inFaceStack)
744 ::peano4::grid::loadPersistently( {{full_qualified_type}}::loadStoreComputeFlag(
746 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
748 bool initialiseStackContentForNewData =
749 ::peano4::grid::computeOnData( {{full_qualified_type}}::loadStoreComputeFlag(
751 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
754 inFaceStack==peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
756 inFaceStack==peano4::grid::TraversalObserver::CreateOrDestroyHangingGridEntity
759 if ( dataResidesOnIntermediateStack or dataResidesOnInputStack ) {
762 "load data of face {{name}} with " << marker.x(outFaceStackPosition) << " x " << marker.h() <<
763 ": " << ::peano4::grid::toString( {{full_qualified_type}}::loadStoreComputeFlag(
765 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
769 not {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,inFaceStack))->empty(),
771 peano4::datamanagement::FaceMarker(event).toString(),
772 _spacetreeId, inFaceStack,
773 ::peano4::grid::toString( {{full_qualified_type}}::loadStoreComputeFlag(
775 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
778 {{full_qualified_type}} data = std::move( {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,inFaceStack))->pop() );
780 if ( peano4::grid::PeanoCurve::isInOutStack(inFaceStack) ) {
781 assertionVectorNumericalEquals5( data.getDebugX(), marker.x(outFaceStackPosition), data.getDebugX(), data.getDebugH(), marker.toString(), outFaceStackPosition, _spacetreeId );
782 assertionVectorNumericalEquals5( data.getDebugH(), marker.h(), data.getDebugX(), data.getDebugH(), marker.toString(), outFaceStackPosition, _spacetreeId );
785 view.set(outFaceStackPosition,data);
787 else if ( initialiseStackContentForNewData ) {
788 {{full_qualified_type}} data;
792 "initialise meta data of new face {{name}} with " << marker.x(outFaceStackPosition) << " x " << marker.h() <<
793 ": " << ::peano4::grid::toString( {{full_qualified_type}}::loadStoreComputeFlag(
795 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
798 data.setDebugX( marker.x(outFaceStackPosition) );
799 data.setDebugH( marker.h() );
801 view.set(outFaceStackPosition,data);
807 "initialise meta data of unused face {{name}} with " << marker.x(outFaceStackPosition) << " x " << marker.h() <<
808 ": " << ::peano4::grid::toString( {{full_qualified_type}}::loadStoreComputeFlag(
810 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
813 view.get(outFaceStackPosition).setDebugX( marker.x(outFaceStackPosition) );
814 view.get(outFaceStackPosition).setDebugH( marker.h() );
822 tasks.push_back( new tarch::multicore::TaskWithoutCopyOfFunctor(
823 tarch::multicore::Task::DontFuse,
824 tarch::multicore::Task::DefaultPriority,
825 loadFace{{logical_type_name}}
830 TemplateEnterCell_FaceMappingCall =
"""
831 // Handle face {{logical_type_name}}
833 peano4::datamanagement::FaceMarker marker( event );
834 for (int i=0; i<TwoTimesD; i++) {
835 int inFaceStack = event.getFaceDataFrom(i);
836 int pick = event.getFaceDataTo(i);
841 marker.isLocal() or not event.getIsCellLocal(),
849 inFaceStack==peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
853 {{ACTIVE_ACTION_SET}}.createPersistentFace(
855 {{_COMMA_MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS}}
856 ,{{MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY}}
857 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
859 {{ACTIVE_ACTION_SET}}.touchFaceFirstTime(
861 {{_COMMA_MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS}}
862 ,{{MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY}}
863 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
867 inFaceStack==peano4::grid::TraversalObserver::CreateOrDestroyHangingGridEntity
871 {{ACTIVE_ACTION_SET}}.createHangingFace(
873 {{_COMMA_MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS}}
874 ,{{MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY}}
875 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
879 peano4::grid::PeanoCurve::isInOutStack(inFaceStack)
883 {{ACTIVE_ACTION_SET}}.touchFaceFirstTime(
885 {{_COMMA_MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS}}
886 ,{{MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY}}
887 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
894 TemplateLoadCell_CellLoad =
"""
895 // Load cell {{logical_type_name}}
896 std::function<bool ()> loadCell{{logical_type_name}} =
898 auto view = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->pushBlock( 1 );
900 peano4::datamanagement::CellMarker marker(event);
902 const int inCellStack = event.getCellData();
903 const int outCellStack = peano4::grid::PeanoCurve::CallStack;
905 bool dataResidesOnInputStack =
906 inCellStack!=peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
908 inCellStack!=peano4::grid::TraversalObserver::NoData
910 ::peano4::grid::loadPersistently( {{full_qualified_type}}::loadStoreComputeFlag(
912 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
914 bool initialiseStackContentForNewData =
915 ::peano4::grid::computeOnData( {{full_qualified_type}}::loadStoreComputeFlag(
917 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
920 inCellStack==peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
923 if ( dataResidesOnInputStack ) {
926 "load data of cell {{name}} with " << marker.toString() <<
927 ": " << ::peano4::grid::toString( {{full_qualified_type}}::loadStoreComputeFlag(
929 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
932 assertion3( not {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,inCellStack))->empty(), event.toString(), _spacetreeId, inCellStack);
933 {{full_qualified_type}} data = std::move( {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,inCellStack))->pop() );
936 assertionVectorNumericalEquals4( data.getDebugX(), marker.x(), data.getDebugX(), data.getDebugH(), marker.toString(), _spacetreeId );
937 assertionVectorNumericalEquals4( data.getDebugH(), marker.h(), data.getDebugX(), data.getDebugH(), marker.toString(), _spacetreeId );
942 else if ( initialiseStackContentForNewData ) {
943 {{full_qualified_type}} data;
948 "initialise meta data of new cell {{name}} with " << marker.toString() <<
949 ": " << ::peano4::grid::toString( {{full_qualified_type}}::loadStoreComputeFlag(
951 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
954 data.setDebugX( marker.x() );
955 data.setDebugH( marker.h() );
963 "initialise meta data of unused cell {{name}} with " << marker.toString() <<
964 ": " << ::peano4::grid::toString( {{full_qualified_type}}::loadStoreComputeFlag(
966 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
969 view.get(0).setDebugX( marker.x() );
970 view.get(0).setDebugH( marker.h() );
976 tasks.push_back( new tarch::multicore::TaskWithoutCopyOfFunctor(
977 tarch::multicore::Task::DontFuse,
978 tarch::multicore::Task::DefaultPriority,
979 loadCell{{logical_type_name}}
984 TemplateEnterCell_CellMappingCall =
"""
985 // Invoke creational events on cell {{logical_type_name}}
987 peano4::datamanagement::CellMarker marker( event );
989 event.getCellData()==peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
993 {{ACTIVE_ACTION_SET}}.createCell(
995 {{MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_COMMA_}}
996 {{MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_COMMA_}}
997 {{MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_PICK_ENTRY}}
998 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS}}
999 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS}}
1000 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1006 TemplateEnterCell_MappingCall =
"""
1008 peano4::datamanagement::CellMarker marker( event );
1012 {{ACTIVE_ACTION_SET}}.touchCellFirstTime(
1014 {{_COMMA_MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_CELL_EVENT}}
1015 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS_CELL_EVENT}}
1021 TemplateEnterCell_Epilogue =
"""
1022 logTraceOut( "enterCell(...)" );
1030 Some logic to produce new dictionary entries from existing ones.
1031 This deals mainly with having to avoid C++ code with consequtive commata
1032 as some dict entries can be an empty string.
1035 fields = key.split(
",")
1036 nonempty = [self.
d[f]
for f
in fields
if not f ==
"" and not self.
d[f] ==
""]
1037 if len(nonempty) > 0:
1038 s =
",".join(nonempty)
1039 if key.startswith(
",")
and not s.startswith(
","):
1041 if key.endswith(
",")
and not s.endswith(
","):
1051 Create the particular subdictionary that's used for an expression.
1062 result[k.replace(
",",
"_COMMA_").strip()] = temp[k]
1072 "name": vertex.name,
1073 "enumeration_type": vertex.get_enumeration_type(),
1074 "logical_type_name": vertex.get_logical_type_name(),
1075 "full_qualified_type": vertex.get_full_qualified_type(),
1076 "ADDITIONAL_LOAD_STORE_ARGUMENTS": vertex.additional_load_and_store_arguments,
1077 "subnamespace": vertex.subnamespace,
1079 self.
d[
"name"] = vertex.name
1084 for face
in self.
faces:
1087 "enumeration_type": face.get_enumeration_type(),
1088 "logical_type_name": face.get_logical_type_name(),
1089 "full_qualified_type": face.get_full_qualified_type(),
1090 "ADDITIONAL_LOAD_STORE_ARGUMENTS": face.additional_load_and_store_arguments,
1091 "subnamespace": face.subnamespace,
1093 self.
d[
"name"] = face.name
1098 for cell
in self.
cells:
1101 "logical_type_name": cell.get_logical_type_name(),
1102 "full_qualified_type": cell.get_full_qualified_type(),
1103 "ADDITIONAL_LOAD_STORE_ARGUMENTS": cell.additional_load_and_store_arguments,
1104 "subnamespace": cell.subnamespace,
1106 self.
d[
"name"] = cell.name
1115 Generates enter cell
1125 "MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY",
1126 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS",
1136 if len(self.
faces) > 0:
1140 "MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS",
1141 "MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY",
1142 "MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS",
1143 "MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS",
1144 "MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS",
1145 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS",
1146 ",MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS",
1156 if len(self.
cells) > 0:
1160 "MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS,",
1161 "MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS,",
1162 "MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_PICK_ENTRY",
1163 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS",
1164 ",MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS",
1165 ",MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS",
1177 ",MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_CELL_EVENT",
1178 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS_CELL_EVENT",
1187 TemplateLoadCell_Prologue =
"""
1188void {{FULL_QUALIFIED_CLASSNAME}}::loadCell( const peano4::grid::GridTraversalEvent& event ) {
1189 logTraceInWith2Arguments( "loadCell(...)", _spacetreeId, event.toString() );
1191 std::vector< tarch::multicore::Task* > tasks;
1194 TemplateStoreCell_Prologue =
"""
1195void {{FULL_QUALIFIED_CLASSNAME}}::storeCell( const peano4::grid::GridTraversalEvent& event ) {
1196 logTraceInWith2Arguments( "storeCell(...)", _spacetreeId, event.toString() );
1197 std::vector< tarch::multicore::Task* > tasks;
1200 TemplateLeaveCell_Prologue =
"""
1201void {{FULL_QUALIFIED_CLASSNAME}}::leaveCell( const peano4::grid::GridTraversalEvent& event ) {
1202 logTraceInWith2Arguments( "leaveCell(...)", _spacetreeId, event.toString() );
1205 TemplateLeaveCell_MappingCall =
"""
1207 peano4::datamanagement::CellMarker marker( event );
1211 {{ACTIVE_ACTION_SET}}.touchCellLastTime(
1213 {{_COMMA_MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_CELL_EVENT}}
1214 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS_CELL_EVENT}}
1220 TemplateLeaveCell_CellStore_MappingCall =
"""
1222 peano4::datamanagement::CellMarker marker( event );
1224 event.getCellData()==peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
1228 {{ACTIVE_ACTION_SET}}.destroyCell(
1230 {{_COMMA_MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS}}
1231 ,{{MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_PICK_ENTRY}}
1232 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1238 TemplateStoreCell_CellStore =
"""
1239 // Handle cell {{logical_type_name}}
1240 std::function<bool ()> storeCell{{logical_type_name}} =
1242 const int inCellStack = peano4::grid::PeanoCurve::CallStack;
1243 const int outCellStack = event.getCellData();
1244 logDebug("storeCell(...)", "cell stack " << inCellStack << "->pos-" << outCellStack );
1246 peano4::datamanagement::CellMarker marker(event);
1248 auto view = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->popBlock( 1 );
1250 bool dataShallBePushedOntoIntermediateStack =
1251 not peano4::grid::PeanoCurve::isInOutStack(outCellStack)
1253 outCellStack!=peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
1255 outCellStack!=peano4::grid::TraversalObserver::NoData;
1256 bool dataShallBePushedOntoOutputStack =
1257 peano4::grid::PeanoCurve::isInOutStack(outCellStack)
1259 ::peano4::grid::storePersistently( {{full_qualified_type}}::loadStoreComputeFlag(
1261 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1264 if ( dataShallBePushedOntoIntermediateStack or dataShallBePushedOntoOutputStack ) {
1265 {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,outCellStack))->push( view.get(0) );
1270 "do not store cell {{name}} with " << marker.x() << " x " << marker.h() << ":" <<
1271 " destroy=" << (outCellStack==peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity) <<
1272 ", no-data=" << (outCellStack==peano4::grid::TraversalObserver::NoData) <<
1273 ", is-in/out=" << peano4::grid::PeanoCurve::isInOutStack(outCellStack)
1279 tasks.push_back( new tarch::multicore::TaskWithoutCopyOfFunctor(
1280 tarch::multicore::Task::DontFuse,
1281 tarch::multicore::Task::DefaultPriority,
1282 storeCell{{logical_type_name}}
1287 TemplateLeaveCell_FaceStore_MappingCall =
"""
1288 // Handle face {{logical_type_name}}
1290 peano4::datamanagement::FaceMarker marker(event);
1292 for (int i=0; i<TwoTimesD; i++) {
1293 int outFaceStack = event.getFaceDataTo(i);
1294 int pick = event.getFaceDataFrom(i);
1296 marker.select(pick);
1299 outFaceStack==peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
1303 {{ACTIVE_ACTION_SET}}.touchFaceLastTime(
1305 {{_COMMA_MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS}}
1306 ,{{MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY}}
1307 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1309 {{ACTIVE_ACTION_SET}}.destroyPersistentFace(
1311 {{_COMMA_MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS}}
1312 ,{{MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY}}
1313 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1317 outFaceStack==peano4::grid::TraversalObserver::CreateOrDestroyHangingGridEntity
1321 {{ACTIVE_ACTION_SET}}.destroyHangingFace(
1323 {{_COMMA_MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS}}
1324 ,{{MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY}}
1325 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1329 peano4::grid::PeanoCurve::isInOutStack(outFaceStack)
1333 {{ACTIVE_ACTION_SET}}.touchFaceLastTime(
1335 {{_COMMA_MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS}}
1336 ,{{MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY}}
1337 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1344 TemplateStoreCell_FaceStore =
"""
1345 // Store face {{logical_type_name}}
1346 std::function<bool ()> storeFace{{logical_type_name}} =
1348 auto view = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->popBlock( TwoTimesD );
1349 for (int i=0; i<TwoTimesD; i++) {
1350 int inFaceStackPosition = event.getFaceDataFrom(i);
1351 int outFaceStack = event.getFaceDataTo(i);
1352 logDebug("storeCell(...)", "pos-" << inFaceStackPosition << "->face stack " << outFaceStack );
1354 peano4::datamanagement::FaceMarker marker(event,inFaceStackPosition);
1356 {{full_qualified_type}}& data = view.get(inFaceStackPosition);
1358 bool dataShallBePushedOntoIntermediateStack =
1359 not peano4::grid::PeanoCurve::isInOutStack(outFaceStack)
1361 outFaceStack!=peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
1363 outFaceStack!=peano4::grid::TraversalObserver::CreateOrDestroyHangingGridEntity
1365 outFaceStack!=peano4::grid::TraversalObserver::NoData;
1366 bool dataShallBePushedOntoOutputStack =
1367 peano4::grid::PeanoCurve::isInOutStack(outFaceStack)
1369 ::peano4::grid::storePersistently( {{full_qualified_type}}::loadStoreComputeFlag(
1371 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1374 if ( dataShallBePushedOntoIntermediateStack or dataShallBePushedOntoOutputStack ) {
1375 logDebug( "storeCell(...)", "store face {{name}} with " << marker.x(inFaceStackPosition) << " x " << marker.h() );
1376 {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,outFaceStack))->push(data);
1379 logDebug( "storeCell(...)", "do not store face {{name}} with " << marker.x(inFaceStackPosition) << " x " << marker.h() );
1385 tasks.push_back( new tarch::multicore::TaskWithoutCopyOfFunctor(
1386 tarch::multicore::Task::DontFuse,
1387 tarch::multicore::Task::DefaultPriority,
1388 storeFace{{logical_type_name}}
1393 TemplateLeaveCell_VertexStore_MappingCall =
"""
1394 // Handle vertex {{logical_type_name}}
1396 peano4::datamanagement::VertexMarker marker(event);
1398 for (int i=0; i<TwoPowerD; i++) {
1399 int outVertexStack = event.getVertexDataTo(i);
1400 int pick = event.getVertexDataFrom(i);
1402 marker.select(pick);
1405 outVertexStack==peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
1409 {{ACTIVE_ACTION_SET}}.touchVertexLastTime(
1411 ,{{MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY}}
1412 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1414 {{ACTIVE_ACTION_SET}}.destroyPersistentVertex(
1416 ,{{MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY}}
1417 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1421 outVertexStack==peano4::grid::TraversalObserver::CreateOrDestroyHangingGridEntity
1425 {{ACTIVE_ACTION_SET}}.destroyHangingVertex(
1427 ,{{MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY}}
1428 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1432 peano4::grid::PeanoCurve::isInOutStack(outVertexStack)
1436 {{ACTIVE_ACTION_SET}}.touchVertexLastTime(
1438 ,{{MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY}}
1439 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1446 TemplateStoreCell_VertexStore =
"""
1447 // Store vertex {{logical_type_name}}
1448 std::function<bool ()> storeVertex{{logical_type_name}} =
1450 auto view = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->popBlock( TwoPowerD );
1451 for (int i=0; i<TwoPowerD; i++) {
1452 int inVertexStackPosition = event.getVertexDataFrom(i);
1453 int outVertexStack = event.getVertexDataTo(i);
1454 logDebug("storeCell(...)", "pos-" << inVertexStackPosition << "->vertex stack " << outVertexStack);
1456 peano4::datamanagement::VertexMarker marker(event,inVertexStackPosition);
1458 {{full_qualified_type}}& data = view.get(inVertexStackPosition);
1461 bool dataShallBePushedOntoIntermediateStack =
1462 not peano4::grid::PeanoCurve::isInOutStack(outVertexStack)
1464 outVertexStack!=peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
1466 outVertexStack!=peano4::grid::TraversalObserver::CreateOrDestroyHangingGridEntity
1468 outVertexStack!=peano4::grid::TraversalObserver::NoData;
1469 bool dataShallBePushedOntoOutputStack =
1470 peano4::grid::PeanoCurve::isInOutStack(outVertexStack)
1472 ::peano4::grid::storePersistently( {{full_qualified_type}}::loadStoreComputeFlag(
1474 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1477 if ( dataShallBePushedOntoIntermediateStack or dataShallBePushedOntoOutputStack ) {
1478 logDebug( "storeCell(...)", "store vertex {{name}} with " << marker.x(inVertexStackPosition) << " x " << marker.h() );
1479 {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush({{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,outVertexStack))->push(data);
1482 logDebug( "storeCell(...)", "do not store vertex {{name}} with " << marker.x(inVertexStackPosition) << " x " << marker.h() );
1488 tasks.push_back( new tarch::multicore::TaskWithoutCopyOfFunctor(
1489 tarch::multicore::Task::DontFuse,
1490 tarch::multicore::Task::DefaultPriority,
1491 storeVertex{{logical_type_name}}
1496 TemplateLeaveCell_Epilogue =
"""
1497 logTraceOutWith1Argument( "leaveCell(...)", _spacetreeId );
1503 TemplateLoadCell_Epilogue =
"""
1504 tarch::multicore::spawnAndWait(tasks);
1505 logTraceOutWith1Argument( "loadCell(...)", _spacetreeId );
1511 TemplateStoreCell_Epilogue =
"""
1512 tarch::multicore::spawnAndWait( tasks );
1513 logTraceOutWith1Argument( "storeCell(...)", _spacetreeId );
1521 Generates enter cell
1525 **self.
mkSubDict([
"FULL_QUALIFIED_CLASSNAME"])
1531 ",MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_CELL_EVENT",
1532 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS_CELL_EVENT",
1539 if len(self.
cells) > 0:
1542 ",MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS",
1543 "MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_PICK_ENTRY",
1544 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS",
1554 if len(self.
faces) > 0:
1558 ",MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS",
1559 "MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY",
1560 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS",
1561 ",MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS",
1562 "MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY",
1563 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS",
1577 "MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY",
1578 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS",
1579 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS",
1580 "MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY",
1597 cells_inverted = [x
for x
in self.
cells]
1598 faces_inverted = [x
for x
in self.
faces]
1599 vertices_inverted = [x
for x
in self.
vertices]
1601 cells_inverted.reverse()
1602 faces_inverted.reverse()
1603 vertices_inverted.reverse()
1605 for cell
in cells_inverted:
1608 "logical_type_name": cell.get_logical_type_name(),
1609 "full_qualified_type": cell.get_full_qualified_type(),
1610 "ADDITIONAL_LOAD_STORE_ARGUMENTS": cell.additional_load_and_store_arguments,
1611 "subnamespace": cell.subnamespace,
1613 self.
d[
"name"] = cell.name
1618 for face
in faces_inverted:
1621 "enumeration_type": face.get_enumeration_type(),
1622 "logical_type_name": face.get_logical_type_name(),
1623 "full_qualified_type": face.get_full_qualified_type(),
1624 "ADDITIONAL_LOAD_STORE_ARGUMENTS": face.additional_load_and_store_arguments,
1625 "subnamespace": face.subnamespace,
1627 self.
d[
"name"] = face.name
1632 for vertex
in vertices_inverted:
1634 "name": vertex.name,
1635 "enumeration_type": vertex.get_enumeration_type(),
1636 "logical_type_name": vertex.get_logical_type_name(),
1637 "full_qualified_type": vertex.get_full_qualified_type(),
1638 "ADDITIONAL_LOAD_STORE_ARGUMENTS": vertex.additional_load_and_store_arguments,
1639 "subnamespace": vertex.subnamespace,
1641 self.
d[
"name"] = vertex.name
1648 TemplateExchangeRoutines_exchangeAllVerticalDataExchangeStacks_Prologue =
"""
1649void {{FULL_QUALIFIED_CLASSNAME}}::exchangeAllVerticalDataExchangeStacks( int masterId ) {
1650 logTraceInWith2Arguments( "exchangeAllVerticalDataExchangeStacks(...)", masterId, _spacetreeId );
1653 TemplateExchangeRoutines_exchangeAllVerticalDataExchangeStacks_Exchange =
"""
1654 peano4::parallel::SpacetreeSet::exchangeAllVerticalDataExchangeStacks(
1661 TemplateExchangeRoutines_exchangeAllVerticalDataExchangeStacks_Epilogue =
"""
1662 logTraceOut( "exchangeAllVerticalDataExchangeStacks(...)" );
1668 TemplateExchangeRoutines_exchangeAllHorizontalDataExchangeStacks_Prologue =
"""
1669void {{FULL_QUALIFIED_CLASSNAME}}::exchangeAllHorizontalDataExchangeStacks( bool symmetricDataCardinality ) {
1670 logTraceInWith2Arguments( "exchangeAllHorizontalDataExchangeStacks(...)", symmetricDataCardinality, _spacetreeId );
1673 TemplateExchangeRoutines_exchangeAllHorizontalDataExchangeStacks_Exchange =
"""
1674 peano4::parallel::SpacetreeSet::exchangeAllHorizontalDataExchangeStacks(
1677 symmetricDataCardinality
1681 TemplateExchangeRoutines_exchangeAllHorizontalDataExchangeStacks_Epilogue =
"""
1682 logTraceOut( "exchangeAllHorizontalDataExchangeStacks(...)" );
1688 TemplateExchangeRoutines_exchangeAllPeriodicBoundaryDataStacks_Prologue =
"""
1689void {{FULL_QUALIFIED_CLASSNAME}}::exchangeAllPeriodicBoundaryDataStacks() {
1690 logTraceInWith1Argument( "exchangeAllPeriodicBoundaryDataStacks()", _spacetreeId );
1693 TemplateExchangeRoutines_exchangeAllPeriodicBoundaryDataStacks_Exchange =
"""
1694 peano4::parallel::SpacetreeSet::exchangeAllPeriodicBoundaryDataStacks(
1700 TemplateExchangeRoutines_exchangeAllPeriodicBoundaryDataStacks_Epilogue =
"""
1701 logTraceOut( "exchangeAllPeriodicBoundaryDataStacks()" );
1707 TemplateExchangeRoutines_streamDataFromSplittingTreeToNewTree_Prologue =
"""
1708void {{FULL_QUALIFIED_CLASSNAME}}::streamDataFromSplittingTreeToNewTree(int newWorker) {
1709 logTraceInWith2Arguments( "streamDataFromSplittingTreeToNewTree(int)", _spacetreeId, newWorker );
1712 TemplateExchangeRoutines_streamDataFromSplittingTreeToNewTree_Exchange =
"""
1713 peano4::parallel::SpacetreeSet::streamDataFromSplittingTreeToNewTree(
1720 TemplateExchangeRoutines_streamDataFromSplittingTreeToNewTree_Epilogue =
"""
1721 logTraceOut( "streamDataFromSplittingTreeToNewTree(int)");
1727 TemplateExchangeRoutines_streamDataFromJoiningTreeToMasterTree_Prologue =
"""
1728void {{FULL_QUALIFIED_CLASSNAME}}::streamDataFromJoiningTreeToMasterTree(int master) {
1729 logTraceInWith2Arguments( "streamDataFromJoiningTreeToMasterTree(int)", _spacetreeId, master );
1732 TemplateExchangeRoutines_streamDataFromJoiningTreeToMasterTree_Exchange =
"""
1733 peano4::parallel::SpacetreeSet::streamDataFromJoiningTreeToMasterTree(
1740 TemplateExchangeRoutines_streamDataFromJoiningTreeToMasterTree_Epilogue =
"""
1741 logTraceOut( "streamDataFromJoiningTreeToMasterTree(int)");
1747 TemplateExchangeRoutines_finishAllOutstandingSendsAndReceives_Prologue =
"""
1748void {{FULL_QUALIFIED_CLASSNAME}}::finishAllOutstandingSendsAndReceives() {
1749 logTraceInWith1Argument( "finishAllOutstandingSendsAndReceives()", _spacetreeId );
1752 TemplateExchangeRoutines_finishAllOutstandingSendsAndReceives_Exchange =
"""
1753 peano4::parallel::SpacetreeSet::finishAllOutstandingSendsAndReceives(
1759 TemplateExchangeRoutines_finishAllOutstandingSendsAndReceives_Epilogue =
"""
1760 logTraceOut( "finishAllOutstandingSendsAndReceives()");
1766 TemplateSendVertex_Prologue =
"""
1767void {{FULL_QUALIFIED_CLASSNAME}}::sendVertex(int position, int toStack, ::peano4::grid::TraversalObserver::SendReceiveContext context, const peano4::grid::GridTraversalEvent& event) {
1768 logTraceInWith4Arguments( "sendVertex(int,int,int)", position, toStack, event.toString(), _spacetreeId );
1772 TemplateSendVertex_SendCall =
"""
1774 peano4::datamanagement::VertexMarker marker(event,position);
1776 const {{full_qualified_type}}& data = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop(
1777 {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack)
1778 )->top(TwoPowerD-1-position);
1780 ::peano4::grid::storePersistently( {{full_qualified_type}}::loadStoreComputeFlag(
1782 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1788 context == TraversalObserver::SendReceiveContext::ForkDomain
1790 context == TraversalObserver::SendReceiveContext::JoinDomain
1793 logDebug( "sendVertex(...)", "send out " << data.toString() << " to stack " << toStack << " on tree " << _spacetreeId << " for marker " << marker.toString() );
1795 {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush(
1796 _spacetreeId, toStack
1802 TemplateSendVertex_Epilogue =
"""
1803 logTraceOut( "sendVertex(int,int,int)");
1809 TemplateSendFace_Prologue =
"""
1810void {{FULL_QUALIFIED_CLASSNAME}}::sendFace(int position, int toStack, ::peano4::grid::TraversalObserver::SendReceiveContext context, const peano4::grid::GridTraversalEvent& event) {
1811 logTraceInWith4Arguments( "sendFace(int,int,int)", position, toStack, event.toString(), _spacetreeId );
1815 TemplateSendFace_SendCall =
"""
1817 peano4::datamanagement::FaceMarker marker(event,position);
1818 const {{full_qualified_type}}& data = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop(
1819 {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack)
1820 )->top(TwoTimesD-1-position);
1822 ::peano4::grid::storePersistently( {{full_qualified_type}}::loadStoreComputeFlag(
1824 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1829 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1832 context == TraversalObserver::SendReceiveContext::ForkDomain
1834 context == TraversalObserver::SendReceiveContext::JoinDomain
1837 logDebug( "sendFace(...)", "send out " << data.toString() << " to stack " << toStack << " on tree " << _spacetreeId << " for marker " << marker.toString() );
1839 {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush(
1840 _spacetreeId, toStack
1846 TemplateSendFace_Epilogue =
"""
1847 logTraceOut( "sendFace(int,int,int)");
1853 TemplateSendCell_Prologue =
"""
1854void {{FULL_QUALIFIED_CLASSNAME}}::sendCell(int toStack, ::peano4::grid::TraversalObserver::SendReceiveContext context, const peano4::grid::GridTraversalEvent& event) {
1855 logTraceInWith3Arguments( "sendCell(int,int,int)", toStack, event.toString(), _spacetreeId );
1859 TemplateSendCell_SendCall =
"""
1861 peano4::datamanagement::CellMarker marker(event);
1862 const {{full_qualified_type}}& data = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->top();
1864 ::peano4::grid::storePersistently( {{full_qualified_type}}::loadStoreComputeFlag(
1866 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1872 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1875 context == TraversalObserver::SendReceiveContext::ForkDomain
1877 context == TraversalObserver::SendReceiveContext::JoinDomain
1880 logDebug( "sendCell(...)", "send out " << data.toString() << " to stack " << toStack << " on tree " << _spacetreeId );
1882 {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush(
1883 _spacetreeId, toStack
1889 TemplateSendCell_Epilogue =
"""
1890 logTraceOut( "sendCell(int,int,int)");
1896 TemplateReceiveAndMergeCell_Prologue =
"""
1897void {{FULL_QUALIFIED_CLASSNAME}}::receiveAndMergeCell(int fromStack, peano4::grid::TraversalObserver::SendReceiveContext context, const peano4::grid::GridTraversalEvent& event ) {
1898 logTraceInWith3Arguments( "receiveAndMergeCell(...)", fromStack, event.toString(), _spacetreeId );
1901 TemplateReceiveAndMergeCell_Epilogue =
"""
1902 logTraceOut( "receiveAndMergeCell(...)");
1908 TemplateReceiveAndMergeVertex_Prologue =
"""
1909void {{FULL_QUALIFIED_CLASSNAME}}::receiveAndMergeVertex(int position, int fromStack, peano4::grid::TraversalObserver::SendReceiveContext context, const peano4::grid::GridTraversalEvent& event) {
1910 logTraceInWith4Arguments( "receiveAndMergeVertex(...)", position, fromStack, event.toString(), _spacetreeId );
1913 TemplateReceiveAndMergeVertex_Epilogue =
"""
1914 logTraceOut( "receiveAndMergeVertex(...)");
1920 TemplateReceiveAndMergeFace_Epilogue =
"""
1921 logTraceOut( "receiveAndMergeFace(...)");
1927 TemplateReceiveAndMergeFace_Prologue =
"""
1928void {{FULL_QUALIFIED_CLASSNAME}}::receiveAndMergeFace(int position, int fromStack, peano4::grid::TraversalObserver::SendReceiveContext context, const peano4::grid::GridTraversalEvent& event) {
1929 logTraceInWith4Arguments( "receiveAndMergeFace(...)", position, fromStack, event.toString(), _spacetreeId );
1932 TemplateReceiveAndMergeVertex_ReceiveAndMergeCalls =
"""
1934 peano4::datamanagement::VertexMarker marker(event,position);
1935 {{full_qualified_type}}& data = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush(
1936 {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack)
1937 )->top(TwoPowerD-1-position);
1940 ::peano4::grid::loadPersistently( {{full_qualified_type}}::loadStoreComputeFlag(
1942 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1945 data.receiveAndMerge(
1947 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1951 not {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop(_spacetreeId, fromStack)->empty(),
1952 _spacetreeId, fromStack, event.toString(), position, marker.toString()
1955 auto incomingData = std::move( {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop(
1956 _spacetreeId, fromStack
1959 logDebug( "receiveAndMergeVertex(...)", "merge " << incomingData.toString() << " into " << data.toString() );
1961 if (context==::peano4::grid::TraversalObserver::SendReceiveContext::PeriodicBoundaryDataSwap) {
1962 // @todo Different to faces. As we can have diagonal exchange, too,
1963 // we only know that it has to be unequal
1965 data.getDebugX()!=incomingData.getDebugX(),
1966 data.getDebugX(), incomingData.getDebugX(),
1967 data.getDebugH(), incomingData.getDebugH(),
1968 fromStack, event.toString(), marker.toString(), _spacetreeId );
1969 assertionVectorNumericalEquals6(
1970 data.getDebugH(), incomingData.getDebugH(),
1971 data.getDebugX(), incomingData.getDebugX(), fromStack, event.toString(), marker.toString(), _spacetreeId );
1974 assertionVectorNumericalEquals6(
1975 data.getDebugX(), incomingData.getDebugX(),
1976 data.getDebugH(), incomingData.getDebugH(), fromStack, event.toString(), marker.toString(), _spacetreeId );
1977 assertionVectorNumericalEquals6(
1978 data.getDebugH(), incomingData.getDebugH(),
1979 data.getDebugX(), incomingData.getDebugX(), fromStack, event.toString(), marker.toString(), _spacetreeId );
1982 data.merge(context, incomingData, marker, _spacetreeId);
1987 TemplateReceiveAndMergeFace_ReceiveAndMergeCalls =
"""
1989 peano4::datamanagement::FaceMarker marker(event,position);
1990 {{full_qualified_type}}& data = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush(
1991 {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack)
1992 )->top(TwoTimesD-1-position);
1995 ::peano4::grid::loadPersistently( {{full_qualified_type}}::loadStoreComputeFlag(
1997 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
2000 data.receiveAndMerge(
2002 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
2005 auto incomingData = std::move( {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop(
2006 _spacetreeId, fromStack
2009 logDebug( "receiveAndMergeFace(...)", "merge " << incomingData.toString() << " into " << data.toString() << " within marker " << marker.toString() );
2011 if (context==::peano4::grid::TraversalObserver::SendReceiveContext::PeriodicBoundaryDataSwap) {
2013 tarch::la::countEqualEntries(data.getDebugX(), incomingData.getDebugX())==Dimensions-1,
2014 data.getDebugX(), incomingData.getDebugX(),
2015 data.getDebugH(), incomingData.getDebugH(),
2016 fromStack, event.toString(), marker.toString(), _spacetreeId );
2017 assertionVectorNumericalEquals6(
2018 data.getDebugH(), incomingData.getDebugH(),
2019 data.getDebugX(), incomingData.getDebugX(), fromStack, event.toString(), marker.toString(), _spacetreeId );
2022 assertionVectorNumericalEquals6(
2023 data.getDebugX(), incomingData.getDebugX(),
2024 data.getDebugH(), incomingData.getDebugH(), fromStack, event.toString(), marker.toString(), _spacetreeId );
2025 assertionVectorNumericalEquals6(
2026 data.getDebugH(), incomingData.getDebugH(),
2027 data.getDebugX(), incomingData.getDebugX(), fromStack, event.toString(), marker.toString(), _spacetreeId );
2030 data.merge(context,incomingData, marker, _spacetreeId);
2035 TemplateReceiveAndMergeCell_ReceiveAndMergeCalls =
"""
2037 peano4::datamanagement::CellMarker marker(event);
2039 {{full_qualified_type}}& data = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush(
2040 {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack)
2044 ::peano4::grid::loadPersistently( {{full_qualified_type}}::loadStoreComputeFlag(
2046 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
2049 data.receiveAndMerge(
2051 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
2054 auto incomingData = std::move( {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop(
2055 _spacetreeId, fromStack
2058 logDebug( "receiveAndMergeCell(...)", "merge " << incomingData.toString() << " into " << data.toString() );
2060 if (context==::peano4::grid::TraversalObserver::SendReceiveContext::PeriodicBoundaryDataSwap) {
2062 tarch::la::countEqualEntries(data.getDebugX(), incomingData.getDebugX())==Dimensions-1,
2063 data.getDebugX(), incomingData.getDebugX(),
2064 data.getDebugH(), incomingData.getDebugH(),
2065 fromStack, event.toString(), marker.toString(), _spacetreeId );
2066 assertionVectorNumericalEquals6(
2067 data.getDebugH(), incomingData.getDebugH(),
2068 data.getDebugX(), incomingData.getDebugX(), fromStack, event.toString(), marker.toString(), _spacetreeId );
2071 assertionVectorNumericalEquals6(
2072 data.getDebugX(), incomingData.getDebugX(),
2073 data.getDebugH(), incomingData.getDebugH(), fromStack, event.toString(), marker.toString(), _spacetreeId );
2074 assertionVectorNumericalEquals6(
2075 data.getDebugH(), incomingData.getDebugH(),
2076 data.getDebugX(), incomingData.getDebugX(), fromStack, event.toString(), marker.toString(), _spacetreeId );
2079 data.merge(context,incomingData, marker, _spacetreeId);
2084 TemplateExchangeRoutines_deleteAllStacks_Prologue =
"""
2085void {{FULL_QUALIFIED_CLASSNAME}}::deleteAllStacks() {
2086 logTraceInWith1Argument( "deleteAllStacks()", _spacetreeId );
2089 TemplateExchangeRoutines_deleteAllStacks_Exchange =
"""
2090 peano4::parallel::SpacetreeSet::deleteAllStacks(
2096 TemplateExchangeRoutines_deleteAllStacks_Epilogue =
"""
2097 logTraceOut( "deleteAllStacks()");
2106 generic_dict_for_prologue_and_epilogue = {
2107 "FULL_QUALIFIED_CLASSNAME": self.
d[
"FULL_QUALIFIED_CLASSNAME"]
2110 s += jinja2.Template(
2112 ).render(**generic_dict_for_prologue_and_epilogue)
2113 for cell
in self.
cells:
2114 s += jinja2.Template(
2118 "DATASET": cell.subnamespace +
"repositories::DataRepository::_"
2119 + cell.get_logical_type_name()
2123 for face
in self.
faces:
2124 s += jinja2.Template(
2128 "DATASET": face.subnamespace +
"repositories::DataRepository::_"
2129 + face.get_logical_type_name()
2134 s += jinja2.Template(
2138 "DATASET": vertex.subnamespace +
"repositories::DataRepository::_"
2139 + vertex.get_logical_type_name()
2143 s += jinja2.Template(
2147 s += jinja2.Template(
2149 ).render(**generic_dict_for_prologue_and_epilogue)
2150 for cell
in self.
cells:
2151 s += jinja2.Template(
2155 "DATASET": cell.subnamespace +
"repositories::DataRepository::_"
2156 + cell.get_logical_type_name()
2160 for face
in self.
faces:
2161 s += jinja2.Template(
2165 "DATASET": face.subnamespace +
"repositories::DataRepository::_"
2166 + face.get_logical_type_name()
2171 s += jinja2.Template(
2175 "DATASET": vertex.subnamespace +
"repositories::DataRepository::_"
2176 + vertex.get_logical_type_name()
2180 s += jinja2.Template(
2184 s += jinja2.Template(
2186 ).render(**generic_dict_for_prologue_and_epilogue)
2187 for cell
in self.
cells:
2188 s += jinja2.Template(
2192 "DATASET": cell.subnamespace +
"repositories::DataRepository::_"
2193 + cell.get_logical_type_name()
2197 for face
in self.
faces:
2198 s += jinja2.Template(
2202 "DATASET": face.subnamespace +
"repositories::DataRepository::_"
2203 + face.get_logical_type_name()
2208 s += jinja2.Template(
2212 "DATASET": vertex.subnamespace +
"repositories::DataRepository::_"
2213 + vertex.get_logical_type_name()
2217 s += jinja2.Template(
2221 s += jinja2.Template(
2223 ).render(**generic_dict_for_prologue_and_epilogue)
2224 for cell
in self.
cells:
2225 s += jinja2.Template(
2229 "DATASET": cell.subnamespace +
"repositories::DataRepository::_"
2230 + cell.get_logical_type_name()
2234 for face
in self.
faces:
2235 s += jinja2.Template(
2239 "DATASET": face.subnamespace +
"repositories::DataRepository::_"
2240 + face.get_logical_type_name()
2245 s += jinja2.Template(
2249 "DATASET": vertex.subnamespace +
"repositories::DataRepository::_"
2250 + vertex.get_logical_type_name()
2254 s += jinja2.Template(
2258 s += jinja2.Template(
2260 ).render(**generic_dict_for_prologue_and_epilogue)
2261 for cell
in self.
cells:
2262 s += jinja2.Template(
2266 "DATASET": cell.subnamespace +
"repositories::DataRepository::_"
2267 + cell.get_logical_type_name()
2271 for face
in self.
faces:
2272 s += jinja2.Template(
2276 "DATASET": face.subnamespace +
"repositories::DataRepository::_"
2277 + face.get_logical_type_name()
2282 s += jinja2.Template(
2286 "DATASET": vertex.subnamespace +
"repositories::DataRepository::_"
2287 + vertex.get_logical_type_name()
2291 s += jinja2.Template(
2295 s += jinja2.Template(
2297 ).render(**generic_dict_for_prologue_and_epilogue)
2298 for cell
in self.
cells:
2299 s += jinja2.Template(
2303 "DATASET": cell.subnamespace +
"repositories::DataRepository::_"
2304 + cell.get_logical_type_name()
2308 for face
in self.
faces:
2309 s += jinja2.Template(
2313 "DATASET": face.subnamespace +
"repositories::DataRepository::_"
2314 + face.get_logical_type_name()
2319 s += jinja2.Template(
2323 "DATASET": vertex.subnamespace +
"repositories::DataRepository::_"
2324 + vertex.get_logical_type_name()
2328 s += jinja2.Template(
2333 **generic_dict_for_prologue_and_epilogue
2337 "name": vertex.name,
2338 "enumeration_type": vertex.get_enumeration_type(),
2339 "logical_type_name": vertex.get_logical_type_name(),
2340 "full_qualified_type": vertex.get_full_qualified_type(),
2341 "FULL_QUALIFIED_CLASSNAME": self.
d[
"FULL_QUALIFIED_CLASSNAME"],
2342 "ADDITIONAL_LOAD_STORE_ARGUMENTS": vertex.additional_load_and_store_arguments,
2343 "subnamespace": vertex.subnamespace,
2347 **generic_dict_for_prologue_and_epilogue
2351 **generic_dict_for_prologue_and_epilogue
2353 for face
in self.
faces:
2356 "enumeration_type": face.get_enumeration_type(),
2357 "logical_type_name": face.get_logical_type_name(),
2358 "full_qualified_type": face.get_full_qualified_type(),
2359 "FULL_QUALIFIED_CLASSNAME": self.
d[
"FULL_QUALIFIED_CLASSNAME"],
2360 "ADDITIONAL_LOAD_STORE_ARGUMENTS": face.additional_load_and_store_arguments,
2361 "subnamespace": face.subnamespace,
2365 **generic_dict_for_prologue_and_epilogue
2369 **generic_dict_for_prologue_and_epilogue
2371 for cell
in self.
cells:
2374 "logical_type_name": cell.get_logical_type_name(),
2375 "full_qualified_type": cell.get_full_qualified_type(),
2376 "FULL_QUALIFIED_CLASSNAME": self.
d[
"FULL_QUALIFIED_CLASSNAME"],
2377 "ADDITIONAL_LOAD_STORE_ARGUMENTS": cell.additional_load_and_store_arguments,
2378 "subnamespace": cell.subnamespace,
2382 **generic_dict_for_prologue_and_epilogue
2386 **generic_dict_for_prologue_and_epilogue
2388 for cell
in self.
cells:
2391 "logical_type_name": cell.get_logical_type_name(),
2392 "full_qualified_type": cell.get_full_qualified_type(),
2393 "FULL_QUALIFIED_CLASSNAME": self.
d[
"FULL_QUALIFIED_CLASSNAME"],
2394 "ADDITIONAL_LOAD_STORE_ARGUMENTS": cell.additional_load_and_store_arguments,
2395 "subnamespace": cell.subnamespace,
2397 s += jinja2.Template(
2401 **generic_dict_for_prologue_and_epilogue
2405 **generic_dict_for_prologue_and_epilogue
2407 for face
in self.
faces:
2410 "enumeration_type": face.get_enumeration_type(),
2411 "logical_type_name": face.get_logical_type_name(),
2412 "full_qualified_type": face.get_full_qualified_type(),
2413 "FULL_QUALIFIED_CLASSNAME": self.
d[
"FULL_QUALIFIED_CLASSNAME"],
2414 "ADDITIONAL_LOAD_STORE_ARGUMENTS": face.additional_load_and_store_arguments,
2415 "subnamespace": face.subnamespace,
2417 s += jinja2.Template(
2421 **generic_dict_for_prologue_and_epilogue
2425 **generic_dict_for_prologue_and_epilogue
2429 "name": vertex.name,
2430 "enumeration_type": vertex.get_enumeration_type(),
2431 "logical_type_name": vertex.get_logical_type_name(),
2432 "full_qualified_type": vertex.get_full_qualified_type(),
2433 "FULL_QUALIFIED_CLASSNAME": self.
d[
"FULL_QUALIFIED_CLASSNAME"],
2434 "ADDITIONAL_LOAD_STORE_ARGUMENTS": vertex.additional_load_and_store_arguments,
2435 "subnamespace": vertex.subnamespace,
2437 s += jinja2.Template(
2441 **generic_dict_for_prologue_and_epilogue
2444 s += jinja2.Template(
2446 ).render(**generic_dict_for_prologue_and_epilogue)
2447 for cell
in self.
cells:
2448 s += jinja2.Template(
2452 "DATASET": cell.subnamespace +
"repositories::DataRepository::_"
2453 + cell.get_logical_type_name()
2457 for face
in self.
faces:
2458 s += jinja2.Template(
2462 "DATASET": face.subnamespace +
"repositories::DataRepository::_"
2463 + face.get_logical_type_name()
2468 s += jinja2.Template(
2472 "DATASET": vertex.subnamespace +
"repositories::DataRepository::_"
2473 + vertex.get_logical_type_name()
2477 s += jinja2.Template(
2479 ).render(**generic_dict_for_prologue_and_epilogue)
2481 output_file.write(s)
2483 TemplateImplementationFilePrologue =
"""
2484#include "{{CLASSNAME}}.h"
2485{{DATAREPOSITORY_INCLUDES}}
2487#include "peano4/grid/PeanoCurve.h"
2489#include "peano4/datamanagement/VertexEnumerator.h"
2490#include "peano4/datamanagement/VertexMarker.h"
2491#include "peano4/datamanagement/FaceEnumerator.h"
2492#include "peano4/datamanagement/FaceMarker.h"
2493#include "peano4/datamanagement/CellMarker.h"
2495#include "peano4/parallel/SpacetreeSet.h"
2498tarch::logging::Log {{FULL_QUALIFIED_CLASSNAME}}::_log( "{{FULL_QUALIFIED_CLASSNAME}}" );
2507 "{} written by {}".format(
2508 full_qualified_filename,
2513 output_file = open(full_qualified_filename,
"w")
2540 if not os.path.exists(directory +
"/" + self.
subdirectory):
__generate_getGridControlEvents(self, output_file)
TemplateEnterCell_Prologue
str TemplateExchangeRoutines_exchangeAllPeriodicBoundaryDataStacks_Prologue
TemplateEnterCell_MappingCall
str TemplatePrepareTraversal
str TemplateSendCell_SendCall
str TemplateExchangeRoutines_deleteAllStacks_Prologue
TemplateGetGridControlEvents_MappingCall
str TemplateExchangeRoutines_streamDataFromJoiningTreeToMasterTree_Prologue
str TemplateExchangeRoutines_deleteAllStacks_Exchange
__generate_header(self, overwrite, directory)
TemplateLoadCell_CellLoad
str TemplateGetGridControlEvents_Prologue
TemplateLeaveCell_MappingCall
str TemplateGetGridControlEvents_Epilogue
str TemplateUnprepareTraversal
TemplateLoadCell_Prologue
str TemplateSendCell_Prologue
str TemplateExchangeRoutines_exchangeAllPeriodicBoundaryDataStacks_Exchange
str TemplateExchangeRoutines_streamDataFromJoiningTreeToMasterTree_Exchange
mkSubDict(self, keys)
Create the particular subdictionary that's used for an expression.
TemplateStoreCell_Prologue
str TemplateEnterCell_Prologue
str TemplateExchangeRoutines_finishAllOutstandingSendsAndReceives_Epilogue
TemplateLoadCell_FaceLoad
str TemplateLeaveCell_VertexStore_MappingCall
TemplateUnprepareTraversal
__generate_unprepareTraversal(self, output_file)
str TemplateReceiveAndMergeFace_Epilogue
str TemplateExchangeRoutines_exchangeAllVerticalDataExchangeStacks_Epilogue
str TemplateReceiveAndMergeVertex_Prologue
str TemplateReceiveAndMergeFace_ReceiveAndMergeCalls
str TemplateLeaveCell_CellStore_MappingCall
str TemplateExchangeRoutines_exchangeAllHorizontalDataExchangeStacks_Exchange
TemplateEnterCell_VertexMappingCall
TemplateGetGridControlEvents_Prologue
str TemplateExchangeRoutines_streamDataFromSplittingTreeToNewTree_Prologue
TemplateImplementationFilePrologue
str TemplateExchangeRoutines_exchangeAllHorizontalDataExchangeStacks_Prologue
str TemplateStoreCell_FaceStore
str TemplateReceiveAndMergeFace_Prologue
str TemplateEnterCell_FaceMappingCall
str TemplateLoadCell_VertexLoad
__generate_exchange_routines(self, output_file)
str TemplateExchangeRoutines_streamDataFromSplittingTreeToNewTree_Epilogue
__generate_clone(self, output_file)
str TemplateSendFace_SendCall
str TemplateSendVertex_SendCall
str TemplateReceiveAndMergeVertex_ReceiveAndMergeCalls
str TemplateExchangeRoutines_streamDataFromSplittingTreeToNewTree_Exchange
str TemplateGetGridControlEvents_MappingCall
str TemplateReceiveAndMergeCell_ReceiveAndMergeCalls
str TemplateLeaveCell_Prologue
TemplateStoreCell_Epilogue
str TemplateReceiveAndMergeCell_Prologue
TemplateEnterCell_CellMappingCall
str TemplateExchangeRoutines_finishAllOutstandingSendsAndReceives_Exchange
str TemplateImplementationFilePrologue
TemplateLeaveCell_FaceStore_MappingCall
TemplateEnterCell_FaceMappingCall
TemplateStoreCell_VertexStore
str TemplateExchangeRoutines_finishAllOutstandingSendsAndReceives_Prologue
str TemplateEnterCell_CellMappingCall
__generate_loadCell(self, output_file)
str TemplateExchangeRoutines_exchangeAllVerticalDataExchangeStacks_Prologue
__init__(self, classname, namespace, subdirectory, included_actions, vertices, faces, cells)
Included actions is a list of qualified actions which are used.
__generate_implementation(self, overwrite, full_qualified_filename)
str TemplateLeaveCell_MappingCall
str TemplateSendVertex_Prologue
str TemplateExchangeRoutines_exchangeAllPeriodicBoundaryDataStacks_Epilogue
str TemplateLeaveCell_Epilogue
str TemplateStoreCell_Epilogue
TemplateLoadCell_Epilogue
str TemplateReceiveAndMergeVertex_Epilogue
str TemplateExchangeRoutines_streamDataFromJoiningTreeToMasterTree_Epilogue
__generate_leaveCell(self, output_file)
Generates enter cell.
TemplateGetGridControlEvents_Epilogue
str TemplateLoadCell_CellLoad
TemplateStoreCell_CellStore
str TemplateLoadCell_Prologue
str TemplateSendVertex_Epilogue
__format_template_per_action(self, output_file, template, reverse_order=False, manual_dict=None)
Takes the specified template file, iterates over actions and pastes the template into the output file...
str TemplateLeaveCell_FaceStore_MappingCall
TemplateLeaveCell_Prologue
str TemplateSendCell_Epilogue
TemplateEnterCell_Epilogue
str TemplateExchangeRoutines_exchangeAllHorizontalDataExchangeStacks_Epilogue
__generate_storeCell(self, output_file)
str TemplateBeginTraversal
TemplateLeaveCell_CellStore_MappingCall
str TemplateStoreCell_CellStore
generateDictEntry(self, key)
Some logic to produce new dictionary entries from existing ones.
str TemplateSendFace_Epilogue
str TemplateExchangeRoutines_deleteAllStacks_Epilogue
__generate_beginTraversal(self, output_file)
str TemplateExchangeRoutines_exchangeAllVerticalDataExchangeStacks_Exchange
str TemplateLoadCell_FaceLoad
TemplateStoreCell_FaceStore
__generate_constructor(self, output_file)
str TemplateStoreCell_Prologue
str TemplateStoreCell_VertexStore
str TemplateEnterCell_Epilogue
TemplateLeaveCell_Epilogue
str TemplateReceiveAndMergeCell_Epilogue
str TemplateLoadCell_Epilogue
str TemplateEnterCell_VertexMappingCall
__generate_endTraversal(self, output_file)
__generate_enterCell(self, output_file)
Generates enter cell.
str TemplateSendFace_Prologue
__generate_prepareTraversal(self, output_file)
TemplateLeaveCell_VertexStore_MappingCall
str TemplateEnterCell_MappingCall
TemplateLoadCell_VertexLoad
generate(self, overwrite, directory)