From ea202689d414d0e8183ec683aabea82f01cc3f29 Mon Sep 17 00:00:00 2001 From: apo Date: Thu, 10 Nov 2005 15:05:42 +0000 Subject: [PATCH] To document the sources --- src/CONVERTOR/VISU_Convertor.hxx | 115 +++++++++++--- src/CONVERTOR/VISU_ConvertorDef.hxx | 5 + src/CONVERTOR/VISU_Convertor_impl.hxx | 208 +++++++++++++++++++------- src/CONVERTOR/VISU_IDMapper.hxx | 28 +++- 4 files changed, 279 insertions(+), 77 deletions(-) diff --git a/src/CONVERTOR/VISU_Convertor.hxx b/src/CONVERTOR/VISU_Convertor.hxx index d9145a7c..c81ce297 100644 --- a/src/CONVERTOR/VISU_Convertor.hxx +++ b/src/CONVERTOR/VISU_Convertor.hxx @@ -27,6 +27,11 @@ #ifndef VISU_Convertor_HeaderFile #define VISU_Convertor_HeaderFile +/*! + \file VISU_Convertor.hxx + \brief The file contains definitions for basic classes of the VISU CONVERTER package +*/ + #include "VISU_IDMapper.hxx" #include "VISU_ConvertorDef.hxx" @@ -48,6 +53,7 @@ namespace VISU typedef TVector TNames; //--------------------------------------------------------------- + //! Define a basic class for all MED entites which can be identified by its number struct TIntId: virtual TBaseStructure { vtkIdType myId; @@ -61,12 +67,17 @@ namespace VISU typedef std::map TMeshOnEntityMap; typedef std::map TGroupMap; + //! Define a basic class which corresponds to MED MESH entity + /*! + This class in its turn contains map of TMeshOnEntity and TGroup substructures, + also it keeps name and dimention of corresponding MED MESH entity. + */ struct TMesh: virtual TBaseStructure { - TMeshOnEntityMap myMeshOnEntityMap; - TGroupMap myGroupMap; - TName myName; - int myDim; + TMeshOnEntityMap myMeshOnEntityMap; //!< Contains corresponding meshes for MED ENTITIES + TGroupMap myGroupMap; //!< Contains map of bounded MED GROUPS + TName myName; //! Name of the corresponding MED MESH + int myDim; //! Dimension of the corresponding MED MESH TMesh(): myDim(0) {} @@ -75,11 +86,13 @@ namespace VISU //--------------------------------------------------------------- + //! Define a basic class which corresponds to MED PROFILE entity struct TSubProfile: virtual TBaseStructure {}; //--------------------------------------------------------------- + //! Define a containerfor MED PROFILE entities which belongs to the same MED ENTITY struct TProfile: virtual TIDMapper {}; @@ -93,11 +106,13 @@ namespace VISU //--------------------------------------------------------------- + //! Define a basic class for MED GAUSS entity struct TGauss: virtual TBaseStructure {}; //--------------------------------------------------------------- + //! Define a container for mesh generated from MED GAUSS and corresponding MED PROFILE struct TGaussSubMesh: virtual TBaseStructure { PSubProfile mySubProfile; @@ -105,6 +120,7 @@ namespace VISU //--------------------------------------------------------------- + //! Define a container for all TGaussSubMesh that belongs to the same MED ENTITY struct TGaussMesh: virtual TGaussPtsIDMapper {}; @@ -122,31 +138,38 @@ namespace VISU typedef std::map TFamilyMap; typedef std::map TFieldMap; + //! Define a basic class which corresponds to MED ENTITY + /*! + This class in its turn contains map of TGaussMesh and TProfile substructures, + also it keeps corresponding map of MED FAMILIES and FIELDS. + */ struct TMeshOnEntity: virtual TNamedIDMapper { - TGaussMeshMap myGaussMeshMap; - TProfileMap myProfileMap; + TGaussMeshMap myGaussMeshMap; //!< Contains map of Gauss mesh which exist on it + TProfileMap myProfileMap; //!< Contains map of Profile mesh which exist on it - TFamilyMap myFamilyMap; - TFieldMap myFieldMap; + TFamilyMap myFamilyMap; //!< Contains map of MED FAMILIES which belongs to it + TFieldMap myFieldMap; //!< Contains map of MED FIELDS which belongs to it - TName myMeshName; - TEntity myEntity; + TName myMeshName; //!< Contains name of the MED MESH where the it belongs to. + TEntity myEntity; //!< Referes to MED ENTITY where the it belongs to. }; //--------------------------------------------------------------- + //! Define a basic class for MED FAMILY entity struct TFamily: virtual TIntId, virtual TIDMapper { - TEntity myEntity; - TName myName; + TEntity myEntity; //!< Referes to MED ENTITY where the TFamily belongs to. + TName myName; //!< Contains name of the corresponding MED FAMILY }; //--------------------------------------------------------------- typedef std::set TFamilySet; + //! Define a basic class for MED GROUP entity struct TGroup: virtual TIDMapper { TFamilySet myFamilySet; @@ -157,16 +180,22 @@ namespace VISU typedef std::map TValField; typedef std::pair TMinMax; + //! Define a basic class for MED FIELD entity struct TField: virtual TIntId { - TEntity myEntity; - TName myName; - TName myMeshName; - TValField myValField; - TNames myCompNames; - TNames myUnitNames; - vtkIdType myNbComp; - + TEntity myEntity; //!< Referes to MED ENTITY where it belongs to. + TName myName; //!< Contains name of the corresponding MED FIELD + TName myMeshName; //!< Contains name of the MED MESH where it belongs to. + TValField myValField; //!< Contains sequence of values for corresponding MED TIMESTAMPS + TNames myCompNames; //!< Contains names of components of the MED FIELD + TNames myUnitNames; //!< Contains names of units of the MED FIELD + vtkIdType myNbComp; //!< Keeps number of components for the MED FIELD + + //! Calculate min/max values for each of the MED FIELD components among all its timestamps + /*! + Numeration of the components starts from 1. + Zero component contains min/max value for modulus of corresponding vector + */ virtual TMinMax GetMinMax(vtkIdType theCompID) = 0; @@ -179,19 +208,21 @@ namespace VISU //--------------------------------------------------------------- typedef std::pair TTime; + //! Define a basic class for MED TIMESTAMP entity struct TValForTime: virtual TIntId { - TEntity myEntity; - TName myMeshName; - TName myFieldName; + TEntity myEntity; //!< Referes to MED ENTITY where it belongs to. + TName myMeshName; //!< Contains name of the MED MESH where it belongs to. + TName myFieldName; //!< Contains name of the MED FIELD where it belongs to. TTime myTime; - PProfile myProfile; + PProfile myProfile; //!< Contains corresponding MED PROFILE where the MED TIEMSTMAP attached to PGaussMesh myGaussMesh; }; //--------------------------------------------------------------- + //! The utility function allows to write vtkUnstructuredGrid to a file with defined name void WriteToFile(vtkUnstructuredGrid* theDataSet, const std::string& theFileName); @@ -199,6 +230,20 @@ namespace VISU //--------------------------------------------------------------- +//! This class defines interface to read VTK interpretation of MED entities +/*! + It is the main class of the VISU CONVERTER package. + Following MED entities can be retrived from any MED file: + - mesh from corresponding MED ENTITIES; + - MED TIMESTAMPS; + - MED FAMILIES; + - MED GROUPS. + The class produce its work in two main steps: + 1. Perfrom parsing of MED file to get known what MED entities are pressent in it + 2. Get VTK representation for any existing MED entity + Also, it can perform some additional work to calculate expected amount of memory to build defined VTK representation + +*/ class VISU_Convertor { protected: @@ -211,58 +256,73 @@ public: ~VISU_Convertor() {}; + //! Get brief name of the corresponding source MED file virtual const std::string& GetName(){ return myName;} + //! Let known whether the source MED file parsed or not virtual int IsDone() const { return myIsDone; } + //! Defines what subtype of vtkDataSet is used for MED to VTK mapping typedef VISU::TVTKOutput TOutput; + //! This method perform first parsing of MED file to get known what MED entities are pressent in it virtual VISU_Convertor* Build() = 0; + //! This method allow to get known what MED entities are present is the MED file virtual const VISU::TMeshMap& GetMeshMap(); + //! Get amount of memory to build VTK representations for all existing MED entities virtual float GetSize() = 0; + //! Get mesh for corresponding MED ENTITY virtual VISU::PNamedIDMapper GetMeshOnEntity(const std::string& theMeshName, const VISU::TEntity& theEntity) = 0; + //! Get amount of memory to build mesh for corresponding MED ENTITY virtual float GetMeshOnEntitySize(const std::string& theMeshName, const VISU::TEntity& theEntity) = 0; + //! Get mesh for corresponding MED FAMILY virtual VISU::PIDMapper GetFamilyOnEntity(const std::string& theMeshName, const VISU::TEntity& theEntity, const std::string& theFamilyName) = 0; + + //! Get amount of memory to build mesh for corresponding MED FAMILY virtual float GetFamilyOnEntitySize(const std::string& theMeshName, const VISU::TEntity& theEntity, const std::string& theFamilyName) = 0; + + //! Get mesh for corresponding MED GROUP virtual VISU::PIDMapper GetMeshOnGroup(const std::string& theMeshName, const std::string& theGroupName) = 0; + //! Get amount of memory to build mesh for corresponding MED GROUP virtual float GetMeshOnGroupSize(const std::string& theMeshName, const std::string& theGroupName) = 0; + //! Get mesh with attached values for corresponding MED TIMESTAMP virtual VISU::PIDMapper GetTimeStampOnMesh(const std::string& theMeshName, @@ -270,6 +330,7 @@ public: const std::string& theFieldName, int theStampsNum) = 0; + //! Get Gauss Points mesh with attached values for corresponding MED TIMESTAMP virtual VISU::PGaussPtsIDMapper GetTimeStampOnGaussPts(const std::string& theMeshName, @@ -277,6 +338,7 @@ public: const std::string& theFieldName, int theStampsNum) = 0; + //! Get amount of memory to build mesh for corresponding MED TIMESTAMP virtual float GetTimeStampSize(const std::string& theMeshName, @@ -284,18 +346,21 @@ public: const std::string& theFieldName, int theStampsNum) = 0; + //! Get amount of memory to build all MED TIMESTAMPS for corresponding MED FIELD virtual float GetFieldOnMeshSize(const std::string& theMeshName, const VISU::TEntity& theEntity, const std::string& theFieldName) = 0; + //! Find MED FIELD container virtual const VISU::PField GetField(const std::string& theMeshName, VISU::TEntity theEntity, const std::string& theFieldName) = 0; + //! Find MED TIMESTAMP container virtual const VISU::PValForTime GetTimeStamp(const std::string& theMeshName, @@ -303,6 +368,7 @@ public: const std::string& theFieldName, int theStampsNum) = 0; + //! Allow to generate pretty name for MED TIMESTAMP static std::string GenerateName(const VISU::TTime& aTime); @@ -314,6 +380,7 @@ public: extern "C" { + //! Instatiate proper VISU_Convertor subclass VISU_Convertor* CreateConvertor(const std::string& theFileName); }; diff --git a/src/CONVERTOR/VISU_ConvertorDef.hxx b/src/CONVERTOR/VISU_ConvertorDef.hxx index 4744e653..0fedadc5 100644 --- a/src/CONVERTOR/VISU_ConvertorDef.hxx +++ b/src/CONVERTOR/VISU_ConvertorDef.hxx @@ -27,6 +27,11 @@ #ifndef VISU_ConvertorDef_HeaderFile #define VISU_ConvertorDef_HeaderFile +/*! + \file VISU_ConvertorDef.hxx + \brief The file contains predeclarations for basic classes of the VISU CONVERTER package +*/ + #include "MED_SharedPtr.hxx" namespace VISU diff --git a/src/CONVERTOR/VISU_Convertor_impl.hxx b/src/CONVERTOR/VISU_Convertor_impl.hxx index 08771a4c..a00aa315 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.hxx +++ b/src/CONVERTOR/VISU_Convertor_impl.hxx @@ -49,15 +49,18 @@ class VISU_MergeFilter; namespace VISU { + //! Defines VISU enumeration of geometrical types enum EGeometry {ePOINT1=1, eSEG2=102, eSEG3=103, eTRIA3=203, eQUAD4=204, eTRIA6=206,eQUAD8=208, eTETRA4=304, ePYRA5=305, ePENTA6=306, eHEXA8=308, eTETRA10=310, ePYRA13=313, ePENTA15=315, eHEXA20=320, ePOLYGONE=400, ePOLYEDRE=500, eNONE=-1}; + //! Get number of nodes for defined geometrical type vtkIdType VISUGeom2NbNodes(EGeometry theGeom); + //! Maps VISU geometrical type to VTK one vtkIdType VISUGeom2VTK(EGeometry theGeom); @@ -76,24 +79,27 @@ namespace VISU typedef float TCoord; //--------------------------------------------------------------- + //! Define an utility base class which is repsonsible for preventing repetion struct TIsVTKDone: virtual TBaseStructure { TIsVTKDone(); - bool myIsDone; - bool myIsVTKDone; + bool myIsDone; //!< Say, is the corresponding MED entity already loaded into intermediate data structure + bool myIsVTKDone; //!< Say, is the corresponding intermediate data structure already mapped into VTK representation }; //--------------------------------------------------------------- + //! Define an utility base class which allow to keep calculated number of cells and their size struct TSizeCounter: virtual TIsVTKDone { TSizeCounter(); - vtkIdType myNbCells; - vtkIdType myCellsSize; + vtkIdType myNbCells; //!< Number of cells contained into corresponding sublclass + vtkIdType myCellsSize; //!< Size of cells contained into corresponding sublclass }; //--------------------------------------------------------------- + //! Define a container for VTK representation class TSource: public virtual TSizeCounter { protected: @@ -101,6 +107,7 @@ namespace VISU public: TSource(); + //! This method allow to create corresponding VTK data set by demand (not at once) const TVTKSource& GetSource() const; @@ -111,6 +118,10 @@ namespace VISU //--------------------------------------------------------------- + //! Define a container for VTK representation + /*! + This container allow to combine other VTK representation into single one. + */ class TAppendFilter: public virtual TIsVTKDone, public virtual TIDMapper { @@ -119,6 +130,7 @@ namespace VISU public: TAppendFilter(); + //! This method allow to create corresponding VTK filter by demand (not at once) const TVTKAppendFilter& GetFilter() const; @@ -129,6 +141,10 @@ namespace VISU //--------------------------------------------------------------- + //! Define a container for VTK representation + /*! + This container allow to assign data to mesh and represent them into single VTK representation + */ class TMergeFilter: public virtual TIsVTKDone, public virtual TIDMapper { @@ -137,6 +153,7 @@ namespace VISU public: TMergeFilter(); + //! This method allow to create corresponding VTK filter by demand (not at once) const TVTKMergeFilter& GetFilter() const; @@ -151,25 +168,34 @@ namespace VISU typedef TSlice TCoordSlice; typedef TCSlice TCCoordSlice; + //! This class is responsible for representation of mesh nodes class TPointCoords: public virtual TBaseStructure { protected: - vtkIdType myDim; - vtkIdType myNbPoints; + vtkIdType myDim; //!< Dimension of the nodal coordinates + vtkIdType myNbPoints; //!< Number of nodes in corresponding mesh - TCoordArray myCoord; - TVTKPoints myPoints; + //! An container for coordinates of the nodes + /*! + Usage of slices allow to minimize amount of memory to store the nodal coordinates and + provide unifirm way of conversation with this coordinates (independant from mesh dimension) + */ + TCoordArray myCoord; + TVTKPoints myPoints; //!< VTK representation for the mesh nodes public: TPointCoords(); + //! To initilize the class void Init(vtkIdType theNbPoints, vtkIdType theDim); + //! Get slice of coordinates for defined node (const version) TCCoordSlice GetCoordSlice(vtkIdType theNodeId) const; + //! Get slice of coordinates for defined node TCoordSlice GetCoordSlice(vtkIdType theNodeId); @@ -192,35 +218,46 @@ namespace VISU typedef TVector TVectorID; typedef std::map TObj2VTKID; + //! This class is responsible for representation of mesh nodes + /*! + In additition to its base functionlity it support mapping of VTK to object numeration and + keeps names for each of nodes. + */ class TNamedPointCoords: public virtual TPointCoords { protected: typedef TVector TPointsDim; - TPointsDim myPointsDim; - TVectorID myVectorID; - TObj2VTKID myObj2VTKID; + TPointsDim myPointsDim; //!< Keeps name of each dimension + TVectorID myVectorID; //!< Keeps object¶ numeration + TObj2VTKID myObj2VTKID; //!< Keeps mapping from object number to VTK one public: + //! To initilize the class (numeration of the nodes can be missed) void Init(vtkIdType theNbPoints, vtkIdType theDim, const TVectorID& theVectorID = TVectorID()); + //! Get name for defined dimension std::string& GetName(vtkIdType theDim); + //! Get name for defined dimension (const version) const std::string& GetName(vtkIdType theDim) const; + //! Get object number for node by its VTK one virtual vtkIdType GetObjID(vtkIdType theID) const; + //! Get VTK number for node by its object one virtual vtkIdType GetVTKID(vtkIdType theID) const; + //! Get name of node by its object number virtual std::string GetNodeName(vtkIdType theObjID) const; @@ -229,6 +266,7 @@ namespace VISU //--------------------------------------------------------------- + //! Specialize TMesh to provide VTK mapping for nodes struct TMeshImpl: virtual TMesh, virtual TIsVTKDone { @@ -246,20 +284,27 @@ namespace VISU typedef TVector TSubMeshID; typedef enum {eRemoveAll, eAddAll, eAddPart, eNone} ESubMeshStatus; + //! Specialize TSubProfile to provide VTK mapping struct TSubProfileImpl: virtual TSubProfile, virtual TSource { TSubProfileImpl(); - EGeometry myGeom; - std::string myName; + EGeometry myGeom; //!< Defines to what geometrical type the MED PROFILE belong to + std::string myName; //!< Keeps its name + //! Get object number of mesh cell by its VTK one virtual vtkIdType GetElemObjID(int theVtkI) const; - ESubMeshStatus myStatus; - TSubMeshID mySubMeshID; + //! Keeps status of the structure + /*! + In some cases MED file does not use MED PROFILES, but at VISU creates corresponding data strucutre + in order to construct mesh for MED TIEMSTAMPS in uniform way. + */ + ESubMeshStatus myStatus; + TSubMeshID mySubMeshID; //!< Keeps numbers of mesh cell which contain the MED PROFILE }; typedef SharedPtr PSubProfileImpl; @@ -271,77 +316,92 @@ namespace VISU typedef TVector TSubProfileArr; typedef std::map TGeom2SubProfile; + //! Specialize TProfile to provide VTK mapping for MED TIMESTAMP mesh struct TProfileImpl: virtual TProfile, virtual TAppendFilter { TProfileImpl(); - bool myIsAll; + bool myIsAll; //!< Say, whether the MED TIMESTAMP defined on all MED ENTITY or not + //! Reimplement the TIDMapper::GetNodeObjID virtual vtkIdType GetNodeObjID(vtkIdType theID) const; + //! Reimplement the TIDMapper::GetNodeVTKID virtual vtkIdType GetNodeVTKID(vtkIdType theID) const; + //! Reimplement the TIDMapper::GetNodeCoord virtual float* GetNodeCoord(vtkIdType theObjID); + //! Reimplement the TIDMapper::GetElemObjID virtual vtkIdType GetElemObjID(vtkIdType theID) const; + //! Reimplement the TIDMapper::GetElemVTKID virtual vtkIdType GetElemVTKID(vtkIdType theID) const; + //! Reimplement the TIDMapper::GetElemCell virtual vtkCell* GetElemCell(vtkIdType theObjID); + //! Get corresponding VTK output virtual TVTKOutput* GetVTKOutput(); - TID2ID myElemObj2VTKID; - TSubProfileArr mySubProfileArr; - PNamedPointCoords myNamedPointCoords; - TMeshOnEntityImpl* myMeshOnEntity; + TID2ID myElemObj2VTKID; //!< Keeps object to VTK numeration mapping + TSubProfileArr mySubProfileArr; //!< Keeps sequence of TSubProfiles as they was added into TAppendFilter + PNamedPointCoords myNamedPointCoords; //!< Keeps reference on the same TNamedPointCoords as TMesh + TMeshOnEntityImpl* myMeshOnEntity; // PProfileImpl; //--------------------------------------------------------------- + //! Specialize TMergeFilter to provide VTK mapping for MED TIMESTAMP mesh struct TIDMapperFilter: virtual TMergeFilter { - TAppendFilter myIDMapper; - TSource mySource; + TAppendFilter myIDMapper; //!< Responsible for numbering + TSource mySource; //!< Keeps assigned data + //! Reimplement the TIDMapper::GetNodeObjID virtual vtkIdType GetNodeObjID(vtkIdType theID) const; + //! Reimplement the TIDMapper::GetNodeVTKID virtual vtkIdType GetNodeVTKID(vtkIdType theID) const; + //! Reimplement the TIDMapper::GetNodeCoord virtual float* GetNodeCoord(vtkIdType theObjID); + //! Reimplement the TIDMapper::GetElemObjID virtual vtkIdType GetElemObjID(vtkIdType theID) const; + //! Reimplement the TIDMapper::GetElemVTKID virtual vtkIdType GetElemVTKID(vtkIdType theID) const; + //! Reimplement the TIDMapper::GetElemCell virtual vtkCell* GetElemCell(vtkIdType theObjID); @@ -354,28 +414,38 @@ namespace VISU //--------------------------------------------------------------- + //! Specialize TGauss to provide more detail information for the MED GAUSS entity struct TGaussImpl: virtual TGauss { - EGeometry myGeom; - std::string myName; - vtkIdType myNbPoints; + EGeometry myGeom; //!< Define, to which geometrical type the MED GAUSS entity belongs + std::string myName; //!< Keeps name of the MED GAUSS entity + vtkIdType myNbPoints; // PGaussImpl; //--------------------------------------------------------------- + //! Specialize TGaussSubMesh to provide VTK mapping for the entity struct TGaussSubMeshImpl: virtual TGaussSubMesh, virtual TSource { TGaussSubMeshImpl(); + //! To implement the TGaussPtsIDMapper::GetObjID virtual TGaussPointID GetObjID(vtkIdType theID) const; - PGaussImpl myGauss; + PGaussImpl myGauss; // PGaussSubMeshImpl; @@ -384,11 +454,13 @@ namespace VISU typedef TVector TGaussSubMeshArr; typedef std::map TGeom2GaussSubMesh; + //! Specialize TGaussMesh to provide VTK mapping for the entity struct TGaussMeshImpl: virtual TGaussMesh, virtual TAppendFilter { TGaussMeshImpl(); + //! Reimplement the TGaussPtsIDMapper::GetObjID virtual TGaussPointID GetObjID(vtkIdType theID) const; @@ -397,14 +469,15 @@ namespace VISU TVTKOutput* GetVTKOutput(); + //! Reimplement the TGaussPtsIDMapper::GetParent virtual TNamedIDMapper* GetParent(); - TSource mySource; - TNamedIDMapper* myParent; - TGaussSubMeshArr myGaussSubMeshArr; - TGeom2GaussSubMesh myGeom2GaussSubMesh; + TSource mySource; //!< Keeps VTK representation of the Gauss Points + TNamedIDMapper* myParent; //!< Refer to parent mesh + TGaussSubMeshArr myGaussSubMeshArr; //!< Keeps sequence of TGaussSubMesh as they was added into TAppendFilter + TGeom2GaussSubMesh myGeom2GaussSubMesh; //! Keeps TGaussSubMesh according to their geometrical type }; typedef SharedPtr PGaussMeshImpl; @@ -429,18 +502,22 @@ namespace VISU typedef TVector TConnect; typedef TVector TCell2Connect; + //! The class is responsible for mapping of cells of defined geometrical type struct TSubMeshImpl: virtual TSource { + + //! To implement the TIDMapper::GetElemObjID virtual vtkIdType GetElemObjID(vtkIdType theID) const; + //! To implement the TNamedIDMapper::GetElemName virtual std::string GetElemName(vtkIdType theObjID) const; vtkIdType myStartID; - TCell2Connect myCell2Connect; + TCell2Connect myCell2Connect; //!< Contains connectivity for the cells }; typedef SharedPtr PSubMeshImpl; @@ -449,39 +526,46 @@ namespace VISU typedef std::map TGeom2SubMesh; typedef TVector TSubMeshArr; + //! Specialize TMeshOnEntity to provide VTK mapping for the entity struct TMeshOnEntityImpl: virtual TMeshOnEntity, virtual TAppendFilter, virtual TSizeCounter { + //! Reimplement the TIDMapper::GetNodeVTKID virtual vtkIdType GetNodeVTKID(vtkIdType theID) const; + //! Reimplement the TIDMapper::GetNodeObjID virtual vtkIdType GetNodeObjID(vtkIdType theID) const; + //! Reimplement the TIDMapper::GetElemVTKID virtual vtkIdType GetElemVTKID(vtkIdType theID) const; + //! Reimplement the TIDMapper::GetElemObjID virtual vtkIdType GetElemObjID(vtkIdType theID) const; + //! Reimplement the TNamedIDMapper::GetNodeName virtual std::string GetNodeName(vtkIdType theObjID) const; + //! Reimplement the TNamedIDMapper::GetElemName virtual std::string GetElemName(vtkIdType theObjID) const; - TID2ID myElemObj2VTKID; - TSubMeshArr mySubMeshArr; - PNamedPointCoords myNamedPointCoords; + TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping + TSubMeshArr mySubMeshArr; //!< Keeps sequence of TSubMeshImpl as they were added into TAppendFilter + PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping - TGeom2SubMesh myGeom2SubMesh; + TGeom2SubMesh myGeom2SubMesh; //!< Keeps TSubMeshImpl according to their geometrical type }; typedef SharedPtr PMeshOnEntityImpl; @@ -489,20 +573,25 @@ namespace VISU //--------------------------------------------------------------- typedef std::map TGeom2SubMeshID; + //! Specialize TFamily to provide VTK mapping for the entity struct TFamilyImpl: virtual TFamily, virtual TSource { + //! Reimplement the TIDMapper::GetNodeObjID vtkIdType GetNodeObjID(vtkIdType theID) const ; + //! Reimplement the TIDMapper::GetNodeVTKID virtual vtkIdType GetNodeVTKID(vtkIdType theID) const ; + //! Reimplement the TIDMapper::GetElemVTKID virtual vtkIdType GetElemVTKID(vtkIdType theID) const; + //! Reimplement the TIDMapper::GetElemObjID virtual vtkIdType GetElemObjID(vtkIdType theID) const; @@ -511,11 +600,11 @@ namespace VISU TVTKOutput* GetVTKOutput(); - PNamedPointCoords myNamedPointCoords; - TID2ID myElemObj2VTKID; - TSubMeshID myMeshID; + PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping + TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping + TSubMeshID myMeshID; //!< Keeps numbers of mesh elements that belongs to the MED FAMILY - TGeom2SubMeshID myGeom2SubMeshID; + TGeom2SubMeshID myGeom2SubMeshID; //!< Keeps TSubMeshID according to their geometrical type }; typedef SharedPtr PFamilyImpl; @@ -524,31 +613,37 @@ namespace VISU typedef std::pair TNbASizeCells; typedef TVector TFamilyArr; + //! Specialize TGroup to provide VTK mapping for the entity struct TGroupImpl: virtual TGroup, virtual TAppendFilter { + //! Calculate pair of values - number of cells and its size TNbASizeCells GetNbASizeCells() const; + //! Reimplement the TIDMapper::GetElemVTKID virtual vtkIdType GetElemVTKID(vtkIdType theID) const; + //! Reimplement the TIDMapper::GetElemObjID virtual vtkIdType GetElemObjID(vtkIdType theID) const; + //! Reimplement the TIDMapper::GetNodeObjID virtual vtkIdType GetNodeObjID(vtkIdType theID) const; + //! Reimplement the TIDMapper::GetNodeVTKID virtual vtkIdType GetNodeVTKID(vtkIdType theID) const; - TID2ID myElemObj2VTKID; - TFamilyArr myFamilyArr; - PNamedPointCoords myNamedPointCoords; + TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping + TFamilyArr myFamilyArr; //!< Keeps sequence of TFamily as they were added into TAppendFilter + PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping }; typedef SharedPtr PGroupImpl; @@ -556,16 +651,19 @@ namespace VISU //--------------------------------------------------------------- typedef TVector TMinMaxArr; + //! Specialize TField to provide VTK mapping for the entity struct TFieldImpl: virtual TField { - vtkIdType myDataSize; + vtkIdType myDataSize; //!< Keeps size of the assigned data - TMinMaxArr myMinMaxArr; + TMinMaxArr myMinMaxArr; //!< Keeps min/max values for each component of the MED FIELD + //! Implement the TField::GetMinMax virtual TMinMax GetMinMax(vtkIdType theCompID); + //! To initialize the data structure void InitArrays(vtkIdType theNbComp); @@ -582,29 +680,35 @@ namespace VISU typedef TVector TCValueSliceArr; typedef TVector TValueSliceArr; + //! Define a container to get access to data assigned to mesh struct TMeshValue { - TValue myValue; + TValue myValue; //!< Keeps all values as one dimensional sequence - vtkIdType myNbElem; - vtkIdType myNbComp; - vtkIdType myNbGauss; - vtkIdType myStep; + vtkIdType myNbElem; //!< Defines number of mesh elements where the data assigned to + vtkIdType myNbComp; //!< Keeps number of components of corresponding MED FIELD + vtkIdType myNbGauss; //!< Defines number of Gauss Points + vtkIdType myStep; //! Internal variable + //! To intitilize the data strucutre void Init(vtkIdType theNbElem, vtkIdType theNbGauss, vtkIdType theNbComp); + //! To get assigned values first by Gauss Points and then by components (constant version) TCValueSliceArr GetGaussValueSliceArr(vtkIdType theElemId) const; + //! To get assigned values first by Gauss Points and then by components TValueSliceArr GetGaussValueSliceArr(vtkIdType theElemId); + //! To get assigned values first by components and then by Gauss Points (constant version) TCValueSliceArr GetCompValueSliceArr(vtkIdType theElemId) const; + //! To get assigned values first by components and then by Gauss Points TValueSliceArr GetCompValueSliceArr(vtkIdType theElemId); }; diff --git a/src/CONVERTOR/VISU_IDMapper.hxx b/src/CONVERTOR/VISU_IDMapper.hxx index 8bfdd23f..3fd19bb4 100644 --- a/src/CONVERTOR/VISU_IDMapper.hxx +++ b/src/CONVERTOR/VISU_IDMapper.hxx @@ -27,6 +27,11 @@ #ifndef VISU_IDMapper_HeaderFile #define VISU_IDMapper_HeaderFile +/*! + \file VISU_IDMapper.hxx + \brief The file contains declarations for basic interfaces that defines mapping of mesh elements +*/ + #include "MED_SharedPtr.hxx" #include @@ -50,32 +55,44 @@ namespace VISU //--------------------------------------------------------------- typedef vtkUnstructuredGrid TVTKOutput; + //! Defines a basic abstract interface for VTK to object ID's and backward mapping + /*! + Where object ID means ID which attached to corresponding MED entity. + For example, each MED node can have its own ID as well as any other mesh cell + */ struct TIDMapper: virtual TBaseStructure { + //! Get node object ID for corresponding VTK ID virtual vtkIdType GetNodeObjID(vtkIdType theID) const; + //! Get node VTK ID for corresponding object ID virtual vtkIdType GetNodeVTKID(vtkIdType theID) const; + //! Get coordinates of node for corresponding object ID virtual float* GetNodeCoord(vtkIdType theObjID); + //! Get cell object ID for corresponding VTK ID virtual vtkIdType GetElemObjID(vtkIdType theID) const; + //! Get cell VTK ID for corresponding object ID virtual vtkIdType GetElemVTKID(vtkIdType theID) const; + //! Get VTK representation of mesh cell for corresponding object ID virtual vtkCell* GetElemCell(vtkIdType theObjID); + //! Get VTK representation of mesh for corresponding MED entity virtual TVTKOutput* GetVTKOutput() = 0; @@ -84,12 +101,18 @@ namespace VISU //--------------------------------------------------------------- + //! Defines an abstract interface for VTK to object ID's and backward mapping + /*! + This class defines some additional methods that allow get names for corresponding mesh elements + */ struct TNamedIDMapper: virtual TIDMapper { + //! Get name of mesh node for corresponding object ID virtual std::string GetNodeName(vtkIdType theObjID) const = 0; + //! Get name of mesh cell for corresponding object ID virtual std::string GetElemName(vtkIdType theObjID) const = 0; @@ -98,16 +121,19 @@ namespace VISU //--------------------------------------------------------------- - typedef vtkIdType TCellID; + typedef vtkIdType TCellID; typedef vtkIdType TLocalPntID; + //! Defines a type that represent complex ID for defined Gauss Point typedef std::pair TGaussPointID; struct TGaussPtsIDMapper: virtual TIDMapper { + //! Gets complex Gauss Point ID by its VTK ID virtual TGaussPointID GetObjID(vtkIdType theID) const = 0; + //! Gets parent TNamedIDMapper, which contains reference mesh cells virtual TNamedIDMapper* GetParent() = 0; -- 2.39.2