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 =
r"""
565 // Load vertex {{logical_type_name}}
566 std::function<void ()> 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() );
654 tasks.push_back( new tarch::multicore::TaskWithoutCopyOfFunctor(
655 tarch::multicore::Task::DontFuse,
656 tarch::multicore::Task::DefaultPriority,
657 loadVertex{{logical_type_name}}
662 TemplateEnterCell_VertexMappingCall =
r"""
663 // Handle vertex {{logical_type_name}}
665 peano4::datamanagement::VertexMarker marker(event);
667 for (int i=0; i<TwoPowerD; i++) {
668 int inVertexStack = event.getVertexDataFrom(i);
669 int pick = event.getVertexDataTo(i); // the vertex position
673 logDebug( "enterCell(...)", inVertexStack << "->" << pick << " (is-local=" << marker.isLocal() << ")" );
676 inVertexStack==peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
680 // Take care about the coarse grid accesses: Faces and cells are not yet loaded.
681 // Therefore we don't use the usual shift of 2*2d or 2*2**d (don't use LaTeX here
682 // as this is within a Python document and the Python interpreter doesn't fancy
683 // escape chars here, even though these escape chars are actually within a TeX
684 // formula) but only half of it.
685 {{ACTIVE_ACTION_SET}}.createPersistentVertex(
687 ,{{MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY}}
688 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
690 {{ACTIVE_ACTION_SET}}.touchVertexFirstTime(
692 ,{{MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY}}
693 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
697 inVertexStack==peano4::grid::TraversalObserver::CreateOrDestroyHangingGridEntity
701 {{ACTIVE_ACTION_SET}}.createHangingVertex(
703 ,{{MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY}}
704 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
708 peano4::grid::PeanoCurve::isInOutStack(inVertexStack)
712 {{ACTIVE_ACTION_SET}}.touchVertexFirstTime(
714 ,{{MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY}}
715 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
722 TemplateLoadCell_FaceLoad =
r"""
723 // Load face {{logical_type_name}}
724 std::function<void ()> loadFace{{logical_type_name}} =
726 auto view = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->pushBlock( TwoTimesD );
727 for (int i=0; i<TwoTimesD; i++) {
728 int inFaceStack = event.getFaceDataFrom(i);
729 int outFaceStackPosition = event.getFaceDataTo(i);
730 logDebug("loadCell(...)", "face stack " << inFaceStack << "->pos-" << outFaceStackPosition );
732 peano4::datamanagement::FaceMarker marker(event,outFaceStackPosition);
734 bool dataResidesOnIntermediateStack =
735 not peano4::grid::PeanoCurve::isInOutStack(inFaceStack)
737 inFaceStack!=peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
739 inFaceStack!=peano4::grid::TraversalObserver::CreateOrDestroyHangingGridEntity
741 inFaceStack!=peano4::grid::TraversalObserver::NoData;
742 bool dataResidesOnInputStack =
743 peano4::grid::PeanoCurve::isInOutStack(inFaceStack)
745 ::peano4::grid::loadPersistently( {{full_qualified_type}}::loadStoreComputeFlag(
747 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
749 bool initialiseStackContentForNewData =
750 ::peano4::grid::computeOnData( {{full_qualified_type}}::loadStoreComputeFlag(
752 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
755 inFaceStack==peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
757 inFaceStack==peano4::grid::TraversalObserver::CreateOrDestroyHangingGridEntity
760 if ( dataResidesOnIntermediateStack or dataResidesOnInputStack ) {
763 "load data of face {{name}} with " << marker.x(outFaceStackPosition) << " x " << marker.h() <<
764 ": " << ::peano4::grid::toString( {{full_qualified_type}}::loadStoreComputeFlag(
766 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
770 not {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,inFaceStack))->empty(),
772 peano4::datamanagement::FaceMarker(event).toString(),
773 _spacetreeId, inFaceStack,
774 ::peano4::grid::toString( {{full_qualified_type}}::loadStoreComputeFlag(
776 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
779 {{full_qualified_type}} data = std::move( {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,inFaceStack))->pop() );
781 if ( peano4::grid::PeanoCurve::isInOutStack(inFaceStack) ) {
782 assertionVectorNumericalEquals5( data.getDebugX(), marker.x(outFaceStackPosition), data.getDebugX(), data.getDebugH(), marker.toString(), outFaceStackPosition, _spacetreeId );
783 assertionVectorNumericalEquals5( data.getDebugH(), marker.h(), data.getDebugX(), data.getDebugH(), marker.toString(), outFaceStackPosition, _spacetreeId );
786 view.set(outFaceStackPosition,data);
788 else if ( initialiseStackContentForNewData ) {
789 {{full_qualified_type}} data;
793 "initialise meta data of new face {{name}} with " << marker.x(outFaceStackPosition) << " x " << marker.h() <<
794 ": " << ::peano4::grid::toString( {{full_qualified_type}}::loadStoreComputeFlag(
796 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
799 data.setDebugX( marker.x(outFaceStackPosition) );
800 data.setDebugH( marker.h() );
802 view.set(outFaceStackPosition,data);
808 "initialise meta data of unused face {{name}} with " << marker.x(outFaceStackPosition) << " x " << marker.h() <<
809 ": " << ::peano4::grid::toString( {{full_qualified_type}}::loadStoreComputeFlag(
811 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
814 view.get(outFaceStackPosition).setDebugX( marker.x(outFaceStackPosition) );
815 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 =
r"""
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 =
r"""
895 // Load cell {{logical_type_name}}
896 std::function<void ()> 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() );
975 tasks.push_back( new tarch::multicore::TaskWithoutCopyOfFunctor(
976 tarch::multicore::Task::DontFuse,
977 tarch::multicore::Task::DefaultPriority,
978 loadCell{{logical_type_name}}
983 TemplateEnterCell_CellMappingCall =
r"""
984 // Invoke creational events on cell {{logical_type_name}}
986 peano4::datamanagement::CellMarker marker( event );
988 event.getCellData()==peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
992 {{ACTIVE_ACTION_SET}}.createCell(
994 {{MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_COMMA_}}
995 {{MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_COMMA_}}
996 {{MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_PICK_ENTRY}}
997 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS}}
998 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS}}
999 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1005 TemplateEnterCell_MappingCall =
r"""
1007 peano4::datamanagement::CellMarker marker( event );
1011 {{ACTIVE_ACTION_SET}}.touchCellFirstTime(
1013 {{_COMMA_MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_CELL_EVENT}}
1014 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS_CELL_EVENT}}
1020 TemplateEnterCell_Epilogue =
"""
1021 logTraceOut( "enterCell(...)" );
1029 Some logic to produce new dictionary entries from existing ones.
1030 This deals mainly with having to avoid C++ code with consequtive commata
1031 as some dict entries can be an empty string.
1034 fields = key.split(
",")
1035 nonempty = [self.
d[f]
for f
in fields
if not f ==
"" and not self.
d[f] ==
""]
1036 if len(nonempty) > 0:
1037 s =
",".join(nonempty)
1038 if key.startswith(
",")
and not s.startswith(
","):
1040 if key.endswith(
",")
and not s.endswith(
","):
1050 Create the particular subdictionary that's used for an expression.
1061 result[k.replace(
",",
"_COMMA_").strip()] = temp[k]
1071 "name": vertex.name,
1072 "enumeration_type": vertex.get_enumeration_type(),
1073 "logical_type_name": vertex.get_logical_type_name(),
1074 "full_qualified_type": vertex.get_full_qualified_type(),
1075 "ADDITIONAL_LOAD_STORE_ARGUMENTS": vertex.additional_load_and_store_arguments,
1076 "subnamespace": vertex.subnamespace,
1078 self.
d[
"name"] = vertex.name
1083 for face
in self.
faces:
1086 "enumeration_type": face.get_enumeration_type(),
1087 "logical_type_name": face.get_logical_type_name(),
1088 "full_qualified_type": face.get_full_qualified_type(),
1089 "ADDITIONAL_LOAD_STORE_ARGUMENTS": face.additional_load_and_store_arguments,
1090 "subnamespace": face.subnamespace,
1092 self.
d[
"name"] = face.name
1097 for cell
in self.
cells:
1100 "logical_type_name": cell.get_logical_type_name(),
1101 "full_qualified_type": cell.get_full_qualified_type(),
1102 "ADDITIONAL_LOAD_STORE_ARGUMENTS": cell.additional_load_and_store_arguments,
1103 "subnamespace": cell.subnamespace,
1105 self.
d[
"name"] = cell.name
1114 Generates enter cell
1124 "MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY",
1125 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS",
1135 if len(self.
faces) > 0:
1139 "MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS",
1140 "MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY",
1141 "MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS",
1142 "MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS",
1143 "MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS",
1144 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS",
1145 ",MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS",
1155 if len(self.
cells) > 0:
1159 "MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS,",
1160 "MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS,",
1161 "MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_PICK_ENTRY",
1162 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS",
1163 ",MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS",
1164 ",MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS",
1176 ",MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_CELL_EVENT",
1177 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS_CELL_EVENT",
1186 TemplateLoadCell_Prologue =
"""
1187void {{FULL_QUALIFIED_CLASSNAME}}::loadCell( const peano4::grid::GridTraversalEvent& event ) {
1188 logTraceInWith2Arguments( "loadCell(...)", _spacetreeId, event.toString() );
1190 std::vector< tarch::multicore::Task* > tasks;
1193 TemplateStoreCell_Prologue =
"""
1194void {{FULL_QUALIFIED_CLASSNAME}}::storeCell( const peano4::grid::GridTraversalEvent& event ) {
1195 logTraceInWith2Arguments( "storeCell(...)", _spacetreeId, event.toString() );
1196 std::vector< tarch::multicore::Task* > tasks;
1199 TemplateLeaveCell_Prologue =
"""
1200void {{FULL_QUALIFIED_CLASSNAME}}::leaveCell( const peano4::grid::GridTraversalEvent& event ) {
1201 logTraceInWith2Arguments( "leaveCell(...)", _spacetreeId, event.toString() );
1204 TemplateLeaveCell_MappingCall =
"""
1206 peano4::datamanagement::CellMarker marker( event );
1210 {{ACTIVE_ACTION_SET}}.touchCellLastTime(
1212 {{_COMMA_MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_CELL_EVENT}}
1213 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS_CELL_EVENT}}
1219 TemplateLeaveCell_CellStore_MappingCall =
"""
1221 peano4::datamanagement::CellMarker marker( event );
1223 event.getCellData()==peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
1227 {{ACTIVE_ACTION_SET}}.destroyCell(
1229 {{_COMMA_MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS}}
1230 ,{{MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_PICK_ENTRY}}
1231 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1237 TemplateStoreCell_CellStore =
"""
1238 // Handle cell {{logical_type_name}}
1239 std::function<void ()> storeCell{{logical_type_name}} =
1241 const int inCellStack = peano4::grid::PeanoCurve::CallStack;
1242 const int outCellStack = event.getCellData();
1243 logDebug("storeCell(...)", "cell stack " << inCellStack << "->pos-" << outCellStack );
1245 peano4::datamanagement::CellMarker marker(event);
1247 auto view = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->popBlock( 1 );
1249 bool dataShallBePushedOntoIntermediateStack =
1250 not peano4::grid::PeanoCurve::isInOutStack(outCellStack)
1252 outCellStack!=peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
1254 outCellStack!=peano4::grid::TraversalObserver::NoData;
1255 bool dataShallBePushedOntoOutputStack =
1256 peano4::grid::PeanoCurve::isInOutStack(outCellStack)
1258 ::peano4::grid::storePersistently( {{full_qualified_type}}::loadStoreComputeFlag(
1260 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1263 if ( dataShallBePushedOntoIntermediateStack or dataShallBePushedOntoOutputStack ) {
1264 {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,outCellStack))->push( view.get(0) );
1269 "do not store cell {{name}} with " << marker.x() << " x " << marker.h() << ":" <<
1270 " destroy=" << (outCellStack==peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity) <<
1271 ", no-data=" << (outCellStack==peano4::grid::TraversalObserver::NoData) <<
1272 ", is-in/out=" << peano4::grid::PeanoCurve::isInOutStack(outCellStack)
1277 tasks.push_back( new tarch::multicore::TaskWithoutCopyOfFunctor(
1278 tarch::multicore::Task::DontFuse,
1279 tarch::multicore::Task::DefaultPriority,
1280 storeCell{{logical_type_name}}
1285 TemplateLeaveCell_FaceStore_MappingCall =
"""
1286 // Handle face {{logical_type_name}}
1288 peano4::datamanagement::FaceMarker marker(event);
1290 for (int i=0; i<TwoTimesD; i++) {
1291 int outFaceStack = event.getFaceDataTo(i);
1292 int pick = event.getFaceDataFrom(i);
1294 marker.select(pick);
1297 outFaceStack==peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
1301 {{ACTIVE_ACTION_SET}}.touchFaceLastTime(
1303 {{_COMMA_MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS}}
1304 ,{{MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY}}
1305 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1307 {{ACTIVE_ACTION_SET}}.destroyPersistentFace(
1309 {{_COMMA_MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS}}
1310 ,{{MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY}}
1311 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1315 outFaceStack==peano4::grid::TraversalObserver::CreateOrDestroyHangingGridEntity
1319 {{ACTIVE_ACTION_SET}}.destroyHangingFace(
1321 {{_COMMA_MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS}}
1322 ,{{MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY}}
1323 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1327 peano4::grid::PeanoCurve::isInOutStack(outFaceStack)
1331 {{ACTIVE_ACTION_SET}}.touchFaceLastTime(
1333 {{_COMMA_MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS}}
1334 ,{{MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY}}
1335 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1342 TemplateStoreCell_FaceStore =
"""
1343 // Store face {{logical_type_name}}
1344 std::function<void ()> storeFace{{logical_type_name}} =
1346 auto view = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->popBlock( TwoTimesD );
1347 for (int i=0; i<TwoTimesD; i++) {
1348 int inFaceStackPosition = event.getFaceDataFrom(i);
1349 int outFaceStack = event.getFaceDataTo(i);
1350 logDebug("storeCell(...)", "pos-" << inFaceStackPosition << "->face stack " << outFaceStack );
1352 peano4::datamanagement::FaceMarker marker(event,inFaceStackPosition);
1354 {{full_qualified_type}}& data = view.get(inFaceStackPosition);
1356 bool dataShallBePushedOntoIntermediateStack =
1357 not peano4::grid::PeanoCurve::isInOutStack(outFaceStack)
1359 outFaceStack!=peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
1361 outFaceStack!=peano4::grid::TraversalObserver::CreateOrDestroyHangingGridEntity
1363 outFaceStack!=peano4::grid::TraversalObserver::NoData;
1364 bool dataShallBePushedOntoOutputStack =
1365 peano4::grid::PeanoCurve::isInOutStack(outFaceStack)
1367 ::peano4::grid::storePersistently( {{full_qualified_type}}::loadStoreComputeFlag(
1369 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1372 if ( dataShallBePushedOntoIntermediateStack or dataShallBePushedOntoOutputStack ) {
1373 logDebug( "storeCell(...)", "store face {{name}} with " << marker.x(inFaceStackPosition) << " x " << marker.h() );
1374 {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,outFaceStack))->push(data);
1377 logDebug( "storeCell(...)", "do not store face {{name}} with " << marker.x(inFaceStackPosition) << " x " << marker.h() );
1382 tasks.push_back( new tarch::multicore::TaskWithoutCopyOfFunctor(
1383 tarch::multicore::Task::DontFuse,
1384 tarch::multicore::Task::DefaultPriority,
1385 storeFace{{logical_type_name}}
1390 TemplateLeaveCell_VertexStore_MappingCall =
"""
1391 // Handle vertex {{logical_type_name}}
1393 peano4::datamanagement::VertexMarker marker(event);
1395 for (int i=0; i<TwoPowerD; i++) {
1396 int outVertexStack = event.getVertexDataTo(i);
1397 int pick = event.getVertexDataFrom(i);
1399 marker.select(pick);
1402 outVertexStack==peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
1406 {{ACTIVE_ACTION_SET}}.touchVertexLastTime(
1408 ,{{MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY}}
1409 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1411 {{ACTIVE_ACTION_SET}}.destroyPersistentVertex(
1413 ,{{MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY}}
1414 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1418 outVertexStack==peano4::grid::TraversalObserver::CreateOrDestroyHangingGridEntity
1422 {{ACTIVE_ACTION_SET}}.destroyHangingVertex(
1424 ,{{MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY}}
1425 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1429 peano4::grid::PeanoCurve::isInOutStack(outVertexStack)
1433 {{ACTIVE_ACTION_SET}}.touchVertexLastTime(
1435 ,{{MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY}}
1436 {{_COMMA_MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS_COMMA_MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS}}
1443 TemplateStoreCell_VertexStore =
"""
1444 // Store vertex {{logical_type_name}}
1445 std::function<void ()> storeVertex{{logical_type_name}} =
1447 auto view = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->popBlock( TwoPowerD );
1448 for (int i=0; i<TwoPowerD; i++) {
1449 int inVertexStackPosition = event.getVertexDataFrom(i);
1450 int outVertexStack = event.getVertexDataTo(i);
1451 logDebug("storeCell(...)", "pos-" << inVertexStackPosition << "->vertex stack " << outVertexStack);
1453 peano4::datamanagement::VertexMarker marker(event,inVertexStackPosition);
1455 {{full_qualified_type}}& data = view.get(inVertexStackPosition);
1457 bool dataShallBePushedOntoIntermediateStack =
1458 not peano4::grid::PeanoCurve::isInOutStack(outVertexStack)
1460 outVertexStack!=peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity
1462 outVertexStack!=peano4::grid::TraversalObserver::CreateOrDestroyHangingGridEntity
1464 outVertexStack!=peano4::grid::TraversalObserver::NoData;
1465 bool dataShallBePushedOntoOutputStack =
1466 peano4::grid::PeanoCurve::isInOutStack(outVertexStack)
1468 ::peano4::grid::storePersistently( {{full_qualified_type}}::loadStoreComputeFlag(
1470 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1473 if ( dataShallBePushedOntoIntermediateStack or dataShallBePushedOntoOutputStack ) {
1474 logDebug( "storeCell(...)", "store vertex {{name}} with " << marker.x(inVertexStackPosition) << " x " << marker.h() );
1475 {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush({{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,outVertexStack))->push(data);
1478 logDebug( "storeCell(...)", "do not store vertex {{name}} with " << marker.x(inVertexStackPosition) << " x " << marker.h() );
1483 tasks.push_back( new tarch::multicore::TaskWithoutCopyOfFunctor(
1484 tarch::multicore::Task::DontFuse,
1485 tarch::multicore::Task::DefaultPriority,
1486 storeVertex{{logical_type_name}}
1491 TemplateLeaveCell_Epilogue =
"""
1492 logTraceOutWith1Argument( "leaveCell(...)", _spacetreeId );
1498 TemplateLoadCell_Epilogue =
"""
1499 tarch::multicore::spawnAndWait(tasks);
1500 logTraceOutWith1Argument( "loadCell(...)", _spacetreeId );
1506 TemplateStoreCell_Epilogue =
"""
1507 tarch::multicore::spawnAndWait( tasks );
1508 logTraceOutWith1Argument( "storeCell(...)", _spacetreeId );
1516 Generates enter cell
1520 **self.
mkSubDict([
"FULL_QUALIFIED_CLASSNAME"])
1526 ",MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_CELL_EVENT",
1527 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS_CELL_EVENT",
1534 if len(self.
cells) > 0:
1537 ",MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS",
1538 "MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS_PICK_ENTRY",
1539 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS",
1549 if len(self.
faces) > 0:
1553 ",MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS",
1554 "MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY",
1555 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS",
1556 ",MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS",
1557 "MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS_PICK_ENTRY",
1558 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS",
1572 "MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY",
1573 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_FINE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_FINE_GRID_CELL_ARGUMENTS",
1574 ",MAPPING_SIGNATURE_COARSE_GRID_VERTICES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_FACES_ARGUMENTS,MAPPING_SIGNATURE_COARSE_GRID_CELL_ARGUMENTS",
1575 "MAPPING_SIGNATURE_FINE_GRID_VERTICES_ARGUMENTS_PICK_ENTRY",
1592 cells_inverted = [x
for x
in self.
cells]
1593 faces_inverted = [x
for x
in self.
faces]
1594 vertices_inverted = [x
for x
in self.
vertices]
1596 cells_inverted.reverse()
1597 faces_inverted.reverse()
1598 vertices_inverted.reverse()
1600 for cell
in cells_inverted:
1603 "logical_type_name": cell.get_logical_type_name(),
1604 "full_qualified_type": cell.get_full_qualified_type(),
1605 "ADDITIONAL_LOAD_STORE_ARGUMENTS": cell.additional_load_and_store_arguments,
1606 "subnamespace": cell.subnamespace,
1608 self.
d[
"name"] = cell.name
1613 for face
in faces_inverted:
1616 "enumeration_type": face.get_enumeration_type(),
1617 "logical_type_name": face.get_logical_type_name(),
1618 "full_qualified_type": face.get_full_qualified_type(),
1619 "ADDITIONAL_LOAD_STORE_ARGUMENTS": face.additional_load_and_store_arguments,
1620 "subnamespace": face.subnamespace,
1622 self.
d[
"name"] = face.name
1627 for vertex
in vertices_inverted:
1629 "name": vertex.name,
1630 "enumeration_type": vertex.get_enumeration_type(),
1631 "logical_type_name": vertex.get_logical_type_name(),
1632 "full_qualified_type": vertex.get_full_qualified_type(),
1633 "ADDITIONAL_LOAD_STORE_ARGUMENTS": vertex.additional_load_and_store_arguments,
1634 "subnamespace": vertex.subnamespace,
1636 self.
d[
"name"] = vertex.name
1643 TemplateExchangeRoutines_exchangeAllVerticalDataExchangeStacks_Prologue =
"""
1644void {{FULL_QUALIFIED_CLASSNAME}}::exchangeAllVerticalDataExchangeStacks( int masterId ) {
1645 logTraceInWith2Arguments( "exchangeAllVerticalDataExchangeStacks(...)", masterId, _spacetreeId );
1648 TemplateExchangeRoutines_exchangeAllVerticalDataExchangeStacks_Exchange =
"""
1649 peano4::parallel::SpacetreeSet::exchangeAllVerticalDataExchangeStacks(
1656 TemplateExchangeRoutines_exchangeAllVerticalDataExchangeStacks_Epilogue =
"""
1657 logTraceOut( "exchangeAllVerticalDataExchangeStacks(...)" );
1663 TemplateExchangeRoutines_exchangeAllHorizontalDataExchangeStacks_Prologue =
"""
1664void {{FULL_QUALIFIED_CLASSNAME}}::exchangeAllHorizontalDataExchangeStacks( bool symmetricDataCardinality ) {
1665 logTraceInWith2Arguments( "exchangeAllHorizontalDataExchangeStacks(...)", symmetricDataCardinality, _spacetreeId );
1668 TemplateExchangeRoutines_exchangeAllHorizontalDataExchangeStacks_Exchange =
"""
1669 peano4::parallel::SpacetreeSet::exchangeAllHorizontalDataExchangeStacks(
1672 symmetricDataCardinality
1676 TemplateExchangeRoutines_exchangeAllHorizontalDataExchangeStacks_Epilogue =
"""
1677 logTraceOut( "exchangeAllHorizontalDataExchangeStacks(...)" );
1683 TemplateExchangeRoutines_exchangeAllPeriodicBoundaryDataStacks_Prologue =
"""
1684void {{FULL_QUALIFIED_CLASSNAME}}::exchangeAllPeriodicBoundaryDataStacks() {
1685 logTraceInWith1Argument( "exchangeAllPeriodicBoundaryDataStacks()", _spacetreeId );
1688 TemplateExchangeRoutines_exchangeAllPeriodicBoundaryDataStacks_Exchange =
"""
1689 peano4::parallel::SpacetreeSet::exchangeAllPeriodicBoundaryDataStacks(
1695 TemplateExchangeRoutines_exchangeAllPeriodicBoundaryDataStacks_Epilogue =
"""
1696 logTraceOut( "exchangeAllPeriodicBoundaryDataStacks()" );
1702 TemplateExchangeRoutines_streamDataFromSplittingTreeToNewTree_Prologue =
"""
1703void {{FULL_QUALIFIED_CLASSNAME}}::streamDataFromSplittingTreeToNewTree(int newWorker) {
1704 logTraceInWith2Arguments( "streamDataFromSplittingTreeToNewTree(int)", _spacetreeId, newWorker );
1707 TemplateExchangeRoutines_streamDataFromSplittingTreeToNewTree_Exchange =
"""
1708 peano4::parallel::SpacetreeSet::streamDataFromSplittingTreeToNewTree(
1715 TemplateExchangeRoutines_streamDataFromSplittingTreeToNewTree_Epilogue =
"""
1716 logTraceOut( "streamDataFromSplittingTreeToNewTree(int)");
1722 TemplateExchangeRoutines_streamDataFromJoiningTreeToMasterTree_Prologue =
"""
1723void {{FULL_QUALIFIED_CLASSNAME}}::streamDataFromJoiningTreeToMasterTree(int master) {
1724 logTraceInWith2Arguments( "streamDataFromJoiningTreeToMasterTree(int)", _spacetreeId, master );
1727 TemplateExchangeRoutines_streamDataFromJoiningTreeToMasterTree_Exchange =
"""
1728 peano4::parallel::SpacetreeSet::streamDataFromJoiningTreeToMasterTree(
1735 TemplateExchangeRoutines_streamDataFromJoiningTreeToMasterTree_Epilogue =
"""
1736 logTraceOut( "streamDataFromJoiningTreeToMasterTree(int)");
1742 TemplateExchangeRoutines_finishAllOutstandingSendsAndReceives_Prologue =
"""
1743void {{FULL_QUALIFIED_CLASSNAME}}::finishAllOutstandingSendsAndReceives() {
1744 logTraceInWith1Argument( "finishAllOutstandingSendsAndReceives()", _spacetreeId );
1747 TemplateExchangeRoutines_finishAllOutstandingSendsAndReceives_Exchange =
"""
1748 peano4::parallel::SpacetreeSet::finishAllOutstandingSendsAndReceives(
1754 TemplateExchangeRoutines_finishAllOutstandingSendsAndReceives_Epilogue =
"""
1755 logTraceOut( "finishAllOutstandingSendsAndReceives()");
1761 TemplateSendVertex_Prologue =
"""
1762void {{FULL_QUALIFIED_CLASSNAME}}::sendVertex(int position, int toStack, ::peano4::grid::TraversalObserver::SendReceiveContext context, const peano4::grid::GridTraversalEvent& event) {
1763 logTraceInWith4Arguments( "sendVertex(int,int,int)", position, toStack, event.toString(), _spacetreeId );
1767 TemplateSendVertex_SendCall =
"""
1769 peano4::datamanagement::VertexMarker marker(event,position);
1771 const {{full_qualified_type}}& data = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop(
1772 {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack)
1773 )->top(TwoPowerD-1-position);
1775 ::peano4::grid::storePersistently( {{full_qualified_type}}::loadStoreComputeFlag(
1777 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1783 context == TraversalObserver::SendReceiveContext::ForkDomain
1785 context == TraversalObserver::SendReceiveContext::JoinDomain
1788 logDebug( "sendVertex(...)", "send out " << data.toString() << " to stack " << toStack << " on tree " << _spacetreeId << " for marker " << marker.toString() );
1790 {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush(
1791 _spacetreeId, toStack
1797 TemplateSendVertex_Epilogue =
"""
1798 logTraceOut( "sendVertex(int,int,int)");
1804 TemplateSendFace_Prologue =
"""
1805void {{FULL_QUALIFIED_CLASSNAME}}::sendFace(int position, int toStack, ::peano4::grid::TraversalObserver::SendReceiveContext context, const peano4::grid::GridTraversalEvent& event) {
1806 logTraceInWith4Arguments( "sendFace(int,int,int)", position, toStack, event.toString(), _spacetreeId );
1810 TemplateSendFace_SendCall =
"""
1812 peano4::datamanagement::FaceMarker marker(event,position);
1813 const {{full_qualified_type}}& data = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop(
1814 {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack)
1815 )->top(TwoTimesD-1-position);
1817 ::peano4::grid::storePersistently( {{full_qualified_type}}::loadStoreComputeFlag(
1819 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1824 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1827 context == TraversalObserver::SendReceiveContext::ForkDomain
1829 context == TraversalObserver::SendReceiveContext::JoinDomain
1832 logDebug( "sendFace(...)", "send out " << data.toString() << " to stack " << toStack << " on tree " << _spacetreeId << " for marker " << marker.toString() );
1834 {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush(
1835 _spacetreeId, toStack
1841 TemplateSendFace_Epilogue =
"""
1842 logTraceOut( "sendFace(int,int,int)");
1848 TemplateSendCell_Prologue =
"""
1849void {{FULL_QUALIFIED_CLASSNAME}}::sendCell(int toStack, ::peano4::grid::TraversalObserver::SendReceiveContext context, const peano4::grid::GridTraversalEvent& event) {
1850 logTraceInWith3Arguments( "sendCell(int,int,int)", toStack, event.toString(), _spacetreeId );
1854 TemplateSendCell_SendCall =
"""
1856 peano4::datamanagement::CellMarker marker(event);
1857 const {{full_qualified_type}}& data = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop( {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->top();
1859 ::peano4::grid::storePersistently( {{full_qualified_type}}::loadStoreComputeFlag(
1861 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1867 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1870 context == TraversalObserver::SendReceiveContext::ForkDomain
1872 context == TraversalObserver::SendReceiveContext::JoinDomain
1875 logDebug( "sendCell(...)", "send out " << data.toString() << " to stack " << toStack << " on tree " << _spacetreeId );
1877 {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush(
1878 _spacetreeId, toStack
1884 TemplateSendCell_Epilogue =
"""
1885 logTraceOut( "sendCell(int,int,int)");
1891 TemplateReceiveAndMergeCell_Prologue =
"""
1892void {{FULL_QUALIFIED_CLASSNAME}}::receiveAndMergeCell(int fromStack, peano4::grid::TraversalObserver::SendReceiveContext context, const peano4::grid::GridTraversalEvent& event ) {
1893 logTraceInWith3Arguments( "receiveAndMergeCell(...)", fromStack, event.toString(), _spacetreeId );
1896 TemplateReceiveAndMergeCell_Epilogue =
"""
1897 logTraceOut( "receiveAndMergeCell(...)");
1903 TemplateReceiveAndMergeVertex_Prologue =
"""
1904void {{FULL_QUALIFIED_CLASSNAME}}::receiveAndMergeVertex(int position, int fromStack, peano4::grid::TraversalObserver::SendReceiveContext context, const peano4::grid::GridTraversalEvent& event) {
1905 logTraceInWith4Arguments( "receiveAndMergeVertex(...)", position, fromStack, event.toString(), _spacetreeId );
1908 TemplateReceiveAndMergeVertex_Epilogue =
"""
1909 logTraceOut( "receiveAndMergeVertex(...)");
1915 TemplateReceiveAndMergeFace_Epilogue =
"""
1916 logTraceOut( "receiveAndMergeFace(...)");
1922 TemplateReceiveAndMergeFace_Prologue =
"""
1923void {{FULL_QUALIFIED_CLASSNAME}}::receiveAndMergeFace(int position, int fromStack, peano4::grid::TraversalObserver::SendReceiveContext context, const peano4::grid::GridTraversalEvent& event) {
1924 logTraceInWith4Arguments( "receiveAndMergeFace(...)", position, fromStack, event.toString(), _spacetreeId );
1927 TemplateReceiveAndMergeVertex_ReceiveAndMergeCalls =
"""
1929 peano4::datamanagement::VertexMarker marker(event,position);
1930 {{full_qualified_type}}& data = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush(
1931 {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack)
1932 )->top(TwoPowerD-1-position);
1935 ::peano4::grid::loadPersistently( {{full_qualified_type}}::loadStoreComputeFlag(
1937 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1940 data.receiveAndMerge(
1942 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1946 not {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop(_spacetreeId, fromStack)->empty(),
1947 _spacetreeId, fromStack, event.toString(), position, marker.toString()
1950 auto incomingData = std::move( {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop(
1951 _spacetreeId, fromStack
1954 logDebug( "receiveAndMergeVertex(...)", "merge " << incomingData.toString() << " into " << data.toString() );
1956 if (context==::peano4::grid::TraversalObserver::SendReceiveContext::PeriodicBoundaryDataSwap) {
1957 // @todo Different to faces. As we can have diagonal exchange, too,
1958 // we only know that it has to be unequal
1960 data.getDebugX()!=incomingData.getDebugX(),
1961 data.getDebugX(), incomingData.getDebugX(),
1962 data.getDebugH(), incomingData.getDebugH(),
1963 fromStack, event.toString(), marker.toString(), _spacetreeId );
1964 assertionVectorNumericalEquals6(
1965 data.getDebugH(), incomingData.getDebugH(),
1966 data.getDebugX(), incomingData.getDebugX(), fromStack, event.toString(), marker.toString(), _spacetreeId );
1969 assertionVectorNumericalEquals6(
1970 data.getDebugX(), incomingData.getDebugX(),
1971 data.getDebugH(), incomingData.getDebugH(), fromStack, event.toString(), marker.toString(), _spacetreeId );
1972 assertionVectorNumericalEquals6(
1973 data.getDebugH(), incomingData.getDebugH(),
1974 data.getDebugX(), incomingData.getDebugX(), fromStack, event.toString(), marker.toString(), _spacetreeId );
1977 data.merge(context, incomingData, marker, _spacetreeId);
1982 TemplateReceiveAndMergeFace_ReceiveAndMergeCalls =
"""
1984 peano4::datamanagement::FaceMarker marker(event,position);
1985 {{full_qualified_type}}& data = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush(
1986 {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack)
1987 )->top(TwoTimesD-1-position);
1990 ::peano4::grid::loadPersistently( {{full_qualified_type}}::loadStoreComputeFlag(
1992 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
1995 data.receiveAndMerge(
1997 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
2000 auto incomingData = std::move( {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop(
2001 _spacetreeId, fromStack
2004 logDebug( "receiveAndMergeFace(...)", "merge " << incomingData.toString() << " into " << data.toString() << " within marker " << marker.toString() );
2006 if (context==::peano4::grid::TraversalObserver::SendReceiveContext::PeriodicBoundaryDataSwap) {
2008 tarch::la::countEqualEntries(data.getDebugX(), incomingData.getDebugX())==Dimensions-1,
2009 data.getDebugX(), incomingData.getDebugX(),
2010 data.getDebugH(), incomingData.getDebugH(),
2011 fromStack, event.toString(), marker.toString(), _spacetreeId );
2012 assertionVectorNumericalEquals6(
2013 data.getDebugH(), incomingData.getDebugH(),
2014 data.getDebugX(), incomingData.getDebugX(), fromStack, event.toString(), marker.toString(), _spacetreeId );
2017 assertionVectorNumericalEquals6(
2018 data.getDebugX(), incomingData.getDebugX(),
2019 data.getDebugH(), incomingData.getDebugH(), fromStack, event.toString(), marker.toString(), _spacetreeId );
2020 assertionVectorNumericalEquals6(
2021 data.getDebugH(), incomingData.getDebugH(),
2022 data.getDebugX(), incomingData.getDebugX(), fromStack, event.toString(), marker.toString(), _spacetreeId );
2025 data.merge(context,incomingData, marker, _spacetreeId);
2030 TemplateReceiveAndMergeCell_ReceiveAndMergeCalls =
"""
2032 peano4::datamanagement::CellMarker marker(event);
2034 {{full_qualified_type}}& data = {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPush(
2035 {{subnamespace}}repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack)
2039 ::peano4::grid::loadPersistently( {{full_qualified_type}}::loadStoreComputeFlag(
2041 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
2044 data.receiveAndMerge(
2046 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, {{arg[0]}} {% endfor %}
2049 auto incomingData = std::move( {{subnamespace}}repositories::DataRepository::_{{logical_type_name}}Stack.getForPop(
2050 _spacetreeId, fromStack
2053 logDebug( "receiveAndMergeCell(...)", "merge " << incomingData.toString() << " into " << data.toString() );
2055 if (context==::peano4::grid::TraversalObserver::SendReceiveContext::PeriodicBoundaryDataSwap) {
2057 tarch::la::countEqualEntries(data.getDebugX(), incomingData.getDebugX())==Dimensions-1,
2058 data.getDebugX(), incomingData.getDebugX(),
2059 data.getDebugH(), incomingData.getDebugH(),
2060 fromStack, event.toString(), marker.toString(), _spacetreeId );
2061 assertionVectorNumericalEquals6(
2062 data.getDebugH(), incomingData.getDebugH(),
2063 data.getDebugX(), incomingData.getDebugX(), fromStack, event.toString(), marker.toString(), _spacetreeId );
2066 assertionVectorNumericalEquals6(
2067 data.getDebugX(), incomingData.getDebugX(),
2068 data.getDebugH(), incomingData.getDebugH(), fromStack, event.toString(), marker.toString(), _spacetreeId );
2069 assertionVectorNumericalEquals6(
2070 data.getDebugH(), incomingData.getDebugH(),
2071 data.getDebugX(), incomingData.getDebugX(), fromStack, event.toString(), marker.toString(), _spacetreeId );
2074 data.merge(context,incomingData, marker, _spacetreeId);
2079 TemplateExchangeRoutines_deleteAllStacks_Prologue =
"""
2080void {{FULL_QUALIFIED_CLASSNAME}}::deleteAllStacks() {
2081 logTraceInWith1Argument( "deleteAllStacks()", _spacetreeId );
2084 TemplateExchangeRoutines_deleteAllStacks_Exchange =
"""
2085 peano4::parallel::SpacetreeSet::deleteAllStacks(
2091 TemplateExchangeRoutines_deleteAllStacks_Epilogue =
"""
2092 logTraceOut( "deleteAllStacks()");
2101 generic_dict_for_prologue_and_epilogue = {
2102 "FULL_QUALIFIED_CLASSNAME": self.
d[
"FULL_QUALIFIED_CLASSNAME"]
2105 s += jinja2.Template(
2107 ).render(**generic_dict_for_prologue_and_epilogue)
2108 for cell
in self.
cells:
2109 s += jinja2.Template(
2113 "DATASET": cell.subnamespace +
"repositories::DataRepository::_"
2114 + cell.get_logical_type_name()
2118 for face
in self.
faces:
2119 s += jinja2.Template(
2123 "DATASET": face.subnamespace +
"repositories::DataRepository::_"
2124 + face.get_logical_type_name()
2129 s += jinja2.Template(
2133 "DATASET": vertex.subnamespace +
"repositories::DataRepository::_"
2134 + vertex.get_logical_type_name()
2138 s += jinja2.Template(
2142 s += jinja2.Template(
2144 ).render(**generic_dict_for_prologue_and_epilogue)
2145 for cell
in self.
cells:
2146 s += jinja2.Template(
2150 "DATASET": cell.subnamespace +
"repositories::DataRepository::_"
2151 + cell.get_logical_type_name()
2155 for face
in self.
faces:
2156 s += jinja2.Template(
2160 "DATASET": face.subnamespace +
"repositories::DataRepository::_"
2161 + face.get_logical_type_name()
2166 s += jinja2.Template(
2170 "DATASET": vertex.subnamespace +
"repositories::DataRepository::_"
2171 + vertex.get_logical_type_name()
2175 s += jinja2.Template(
2179 s += jinja2.Template(
2181 ).render(**generic_dict_for_prologue_and_epilogue)
2182 for cell
in self.
cells:
2183 s += jinja2.Template(
2187 "DATASET": cell.subnamespace +
"repositories::DataRepository::_"
2188 + cell.get_logical_type_name()
2192 for face
in self.
faces:
2193 s += jinja2.Template(
2197 "DATASET": face.subnamespace +
"repositories::DataRepository::_"
2198 + face.get_logical_type_name()
2203 s += jinja2.Template(
2207 "DATASET": vertex.subnamespace +
"repositories::DataRepository::_"
2208 + vertex.get_logical_type_name()
2212 s += jinja2.Template(
2216 s += jinja2.Template(
2218 ).render(**generic_dict_for_prologue_and_epilogue)
2219 for cell
in self.
cells:
2220 s += jinja2.Template(
2224 "DATASET": cell.subnamespace +
"repositories::DataRepository::_"
2225 + cell.get_logical_type_name()
2229 for face
in self.
faces:
2230 s += jinja2.Template(
2234 "DATASET": face.subnamespace +
"repositories::DataRepository::_"
2235 + face.get_logical_type_name()
2240 s += jinja2.Template(
2244 "DATASET": vertex.subnamespace +
"repositories::DataRepository::_"
2245 + vertex.get_logical_type_name()
2249 s += jinja2.Template(
2253 s += jinja2.Template(
2255 ).render(**generic_dict_for_prologue_and_epilogue)
2256 for cell
in self.
cells:
2257 s += jinja2.Template(
2261 "DATASET": cell.subnamespace +
"repositories::DataRepository::_"
2262 + cell.get_logical_type_name()
2266 for face
in self.
faces:
2267 s += jinja2.Template(
2271 "DATASET": face.subnamespace +
"repositories::DataRepository::_"
2272 + face.get_logical_type_name()
2277 s += jinja2.Template(
2281 "DATASET": vertex.subnamespace +
"repositories::DataRepository::_"
2282 + vertex.get_logical_type_name()
2286 s += jinja2.Template(
2290 s += jinja2.Template(
2292 ).render(**generic_dict_for_prologue_and_epilogue)
2293 for cell
in self.
cells:
2294 s += jinja2.Template(
2298 "DATASET": cell.subnamespace +
"repositories::DataRepository::_"
2299 + cell.get_logical_type_name()
2303 for face
in self.
faces:
2304 s += jinja2.Template(
2308 "DATASET": face.subnamespace +
"repositories::DataRepository::_"
2309 + face.get_logical_type_name()
2314 s += jinja2.Template(
2318 "DATASET": vertex.subnamespace +
"repositories::DataRepository::_"
2319 + vertex.get_logical_type_name()
2323 s += jinja2.Template(
2328 **generic_dict_for_prologue_and_epilogue
2332 "name": vertex.name,
2333 "enumeration_type": vertex.get_enumeration_type(),
2334 "logical_type_name": vertex.get_logical_type_name(),
2335 "full_qualified_type": vertex.get_full_qualified_type(),
2336 "FULL_QUALIFIED_CLASSNAME": self.
d[
"FULL_QUALIFIED_CLASSNAME"],
2337 "ADDITIONAL_LOAD_STORE_ARGUMENTS": vertex.additional_load_and_store_arguments,
2338 "subnamespace": vertex.subnamespace,
2342 **generic_dict_for_prologue_and_epilogue
2346 **generic_dict_for_prologue_and_epilogue
2348 for face
in self.
faces:
2351 "enumeration_type": face.get_enumeration_type(),
2352 "logical_type_name": face.get_logical_type_name(),
2353 "full_qualified_type": face.get_full_qualified_type(),
2354 "FULL_QUALIFIED_CLASSNAME": self.
d[
"FULL_QUALIFIED_CLASSNAME"],
2355 "ADDITIONAL_LOAD_STORE_ARGUMENTS": face.additional_load_and_store_arguments,
2356 "subnamespace": face.subnamespace,
2360 **generic_dict_for_prologue_and_epilogue
2364 **generic_dict_for_prologue_and_epilogue
2366 for cell
in self.
cells:
2369 "logical_type_name": cell.get_logical_type_name(),
2370 "full_qualified_type": cell.get_full_qualified_type(),
2371 "FULL_QUALIFIED_CLASSNAME": self.
d[
"FULL_QUALIFIED_CLASSNAME"],
2372 "ADDITIONAL_LOAD_STORE_ARGUMENTS": cell.additional_load_and_store_arguments,
2373 "subnamespace": cell.subnamespace,
2377 **generic_dict_for_prologue_and_epilogue
2381 **generic_dict_for_prologue_and_epilogue
2383 for cell
in self.
cells:
2386 "logical_type_name": cell.get_logical_type_name(),
2387 "full_qualified_type": cell.get_full_qualified_type(),
2388 "FULL_QUALIFIED_CLASSNAME": self.
d[
"FULL_QUALIFIED_CLASSNAME"],
2389 "ADDITIONAL_LOAD_STORE_ARGUMENTS": cell.additional_load_and_store_arguments,
2390 "subnamespace": cell.subnamespace,
2392 s += jinja2.Template(
2396 **generic_dict_for_prologue_and_epilogue
2400 **generic_dict_for_prologue_and_epilogue
2402 for face
in self.
faces:
2405 "enumeration_type": face.get_enumeration_type(),
2406 "logical_type_name": face.get_logical_type_name(),
2407 "full_qualified_type": face.get_full_qualified_type(),
2408 "FULL_QUALIFIED_CLASSNAME": self.
d[
"FULL_QUALIFIED_CLASSNAME"],
2409 "ADDITIONAL_LOAD_STORE_ARGUMENTS": face.additional_load_and_store_arguments,
2410 "subnamespace": face.subnamespace,
2412 s += jinja2.Template(
2416 **generic_dict_for_prologue_and_epilogue
2420 **generic_dict_for_prologue_and_epilogue
2424 "name": vertex.name,
2425 "enumeration_type": vertex.get_enumeration_type(),
2426 "logical_type_name": vertex.get_logical_type_name(),
2427 "full_qualified_type": vertex.get_full_qualified_type(),
2428 "FULL_QUALIFIED_CLASSNAME": self.
d[
"FULL_QUALIFIED_CLASSNAME"],
2429 "ADDITIONAL_LOAD_STORE_ARGUMENTS": vertex.additional_load_and_store_arguments,
2430 "subnamespace": vertex.subnamespace,
2432 s += jinja2.Template(
2436 **generic_dict_for_prologue_and_epilogue
2439 s += jinja2.Template(
2441 ).render(**generic_dict_for_prologue_and_epilogue)
2442 for cell
in self.
cells:
2443 s += jinja2.Template(
2447 "DATASET": cell.subnamespace +
"repositories::DataRepository::_"
2448 + cell.get_logical_type_name()
2452 for face
in self.
faces:
2453 s += jinja2.Template(
2457 "DATASET": face.subnamespace +
"repositories::DataRepository::_"
2458 + face.get_logical_type_name()
2463 s += jinja2.Template(
2467 "DATASET": vertex.subnamespace +
"repositories::DataRepository::_"
2468 + vertex.get_logical_type_name()
2472 s += jinja2.Template(
2474 ).render(**generic_dict_for_prologue_and_epilogue)
2476 output_file.write(s)
2478 TemplateImplementationFilePrologue =
"""
2479#include "{{CLASSNAME}}.h"
2480{{DATAREPOSITORY_INCLUDES}}
2482#include "peano4/grid/PeanoCurve.h"
2484#include "peano4/datamanagement/VertexEnumerator.h"
2485#include "peano4/datamanagement/VertexMarker.h"
2486#include "peano4/datamanagement/FaceEnumerator.h"
2487#include "peano4/datamanagement/FaceMarker.h"
2488#include "peano4/datamanagement/CellMarker.h"
2490#include "peano4/parallel/SpacetreeSet.h"
2493tarch::logging::Log {{FULL_QUALIFIED_CLASSNAME}}::_log( "{{FULL_QUALIFIED_CLASSNAME}}" );
2502 "{} written by {}".format(
2503 full_qualified_filename,
2508 output_file = open(full_qualified_filename,
"w")
2535 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)