Peano
Loading...
Searching...
No Matches
dastgen2.attributes.Attribute.Attribute Class Reference

Represents one attribute. More...

Inheritance diagram for dastgen2.attributes.Attribute.Attribute:
Collaboration diagram for dastgen2.attributes.Attribute.Attribute:

Data Structures

class  Qualifier
 classifies attribute qualifiers. More...

Public Member Functions

 __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_methods (self, _full_qualified_class_name, for_declaration=True)
 Return sequence of methods that are defined for this attribute.
 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_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_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.
 get_method_body (self, signature)
 I hand in the method signature (see get_methods()) and wanna get the whole implementation.
 name (self)
 I expect that there's at least one setter/getter pair.
 get_native_MPI_type (self)
 Return native (built-in) MPI datatype.
 get_to_string (self)
 Return string representation of attribute.
 get_includes (self)

Data Fields

bool use_data_store = False
 ifdefs = ifdefs
 qualifier = qualifier
 expose_in_header_file = expose_in_header_file

Protected Member Functions

 _is_static (self)
 _is_const_static (self)
 _is_const (self)
 _is_constexpr (self)

Protected Attributes

 _name = name
 _initval = initval

Detailed Description

Represents one attribute.

This is the superclass of all attributes tied

Definition at line 8 of file Attribute.py.

Constructor & Destructor Documentation

◆ __init__()

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.

it is case-sensitive and may not contain any special characters besides the underscore. If also has to be unique within the enclosing data model. However, this uniqueness is a C++ constraint. A DaStGen model can hold the same attribute multiple times, as long as their ifdefs are different and hence mask them out, i.e. ensure that only version is "active" at any compile run.

ifdefs: [String] A set of strings which have to hold at compile time to determine if this attribute does exist or not.

qualifier: self.Qualifier An additional qualifier.

initval: str or None Initial value. The type depends on underlying type. But you can always pass in a string that evaluates to the correct type.

expose_in_header_file: Boolean Flag that determines if an attribute's setters and getters should have an implementation within the header or if the generated C++ code should strictly separate declaration and definition and stick the latter into a separate implementation and hence object file.

Definition at line 28 of file Attribute.py.

Member Function Documentation

◆ _is_const()

dastgen2.attributes.Attribute.Attribute._is_const ( self)
protected

Definition at line 90 of file Attribute.py.

References qualifier.

◆ _is_const_static()

dastgen2.attributes.Attribute.Attribute._is_const_static ( self)
protected

Definition at line 86 of file Attribute.py.

References qualifier.

◆ _is_constexpr()

dastgen2.attributes.Attribute.Attribute._is_constexpr ( self)
protected

Definition at line 94 of file Attribute.py.

References qualifier.

◆ _is_static()

dastgen2.attributes.Attribute.Attribute._is_static ( self)
protected

Definition at line 82 of file Attribute.py.

References qualifier.

◆ get_accessor_name()

◆ get_attribute_declaration_string()

dastgen2.attributes.Attribute.Attribute.get_attribute_declaration_string ( self)

Construct the string used for variable declaration using the output of get_plain_C_attributes(self).

This is a list of tuples, each tuple containing two, three, or four entries.

See get_plain_C_attributes(self) for more details.

Definition at line 211 of file Attribute.py.

References get_plain_C_attributes(), and ifdefs.

Here is the call graph for this function:

◆ get_constructor_arguments()

dastgen2.attributes.Attribute.Attribute.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 in dastgen2.attributes.BooleanArray.BooleanArray, peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray, peano4.api.dastgen2.Peano4IntegerArray.Peano4IntegerArray, and peano4.api.dastgen2.Peano4SmartPointerDoubleArray.Peano4SmartPointerDoubleArray.

Definition at line 137 of file Attribute.py.

References get_plain_C_attributes().

Here is the call graph for this function:

◆ get_first_plain_C_attribute()

dastgen2.attributes.Attribute.Attribute.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 in dastgen2.attributes.BooleanArray.BooleanArray, dastgen2.attributes.DoubleArray.DoubleArray, dastgen2.attributes.IntegerArray.IntegerArray, peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray, peano4.api.dastgen2.Peano4IntegerArray.Peano4IntegerArray, and peano4.api.dastgen2.Peano4SmartPointerDoubleArray.Peano4SmartPointerDoubleArray.

Definition at line 202 of file Attribute.py.

References get_plain_C_attributes().

Here is the call graph for this function:

◆ get_includes()

dastgen2.attributes.Attribute.Attribute.get_includes ( self)

Reimplemented in dastgen2.attributes.UserDefinedType.UserDefinedType.

Definition at line 309 of file Attribute.py.

◆ get_method_body()

◆ get_methods()

dastgen2.attributes.Attribute.Attribute.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 in dastgen2.attributes.Boolean.Boolean, dastgen2.attributes.BooleanArray.BooleanArray, dastgen2.attributes.Double.Double, dastgen2.attributes.DoubleArray.DoubleArray, dastgen2.attributes.DoublePointer.DoublePointer, dastgen2.attributes.Enumeration.Enumeration, dastgen2.attributes.Integer.Integer, dastgen2.attributes.IntegerArray.IntegerArray, dastgen2.attributes.String.String, dastgen2.attributes.UserDefinedType.UserDefinedType, peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray, peano4.api.dastgen2.Peano4IntegerArray.Peano4IntegerArray, and peano4.api.dastgen2.Peano4SmartPointerDoubleArray.Peano4SmartPointerDoubleArray.

Definition at line 108 of file Attribute.py.

◆ get_native_MPI_type()

◆ get_plain_C_attributes()

dastgen2.attributes.Attribute.Attribute.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 in dastgen2.attributes.Boolean.Boolean, dastgen2.attributes.BooleanArray.BooleanArray, dastgen2.attributes.Double.Double, dastgen2.attributes.DoubleArray.DoubleArray, dastgen2.attributes.DoublePointer.DoublePointer, dastgen2.attributes.Enumeration.Enumeration, dastgen2.attributes.Integer.Integer, dastgen2.attributes.IntegerArray.IntegerArray, dastgen2.attributes.String.String, dastgen2.attributes.UserDefinedType.UserDefinedType, peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray, peano4.api.dastgen2.Peano4IntegerArray.Peano4IntegerArray, and peano4.api.dastgen2.Peano4SmartPointerDoubleArray.Peano4SmartPointerDoubleArray.

Definition at line 149 of file Attribute.py.

Referenced by get_attribute_declaration_string(), get_constructor_arguments(), and get_first_plain_C_attribute().

Here is the caller graph for this function:

◆ get_public_fields()

dastgen2.attributes.Attribute.Attribute.get_public_fields ( self)

Return string that is to be embedded into the public part of the class definition.

Most attributes don't add anything here, but some (alike enumerations) need to.

Reimplemented in dastgen2.attributes.Enumeration.Enumeration.

Definition at line 97 of file Attribute.py.

◆ get_to_string()

◆ name()

dastgen2.attributes.Attribute.Attribute.name ( self)

◆ use_default_copy_constructor()

dastgen2.attributes.Attribute.Attribute.use_default_copy_constructor ( self)

Field Documentation

◆ _initval

◆ _name

dastgen2.attributes.Attribute.Attribute._name = name
protected

Definition at line 65 of file Attribute.py.

Referenced by api.Tree.Tree.__str__(), exahype2.api.Solver.Solver.__str__(), solvers.aderdg.ADERDG.ADERDG.__str__(), solvers.api.Solver.Solver.__str__(), solvers.elliptic.AMRMarker.AMRMarker.__str__(), solvers.elliptic.ConstrainedPoissonEquationForMarkerOnCells.ConstrainedPoissonEquationForMarkerOnCells.__str__(), solvers.fv.FV.FV.__str__(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG.__str__(), solvers.fv.EnclaveTasking.EnclaveTasking._enclave_task_name(), dastgen2.attributes.Enumeration.Enumeration._enum_name(), solvers.aderdg.ADERDG.ADERDG._generate_kernels(), solvers.aderdg.ADERDG.ADERDG._init_dictionary_with_default_parameters(), solvers.fv.FV.FV._init_dictionary_with_default_parameters(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG._init_dictionary_with_default_parameters(), solvers.aderdg.ADERDG.ADERDG._interpolate_face_data_default_guard(), solvers.aderdg.SingleSweep.SingleSweep._interpolate_face_data_default_guard(), solvers.aderdg.ADERDG.ADERDG._load_cell_data_default_guard(), solvers.fv.FV.FV._load_cell_data_default_guard(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG._load_cell_data_default_guard(), solvers.aderdg.ADERDG.ADERDG._load_face_data_default_guard(), solvers.fv.FV.FV._load_face_data_default_guard(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG._load_face_data_default_guard(), solvers.aderdg.ADERDG.ADERDG._provide_cell_data_to_compute_kernels_default_guard(), solvers.fv.FV.FV._provide_cell_data_to_compute_kernels_default_guard(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG._provide_cell_data_to_compute_kernels_default_guard(), solvers.aderdg.ADERDG.ADERDG._provide_face_data_to_compute_kernels_default_guard(), solvers.fv.FV.FV._provide_face_data_to_compute_kernels_default_guard(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG._provide_face_data_to_compute_kernels_default_guard(), solvers.aderdg.SingleSweep.SingleSweep._restrict_face_data_default_guard(), solvers.aderdg.ADERDG.ADERDG._store_boundary_data_default_guard(), solvers.aderdg.ADERDG.ADERDG._store_cell_data_default_guard(), solvers.fv.FV.FV._store_cell_data_default_guard(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG._store_cell_data_default_guard(), solvers.aderdg.ADERDG.ADERDG._store_face_data_default_guard(), solvers.fv.FV.FV._store_face_data_default_guard(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG._store_face_data_default_guard(), exahype2.api.Solver.Solver._unknown_identifier(), solvers.aderdg.ADERDG.ADERDG._unknown_identifier(), solvers.elliptic.AMRMarker.AMRMarker._unknown_identifier(), solvers.elliptic.ConstrainedPoissonEquationForMarkerOnCells.ConstrainedPoissonEquationForMarkerOnCells._unknown_identifier(), solvers.fv.FV.FV._unknown_identifier(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG._unknown_identifier(), solvers.fv.FV.FV.add_actions_to_checkpoint_solution(), solvers.fv.EnclaveTasking.EnclaveTasking.add_actions_to_create_grid(), solvers.fv.EnclaveTasking.EnclaveTasking.add_actions_to_init_grid(), solvers.aderdg.ADERDG.ADERDG.add_actions_to_plot_solution(), solvers.elliptic.ConstrainedPoissonEquationForMarkerOnCells.ConstrainedPoissonEquationForMarkerOnCells.add_actions_to_plot_solution(), solvers.fv.FV.FV.add_actions_to_plot_solution(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG.add_actions_to_plot_solution(), solvers.fv.EnclaveTasking.EnclaveTasking.add_entries_to_text_replacement_dictionary(), solvers.rkdg.SeparateSweepsWithEnclaveTasking.SeparateSweepsWithEnclaveTasking.add_entries_to_text_replacement_dictionary(), api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.add_implementation_files_to_project(), api.solvers.DiscontinuousGalerkinDiscretisation.DiscontinuousGalerkinDiscretisation.add_implementation_files_to_project(), solvers.aderdg.ADERDG.ADERDG.add_implementation_files_to_project(), solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.add_implementation_files_to_project(), solvers.api.CollocatedMG.CollocatedMG.add_implementation_files_to_project(), solvers.api.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.add_implementation_files_to_project(), solvers.elliptic.AMRMarker.AMRMarker.add_to_Peano4_datamodel(), solvers.elliptic.ConstrainedPoissonEquationForMarkerOnCells.ConstrainedPoissonEquationForMarkerOnCells.add_to_Peano4_datamodel(), api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.add_to_plot(), exahype2.api.AuxiliaryVariables.AuxiliaryVariables.argument_name(), solvers.aderdg.SingleSweep.SingleSweep.create_action_sets(), solvers.fv.rusanov.LocalTimeStepWithEnclaveTasking.LocalTimeStepWithEnclaveTasking.create_action_sets(), solvers.fv.rusanov.SubcyclingAdaptiveTimeStepWithEnclaveTasking.SubcyclingAdaptiveTimeStepWithEnclaveTasking.create_action_sets(), solvers.fv.rusanov.SubcyclingFixedTimeStep.SubcyclingFixedTimeStep.create_action_sets(), solvers.fv.rusanov.SubcyclingFixedTimeStepWithEnclaveTasking.SubcyclingFixedTimeStepWithEnclaveTasking.create_action_sets(), solvers.rkdg.SeparateSweeps.SeparateSweeps.create_action_sets(), solvers.fv.SingleSweep.SingleSweep.create_data_structures(), exahype2.api.AuxiliaryVariables.AuxiliaryVariables.delta_argument_name(), get_accessor_name(), dastgen2.attributes.BooleanArray.BooleanArray.get_constructor_arguments(), peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray.get_constructor_arguments(), peano4.api.dastgen2.Peano4IntegerArray.Peano4IntegerArray.get_constructor_arguments(), peano4.api.dastgen2.Peano4SmartPointerDoubleArray.Peano4SmartPointerDoubleArray.get_constructor_arguments(), dastgen2.attributes.BooleanArray.BooleanArray.get_first_plain_C_attribute(), dastgen2.attributes.DoubleArray.DoubleArray.get_first_plain_C_attribute(), dastgen2.attributes.IntegerArray.IntegerArray.get_first_plain_C_attribute(), peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray.get_first_plain_C_attribute(), peano4.api.dastgen2.Peano4IntegerArray.Peano4IntegerArray.get_first_plain_C_attribute(), peano4.api.dastgen2.Peano4SmartPointerDoubleArray.Peano4SmartPointerDoubleArray.get_first_plain_C_attribute(), dastgen2.attributes.String.String.get_method_body(), dastgen2.attributes.BooleanArray.BooleanArray.get_methods(), dastgen2.attributes.DoubleArray.DoubleArray.get_methods(), dastgen2.attributes.IntegerArray.IntegerArray.get_methods(), peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray.get_methods(), peano4.api.dastgen2.Peano4IntegerArray.Peano4IntegerArray.get_methods(), peano4.api.dastgen2.Peano4SmartPointerDoubleArray.Peano4SmartPointerDoubleArray.get_methods(), exahype2.api.Solver.Solver.get_name_of_global_instance(), solvers.aderdg.ADERDG.ADERDG.get_name_of_global_instance(), solvers.elliptic.AMRMarker.AMRMarker.get_name_of_global_instance(), solvers.elliptic.ConstrainedPoissonEquationForMarkerOnCells.ConstrainedPoissonEquationForMarkerOnCells.get_name_of_global_instance(), solvers.fv.FV.FV.get_name_of_global_instance(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG.get_name_of_global_instance(), exahype2.api.Solver.Solver.get_name_of_solver_class(), dastgen2.attributes.Boolean.Boolean.get_plain_C_attributes(), dastgen2.attributes.BooleanArray.BooleanArray.get_plain_C_attributes(), dastgen2.attributes.Double.Double.get_plain_C_attributes(), dastgen2.attributes.DoubleArray.DoubleArray.get_plain_C_attributes(), dastgen2.attributes.DoublePointer.DoublePointer.get_plain_C_attributes(), dastgen2.attributes.Integer.Integer.get_plain_C_attributes(), dastgen2.attributes.IntegerArray.IntegerArray.get_plain_C_attributes(), dastgen2.attributes.String.String.get_plain_C_attributes(), dastgen2.attributes.UserDefinedType.UserDefinedType.get_plain_C_attributes(), peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray.get_plain_C_attributes(), dastgen2.attributes.String.String.get_setter_getter_name(), dastgen2.attributes.Boolean.Boolean.get_to_string(), dastgen2.attributes.BooleanArray.BooleanArray.get_to_string(), dastgen2.attributes.Double.Double.get_to_string(), dastgen2.attributes.DoubleArray.DoubleArray.get_to_string(), dastgen2.attributes.DoublePointer.DoublePointer.get_to_string(), dastgen2.attributes.Enumeration.Enumeration.get_to_string(), dastgen2.attributes.Integer.Integer.get_to_string(), dastgen2.attributes.IntegerArray.IntegerArray.get_to_string(), dastgen2.attributes.UserDefinedType.UserDefinedType.get_to_string(), peano4.api.dastgen2.Peano4DoubleArray.Peano4DoubleArray.get_to_string(), peano4.api.dastgen2.Peano4IntegerArray.Peano4IntegerArray.get_to_string(), peano4.api.dastgen2.Peano4SmartPointerDoubleArray.Peano4SmartPointerDoubleArray.get_to_string(), api.solvers.Solver.Solver.name(), name(), exagrype.api.euler.CCZ4WithEuler_OuterAdditiveCoupling.CCZ4WithEuler_OuterAdditiveCoupling.name(), exagrype.api.euler.CCZ4WithEuler_OuterMultiplicativeCoupling.CCZ4WithEuler_OuterMultiplicativeCoupling.name(), exagrype.api.FOSOSolver.FOSOSolver.name(), exagrype.api.scalarfield.CCZ4WithScalarField_InnerCoupling.CCZ4WithScalarField_InnerCoupling.name(), exagrype.api.scalarfield.CCZ4WithScalarField_OuterMultiplicativeCoupling.CCZ4WithScalarField_OuterMultiplicativeCoupling.name(), exahype2.api.AuxiliaryVariables.AuxiliaryVariables.name(), exahype2.api.Solver.Solver.name(), solvers.api.Solver.Solver.name(), solvers.elliptic.ConstrainedPoissonEquationForMarkerOnCells.ConstrainedPoissonEquationForMarkerOnCells.name(), solvers.fv.FV.FV.name(), api.solvers.Solver.Solver.typename(), and solvers.api.Solver.Solver.typename().

◆ expose_in_header_file

dastgen2.attributes.Attribute.Attribute.expose_in_header_file = expose_in_header_file

Definition at line 70 of file Attribute.py.

◆ ifdefs

dastgen2.attributes.Attribute.Attribute.ifdefs = ifdefs

Definition at line 67 of file Attribute.py.

Referenced by get_attribute_declaration_string().

◆ qualifier

dastgen2.attributes.Attribute.Attribute.qualifier = qualifier

Definition at line 68 of file Attribute.py.

Referenced by _is_const(), _is_const_static(), _is_constexpr(), and _is_static().

◆ use_data_store


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