6from .DoF
import DoFAssociation
10 if float_type==
"float":
12 self.
mpi =
"MPI_FLOAT"
14 elif float_type==
"double":
16 self.
mpi =
"MPI_DOUBLE"
18 elif float_type==
"long double":
19 self.
cpp =
"long double"
20 self.
mpi =
"MPI_LONG_DOUBLE"
22 elif float_type==
"_Float16":
26 elif float_type==
"std::float16_t":
27 self.
cpp =
"std::float16_t"
30 elif float_type==
"__bf16":
34 elif float_type==
"std::bfloat16_t":
35 self.
cpp =
"std::bfloat16_t"
39 raise Exception(
"Float type " + float_type +
" not recognized")
45 Very simple converter which maps the patch 1:1 onto a double array.
46 By default, I leave all the MPI merges empty though obviously the
47 merges often are plain copying over along faces (see the discussion
48 on Finite Volumes in the guidebook). If you need any proper MPI
49 handling, use merge_method_definition to inject it. Depending
50 on how you use your patch (as cell or face or vertex data structure)
51 the thing you pass has the respective semantics. The most popular
52 default merge implementation is the one you find in the blockstructured
59 includes Includes to be added to the generated file. This is something
60 totally different than get_header_file_include(). You will need to set
61 something here if your send/receive conditions, e.g., call other stuff.
68 self.
load_store_compute_flag =
"::peano4::grid::LoadStoreComputeFlag::LoadFromInputStream_ProvideToCalculations_StoreToOutputStream"
74 result =
"""Map to double array
78 - merge criterion: """
81 result +=
"""user-defined
90 return "peano4::stacks::STDVectorStack< " + self.
data.get_full_qualified_type() +
" >";
96 This is the include statement for the data container. It is not something
97 directly generated but how to use the generated code.
101#include "peano4/stacks/STDVectorStack.h"
102#include \"""" + self.
data.namespace[-1] +
"/" + self.
data.name +
""".h"
108 "CARDINALITY_2D": str(
int( self.
data.no_of_unknowns*self.
data.dim[0]*self.
data.dim[1] )),
109 "CARDINALITY_3D": str(
int( self.
data.no_of_unknowns*self.
data.dim[0]*self.
data.dim[1]*self.
data.dim[2] )),
110 "MERGE_METHOD_DECLARATIONS":
"",
111 "MERGE_METHOD_DEFINITIONS":
"",
115 "DATA_ASSOCIATION":
int(self.
data.association),
120 "MPI_ELEMENTS_PER_FLOAT": self.
float_type.number_of_mpi_types_per_element,
121 "ADDITIONAL_LOAD_STORE_ARGUMENTS": self.
data.additional_load_and_store_arguments
130 Pass in a version of output
132 output.makefile.add_cpp_file( self.
data.subdirectory + self.
data.namespace[-1] +
"/" + self.
data.name +
".cpp", generated=
True )
133 templatefile_prefix = os.path.realpath(__file__).replace(
".pyc",
"" ).replace(
".py",
"" )
135 templatefile_prefix+
".template.h",
136 templatefile_prefix+
".template.cpp",
139 self.
data.subdirectory + self.
data.namespace[-1],
142 output.add(generated_files)
number_of_mpi_types_per_element
__init__(self, float_type)
Very simple converter which maps the patch 1:1 onto a double array.
_get_dictionary_for_output(self)
get_header_file_include(self)
This is the include statement for the data container.
receive_and_merge_condition
construct_output(self, output)
__init__(self, patch, float_type="double")
includes Includes to be added to the generated file.
get_stack_container(self)