1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : VISU_Vtk2MedConvertor.hxx
23 // Author : Eugeny NIKOLAEV, Open CASCADE SAS
26 #ifndef VISU_VTK2MEDCONVERTOR_H
27 #define VISU_VTK2MEDCONVERTOR_H
29 #include "VISUConvertor.hxx"
31 #include <MED_Common.hxx>
32 #include <vtkIntArray.h>
33 #include <vtkDataSet.h>
39 class vtkUnstructuredGrid;
42 class VISU_CONVERTOR_EXPORT VISU_Vtk2MedConvertor
46 typedef std::vector<std::string> TVectorString;
47 typedef std::vector<double> TVectorDouble;
48 typedef std::vector<int> TCellIds;
49 typedef std::map<MED::EGeometrieElement,TCellIds> TGeom2CellIds;
51 VISU_Vtk2MedConvertor();
53 VISU_Vtk2MedConvertor( const std::string theMEDFileName,
54 const std::string theFirstVTKFileName );
56 VISU_Vtk2MedConvertor( const std::string theMEDFileName,
57 const std::string theFirstVTKFileName,
58 const TVectorString theDataVTKFileNames );
61 void setMEDFileName( const std::string theFileName );
62 std::string getMEDFileName() const;
64 void setFirstVTKFileName( const std::string theFileName );
65 std::string getFirstVTKFileName() const;
67 void setDataVTKFileNames( const TVectorString theFileNames );
68 void getDataVTKFileNames( TVectorString& ) const;
70 void setVersion( const MED::EVersion theVersion );
71 MED::EVersion getVersion() const;
73 void setMeshName( const std::string theMeshName );
74 std::string getMeshName() const;
76 void addToIgnoringFieldList( const std::string& theFieldName );
77 void eraseFromIgnoringFieldList( const std::string& theFieldName );
78 const std::set<std::string>& getIgnoringFieldList() const;
80 void setCellDataFieldNameIDS( const std::string& theFieldName );
81 const std::string& getCellDataFieldNameIDS() const;
83 void setPointDataFieldNameIDS( const std::string& theFieldName );
84 const std::string& getPointDataFieldNameIDS() const;
86 void setTimeStamps( const TVectorDouble& theTStamps );
87 void getTimeStamps( TVectorDouble& theTStamps ) const;
93 TVectorString myDataVTKFileNames; // vtk files with data
94 std::string myMEDFileName; // output MED file name.
95 std::string myFirstVTKFileName; // vtk file with geometry,data from this file also used.
96 MED::EVersion myVersion;
97 std::string myMeshName;
98 std::set<std::string> myIgnoringFieldList;
99 std::string myCellDataFieldNameIDS;
100 std::string myPointDataFieldNameIDS;
101 TVectorDouble myTStamps;
105 // Fill container with indices of cells which match given type.
107 GetIdsOfCellsOfType( vtkDataSet* theInput, // input
108 const int type, // input
109 vtkIntArray *array ); // output
113 // ret value 1 - ERROR
115 Geometry2MED( vtkDataSet* aInput,
117 MED::PMeshInfo aMeshInfo,
118 TGeom2CellIds& outGeom2CellIdMap );
121 // ret value 1 - ERROR
123 Data2MED( std::vector<vtkDataSet*> theListForAdd,
125 MED::PMeshInfo theMeshInfo,
126 TGeom2CellIds& theGeom2CellIdMap );
129 // ret value 1 - ERROR
131 CreateElements( vtkDataSet* theInput,
132 MED::PMeshInfo theMeshInfo,
133 MED::PWrapper theMed,
134 vtkIntArray* theCellsMapper,
135 MED::EEntiteMaillage theEntity,
138 std::vector<int>& theNumberingConvertor,
139 TGeom2CellIds& theGeom2CellIdMap );
142 // ret value 1 - ERROR
144 CreatePolygons( vtkDataSet* theInput,
145 MED::PMeshInfo theMeshInfo,
146 MED::PWrapper theMed,
147 vtkIntArray* theCellsMapper,
148 MED::EEntiteMaillage theEntity,
149 TGeom2CellIds& theGeom2CellIdMap );
152 // ret value 1 - ERROR
154 CreatePolyedres( vtkDataSet* theInput,
155 MED::PMeshInfo theMeshInfo,
156 MED::PWrapper theMed,
157 vtkIntArray* theCellsMapper,
158 MED::EEntiteMaillage theEntity,
159 TGeom2CellIds& theGeom2CellIdMap );
163 #endif // VISU_VTK2MEDCONVERTOR_H