src/CONVERTOR/VISU_IDMapper.hxx

Go to the documentation of this file.
00001 //  VISU CONVERTOR :
00002 //
00003 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
00005 // 
00006 //  This library is free software; you can redistribute it and/or 
00007 //  modify it under the terms of the GNU Lesser General Public 
00008 //  License as published by the Free Software Foundation; either 
00009 //  version 2.1 of the License. 
00010 // 
00011 //  This library is distributed in the hope that it will be useful, 
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
00014 //  Lesser General Public License for more details. 
00015 // 
00016 //  You should have received a copy of the GNU Lesser General Public 
00017 //  License along with this library; if not, write to the Free Software 
00018 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
00019 // 
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 //
00023 //  File   : VISU_Convertor.hxx
00024 //  Author : Alexey PETROV
00025 //  Module : VISU
00026 
00027 #ifndef VISU_IDMapper_HeaderFile
00028 #define VISU_IDMapper_HeaderFile
00029 
00035 #include "MED_SharedPtr.hxx"
00036 #include "MED_Vector.hxx"
00037 #include "VTKViewer.h"
00038 
00039 #include <string>
00040 #include <map>
00041 
00042 class vtkUnstructuredGrid;
00043 class vtkCell;
00044 
00045 namespace VISU
00046 {
00047   using MED::SharedPtr;
00048   using MED::TVector;
00049 
00050   
00051   typedef TVector<vtkIdType> TIdTypeVector;
00052   typedef std::map<vtkIdType,TIdTypeVector> TObj2IdTypeVector;
00053   
00054   struct TStructured
00055   {
00056     TStructured():
00057       myIsStructured(false),
00058       myType(true)
00059     {}
00060 
00061     virtual
00062     bool
00063     IsStructured() const;
00064 
00070     virtual TIdTypeVector
00071     GetStructure();
00072     
00077     virtual TIdTypeVector
00078     GetIndexesOfNode(vtkIdType theNodeId);
00079 
00084     virtual vtkIdType
00085     GetObjectIDByIndexes(TIdTypeVector theVec);
00086 
00087   public:
00088     bool myIsStructured; 
00089     bool myType; 
00090 
00094     TIdTypeVector myGrilleStructure;
00095     
00096     TObj2IdTypeVector myObjID2StructureID;
00097     
00098   };
00099   
00100   //---------------------------------------------------------------
00102   struct TBaseStructure: virtual TStructured
00103   {
00105     virtual ~TBaseStructure()
00106     {}
00107 
00108     std::string myEntry; 
00109   };
00110   typedef SharedPtr<TBaseStructure> PBaseStructure;
00111 
00112   //---------------------------------------------------------------
00113   typedef vtkUnstructuredGrid TVTKOutput;
00114 
00116 
00120   struct TIDMapper: virtual TBaseStructure
00121   {
00123     virtual 
00124     vtkIdType 
00125     GetNodeObjID(vtkIdType theID) const;
00126 
00128     virtual 
00129     vtkIdType 
00130     GetNodeVTKID(vtkIdType theID) const;
00131 
00133     virtual
00134     vtkFloatingPointType* 
00135     GetNodeCoord(vtkIdType theObjID);
00136 
00138     virtual 
00139     vtkIdType 
00140     GetElemObjID(vtkIdType theID) const;
00141 
00143     virtual 
00144     vtkIdType 
00145     GetElemVTKID(vtkIdType theID) const;
00146 
00148     virtual
00149     vtkCell* 
00150     GetElemCell(vtkIdType theObjID);
00151 
00153     virtual
00154     TVTKOutput*
00155     GetVTKOutput() = 0;
00156   };
00157   typedef SharedPtr<TIDMapper> PIDMapper;
00158   
00159 
00160   //---------------------------------------------------------------
00162 
00165   struct TNamedIDMapper: virtual TIDMapper
00166   {
00168     virtual
00169     std::string 
00170     GetNodeName(vtkIdType theObjID) const = 0;
00171 
00173     virtual
00174     std::string 
00175     GetElemName(vtkIdType theObjID) const = 0;
00176   };
00177   typedef SharedPtr<TNamedIDMapper> PNamedIDMapper;
00178   
00179 
00180   //---------------------------------------------------------------
00181   typedef vtkIdType TCellID; 
00182   typedef vtkIdType TLocalPntID;
00184   typedef std::pair<TCellID,TLocalPntID> TGaussPointID;
00185 
00186   struct TGaussPtsIDMapper: virtual TIDMapper
00187   {
00189     virtual 
00190     TGaussPointID 
00191     GetObjID(vtkIdType theID) const = 0;
00192 
00194     virtual 
00195     TNamedIDMapper*
00196     GetParent() = 0;
00197   };
00198   typedef SharedPtr<TGaussPtsIDMapper> PGaussPtsIDMapper;
00199 
00200   //---------------------------------------------------------------
00201 }
00202 
00203 #endif