![]() |
Peano
|
Wrapper around user-defined attribute. More...
Public Member Functions | |
__init__ (self, name, type, include, ifdefs=[], qualifier=Attribute.Qualifier.NONE, initval=None, getter_returns_reference=True, user_type_has_toString_method=True) | |
Create attribute. | |
get_methods (self, _full_qualified_class_name, for_declaration=True) | |
Return sequence of methods that are defined for this attribute. | |
get_plain_C_attributes (self, for_constructor=False) | |
Return list of n-tuples. | |
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) | |
I map the type onto a byte field,but it is not clear if this actually works. | |
get_to_string (self) | |
Return string representation of attribute. | |
get_includes (self) | |
![]() | |
get_public_fields (self) | |
Return string that is to be embedded into the public part of the class definition. | |
use_default_copy_constructor (self) | |
If this routine returns False, the generator will create a copy constructor copying each attribute over via a setter/getter combination. | |
get_constructor_arguments (self) | |
Return list of tuple of arguments for the constructor. | |
get_first_plain_C_attribute (self) | |
For MPI for example, I need to know the first attribute. | |
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. | |
Protected Attributes | |
_type | |
_include | |
_getter_returns_reference | |
_user_type_has_toString_method | |
![]() | |
_name | |
_initval | |
Additional Inherited Members | |
![]() | |
use_data_store | |
ifdefs | |
qualifier | |
expose_in_header_file | |
![]() | |
_is_static (self) | |
_is_const_static (self) | |
_is_const (self) | |
_is_constexpr (self) | |
Wrapper around user-defined attribute.
Wrapper around user-defined object, i.e. an instance of a proper class that is not built into C++. At the moment, we support this only for static attributes. On the one hand, having real object attributes which stem from user code is tricky (are there appropriate to string methods, appropriate constructors) for a "normal", serial code. It becomes close to impossible to map complex nested classes onto MPI. Therefore, this constraint to class attributes.
Definition at line 6 of file UserDefinedType.py.
dastgen2.attributes.UserDefinedType.UserDefinedType.__init__ | ( | self, | |
name, | |||
type, | |||
include, | |||
ifdefs = [], | |||
qualifier = Attribute.Qualifier.NONE, | |||
initval = None, | |||
getter_returns_reference = True, | |||
user_type_has_toString_method = True ) |
Create attribute.
name | Name of the attribute |
type | Fully qualified type of the attribute as string separated with two colons (::) |
include | String which holds the include of the type |
For all other attributes see superclass' constructor.
Reimplemented from dastgen2.attributes.Attribute.Attribute.
Definition at line 21 of file UserDefinedType.py.
dastgen2.attributes.UserDefinedType.UserDefinedType.get_includes | ( | self | ) |
Reimplemented from dastgen2.attributes.Attribute.Attribute.
Definition at line 187 of file UserDefinedType.py.
References dastgen2.attributes.UserDefinedType.UserDefinedType._include.
dastgen2.attributes.UserDefinedType.UserDefinedType.get_method_body | ( | self, | |
signature ) |
I hand in the method signature (see get_methods()) and wanna get the whole implementation.
Reimplemented from dastgen2.attributes.Attribute.Attribute.
Definition at line 148 of file UserDefinedType.py.
References SBH.Limiter._name, dastgen2.attributes.Attribute.Attribute._name, dastgen2.attributes.BooleanArray.BooleanArray._name, dastgen2.attributes.Enumeration.Enumeration._name, exahype2.solvers.aderdg.ADERDG.ADERDG._name, exahype2.solvers.elliptic.AMRMarker.AMRMarker._name, exahype2.solvers.elliptic.ConstrainedPoissonEquationForMarkerOnCells.ConstrainedPoissonEquationForMarkerOnCells._name, exahype2.solvers.fv.EnclaveTasking.EnclaveTasking._name, exahype2.solvers.fv.FV.FV._name, exahype2.solvers.limiting.PosterioriLimiting.PosterioriLimiting._name, exahype2.solvers.limiting.StaticLimiting.StaticLimiting._name, exahype2.solvers.rkdg.RungeKuttaDG.RungeKuttaDG._name, exahype2.solvers.rkdg.SeparateSweeps.SeparateSweeps._name, exahype2.solvers.rkdg.SeparateSweepsWithEnclaveTasking.SeparateSweepsWithEnclaveTasking._name, exahype2.solvers.rkfd.CellCenteredFiniteDifferences.CellCenteredFiniteDifferences._name, exahype2.solvers.rkfd.OneSweepPerRungeKuttaStep.OneSweepPerRungeKuttaStep._name, exahype2.solvers.rkfd.SeparateSweeps.SeparateSweeps._name, exahype2.solvers.rkfd.SeparateSweepsWithEnclaveTasking.SeparateSweepsWithEnclaveTasking._name, peano4.dastgen2.Peano4DoubleArray.Peano4DoubleArray._name, peano4.dastgen2.Peano4IntegerArray.Peano4IntegerArray._name, solvers.api.Solver.Solver._name, mghype::matrixfree::solvers::Solver._name, api.solvers.Solver.Solver._name, tarch::services::ServiceRepository::ServiceEntry._name, and dastgen2.attributes.Attribute.Attribute.use_data_store.
dastgen2.attributes.UserDefinedType.UserDefinedType.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.Attribute.Attribute.
Definition at line 67 of file UserDefinedType.py.
References dastgen2.attributes.UserDefinedType.UserDefinedType._getter_returns_reference, dastgen2.attributes.Attribute.Attribute._is_const(), dastgen2.attributes.Attribute.Attribute._is_const_static(), dastgen2.attributes.Attribute.Attribute._is_constexpr(), dastgen2.attributes.Boolean.Boolean._is_constexpr, dastgen2.attributes.Double.Double._is_constexpr, dastgen2.attributes.Integer.Integer._is_constexpr, dastgen2.attributes.String.String._is_constexpr, dastgen2.attributes.Attribute.Attribute._is_static(), dastgen2.attributes.UserDefinedType.UserDefinedType._type, and dastgen2.attributes.Attribute.Attribute.get_accessor_name().
dastgen2.attributes.UserDefinedType.UserDefinedType.get_native_MPI_type | ( | self | ) |
I map the type onto a byte field,but it is not clear if this actually works.
At the moment, we do not use the MPI data implicitly, as we support user-defined attributes if and only if they are static. That is, we never exchange them as part of an object. That is, at the moment this routine is kind of deprecated.
Reimplemented from dastgen2.attributes.Attribute.Attribute.
Definition at line 161 of file UserDefinedType.py.
References dastgen2.attributes.UserDefinedType.UserDefinedType._type.
dastgen2.attributes.UserDefinedType.UserDefinedType.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.
The first triple entry always is the name, the second one the type. Type has to be plain C.
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 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 can be modelled by adding a cardinality ("[15]" for example) to the first triple entry, i.e. the name.
Reimplemented from dastgen2.attributes.Attribute.Attribute.
Definition at line 116 of file UserDefinedType.py.
References dastgen2.attributes.Attribute.Attribute._initval, dastgen2.attributes.Attribute.Attribute._is_const(), dastgen2.attributes.Attribute.Attribute._is_const_static(), dastgen2.attributes.Attribute.Attribute._is_constexpr(), dastgen2.attributes.Boolean.Boolean._is_constexpr, dastgen2.attributes.Double.Double._is_constexpr, dastgen2.attributes.Integer.Integer._is_constexpr, dastgen2.attributes.String.String._is_constexpr, dastgen2.attributes.Attribute.Attribute._is_static(), SBH.Limiter._name, dastgen2.attributes.Attribute.Attribute._name, dastgen2.attributes.BooleanArray.BooleanArray._name, dastgen2.attributes.Enumeration.Enumeration._name, exahype2.solvers.aderdg.ADERDG.ADERDG._name, exahype2.solvers.elliptic.AMRMarker.AMRMarker._name, exahype2.solvers.elliptic.ConstrainedPoissonEquationForMarkerOnCells.ConstrainedPoissonEquationForMarkerOnCells._name, exahype2.solvers.fv.EnclaveTasking.EnclaveTasking._name, exahype2.solvers.fv.FV.FV._name, exahype2.solvers.limiting.PosterioriLimiting.PosterioriLimiting._name, exahype2.solvers.limiting.StaticLimiting.StaticLimiting._name, exahype2.solvers.rkdg.RungeKuttaDG.RungeKuttaDG._name, exahype2.solvers.rkdg.SeparateSweeps.SeparateSweeps._name, exahype2.solvers.rkdg.SeparateSweepsWithEnclaveTasking.SeparateSweepsWithEnclaveTasking._name, exahype2.solvers.rkfd.CellCenteredFiniteDifferences.CellCenteredFiniteDifferences._name, exahype2.solvers.rkfd.OneSweepPerRungeKuttaStep.OneSweepPerRungeKuttaStep._name, exahype2.solvers.rkfd.SeparateSweeps.SeparateSweeps._name, exahype2.solvers.rkfd.SeparateSweepsWithEnclaveTasking.SeparateSweepsWithEnclaveTasking._name, peano4.dastgen2.Peano4DoubleArray.Peano4DoubleArray._name, peano4.dastgen2.Peano4IntegerArray.Peano4IntegerArray._name, solvers.api.Solver.Solver._name, mghype::matrixfree::solvers::Solver._name, api.solvers.Solver.Solver._name, tarch::services::ServiceRepository::ServiceEntry._name, and dastgen2.attributes.UserDefinedType.UserDefinedType._type.
Referenced by dastgen2.attributes.Attribute.Attribute.get_attribute_declaration_string(), dastgen2.attributes.Attribute.Attribute.get_constructor_arguments(), and dastgen2.attributes.Attribute.Attribute.get_first_plain_C_attribute().
dastgen2.attributes.UserDefinedType.UserDefinedType.get_to_string | ( | self | ) |
Return string representation of attribute.
Reimplemented from dastgen2.attributes.Attribute.Attribute.
Definition at line 174 of file UserDefinedType.py.
References SBH.Limiter._name, dastgen2.attributes.Attribute.Attribute._name, dastgen2.attributes.BooleanArray.BooleanArray._name, dastgen2.attributes.Enumeration.Enumeration._name, exahype2.solvers.aderdg.ADERDG.ADERDG._name, exahype2.solvers.elliptic.AMRMarker.AMRMarker._name, exahype2.solvers.elliptic.ConstrainedPoissonEquationForMarkerOnCells.ConstrainedPoissonEquationForMarkerOnCells._name, exahype2.solvers.fv.EnclaveTasking.EnclaveTasking._name, exahype2.solvers.fv.FV.FV._name, exahype2.solvers.limiting.PosterioriLimiting.PosterioriLimiting._name, exahype2.solvers.limiting.StaticLimiting.StaticLimiting._name, exahype2.solvers.rkdg.RungeKuttaDG.RungeKuttaDG._name, exahype2.solvers.rkdg.SeparateSweeps.SeparateSweeps._name, exahype2.solvers.rkdg.SeparateSweepsWithEnclaveTasking.SeparateSweepsWithEnclaveTasking._name, exahype2.solvers.rkfd.CellCenteredFiniteDifferences.CellCenteredFiniteDifferences._name, exahype2.solvers.rkfd.OneSweepPerRungeKuttaStep.OneSweepPerRungeKuttaStep._name, exahype2.solvers.rkfd.SeparateSweeps.SeparateSweeps._name, exahype2.solvers.rkfd.SeparateSweepsWithEnclaveTasking.SeparateSweepsWithEnclaveTasking._name, peano4.dastgen2.Peano4DoubleArray.Peano4DoubleArray._name, peano4.dastgen2.Peano4IntegerArray.Peano4IntegerArray._name, solvers.api.Solver.Solver._name, mghype::matrixfree::solvers::Solver._name, api.solvers.Solver.Solver._name, tarch::services::ServiceRepository::ServiceEntry._name, dastgen2.attributes.UserDefinedType.UserDefinedType._user_type_has_toString_method, and dastgen2.attributes.Attribute.Attribute.use_data_store.
|
protected |
Definition at line 57 of file UserDefinedType.py.
Referenced by dastgen2.attributes.UserDefinedType.UserDefinedType.get_methods().
|
protected |
Definition at line 56 of file UserDefinedType.py.
Referenced by dastgen2.attributes.UserDefinedType.UserDefinedType.get_includes().
|
protected |
|
protected |
Definition at line 58 of file UserDefinedType.py.
Referenced by dastgen2.attributes.UserDefinedType.UserDefinedType.get_to_string().