Peano
Loading...
Searching...
No Matches
dastgen2.DataModel.DataModel Class Reference

Represents on DaStGen2 object, i.e. More...

Inheritance diagram for dastgen2.DataModel.DataModel:
Collaboration diagram for dastgen2.DataModel.DataModel:

Public Member Functions

 __init__ (self, full_qualified_name, has_nondefault_constructor=True, embed_attributes_into_data_store=False)
 Construct the data model.
 set_full_qualified_name (self, full_qualified_name)
 add_attribute (self, attribute)
 add_or_replace_attribute (self, attribute)
 Check first whether attribute already exists.
 add_aspect (self, aspect)
 Add a new aspect.
 write_header_file (self, full_qualified_filename)
 writes the header file for your data model.
 write_implementation_file (self, full_qualified_filename)
 writes the implementation (.cpp) file for your data model.
 expose_all_attributes_in_header_file (self)
 full_qualified_name (self)
 name (self)

Data Fields

 has_nondefault_constructor = has_nondefault_constructor
str public_fields = ""
str additional_includes = ""

Protected Member Functions

 _get_constructor_arguments (self)
 Generates the list of constructor arguments needed to fully instantiate an object of the class the datamodel generates.

Protected Attributes

 _full_qualified_name = full_qualified_name
list _attributes = []
list _aspects = []
 _embed_attributes_into_data_store = embed_attributes_into_data_store

Static Protected Attributes

str _Header_Template_Without_Data_Store
str _Header_Template_With_Data_Store

Private Member Functions

 __use_default_copy_constructor (self)
 __generate_constructor_definition (self, output)
 In this generation business, I faced multiple issues with initialisation lists: where are comma if some fields are not defined, which fields can I copy directly, and which ones do I have to copy manually, and so forth.
 __generate_toString_definition (self, output)
 __generate_explicit_copy_constructor (self, output)
 __generate_accessors (self, output, is_cpp_file)
 Generate getter/setter functions.

Detailed Description

Represents on DaStGen2 object, i.e.

one data model

A data model has attributes and it is tied to aspects which inject some technical behaviour that is cross-cutting.

Definition at line 8 of file DataModel.py.

Constructor & Destructor Documentation

◆ __init__()

dastgen2.DataModel.DataModel.__init__ ( self,
full_qualified_name,
has_nondefault_constructor = True,
embed_attributes_into_data_store = False )

Construct the data model.

Attributes

public_fields: C++ string This will be used to add public fields to the class, and each attribute can feed into this string. However, you can also modify it yourself.

Arguments

Parameters
full_qualified_nameFull qualified name Please pass in in C++ convention i.e. with :: separating the namespaces.

Definition at line 16 of file DataModel.py.

Member Function Documentation

◆ __generate_accessors()

dastgen2.DataModel.DataModel.__generate_accessors ( self,
output,
is_cpp_file )
private

Generate getter/setter functions.

Generate all the setters and getters and use get_methods() to construct them for the individual attributes.

output: File object File object that will be written to.

is_cpp_file: Boolean. True if the output is intended to be the .cpp file. False if it's the header file.

Definition at line 391 of file DataModel.py.

References _attributes, and _full_qualified_name.

Referenced by write_header_file(), and write_implementation_file().

Here is the caller graph for this function:

◆ __generate_constructor_definition()

dastgen2.DataModel.DataModel.__generate_constructor_definition ( self,
output )
private

In this generation business, I faced multiple issues with initialisation lists: where are comma if some fields are not defined, which fields can I copy directly, and which ones do I have to copy manually, and so forth.

Definition at line 297 of file DataModel.py.

References _attributes, _full_qualified_name, and _get_constructor_arguments().

Referenced by write_implementation_file().

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

◆ __generate_explicit_copy_constructor()

dastgen2.DataModel.DataModel.__generate_explicit_copy_constructor ( self,
output )
private

Definition at line 363 of file DataModel.py.

References _attributes, and _full_qualified_name.

Referenced by write_implementation_file().

Here is the caller graph for this function:

◆ __generate_toString_definition()

dastgen2.DataModel.DataModel.__generate_toString_definition ( self,
output )
private

Definition at line 338 of file DataModel.py.

References _attributes, and _full_qualified_name.

Referenced by write_implementation_file().

Here is the caller graph for this function:

◆ __use_default_copy_constructor()

dastgen2.DataModel.DataModel.__use_default_copy_constructor ( self)
private

Definition at line 194 of file DataModel.py.

References _attributes.

Referenced by write_header_file(), and write_implementation_file().

Here is the caller graph for this function:

◆ _get_constructor_arguments()

dastgen2.DataModel.DataModel._get_constructor_arguments ( self)
protected

Generates the list of constructor arguments needed to fully instantiate an object of the class the datamodel generates.

Definition at line 171 of file DataModel.py.

References _attributes.

Referenced by __generate_constructor_definition(), and write_header_file().

Here is the caller graph for this function:

◆ add_aspect()

dastgen2.DataModel.DataModel.add_aspect ( self,
aspect )

Add a new aspect.

This is a pretty simplistic routine:

  1. Inform the aspect object about the model by invoking set_model()
  2. Add the aspect to the list of used aspects

Definition at line 71 of file DataModel.py.

References _aspects.

◆ add_attribute()

dastgen2.DataModel.DataModel.add_attribute ( self,
attribute )

Definition at line 51 of file DataModel.py.

References _attributes, and _embed_attributes_into_data_store.

◆ add_or_replace_attribute()

dastgen2.DataModel.DataModel.add_or_replace_attribute ( self,
attribute )

Check first whether attribute already exists.

If it does, replace it.

Definition at line 55 of file DataModel.py.

References _attributes, and _embed_attributes_into_data_store.

◆ expose_all_attributes_in_header_file()

dastgen2.DataModel.DataModel.expose_all_attributes_in_header_file ( self)

Definition at line 470 of file DataModel.py.

References _attributes.

◆ full_qualified_name()

dastgen2.DataModel.DataModel.full_qualified_name ( self)

Definition at line 476 of file DataModel.py.

References _full_qualified_name.

◆ name()

◆ set_full_qualified_name()

dastgen2.DataModel.DataModel.set_full_qualified_name ( self,
full_qualified_name )

Definition at line 48 of file DataModel.py.

References _full_qualified_name.

◆ write_header_file()

dastgen2.DataModel.DataModel.write_header_file ( self,
full_qualified_filename )

◆ write_implementation_file()

dastgen2.DataModel.DataModel.write_implementation_file ( self,
full_qualified_filename )

writes the implementation (.cpp) file for your data model.

Definition at line 427 of file DataModel.py.

References __generate_accessors(), __generate_constructor_definition(), __generate_explicit_copy_constructor(), __generate_toString_definition(), __use_default_copy_constructor(), _aspects, _full_qualified_name, and has_nondefault_constructor.

Here is the call graph for this function:

Field Documentation

◆ _aspects

list dastgen2.DataModel.DataModel._aspects = []
protected

Definition at line 42 of file DataModel.py.

Referenced by add_aspect(), write_header_file(), and write_implementation_file().

◆ _attributes

◆ _embed_attributes_into_data_store

dastgen2.DataModel.DataModel._embed_attributes_into_data_store = embed_attributes_into_data_store
protected

Definition at line 44 of file DataModel.py.

Referenced by add_attribute(), add_or_replace_attribute(), and write_header_file().

◆ _full_qualified_name

◆ _Header_Template_With_Data_Store

str dastgen2.DataModel.DataModel._Header_Template_With_Data_Store
staticprotected

Definition at line 128 of file DataModel.py.

Referenced by write_header_file().

◆ _Header_Template_Without_Data_Store

str dastgen2.DataModel.DataModel._Header_Template_Without_Data_Store
staticprotected

Definition at line 85 of file DataModel.py.

Referenced by write_header_file().

◆ additional_includes

str dastgen2.DataModel.DataModel.additional_includes = ""

Definition at line 46 of file DataModel.py.

Referenced by exahype2.api.generators.KernelMicrobenchmarkMain._ExaHyPEKernelBenchmarkMainFileSequence.construct_output(), exahype2.api.generators.KernelMicrobenchmarkMain.KernelMicrobenchmarkMain.construct_output(), api.ApplyPointWiselyToPatch.ApplyPointWiselyToPatch.get_includes(), api.DynamicAMR.DynamicAMR.get_includes(), api.InterpolateAndRestrictCells.InterpolateAndRestrictCells.get_includes(), api.InterpolateHangingFaces.InterpolateHangingFaces.get_includes(), api.PlotPatchesInPeanoBlockFormat.PlotPatchesInPeanoBlockFormat.get_includes(), api.PlotPatchesOverFacesInPeanoBlockFormat.PlotPatchesOverFacesInPeanoBlockFormat.get_includes(), api.ProjectPatchOntoFaces.ProjectPatchOntoFaces.get_includes(), api.ProjectPatchWithHaloOntoFaces.ProjectPatchWithHaloOntoFaces.get_includes(), api.ReconstructPatchWithHalo.ReconstructPatchWithHalo.get_includes(), api.RestrictHangingFaces.RestrictHangingFaces.get_includes(), exagrype.api.actionsets.ApplyReconstructionFunctor.ApplyReconstructionFunctor.get_includes(), exagrype.api.actionsets.CopyPatchWithLinearInterpolation.CopyPatchWithLinearInterpolation.get_includes(), exahype2.api.fv.actionsets.RollOverUpdatedFace.RollOverUpdatedFace.get_includes(), exahype2.api.rkfd4.actionsets.RollOverUpdatedFace.RollOverUpdatedFace.get_includes(), peano4.api.toolbox.multigrid.cellbased.ScalarJacobiWithRediscretisation.ScalarJacobiWithRediscretisation.get_includes(), peano4.api.toolbox.multigrid.MatrixFreeJacobi.MatrixFreeJacobi.get_includes(), peano4.api.toolbox.multigrid.vertexbased.ScalarJacobiWithRediscretisation.ScalarJacobiWithRediscretisation.get_includes(), peano4.api.toolbox.particles.InsertParticlesAlongCartesianLayoutIntoUnrefinedCells.InsertParticlesAlongCartesianLayoutIntoUnrefinedCells.get_includes(), peano4.api.toolbox.particles.InsertParticlesByCoordinates.InsertParticlesByCoordinates.get_includes(), peano4.api.toolbox.particles.InsertRandomParticlesIntoUnrefinedCells.InsertRandomParticlesIntoUnrefinedCells.get_includes(), peano4.api.toolbox.particles.PlotParticlesInVTKFormat.PlotParticlesInVTKFormat.get_includes(), peano4.api.toolbox.PlotCellDataInPeanoBlockFormat.PlotCellDataInPeanoBlockFormat.get_includes(), peano4.api.toolbox.PlotGridInPeanoBlockFormat.PlotGridInPeanoBlockFormat.get_includes(), peano4.api.toolbox.PlotVertexDataInPeanoBlockFormat.PlotVertexDataInPeanoBlockFormat.get_includes(), and write_header_file().

◆ has_nondefault_constructor

dastgen2.DataModel.DataModel.has_nondefault_constructor = has_nondefault_constructor

Definition at line 43 of file DataModel.py.

Referenced by write_implementation_file().

◆ public_fields

str dastgen2.DataModel.DataModel.public_fields = ""

Definition at line 45 of file DataModel.py.

Referenced by write_header_file().


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