Version: 6.3.1

src/CONVERTOR/VISU_IDMapper.hxx

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  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 //  VISU CONVERTOR :
00024 //  File   : VISU_Convertor.hxx
00025 //  Author : Alexey PETROV
00026 //  Module : VISU
00027 //
00028 #ifndef VISU_IDMapper_HeaderFile
00029 #define VISU_IDMapper_HeaderFile
00030 
00036 #include "VISUConvertor.hxx"
00037 
00038 #include "MED_SharedPtr.hxx"
00039 #include "MED_Vector.hxx"
00040 #include "VTKViewer.h"
00041 
00042 #include <string>
00043 #include <map>
00044 
00045 class vtkUnstructuredGrid;
00046 class vtkPolyData;
00047 class vtkDataSet;
00048 class vtkCell;
00049 
00050 namespace VISU
00051 {
00052   using MED::SharedPtr;
00053   using MED::TVector;
00054 
00055 
00056   //---------------------------------------------------------------
00057   class VISU_CONVERTOR_EXPORT TStructuredId
00058   {
00059     vtkIdType myData[3];
00060 
00061   public:
00062     TStructuredId();
00063 
00064     vtkIdType&
00065     operator [] ( size_t theId );
00066 
00067     const vtkIdType&
00068     operator [] ( size_t theId ) const;
00069 
00070     bool
00071     operator == ( const TStructuredId& theId ) const;
00072   };
00073 
00074   typedef std::map<vtkIdType, TStructuredId> TObj2StructuredId;
00075   typedef MED::SharedPtr<TObj2StructuredId> PObj2StructuredId;
00076   
00077   struct TStructured;
00078   typedef MED::SharedPtr<TStructured> PStructured;
00079   
00080   struct VISU_CONVERTOR_EXPORT TStructured
00081   {
00082     TStructured():
00083       myIsStructured(false),
00084       myIsPolarType(true)
00085     {}
00086 
00088     virtual
00089     void
00090     CopyStructure(PStructured theStructured);
00091 
00092     bool
00093     IsStructured() const;
00094 
00100     TStructuredId
00101     GetStructure();
00102     
00103     vtkIdType
00104     GetStructureDim();
00105     
00110     TStructuredId
00111     GetIndexesOfNode(vtkIdType theNodeId);
00112 
00117     vtkIdType
00118     GetObjectIDByIndexes(TStructuredId theVec);
00119 
00120     bool myIsStructured; 
00121     bool myIsPolarType; 
00122 
00126     TStructuredId myGrilleStructure;
00127     
00128     TObj2StructuredId myObj2StructuredId;
00129   };
00130   
00131   //---------------------------------------------------------------
00133   struct VISU_CONVERTOR_EXPORT TBaseStructure: virtual TStructured
00134   {
00136     virtual ~TBaseStructure()
00137     {}
00138 
00139     std::string myEntry; 
00140   };
00141   typedef MED::SharedPtr<TBaseStructure> PBaseStructure;
00142 
00143   //---------------------------------------------------------------
00145 
00149   struct VISU_CONVERTOR_EXPORT TIDMapper: virtual TBaseStructure
00150   {
00152     virtual 
00153     vtkIdType 
00154     GetNodeObjID(vtkIdType theID) const;
00155 
00157     virtual 
00158     vtkIdType 
00159     GetNodeVTKID(vtkIdType theID) const;
00160 
00162     virtual
00163     vtkFloatingPointType* 
00164     GetNodeCoord(vtkIdType theObjID);
00165 
00167     virtual 
00168     vtkIdType 
00169     GetElemObjID(vtkIdType theID) const;
00170 
00172     virtual 
00173     vtkIdType 
00174     GetElemVTKID(vtkIdType theID) const;
00175 
00177     virtual
00178     vtkCell* 
00179     GetElemCell(vtkIdType theObjID);
00180 
00182     virtual
00183     vtkDataSet*
00184     GetOutput() = 0;
00185 
00187     virtual
00188     unsigned long int
00189     GetMemorySize() = 0;
00190   };
00191   typedef MED::SharedPtr<TIDMapper> PIDMapper;
00192   
00193 
00194   //---------------------------------------------------------------
00195   struct VISU_CONVERTOR_EXPORT TUnstructuredGridIDMapper: virtual TIDMapper
00196   {
00198     virtual
00199     vtkUnstructuredGrid*
00200     GetUnstructuredGridOutput() = 0;
00201 
00203     virtual
00204     vtkDataSet*
00205     GetOutput();
00206   };
00207   typedef MED::SharedPtr<TUnstructuredGridIDMapper> PUnstructuredGridIDMapper;
00208   
00209 
00210   //---------------------------------------------------------------
00212 
00215   struct TNamedIDMapper: virtual TUnstructuredGridIDMapper
00216   {
00218     virtual
00219     std::string 
00220     GetNodeName(vtkIdType theObjID) const = 0;
00221 
00223     virtual
00224     std::string 
00225     GetElemName(vtkIdType theObjID) const = 0;
00226   };
00227   typedef MED::SharedPtr<TNamedIDMapper> PNamedIDMapper;
00228   
00229 
00230   //---------------------------------------------------------------
00231   struct TPolyDataIDMapper: virtual TIDMapper
00232   {
00234     virtual
00235     vtkPolyData*
00236     GetPolyDataOutput() = 0;
00237 
00239     virtual
00240     vtkDataSet*
00241     GetOutput();
00242   };
00243   typedef MED::SharedPtr<TPolyDataIDMapper> PPolyDataIDMapper;
00244   
00245 
00246   //---------------------------------------------------------------
00247   typedef vtkIdType TCellID; 
00248   typedef vtkIdType TLocalPntID;
00250   typedef std::pair<TCellID,TLocalPntID> TGaussPointID;
00251 
00252   struct TGaussPtsIDMapper: virtual TPolyDataIDMapper
00253   {
00255     virtual 
00256     TGaussPointID 
00257     GetObjID(vtkIdType theID) const = 0;
00258 
00260     virtual 
00261     vtkIdType 
00262     GetVTKID(const TGaussPointID& theID) const = 0;
00263 
00265     virtual 
00266     TNamedIDMapper*
00267     GetParent() const = 0;
00268   };
00269   typedef MED::SharedPtr<TGaussPtsIDMapper> PGaussPtsIDMapper;
00270 
00271   //---------------------------------------------------------------
00272 }
00273 
00274 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS