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 <MED_Common.hxx>
30 #include <vtkIntArray.h>
31 #include <vtkDataSet.h>
37 class vtkUnstructuredGrid;
40 class VISU_Vtk2MedConvertor
44 typedef std::vector<std::string> TVectorString;
45 typedef std::vector<double> TVectorDouble;
46 typedef std::vector<int> TCellIds;
47 typedef std::map<MED::EGeometrieElement,TCellIds> TGeom2CellIds;
49 VISU_Vtk2MedConvertor();
51 VISU_Vtk2MedConvertor( const std::string theMEDFileName,
52 const std::string theFirstVTKFileName );
54 VISU_Vtk2MedConvertor( const std::string theMEDFileName,
55 const std::string theFirstVTKFileName,
56 const TVectorString theDataVTKFileNames );
59 void setMEDFileName( const std::string theFileName );
60 std::string getMEDFileName() const;
62 void setFirstVTKFileName( const std::string theFileName );
63 std::string getFirstVTKFileName() const;
65 void setDataVTKFileNames( const TVectorString theFileNames );
66 void getDataVTKFileNames( TVectorString& ) const;
68 void setVersion( const MED::EVersion theVersion );
69 MED::EVersion getVersion() const;
71 void setMeshName( const std::string theMeshName );
72 std::string getMeshName() const;
74 void addToIgnoringFieldList( const std::string& theFieldName );
75 void eraseFromIgnoringFieldList( const std::string& theFieldName );
76 const std::set<std::string>& getIgnoringFieldList() const;
78 void setCellDataFieldNameIDS( const std::string& theFieldName );
79 const std::string& getCellDataFieldNameIDS() const;
81 void setPointDataFieldNameIDS( const std::string& theFieldName );
82 const std::string& getPointDataFieldNameIDS() const;
84 void setTimeStamps( const TVectorDouble& theTStamps );
85 void getTimeStamps( TVectorDouble& theTStamps ) const;
91 TVectorString myDataVTKFileNames; // vtk files with data
92 std::string myMEDFileName; // output MED file name.
93 std::string myFirstVTKFileName; // vtk file with geometry,data from this file also used.
94 MED::EVersion myVersion;
95 std::string myMeshName;
96 std::set<std::string> myIgnoringFieldList;
97 std::string myCellDataFieldNameIDS;
98 std::string myPointDataFieldNameIDS;
99 TVectorDouble myTStamps;
103 // Fill container with indices of cells which match given type.
105 GetIdsOfCellsOfType( vtkDataSet* theInput, // input
106 const int type, // input
107 vtkIntArray *array ); // output
111 // ret value 1 - ERROR
113 Geometry2MED( vtkDataSet* aInput,
115 MED::PMeshInfo aMeshInfo,
116 TGeom2CellIds& outGeom2CellIdMap );
119 // ret value 1 - ERROR
121 Data2MED( std::vector<vtkDataSet*> theListForAdd,
123 MED::PMeshInfo theMeshInfo,
124 TGeom2CellIds& theGeom2CellIdMap );
127 // ret value 1 - ERROR
129 CreateElements( vtkDataSet* theInput,
130 MED::PMeshInfo theMeshInfo,
131 MED::PWrapper theMed,
132 vtkIntArray* theCellsMapper,
133 MED::EEntiteMaillage theEntity,
136 std::vector<int>& theNumberingConvertor,
137 TGeom2CellIds& theGeom2CellIdMap );
140 // ret value 1 - ERROR
142 CreatePolygons( vtkDataSet* theInput,
143 MED::PMeshInfo theMeshInfo,
144 MED::PWrapper theMed,
145 vtkIntArray* theCellsMapper,
146 MED::EEntiteMaillage theEntity,
147 TGeom2CellIds& theGeom2CellIdMap );
150 // ret value 1 - ERROR
152 CreatePolyedres( vtkDataSet* theInput,
153 MED::PMeshInfo theMeshInfo,
154 MED::PWrapper theMed,
155 vtkIntArray* theCellsMapper,
156 MED::EEntiteMaillage theEntity,
157 TGeom2CellIds& theGeom2CellIdMap );
161 #endif // VISU_VTK2MEDCONVERTOR_H