Peano
Loading...
Searching...
No Matches
peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray Class Reference

Specialisation of array using Peano's tarch. More...

Inheritance diagram for peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray:
Collaboration diagram for peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray:

Public Member Functions

 __init__ (self, name, cardinality, valid_mantissa_bits=None, ifdefs=[])
 See superclass' constructor.
 get_methods (self, _full_qualified_class_name, for_declaration=True)
 Return sequence of methods that are defined for this attribute.
 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.
 get_first_plain_C_attribute (self)
 For MPI for example, I need to know the first attribute.
 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_native_MPI_type (self)
 Return native (built-in) MPI datatype.
 get_to_string (self)
 Return string representation of attribute.
Public Member Functions inherited from dastgen2.attributes.DoubleArray.DoubleArray
 __init__ (self, name, cardinality, valid_mantissa_bits=None, ifdefs=[], qualifier=Attribute.Qualifier.NONE, initval=None)
 valid_mantissa_bits (self)
 valid_mantissa_bits (self, value)
 Set mantissa used.
Public Member Functions inherited from dastgen2.attributes.Double.Double
 __init__ (self, name, valid_mantissa_bits=None, ifdefs=[], qualifier=Attribute.Qualifier.NONE, initval=None)
Public Member Functions inherited from dastgen2.attributes.Attribute.Attribute
 __init__ (self, name, ifdefs=[], qualifier=Qualifier.NONE, initval=None, expose_in_header_file=False)
 name: String This is a plain string which has to follow the C++ naming conventions, i.e.
 get_public_fields (self)
 Return string that is to be embedded into the public part of the class definition.
 get_attribute_declaration_string (self)
 Construct the string used for variable declaration using the output of get_plain_C_attributes(self).
 get_accessor_name (self)
 Generate the accessor name used throughout dastgen2 to create variables, function names, etc.
 name (self)
 I expect that there's at least one setter/getter pair.
 get_includes (self)

Additional Inherited Members

Data Fields inherited from dastgen2.attributes.Attribute.Attribute
bool use_data_store = False
 ifdefs = ifdefs
 qualifier = qualifier
 expose_in_header_file = expose_in_header_file
Protected Member Functions inherited from dastgen2.attributes.Attribute.Attribute
 _is_static (self)
 _is_const_static (self)
 _is_const (self)
 _is_constexpr (self)
Protected Attributes inherited from dastgen2.attributes.DoubleArray.DoubleArray
 _cardinality = str(cardinality)
Protected Attributes inherited from dastgen2.attributes.Double.Double
 _valid_mantissa_bits = valid_mantissa_bits
Protected Attributes inherited from dastgen2.attributes.Attribute.Attribute
 _name = name
 _initval = initval

Detailed Description

Specialisation of array using Peano's tarch.

Specialisation of dastgen2.attributes.DoubleArray which relies on Peano's tarch. Therefore, things alike the vector initialisation in the constructor do work. We can also directly use Peano's linear algebra operators.

This routine should include Vector and SmartPointerVector. I'm however lazy here and assume that someone else will inject these includes, and indeed Peano uses this class always in combination with MPIAndStorageAspect which in turn includes the right headers.

Definition at line 7 of file Peano4DoubleArray.py.

Constructor & Destructor Documentation

◆ __init__()

peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray.__init__ ( self,
name,
cardinality,
valid_mantissa_bits = None,
ifdefs = [] )

See superclass' constructor.

Parameters
cardinalityString This is important: It is not (necessarily) an integer, but can be a string which is defined via a pragma or constexpr later.

Definition at line 24 of file Peano4DoubleArray.py.

References __init__().

Referenced by __init__().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ get_constructor_arguments()

peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray.get_constructor_arguments ( self)

Return list of tuple of arguments for the constructor.

The first tuple entry is the name, the second one the type. By default, I take them from the plain C attributes, but you can alter this behaviour.

Reimplemented from dastgen2.attributes.Attribute.Attribute.

Definition at line 94 of file Peano4DoubleArray.py.

References dastgen2.attributes.BooleanArray.BooleanArray._cardinality, dastgen2.attributes.DoubleArray.DoubleArray._cardinality, and dastgen2.attributes.Attribute.Attribute._name.

◆ get_first_plain_C_attribute()

peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray.get_first_plain_C_attribute ( self)

For MPI for example, I need to know the first attribute.

If you map your attribute onto multiple data types, it is one type that represents the whole thing.

Reimplemented from dastgen2.attributes.DoubleArray.DoubleArray.

Definition at line 91 of file Peano4DoubleArray.py.

References dastgen2.attributes.Attribute.Attribute._name.

◆ get_method_body()

peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray.get_method_body ( self,
signature )

I hand in the method signature (see get_methods()) and wanna get the whole implementation.

Reimplemented from dastgen2.attributes.DoubleArray.DoubleArray.

Definition at line 99 of file Peano4DoubleArray.py.

◆ get_methods()

peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray.get_methods ( self,
_full_qualified_class_name,
for_declaration = True )

Return sequence of methods that are defined for this attribute.

Each entry is a tuple. Its first entry is the signature of the function (not including the semicolon), the second entry is the return type.

for_declaration: Boolean if True, assume we want method names for function declaration, not definition. Some generators might - for example - add additional annotations for the declaration such as Clang attributes. The most frequently used use case for this flag is the static annotation. To make a function a class function, you have to declare it as static. But the definition does not allow you to repeat that static keyword again.

Reimplemented from dastgen2.attributes.DoubleArray.DoubleArray.

Definition at line 43 of file Peano4DoubleArray.py.

References dastgen2.attributes.BooleanArray.BooleanArray._cardinality, dastgen2.attributes.DoubleArray.DoubleArray._cardinality, and dastgen2.attributes.Attribute.Attribute._name.

◆ get_native_MPI_type()

peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray.get_native_MPI_type ( self)

Return native (built-in) MPI datatype.

Return None if there's no direct mapping. The actual result is not a string only, but a list of tuples from native type to cardinality.

Reimplemented from dastgen2.attributes.DoubleArray.DoubleArray.

Definition at line 164 of file Peano4DoubleArray.py.

References dastgen2.attributes.BooleanArray.BooleanArray._cardinality, and dastgen2.attributes.DoubleArray.DoubleArray._cardinality.

◆ get_plain_C_attributes()

peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray.get_plain_C_attributes ( self,
for_constructor = False )

Return list of n-tuples.

The tuple can either host two, three or four entries. The list itself may contain arbitrary many tuples, as one attribute logically can map onto multiple technical attributes. For example, when declaring an array, also declare an integer variable containing its length.

for_constructor: bool whether the return value of this function is intended for use in the constructor method of the DataModel. If true, will omit (optionally provided) initialization values in the attribute string.

Two entries

The first triple entry always is the name, the second one the type. Type has to be plain C.

Three entries

The first triple entry always is the name, the second one the type. Type has to be plain C. The third entry is a C++ attribute, i.e. a string embedded into [[...]].

Four entries

The first triple entry always is the name, the second one the type. Type has to be plain C. The third entry is a C++ attribute, i.e. a string embedded into [[...]]. The fourth attribute is a list of ifdef symbols that have to be defined to use this attribute. The list of symbols is concatenated with an and. You can return an empty list. All symbol definitions can also be expressions such sa DEBUG>0 or defined(DEBUG).

Please note that these latter ifdefs are something completely different than the base class ifdefs. The base class ifdefs are to be used if you want to switch attributes on and off. The attributes here are used to switch between realisation variants.

Arrays

Arrays can be modelled by adding a cardinality ("[15]" for example) to the first triple entry, i.e. the name.

Reimplemented from dastgen2.attributes.DoubleArray.DoubleArray.

Definition at line 65 of file Peano4DoubleArray.py.

References dastgen2.attributes.BooleanArray.BooleanArray._cardinality, dastgen2.attributes.DoubleArray.DoubleArray._cardinality, dastgen2.attributes.Attribute.Attribute._name, and dastgen2.attributes.Double.Double._valid_mantissa_bits.

◆ get_to_string()

peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray.get_to_string ( self)

◆ use_default_copy_constructor()

peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray.use_default_copy_constructor ( self)

Cannot use the default copy constructor, as it is an array, i.e.

we need some manual deep copying.

Reimplemented from dastgen2.attributes.DoubleArray.DoubleArray.

Definition at line 62 of file Peano4DoubleArray.py.


The documentation for this class was generated from the following file: