Open lroberts36 opened 2 years ago
One small concern: If we require specifying types through Metadata
then won't downstream developers be unable to enroll types that aren't already hardcoded into parthenon, for example a downstream code-specific enum
? I think this wouldn't be a concern if we instead specifed type via a template parameter on the AddField
function.
I was thinking that there might be some clever way to store a generic type in the metadata (not sure if this is possible? although my general belief is that all is possible in c++ at compile time), rather than doing this through metadata flags.
There are a number of use cases for allowing for multiple types of variables (e.g. mixed precision solvers, flagging). During the 2022 Parthenon meeting, a discussion was had about the best path for implementing this and what the needs of various users were. The consensus was that this is straightforward to implement, but it is not currently high priority. Some thoughts:
MeshBlockData<T>
is templated on typeT
even though currentlyT = Real
is the only thing that is ever used. When a newMeshBlockData<T>
object is created, it adds a field for every entry inresolved_packages->AllFields()
. When there are multiple types allowed, there should be some way of specifying the type of a field in itsMetadata
and this loop should check that the field has the typeT
before adding it to theMeshBlockData
.Mesh*Data<T>
in a dataDataCollection
for every stage and adding a methodtemplate<class T = Real> DataCollection::Get(const std::string& stage)
that gets theMesh*Data
for typeT
atstage
.