3from enum
import IntEnum
9 Superclass has to be IntEnum, as I use this one within Jinja2 templates
10 where I struggled to compare against enum variants. I however can always
11 compare against integers.
29 if association==DoFAssociation.Vertex:
30 result +=
"VertexData"
31 elif association==DoFAssociation.Cell:
33 elif association==DoFAssociation.Face:
35 elif association==DoFAssociation.Global:
36 result +=
"GlobalData"
44 if association==DoFAssociation.Vertex:
46 elif association==DoFAssociation.Cell:
48 elif association==DoFAssociation.Face:
50 elif association==DoFAssociation.Global:
59 Base class for any degree of freedom object
61 Any degree of freedom object in Peano is derived from DoF. There are
62 different subclasses of this type which are actually used in most
63 implementations. The most popular one is peano4.datamodel.DaStGen2 which
64 encodes a DoF implementation which is based upon plain C++ objects created
65 through DaStGen2. However, there are also other data models such as bespoke
66 patch data represented through peano4.datamodel.Patch.
68 @image html dof-class-diagram.png
70 Every DoF in Peano has a name and a unique association with a mesh entity
71 which is held in association. There are some further properties tied to
72 each DoF such as a position x and a mesh width h, but we leave it to
73 subclasses to provide those guys.
75 Please consult the tutorials on @ref tutorials_peano4_assign_data_to_mesh "assigning data to a mesh" and
76 @ref tutorials_peano4_mask_out_data_usage "masking out data storage"
77 on some instructions where this class is actually used in code.
85 Create a degree of freedom object
87 Both the association and the namespace are not to be set directly,
88 but through the operation configure().
90 ## Additional store/load/send/receive arguments
92 - The first entry of this triple is the expression that you want the
94 - The second one is the C++ type of this expression.
95 - The third one is the name that you wanna use in the dof signatures
98 It is the responsibility of the DoF subclass to ensure that the second
99 entry is properly used to initialise the store and load routines.
100 Most define an additional setter for property.
105 association: DoFAssociation
108 Has to be a fit to the C++ naming conventions
111 Sequence of namespaces.
113 additional_load_and_store_arguments: [(String,String,String)]
114 This flag is, by default, an empty list. If you add an entry to this
115 list, each store and load routine will get an additional parameter.
116 Consult documentation above for the semantics of the list entries.
126 def configure(self,namespace,association, subdirectory=""):
128 Typically called by model as soon as you add an object to it
147 What should the data type be called within the data repository,
148 or within action sets. We add a prefix name here.
155 What should the data type be called within the data repository.
159 result +=
"peano4::datamanagement::VertexEnumerator<"
161 result +=
"peano4::datamanagement::FaceEnumerator<"
163 assert False,
"association was {}".format( self.
association )
177 use_dof_association = None
181 You can make Peano's store and load arguments of any DoF depend on other
182 DoFs that you have loaded before. So you can load X and then make Y later
183 on depend on the state of X. For this, you have to add a tuple to
184 Y's additional_load_and_store_arguments. It is a very technical tuple.
185 This routine helps you to construct it for X.
187 use_dof_association: DoFAssociation
188 Set this one to None and the routine will pick up self._association.
189 However, there are cases where we want to construct the string and
190 the association is not yet set properly. In this case, you have to
191 supplement the information manually.
194 if use_dof_association==
None:
197 stack_access_string =
"repositories::DataRepository::_{}Stack.getForPush( repositories::DataRepository::DataKey(_spacetreeId,peano4::grid::PeanoCurve::CallStack))->top()".format(
201 data_type =
"{}::{}".format(
206 return (stack_access_string,data_type,argument_name)
Superclass has to be IntEnum, as I use this one within Jinja2 templates where I struggled to compare ...
Base class for any degree of freedom object.
additional_load_and_store_arguments(self)
get_full_qualified_type(self)
additional_load_and_store_arguments_for_other_dof(self, argument_name, use_dof_association=None)
You can make Peano's store and load arguments of any DoF depend on other DoFs that you have loaded be...
__init__(self, name)
Create a degree of freedom object.
_additional_load_and_store_arguments
get_logical_type_name(self)
What should the data type be called within the data repository, or within action sets.
get_enumeration_type(self)
What should the data type be called within the data repository.
configure(self, namespace, association, subdirectory="")
Typically called by model as soon as you add an object to it.
get_subnamespace_for_association(association)
get_logical_type_name_for_association(association, name)