10 Specialisation of array using Peano's tarch
12 Specialisation of dastgen2.attributes.DoubleArray which relies on
13 Peano's tarch. Therefore, things alike the vector initialisation
14 in the constructor do work. We can also directly use Peano's linear
17 This routine should include Vector and SmartPointerVector. I'm however
18 lazy here and assume that someone else will inject these includes, and
19 indeed Peano uses this class always in combination with MPIAndStorageAspect
20 which in turn includes the right headers.
27 valid_mantissa_bits=None,
31 See superclass' constructor.
33 @param cardinality: String
34 This is important: It is not (necessarily) an integer, but can be
35 a string which is defined via a pragma or constexpr later.
38 super(Peano4DoubleArray, self).
__init__(
39 name, cardinality, valid_mantissa_bits=valid_mantissa_bits, ifdefs=ifdefs
43 def get_methods(self, _full_qualified_class_name, for_declaration=True):
47 "get" + accessor_name +
"() const",
53 +
"(const tarch::la::Vector<"
58 (
"get" + accessor_name +
"(int index) const",
"double"),
59 (
"set" + accessor_name +
"(int index, double value)",
"void"),
71 "[[clang::truncate_mantissa("
74 [
"defined(" + LLVMSymbol +
")"],
80 [
"!defined(" + LLVMSymbol +
")"],
92 return [(
"_" + self.
_name_name +
".data()[0]",
"double")]
105 signature.startswith(
"get")
106 and "index" in signature
109 return " return " + name +
"(index);\n"
111 signature.startswith(
"set")
112 and "index" in signature
115 return name +
"(index) = value;\n"
117 return " return " + name +
";\n"
119 return name +
" = value;\n"
121 signature.startswith(
"get")
122 and "index" in signature
125 return " return " + name +
"[index];\n"
127 signature.startswith(
"set")
128 and "index" in signature
131 return name +
"[index] = value;\n"
135 tarch::la::Vector<"""
137 +
""",double> result;
170 Return string representation of attribute.
An array of doubles, i.e.
Specialisation of array using Peano's tarch.
get_constructor_arguments(self)
Return list of tuple of arguments for the constructor.
get_method_body(self, signature)
I hand in the method signature (see get_methods()) and wanna get the whole implementation.
get_to_string(self)
Return string representation of attribute.
get_methods(self, _full_qualified_class_name, for_declaration=True)
Return sequence of methods that are defined for this attribute.
get_first_plain_C_attribute(self)
For MPI for example, I need to know the first attribute.
get_native_MPI_type(self)
Return native (built-in) MPI datatype.
__init__(self, name, cardinality, valid_mantissa_bits=None, ifdefs=[])
See superclass' constructor.
use_default_copy_constructor(self)
Cannot use the default copy constructor, as it is an array, i.e.
get_plain_C_attributes(self, for_constructor=False)
Return list of n-tuples.