1 // Copyright (C) 2003 CEA/DEN, EDF R&D
5 // File : VISU_Convertor_impl.hxx
6 // Author : Alexey PETROV
9 #ifndef VISU_Convertor_impl_HeaderFile
10 #define VISU_Convertor_impl_HeaderFile
12 #include "VISU_Convertor.hxx"
14 #include <vtkSystemIncludes.h>
16 #include <vtkPoints.h>
17 #include <vtkUnstructuredGrid.h>
18 #include <vtkMergeDataObjectFilter.h>
19 #include <vtkFieldDataToAttributeDataFilter.h>
20 #include "VISU_ExtractUnstructuredGrid.hxx"
23 #include <qfileinfo.h>
25 #include <vtkSmartPointer.h>
27 #include <boost/tuple/tuple.hpp>
31 typedef vtkSmartPointer<vtkPoints> TVTKPoints;
32 typedef vtkSmartPointer<vtkUnstructuredGrid> TVTKSource;
33 typedef vtkSmartPointer<vtkMergeDataObjectFilter> TVTKMergetFilter;
34 typedef vtkSmartPointer<VISU_ExtractUnstructuredGrid> TVTKExtractFilter;
35 typedef vtkSmartPointer<vtkFieldDataToAttributeDataFilter> TVTKAttribyteFilter;
39 struct TMeshImpl: TMesh{
42 typedef std::vector<TCoord> TPointsCoord;
43 TPointsCoord myPointsCoord;
45 typedef std::vector<std::string> TPointsDim;
46 TPointsDim myPointsDim;
48 typedef shared_ptr<TMeshImpl> PMeshImpl;
50 struct TMeshOnEntityImpl: TMeshOnEntity{
52 typedef std::vector<vtkIdType> TConnect;
53 typedef std::vector<TConnect> TConnForCellType;
54 typedef std::map<vtkIdType,TConnForCellType> TCellsConn;
55 TCellsConn myCellsConn;
57 typedef shared_ptr<TMeshOnEntityImpl> PMeshOnEntityImpl;
59 struct TFamilyImpl: TFamily{
62 typedef std::set<vtkIdType> TSubMeshOnCellType;
63 typedef std::map<vtkIdType,TSubMeshOnCellType> TSubMesh;
66 typedef shared_ptr<TFamilyImpl> PFamilyImpl;
68 struct TGroupImpl: TGroup{
71 typedef shared_ptr<TGroupImpl> PGroupImpl;
73 struct TFieldImpl: TField{
74 TVTKExtractFilter myExtractFilter;
77 if(myExtractFilter.GetPointer())
78 myExtractFilter->UnRegisterAllOutputs();
81 typedef shared_ptr<TFieldImpl> PFieldImpl;
83 struct TValForTimeImpl: TValForTime{
84 TVTKAttribyteFilter myAttribyteFilter;
85 TVTKMergetFilter myMergeFilter;
88 typedef std::vector<float> TValForCellsWithType;
89 typedef std::map<vtkIdType,TValForCellsWithType> TValForCells;
90 TValForCells myValForCells;
94 if(myMergeFilter.GetPointer())
95 myMergeFilter->UnRegisterAllOutputs();
96 if(myAttribyteFilter.GetPointer())
97 myAttribyteFilter->UnRegisterAllOutputs();
100 typedef shared_ptr<TValForTimeImpl> PValForTimeImpl;
104 class VISU_Convertor_impl: public VISU_Convertor{
106 virtual float GetSize() ;
110 GetMeshOnEntitySize(const std::string& theMeshName,
111 const VISU::TEntity& theEntity,
112 const std::string& theFamilyName = "");
116 GetMeshOnGroupSize(const std::string& theMeshName,
117 const std::string& theGroupName);
121 GetTimeStampSize(const std::string& theMeshName,
122 const VISU::TEntity& theEntity,
123 const std::string& theFieldName,
128 GetFieldOnMeshSize(const std::string& theMeshName,
129 const VISU::TEntity& theEntity,
130 const std::string& theFieldName);
134 GetField(const std::string& theMeshName,
135 VISU::TEntity theEntity,
136 const std::string& theFieldName);
139 const VISU::PValForTime
140 GetTimeStamp(const std::string& theMeshName,
141 const VISU::TEntity& theEntity,
142 const std::string& theFieldName,
146 VISU_Convertor_impl();
148 virtual ~VISU_Convertor_impl();
150 virtual VISU_Convertor* Build() { return this;};
154 GetMeshOnEntity(const std::string& theMeshName,
155 const VISU::TEntity& theEntity,
156 const std::string& theFamilyName = "");
160 GetMeshOnGroup(const std::string& theMeshName,
161 const std::string& theGroupName);
165 GetTimeStampOnMesh(const std::string& theMeshName,
166 const VISU::TEntity& theEntity,
167 const std::string& theFieldName,
172 FindMesh(const std::string& theMeshName);
174 typedef boost::tuple<VISU::PMeshImpl,VISU::PMeshOnEntityImpl,VISU::PFamilyImpl> TFindMeshOnEntity;
176 FindMeshOnEntity(const std::string& theMeshName,
177 const VISU::TEntity& theEntity,
178 const std::string& theFamilyName);
180 typedef boost::tuple<VISU::PMeshImpl,VISU::PGroupImpl> TFindMeshOnGroup;
182 FindMeshOnGroup(const std::string& theMeshName,
183 const std::string& theGroupName);
185 typedef boost::tuple<VISU::PMeshImpl,
186 VISU::PMeshOnEntityImpl,
187 VISU::PMeshOnEntityImpl,
188 VISU::PFieldImpl> TFindField;
190 FindField(const std::string& theMeshName,
191 const VISU::TEntity& theEntity,
192 const std::string& theFieldName);
194 typedef boost::tuple<VISU::PMeshImpl,
195 VISU::PMeshOnEntityImpl,
196 VISU::PMeshOnEntityImpl,
198 VISU::PValForTimeImpl> TFindTimeStamp;
200 FindTimeStamp(const std::string& theMeshName,
201 const VISU::TEntity& theEntity,
202 const std::string& theFieldName,
206 virtual int LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity,
207 const std::string& theFamilyName = "") = 0;
209 virtual int LoadMeshOnGroup(VISU::PMeshImpl theMesh,
210 const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet) = 0;
212 virtual int LoadFieldOnMesh(VISU::PMeshImpl theMesh,
213 VISU::PMeshOnEntityImpl theMeshOnEntity,
214 VISU::PFieldImpl theField,
215 VISU::PValForTimeImpl theValForTime) = 0;