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.
69 self.
load_store_compute_flag =
"::peano4::grid::LoadStoreComputeFlag::LoadFromInputStream_ProvideToCalculations_StoreToOutputStream"
75 result =
"""Map to double array
79 - merge criterion: """
82 result +=
"""user-defined
91 return "peano4::stacks::STDVectorStack< " + self.
data.get_full_qualified_type() +
" >";
97 This is the include statement for the data container. It is not something
98 directly generated but how to use the generated code.
102#include "peano4/stacks/STDVectorStack.h"
103#include \"""" + self.
data.namespace[-1] +
"/" + self.
data.name +
""".h"
109 "CARDINALITY_2D": str( int( self.
data.no_of_unknowns*self.
data.dim[0]*self.
data.dim[1] )),
110 "CARDINALITY_3D": str( int( self.
data.no_of_unknowns*self.
data.dim[0]*self.
data.dim[1]*self.
data.dim[2] )),
111 "MERGE_METHOD_DECLARATIONS":
"",
112 "MERGE_METHOD_DEFINITIONS":
"",
116 "DATA_ASSOCIATION": int(self.
data.association),
121 "MPI_ELEMENTS_PER_FLOAT": self.
float_type.number_of_mpi_types_per_element,
122 "ADDITIONAL_LOAD_STORE_ARGUMENTS": self.
data.additional_load_and_store_arguments
131 Pass in a version of output
133 output.makefile.add_cpp_file( self.
data.subdirectory + self.
data.namespace[-1] +
"/" + self.
data.name +
".cpp", generated=
True )
134 templatefile_prefix = os.path.realpath(__file__).replace(
".pyc",
"" ).replace(
".py",
"" )
136 templatefile_prefix+
".template.h",
137 templatefile_prefix+
".template.cpp",
140 self.
data.subdirectory + self.
data.namespace[-1],
143 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)