1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : VISU_Vtk2MedConvertor.hxx
21 // Author : Eugeny NIKOLAEV, Open CASCADE SAS
23 #ifndef VISU_VTK2MEDCONVERTOR_H
24 #define VISU_VTK2MEDCONVERTOR_H
26 #include "VISUConvertor.hxx"
28 #include <MED_Common.hxx>
29 #include <vtkIntArray.h>
30 #include <vtkDataSet.h>
36 class vtkUnstructuredGrid;
39 class VISU_CONVERTOR_EXPORT VISU_Vtk2MedConvertor
43 typedef std::vector<std::string> TVectorString;
44 typedef std::vector<double> TVectorDouble;
45 typedef std::vector<int> TCellIds;
46 typedef std::map<MED::EGeometrieElement,TCellIds> TGeom2CellIds;
48 VISU_Vtk2MedConvertor();
50 VISU_Vtk2MedConvertor( const std::string theMEDFileName,
51 const std::string theFirstVTKFileName );
53 VISU_Vtk2MedConvertor( const std::string theMEDFileName,
54 const std::string theFirstVTKFileName,
55 const TVectorString theDataVTKFileNames );
58 void setMEDFileName( const std::string theFileName );
59 std::string getMEDFileName() const;
61 void setFirstVTKFileName( const std::string theFileName );
62 std::string getFirstVTKFileName() const;
64 void setDataVTKFileNames( const TVectorString theFileNames );
65 void getDataVTKFileNames( TVectorString& ) const;
67 void setVersion( const MED::EVersion theVersion );
68 MED::EVersion getVersion() const;
70 void setMeshName( const std::string theMeshName );
71 std::string getMeshName() const;
73 void addToIgnoringFieldList( const std::string& theFieldName );
74 void eraseFromIgnoringFieldList( const std::string& theFieldName );
75 const std::set<std::string>& getIgnoringFieldList() const;
77 void setCellDataFieldNameIDS( const std::string& theFieldName );
78 const std::string& getCellDataFieldNameIDS() const;
80 void setPointDataFieldNameIDS( const std::string& theFieldName );
81 const std::string& getPointDataFieldNameIDS() const;
83 void setTimeStamps( const TVectorDouble& theTStamps );
84 void getTimeStamps( TVectorDouble& theTStamps ) const;
90 TVectorString myDataVTKFileNames; // vtk files with data
91 std::string myMEDFileName; // output MED file name.
92 std::string myFirstVTKFileName; // vtk file with geometry,data from this file also used.
93 MED::EVersion myVersion;
94 std::string myMeshName;
95 std::set<std::string> myIgnoringFieldList;
96 std::string myCellDataFieldNameIDS;
97 std::string myPointDataFieldNameIDS;
98 TVectorDouble myTStamps;
102 // Fill container with indices of cells which match given type.
104 GetIdsOfCellsOfType( vtkDataSet* theInput, // input
105 const int type, // input
106 vtkIntArray *array ); // output
110 // ret value 1 - ERROR
112 Geometry2MED( vtkDataSet* aInput,
114 MED::PMeshInfo aMeshInfo,
115 TGeom2CellIds& outGeom2CellIdMap );
118 // ret value 1 - ERROR
120 Data2MED( std::vector<vtkDataSet*> theListForAdd,
122 MED::PMeshInfo theMeshInfo,
123 TGeom2CellIds& theGeom2CellIdMap );
126 // ret value 1 - ERROR
128 CreateElements( vtkDataSet* theInput,
129 MED::PMeshInfo theMeshInfo,
130 MED::PWrapper theMed,
131 vtkIntArray* theCellsMapper,
132 MED::EEntiteMaillage theEntity,
135 std::vector<int>& theNumberingConvertor,
136 TGeom2CellIds& theGeom2CellIdMap );
139 // ret value 1 - ERROR
141 CreatePolygons( vtkDataSet* theInput,
142 MED::PMeshInfo theMeshInfo,
143 MED::PWrapper theMed,
144 vtkIntArray* theCellsMapper,
145 MED::EEntiteMaillage theEntity,
146 TGeom2CellIds& theGeom2CellIdMap );
149 // ret value 1 - ERROR
151 CreatePolyedres( vtkDataSet* theInput,
152 MED::PMeshInfo theMeshInfo,
153 MED::PWrapper theMed,
154 vtkIntArray* theCellsMapper,
155 MED::EEntiteMaillage theEntity,
156 TGeom2CellIds& theGeom2CellIdMap );
160 #endif // VISU_VTK2MEDCONVERTOR_H