X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FCONVERTOR%2FVISU_IDMapper.hxx;h=5a9fec79fead17514cd6ce72a5bd6623e6669431;hb=96e4e80db07d82b18c86c5ca6e7880cba573626b;hp=e86a08c3c0d30c2aeeb65058ee6ee0b4bc6f22c0;hpb=3f4152dedc1ae968267cfb8a079f261ec0088ed0;p=modules%2Fvisu.git diff --git a/src/CONVERTOR/VISU_IDMapper.hxx b/src/CONVERTOR/VISU_IDMapper.hxx index e86a08c3..5a9fec79 100644 --- a/src/CONVERTOR/VISU_IDMapper.hxx +++ b/src/CONVERTOR/VISU_IDMapper.hxx @@ -1,29 +1,29 @@ -// VISU CONVERTOR : +// 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 +// +// 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. // -// 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 +// 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 // +// VISU CONVERTOR : // File : VISU_Convertor.hxx // Author : Alexey PETROV // Module : VISU - +// #ifndef VISU_IDMapper_HeaderFile #define VISU_IDMapper_HeaderFile @@ -32,21 +32,104 @@ \brief The file contains declarations for basic interfaces that defines mapping of mesh elements */ +#include "VISUConvertor.hxx" + #include "MED_SharedPtr.hxx" +#include "MED_Vector.hxx" #include "VTKViewer.h" #include +#include class vtkUnstructuredGrid; +class vtkPolyData; +class vtkDataSet; class vtkCell; namespace VISU { using MED::SharedPtr; + using MED::TVector; + + + //--------------------------------------------------------------- + class VISU_CONVERTOR_EXPORT TStructuredId + { + vtkIdType myData[3]; + + public: + TStructuredId(); + + vtkIdType& + operator [] ( size_t theId ); + + const vtkIdType& + operator [] ( size_t theId ) const; + + bool + operator == ( const TStructuredId& theId ) const; + }; + + typedef std::map TObj2StructuredId; + typedef MED::SharedPtr PObj2StructuredId; + + struct TStructured; + typedef MED::SharedPtr PStructured; + + struct VISU_CONVERTOR_EXPORT TStructured + { + TStructured(): + myIsStructured(false), + myIsPolarType(true) + {} + + //! Copys all information which should be sinchronized between two instances + virtual + void + CopyStructure(PStructured theStructured); + + bool + IsStructured() const; + + /*! + * Get structure of grille + * see also MED::TGrilleInfo::GetGrilleStructure + * see also MED::TGrilleInfo::GetNbIndexes + */ + TStructuredId + GetStructure(); + + vtkIdType + GetStructureDim(); + + /*! + * Gets i,j,k by object id + * return -1, if not found + */ + TStructuredId + GetIndexesOfNode(vtkIdType theNodeId); + + /*! + * Gets object id by i,j,k + * return -1, if not found + */ + vtkIdType + GetObjectIDByIndexes(TStructuredId theVec); + bool myIsStructured; //!< To define mesh type (structured - true, non structured - false) + bool myIsPolarType; //!< To define structured mesh is polair + + /*!provides grille structure for structured grid. + * Example: {3,4,5}, 3 nodes in X axe, 4 nodes in Y axe, ... + */ + TStructuredId myGrilleStructure; + + TObj2StructuredId myObj2StructuredId;//!< map of object id to i,j,k ids of structured grid nodes + }; + //--------------------------------------------------------------- //! Defines a basic class for intemediate data structures - struct TBaseStructure + struct VISU_CONVERTOR_EXPORT TBaseStructure: virtual TStructured { //! Just to provide possibility of dynamic navigation through the class hierarchy virtual ~TBaseStructure() @@ -54,17 +137,15 @@ namespace VISU std::string myEntry; //!< To simplify publication of the object tree }; - typedef SharedPtr PBaseStructure; + typedef MED::SharedPtr PBaseStructure; //--------------------------------------------------------------- - 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 + struct VISU_CONVERTOR_EXPORT TIDMapper: virtual TBaseStructure { //! Get node object ID for corresponding VTK ID virtual @@ -98,10 +179,31 @@ namespace VISU //! Get VTK representation of mesh for corresponding MED entity virtual - TVTKOutput* - GetVTKOutput() = 0; + vtkDataSet* + GetOutput() = 0; + + //! Gets memory size used by the instance (bytes). + virtual + unsigned long int + GetMemorySize() = 0; }; - typedef SharedPtr PIDMapper; + typedef MED::SharedPtr PIDMapper; + + + //--------------------------------------------------------------- + struct VISU_CONVERTOR_EXPORT TUnstructuredGridIDMapper: virtual TIDMapper + { + //! Get VTK representation of mesh for corresponding MED entity + virtual + vtkUnstructuredGrid* + GetUnstructuredGridOutput() = 0; + + //! Reimplement the TIDMapper::GetOutput + virtual + vtkDataSet* + GetOutput(); + }; + typedef MED::SharedPtr PUnstructuredGridIDMapper; //--------------------------------------------------------------- @@ -109,7 +211,7 @@ namespace VISU /*! This class defines some additional methods that allow get names for corresponding mesh elements */ - struct TNamedIDMapper: virtual TIDMapper + struct TNamedIDMapper: virtual TUnstructuredGridIDMapper { //! Get name of mesh node for corresponding object ID virtual @@ -121,7 +223,23 @@ namespace VISU std::string GetElemName(vtkIdType theObjID) const = 0; }; - typedef SharedPtr PNamedIDMapper; + typedef MED::SharedPtr PNamedIDMapper; + + + //--------------------------------------------------------------- + struct TPolyDataIDMapper: virtual TIDMapper + { + //! Get VTK representation of mesh for corresponding MED entity + virtual + vtkPolyData* + GetPolyDataOutput() = 0; + + //! Reimplement the TIDMapper::GetOutput + virtual + vtkDataSet* + GetOutput(); + }; + typedef MED::SharedPtr PPolyDataIDMapper; //--------------------------------------------------------------- @@ -130,19 +248,24 @@ namespace VISU //! Defines a type that represent complex ID for defined Gauss Point typedef std::pair TGaussPointID; - struct TGaussPtsIDMapper: virtual TIDMapper + struct TGaussPtsIDMapper: virtual TPolyDataIDMapper { //! Gets complex Gauss Point ID by its VTK ID virtual TGaussPointID GetObjID(vtkIdType theID) const = 0; + //! Gets VTK ID by its complex Gauss Point ID + virtual + vtkIdType + GetVTKID(const TGaussPointID& theID) const = 0; + //! Gets parent TNamedIDMapper, which contains reference mesh cells virtual TNamedIDMapper* - GetParent() = 0; + GetParent() const = 0; }; - typedef SharedPtr PGaussPtsIDMapper; + typedef MED::SharedPtr PGaussPtsIDMapper; //--------------------------------------------------------------- }