-// SALOME VTKViewer : build VTK viewer into Salome desktop
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// SALOME VTKViewer : build VTK viewer into Salome desktop
// File :
// Author :
// Module : SALOME
// $Header$
-
+//
#ifndef VISU_Convertor_impl_HeaderFile
#define VISU_Convertor_impl_HeaderFile
-#include <vtkSmartPointer.h>
-
-#include <boost/tuple/tuple.hpp>
-
-class vtkCell;
-class vtkPoints;
-class vtkUnstructuredGrid;
-class VTKViewer_AppendFilter;
-class VISU_MergeFilter;
-
#include "VISU_Convertor.hxx"
-#include "MED_SliceArray.hxx"
-
-#ifndef VISU_ENABLE_QUADRATIC
-#define VISU_ENABLE_QUADRATIC
-#define VISU_USE_VTK_QUADRATIC
-#endif
-
-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);
-
- //---------------------------------------------------------------
- using MED::TCSlice;
- using MED::TSlice;
-
- typedef vtkUnstructuredGrid TDataSet;
-
- typedef vtkSmartPointer<TDataSet> TVTKSource;
- typedef vtkSmartPointer<vtkPoints> TVTKPoints;
- typedef vtkSmartPointer<VISU_MergeFilter> TVTKMergeFilter;
-
- typedef vtkSmartPointer<VTKViewer_AppendFilter> TVTKAppendFilter;
-
- typedef float TCoord;
-
- //---------------------------------------------------------------
- //! Define an utility base class which is repsonsible for preventing repetion
- struct TIsVTKDone: virtual TBaseStructure
- {
- TIsVTKDone();
- 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; //!< 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:
- mutable TVTKSource mySource;
- public:
- TSource();
-
- //! This method allow to create corresponding VTK data set by demand (not at once)
- const TVTKSource&
- GetSource() const;
-
- //! Reimplement the TIDMapper::GetVTKOutput
- virtual
- TVTKOutput*
- GetVTKOutput();
- };
-
-
- //---------------------------------------------------------------
- //! 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
- {
- protected:
- mutable TVTKAppendFilter myFilter;
- public:
- TAppendFilter();
-
- //! This method allow to create corresponding VTK filter by demand (not at once)
- const TVTKAppendFilter&
- GetFilter() const;
-
- //! Reimplement the TIDMapper::GetVTKOutput
- virtual
- TVTKOutput*
- GetVTKOutput();
- };
-
-
- //---------------------------------------------------------------
- //! 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
- {
- protected:
- mutable TVTKMergeFilter myFilter;
- public:
- TMergeFilter();
-
- //! This method allow to create corresponding VTK filter by demand (not at once)
- const TVTKMergeFilter&
- GetFilter() const;
-
- //! Reimplement the TIDMapper::GetVTKOutput
- virtual
- TVTKOutput*
- GetVTKOutput();
- };
-
-
- //---------------------------------------------------------------
- typedef TVector<TCoord> TCoordArray;
- typedef TSlice<TCoordArray> TCoordSlice;
- typedef TCSlice<TCoordArray> TCCoordSlice;
-
- //! This class is responsible for representation of mesh nodes
- class TPointCoords: public virtual TBaseStructure
- {
- protected:
- vtkIdType myDim; //!< Dimension of the nodal coordinates
- vtkIdType myNbPoints; //!< Number of nodes in corresponding mesh
-
- //! 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);
-
- vtkIdType
- GetNbPoints() const { return myNbPoints; }
-
- vtkIdType
- GetDim() const { return myDim; }
-
- vtkIdType
- size() const { return GetNbPoints(); }
-
- const TVTKPoints&
- GetPoints() const { return myPoints;}
- };
- typedef SharedPtr<TPointCoords> PPointCoords;
-
-
- //---------------------------------------------------------------
- typedef TVector<vtkIdType> TVectorID;
- typedef std::map<vtkIdType,vtkIdType> 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<std::string> TPointsDim;
- 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;
- };
- typedef SharedPtr<TNamedPointCoords> PNamedPointCoords;
-
-
- //---------------------------------------------------------------
- //! Specialize TMesh to provide VTK mapping for nodes
- struct TMeshImpl: virtual TMesh,
- virtual TIsVTKDone
- {
- PNamedPointCoords myNamedPointCoords; //!< Keeps intermediate representation of the nodes
-
- TVTKPoints myPoints; //!< Keeps VTK representation of the nodes
- vtkIdType myNbPoints; //!< Keeps number of the nodes
-
- TMeshImpl();
- };
- typedef SharedPtr<TMeshImpl> PMeshImpl;
-
-
- //---------------------------------------------------------------
- typedef TVector<vtkIdType> TSubMeshID;
- typedef enum {eRemoveAll, eAddAll, eAddPart, eNone} ESubMeshStatus;
-
- //! Specialize TSubProfile to provide VTK mapping
- struct TSubProfileImpl: virtual TSubProfile,
- virtual TSource
- {
- TSubProfileImpl();
-
- 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;
-
- //! 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<TSubProfileImpl> PSubProfileImpl;
-
-
- //---------------------------------------------------------------
- struct TMeshOnEntityImpl;
-
- typedef std::map<vtkIdType,vtkIdType> TID2ID;
- typedef TVector<PSubProfileImpl> TSubProfileArr;
- typedef std::map<EGeometry,PSubProfileImpl> TGeom2SubProfile;
-
- //! Specialize TProfile to provide VTK mapping for MED TIMESTAMP mesh
- struct TProfileImpl: virtual TProfile,
- virtual TAppendFilter
- {
- TProfileImpl();
- 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);
-
- //! Reimplement the TIDMapper::GetVTKOutput
- virtual
- TVTKOutput*
- GetVTKOutput();
-
- //! Reimplement the TNamedIDMapper::GetNodeName
- virtual
- std::string
- GetNodeName(vtkIdType theObjID) const;
-
- //! Reimplement the TNamedIDMapper::GetElemName
- virtual
- std::string
- GetElemName(vtkIdType theObjID) const;
-
- TID2ID myElemObj2VTKID; //!< Keeps object to VTK numeration mapping
- TSubProfileArr mySubProfileArr; //!< Keeps sequence of TSubProfiles as they were added into TAppendFilter
- PNamedPointCoords myNamedPointCoords; //!< Keeps reference on the same TNamedPointCoords as TMesh
- TMeshOnEntityImpl* myMeshOnEntity; //<! Keeps backward reference to corresponding MED ENTITY mesh
-
- TSource mySource; //!< Keeps VTK representation of the MED TIMESTAMP mesh
- TGeom2SubProfile myGeom2SubProfile; //!< Keeps TSubProfiles according to their geometrical type
- };
- typedef SharedPtr<TProfileImpl> PProfileImpl;
-
-
- //---------------------------------------------------------------
- //! Specialize TIDMapper to provide VTK mapping for MED TIMESTAMP mesh
- struct TIDMapperFilter: virtual TMergeFilter
- {
- 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);
-
- //! Reimplement the TIDMapper::GetVTKOutput
- virtual
- TVTKOutput*
- GetVTKOutput();
- };
- typedef SharedPtr<TIDMapperFilter> PIDMapperFilter;
-
-
- //---------------------------------------------------------------
- struct TGaussImpl;
- typedef SharedPtr<TGaussImpl> PGaussImpl;
-
- //! Specialize TGauss to provide more detail information of the MED GAUSS entity for VTK mapping
- struct TGaussImpl: virtual TGauss
- {
- EGeometry myGeom; //!< Define, to which geometrical type the MED GAUSS entity belongs
- std::string myName; //!< Keeps name of the MED GAUSS entity
- vtkIdType myNbPoints; //<! Keeps number of points for the MED GAUSS entity
-
- //! To define a way to implement more detail comparision of the TGaussSubMesh instances
- virtual
- void
- LessThan(const PGaussImpl& theGauss,
- bool& theResult) const;
- };
-
-
- //---------------------------------------------------------------
- //! 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; //<! Keep reference to corresponding TGauss structure
-
- //! Keeps status of the structure
- /*!
- In some cases MED file does not use MED GAUSS, but at VISU creates corresponding data strucutre
- in order to construct mesh for MED TIEMSTAMPS in uniform way.
- */
- ESubMeshStatus myStatus;
-
- TPointCoords myPointCoords; //!< Keeps coordinates of Gauss Points
- };
- typedef SharedPtr<TGaussSubMeshImpl> PGaussSubMeshImpl;
-
-
- //---------------------------------------------------------------
- typedef TVector<PGaussSubMeshImpl> TGaussSubMeshArr;
- typedef std::map<EGeometry,PGaussSubMeshImpl> 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;
-
- //! Reimplement the TIDMapper::GetVTKOutput
- virtual
- TVTKOutput*
- GetVTKOutput();
-
- //! Reimplement the TGaussPtsIDMapper::GetParent
- virtual
- TNamedIDMapper*
- GetParent();
-
- TSource mySource; //!< Keeps VTK representation of the Gauss Points
- TNamedIDMapper* myParent; //!< Refer to parent mesh
- TGaussSubMeshArr myGaussSubMeshArr; //!< Keeps sequence of TGaussSubMesh as they were added into TAppendFilter
- TGeom2GaussSubMesh myGeom2GaussSubMesh; //!< Keeps TGaussSubMesh according to their geometrical type
- };
- typedef SharedPtr<TGaussMeshImpl> PGaussMeshImpl;
-
-
- //---------------------------------------------------------------
- //! Specialize TGaussPtsIDMapper to provide VTK mapping for MED TIMESTAMP mesh
- struct TGaussPtsIDFilter: virtual TIDMapperFilter,
- virtual TGaussPtsIDMapper
- {
- PGaussPtsIDMapper myGaussPtsIDMapper;
-
- //! Reimplement the TGaussPtsIDMapper::GetObjID
- virtual
- TGaussPointID
- GetObjID(vtkIdType theID) const;
-
- //! Reimplement the TGaussPtsIDMapper::GetParent
- virtual
- TNamedIDMapper*
- GetParent();
- };
- typedef SharedPtr<TGaussPtsIDFilter> PGaussPtsIDFilter;
-
-
- //---------------------------------------------------------------
- typedef TVector<vtkIdType> TConnect;
- typedef TVector<TConnect> 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; //!< Contains connectivity for the cells
- };
- typedef SharedPtr<TSubMeshImpl> PSubMeshImpl;
-
-
- //---------------------------------------------------------------
- typedef std::map<EGeometry,PSubMeshImpl> TGeom2SubMesh;
- typedef TVector<PSubMeshImpl> 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; //!< 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; //!< Keeps TSubMeshImpl according to their geometrical type
- };
- typedef SharedPtr<TMeshOnEntityImpl> PMeshOnEntityImpl;
-
-
- //---------------------------------------------------------------
- typedef std::map<EGeometry,TSubMeshID> 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;
-
- //! Reimplement the TIDMapper::GetVTKOutput
- virtual
- TVTKOutput*
- GetVTKOutput();
-
- 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; //!< Keeps TSubMeshID according to their geometrical type
- };
- typedef SharedPtr<TFamilyImpl> PFamilyImpl;
-
-
- //---------------------------------------------------------------
- typedef std::pair<vtkIdType,vtkIdType> TNbASizeCells;
- typedef TVector<PFamilyImpl> 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; //!< 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<TGroupImpl> PGroupImpl;
-
-
- //---------------------------------------------------------------
- typedef TVector<TMinMax> TMinMaxArr;
-
- //! Specialize TField to provide VTK mapping for the entity
- struct TFieldImpl: virtual TField
- {
- vtkIdType myDataSize; //!< Keeps size of the assigned data
-
- 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);
-
- TFieldImpl();
- };
- typedef SharedPtr<TFieldImpl> PFieldImpl;
-
-
- //---------------------------------------------------------------
- typedef TVector<float> TValue;
- typedef TSlice<TValue> TValueSlice;
- typedef TCSlice<TValue> TCValueSlice;
-
- typedef TVector<TCValueSlice> TCValueSliceArr;
- typedef TVector<TValueSlice> TValueSliceArr;
-
- //! Define a container to get access to data assigned to mesh
- struct TMeshValue
- {
- TValue myValue; //!< Keeps all values as one dimensional sequence
-
- 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);
- };
-
+#include "VISU_ConvertorDef_impl.hxx"
- //---------------------------------------------------------------
- typedef std::map<EGeometry,TMeshValue> TGeom2Value;
- typedef std::map<EGeometry,vtkIdType> TGeom2NbGauss;
-
- //! Specialize TValForTime to provide VTK mapping for the entity
- struct TValForTimeImpl: virtual TValForTime
- {
- PGaussPtsIDFilter myGaussPtsIDFilter; //!< Keep VTK representation for mesh and data on Gauss Points
- PIDMapperFilter myIDMapperFilter; //!< Keep VTK representation for ordinary mesh and data
- TGeom2Value myGeom2Value; //!< Keep value that is assigned to the mesh
- TGeom2NbGauss myGeom2NbGauss; //!< Keep number of Gauss Points
-
- TValForTimeImpl();
-
- //! Get mesh data for defined geometrical type (constant version)
- const TMeshValue&
- GetMeshValue(EGeometry theGeom) const;
-
- //! Get mesh data for defined geometrical type
- TMeshValue&
- GetMeshValue(EGeometry theGeom);
-
- //! Get number of Gauss Points for defined geometrical type
- virtual
- int
- GetNbGauss(EGeometry theGeom) const;
- };
- typedef SharedPtr<TValForTimeImpl> PValForTimeImpl;
-}
+#include <boost/tuple/tuple.hpp>
+//---------------------------------------------------------------
//! This class perfroms mapping of intermediate data strucutres into corresponding VTK representation
/*!
It implements VISU_Convertor public interface and declare new pure virtual functions
to fill its intermediate data structure from a MED source
*/
-class VISU_Convertor_impl: public VISU_Convertor
+class VISU_CONVERTOR_EXPORT VISU_Convertor_impl: public VISU_Convertor
{
public:
VISU_Convertor_impl();
//! Implemention of the VISU_Convertor::GetSize
virtual
- float
+ size_t
GetSize();
//! Implemention of the VISU_Convertor::GetMeshOnEntity
//! Implemention of the VISU_Convertor::GetMeshOnEntitySize
virtual
- float
+ size_t
GetMeshOnEntitySize(const std::string& theMeshName,
const VISU::TEntity& theEntity);
//! Implemention of the VISU_Convertor::GetFamilyOnEntity
virtual
- VISU::PIDMapper
+ VISU::PUnstructuredGridIDMapper
GetFamilyOnEntity(const std::string& theMeshName,
const VISU::TEntity& theEntity,
const std::string& theFamilyName);
//! Implemention of the VISU_Convertor::GetFamilyOnEntitySize
virtual
- float
+ size_t
GetFamilyOnEntitySize(const std::string& theMeshName,
const VISU::TEntity& theEntity,
const std::string& theFamilyName);
//! Implemention of the VISU_Convertor::GetMeshOnGroup
virtual
- VISU::PIDMapper
+ VISU::PUnstructuredGridIDMapper
GetMeshOnGroup(const std::string& theMeshName,
const std::string& theGroupName);
//! Implemention of the VISU_Convertor::GetMeshOnGroupSize
virtual
- float
+ size_t
GetMeshOnGroupSize(const std::string& theMeshName,
const std::string& theGroupName);
//! Implemention of the VISU_Convertor::GetTimeStampOnMesh
virtual
- VISU::PIDMapper
- GetTimeStampOnMesh(const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFieldName,
- int theStampsNum);
+ VISU::PUnstructuredGridIDMapper
+ GetTimeStampOnMesh( const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFieldName,
+ int theTimeStampNumber );
- //! Implemention of the VISU_Convertor::GetTimeStampSize
+ //! Get amount of memory to build vtkDataSet for corresponding MED TIMESTAMP on mesh
virtual
- float
- GetTimeStampSize(const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFieldName,
- int theStampsNum);
+ size_t
+ GetTimeStampOnMeshSize(const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFieldName,
+ int theTimeStampNumber,
+ bool& theIsEstimated);
+
+ //! Get amount of memory to build vtkDataSet for corresponding MED TIMESTAMP on Gauss Points
+ virtual
+ size_t
+ GetTimeStampOnGaussPtsSize(const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFieldName,
+ int theTimeStampNumber,
+ bool& theIsEstimated);
//! Implemention of the VISU_Convertor::GetTimeStampOnGaussPts
virtual
GetTimeStampOnGaussPts(const std::string& theMeshName,
const VISU::TEntity& theEntity,
const std::string& theFieldName,
- int theStampsNum);
+ int theTimeStampNumber);
//! Implemention of the VISU_Convertor::GetFieldOnMeshSize
virtual
- float
+ size_t
GetFieldOnMeshSize(const std::string& theMeshName,
const VISU::TEntity& theEntity,
const std::string& theFieldName);
FindMesh(const std::string& theMeshName);
//! An utility method to find TMeshOnEntity by name of its parent mesh and entity
- typedef boost::tuple<VISU::PMeshImpl,VISU::PMeshOnEntityImpl> TFindMeshOnEntity;
+ typedef boost::tuple<VISU::PMeshImpl,
+ VISU::PMeshOnEntityImpl> TFindMeshOnEntity;
TFindMeshOnEntity
FindMeshOnEntity(const std::string& theMeshName,
const VISU::TEntity& theEntity);
//! An utility method to find TFamily by name of its parent mesh, corresponding entity and its name
- typedef boost::tuple<VISU::PMeshImpl,VISU::PMeshOnEntityImpl,VISU::PFamilyImpl> TFindFamilyOnEntity;
+ typedef boost::tuple<VISU::PMeshImpl,
+ VISU::PMeshOnEntityImpl,VISU::PFamilyImpl> TFindFamilyOnEntity;
TFindFamilyOnEntity
FindFamilyOnEntity(const std::string& theMeshName,
const VISU::TEntity& theEntity,
const std::string& theFamilyName);
//! An utility method to find Group by name of its parent mesh and its name
- typedef boost::tuple<VISU::PMeshImpl,VISU::PGroupImpl> TFindMeshOnGroup;
+ typedef boost::tuple<VISU::PMeshImpl,
+ VISU::PGroupImpl> TFindMeshOnGroup;
TFindMeshOnGroup
FindMeshOnGroup(const std::string& theMeshName,
const std::string& theGroupName);
VISU::PMeshOnEntityImpl,
VISU::PFieldImpl> TFindField;
TFindField
- FindField(const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFieldName);
+ FindField( const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFieldName );
//! An utility method to find TTimeStamp by name of its parent mesh, corresponding entity, field name and its number
typedef boost::tuple<VISU::PMeshImpl,
const std::string& theFieldName,
int theStampsNum);
- VISU::TVTKOutput*
- GetTimeStampOnProfile(const VISU::PMeshImpl& theMesh,
- const VISU::PMeshOnEntityImpl& theMeshOnEntity,
- const VISU::PFieldImpl& theField,
- const VISU::PValForTimeImpl& theValForTime,
- const VISU::PIDMapperFilter& theIDMapperFilter,
- const VISU::PProfileImpl& theProfile,
- const VISU::TEntity& theEntity);
-
+ vtkUnstructuredGrid*
+ GetTimeStampOnProfile( const VISU::PMeshImpl& theMesh,
+ const VISU::PMeshOnEntityImpl& theMeshOnEntity,
+ const VISU::PFieldImpl& theField,
+ const VISU::PValForTimeImpl& theValForTime,
+ const VISU::PUnstructuredGridIDMapperImpl& theIDMapperFilter,
+ const VISU::PProfileImpl& theProfile,
+ const VISU::TEntity& theEntity );
+
protected:
+ //! Implemention of the VISU_Convertor::GetTimeStampSize
+ virtual
+ size_t
+ GetTimeStampSize(const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFieldName,
+ int theStampsNum);
+
//! To fill intermeiate representation of TMeshOnEntity from a MED source
virtual
int