DataAdaptor API has no way of request specific meshes
When a simulation uses multiple meshes it is impossible to know which one is needed.
An motivating example is the Warp LPA simulation code, which computes the solution of a number of different particle species and has a Cartesian or block structured AMR mesh for the solution of megnetic and electric fields. Particle species can be molecules or sub atomic particles such as porotons and electrons. There can be multiple species of the same sub atomic particle type, for instance electrons are kept in distict species identifying which molecules/atoms they derived from. The number of species present in given simulation is problem specific.
Existing DataAdaptor API:
virtual vtkDataObject* GetMesh(bool structure_only=false) = 0;
virtual bool AddArray(vtkDataObject* mesh, int association, const std::string& arrayname) = 0;
virtual unsigned int GetNumberOfArrays(int association) = 0;
virtual std::string GetArrayName(int association, unsigned int index) = 0;
virtual void ReleaseData() = 0;
Note that in AddArray we pass a VTK pointer in which could potentially be used as a key to identify which mesh data is being requested from. However, this might be highly inconvenient and potentially problematic in languages other than C++.
Option 1:
// Discover the number of meshes a simulation can provide
virtual int GetNumberOfMeshes(int &numMeshes) = 0;
// Discover the names of the meshes
virtual int GetMeshName(int id, const std::string &meshName) = 0;
virtual int GetMesh(const std::string &meshName, bool structure_only,
vtkDataObject *&mesh) = 0;
virtual int AddArray(vtkDataObject* mesh, const std::string &meshName,
int association, const std::string& arrayname) = 0;
virtual int GetNumberOfArrays(const std::string &meshName, int association,
unsigned int &numberOfArrays) = 0;
virtual int GetArrayName(const std::string &meshName, int association,
unsigned int index, std::string &arrayName) = 0;
virtual int ReleaseData(const std::string &meshName) = 0;
virtual int ReleaseData() = 0;
meshName
identifies the mesh where necessary. In all API an int
is returned, zero indicates success, non zero an error (see #9 (closed)).