Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/visu.git] / src / CONVERTOR / VISU_Convertor_impl.hxx
1 //  SALOME VTKViewer : build VTK viewer into Salome desktop
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //
24 //  File   : 
25 //  Author : 
26 //  Module : SALOME
27 //  $Header$
28
29 #ifndef VISU_Convertor_impl_HeaderFile
30 #define VISU_Convertor_impl_HeaderFile
31
32 #include "VISU_Convertor.hxx"
33 #include "VISU_ConvertorDef_impl.hxx"
34
35 #include <boost/tuple/tuple.hpp>
36
37
38 //---------------------------------------------------------------
39 //! This class perfroms mapping of intermediate data strucutres into corresponding VTK representation
40 /*!
41   It implements VISU_Convertor public interface and declare new pure virtual functions
42   to fill its intermediate data structure from a MED source
43 */
44 class VISU_CONVERTOR_EXPORT VISU_Convertor_impl: public VISU_Convertor
45 {
46 public:
47   VISU_Convertor_impl();
48
49   virtual
50   ~VISU_Convertor_impl();
51
52   //! Just to define default behaviour
53   virtual
54   VISU_Convertor* 
55   Build();
56
57   //! Just to define default behaviour
58   virtual
59   VISU_Convertor* 
60   BuildEntities();
61
62   //! Just to define default behaviour
63   virtual
64   VISU_Convertor* 
65   BuildFields();
66
67   //! Just to define default behaviour
68   virtual
69   VISU_Convertor* 
70   BuildMinMax();
71
72   //! Just to define default behaviour
73   virtual
74   VISU_Convertor* 
75   BuildGroups();
76
77   //! Implemention of the VISU_Convertor::GetSize
78   virtual 
79   size_t
80   GetSize();
81
82   //! Implemention of the VISU_Convertor::GetMeshOnEntity
83   virtual 
84   VISU::PNamedIDMapper 
85   GetMeshOnEntity(const std::string& theMeshName, 
86                   const VISU::TEntity& theEntity);
87
88   //! Implemention of the VISU_Convertor::GetMeshOnEntitySize
89   virtual 
90   size_t 
91   GetMeshOnEntitySize(const std::string& theMeshName, 
92                        const VISU::TEntity& theEntity);
93
94   //! Implemention of the VISU_Convertor::GetFamilyOnEntity
95   virtual 
96   VISU::PUnstructuredGridIDMapper 
97   GetFamilyOnEntity(const std::string& theMeshName, 
98                     const VISU::TEntity& theEntity,
99                     const std::string& theFamilyName);
100
101   //! Implemention of the VISU_Convertor::GetFamilyOnEntitySize
102   virtual 
103   size_t 
104   GetFamilyOnEntitySize(const std::string& theMeshName, 
105                         const VISU::TEntity& theEntity,
106                         const std::string& theFamilyName);
107
108   //! Implemention of the VISU_Convertor::GetMeshOnGroup
109   virtual 
110   VISU::PUnstructuredGridIDMapper 
111   GetMeshOnGroup(const std::string& theMeshName, 
112                  const std::string& theGroupName);
113   
114   //! Implemention of the VISU_Convertor::GetMeshOnGroupSize
115   virtual 
116   size_t 
117   GetMeshOnGroupSize(const std::string& theMeshName, 
118                      const std::string& theGroupName);
119
120   //! Implemention of the VISU_Convertor::GetTimeStampOnMesh
121   virtual
122   VISU::PUnstructuredGridIDMapper 
123   GetTimeStampOnMesh(const std::string& theMeshName, 
124                      const VISU::TEntity& theEntity,
125                      const std::string& theFieldName,
126                      int theTimeStampNumber);
127
128   //! Get amount of memory to build vtkDataSet for corresponding MED TIMESTAMP on mesh
129   virtual 
130   size_t
131   GetTimeStampOnMeshSize(const std::string& theMeshName, 
132                          const VISU::TEntity& theEntity,
133                          const std::string& theFieldName,
134                          int theTimeStampNumber,
135                          bool& theIsEstimated);
136     
137   //! Get amount of memory to build vtkDataSet for corresponding MED TIMESTAMP on Gauss Points
138   virtual 
139   size_t
140   GetTimeStampOnGaussPtsSize(const std::string& theMeshName, 
141                              const VISU::TEntity& theEntity,
142                              const std::string& theFieldName,
143                              int theTimeStampNumber,
144                              bool& theIsEstimated);
145
146   //! Implemention of the VISU_Convertor::GetTimeStampOnGaussPts
147   virtual
148   VISU::PGaussPtsIDMapper 
149   GetTimeStampOnGaussPts(const std::string& theMeshName, 
150                          const VISU::TEntity& theEntity,
151                          const std::string& theFieldName,
152                          int theTimeStampNumber);
153   
154   //! Implemention of the VISU_Convertor::GetFieldOnMeshSize
155   virtual 
156   size_t 
157   GetFieldOnMeshSize(const std::string& theMeshName, 
158                      const VISU::TEntity& theEntity,
159                      const std::string& theFieldName);
160
161   //! Implemention of the VISU_Convertor::GetField
162   virtual 
163   const VISU::PField 
164   GetField(const std::string& theMeshName, 
165            VISU::TEntity theEntity, 
166            const std::string& theFieldName);
167
168   //! Implemention of the VISU_Convertor::GetTimeStamp
169   virtual 
170   const VISU::PValForTime 
171   GetTimeStamp(const std::string& theMeshName, 
172                const VISU::TEntity& theEntity,
173                const std::string& theFieldName,
174                int theStampsNum);
175
176 protected:
177   //! An utility method to find TMesh by its name
178   VISU::PMeshImpl 
179   FindMesh(const std::string& theMeshName);
180
181   //! An utility method to find TMeshOnEntity by name of its parent mesh and entity
182   typedef boost::tuple<VISU::PMeshImpl,
183                        VISU::PMeshOnEntityImpl> TFindMeshOnEntity;
184   TFindMeshOnEntity
185   FindMeshOnEntity(const std::string& theMeshName,
186                    const VISU::TEntity& theEntity);
187
188   //! An utility method to find TFamily by name of its parent mesh, corresponding entity and its name
189   typedef boost::tuple<VISU::PMeshImpl,
190                        VISU::PMeshOnEntityImpl,VISU::PFamilyImpl> TFindFamilyOnEntity;
191   TFindFamilyOnEntity
192   FindFamilyOnEntity(const std::string& theMeshName,
193                     const VISU::TEntity& theEntity,
194                     const std::string& theFamilyName);
195
196   //! An utility method to find Group by name of its parent mesh and its name
197   typedef boost::tuple<VISU::PMeshImpl,
198                        VISU::PGroupImpl> TFindMeshOnGroup;
199   TFindMeshOnGroup
200   FindMeshOnGroup(const std::string& theMeshName, 
201                   const std::string& theGroupName);
202
203   //! An utility method to find TField by name of its parent mesh, corresponding entity and its name
204   typedef boost::tuple<VISU::PMeshImpl,
205                        VISU::PMeshOnEntityImpl,
206                        VISU::PMeshOnEntityImpl,
207                        VISU::PFieldImpl> TFindField;
208   TFindField
209   FindField(const std::string& theMeshName, 
210             const VISU::TEntity& theEntity, 
211             const std::string& theFieldName);
212
213   //! An utility method to find TTimeStamp by name of its parent mesh, corresponding entity, field name and its number
214   typedef boost::tuple<VISU::PMeshImpl,
215                        VISU::PMeshOnEntityImpl,
216                        VISU::PMeshOnEntityImpl,
217                        VISU::PFieldImpl,
218                        VISU::PValForTimeImpl> TFindTimeStamp;
219   TFindTimeStamp
220   FindTimeStamp(const std::string& theMeshName, 
221                 const VISU::TEntity& theEntity, 
222                 const std::string& theFieldName, 
223                 int theStampsNum);
224
225   vtkUnstructuredGrid*
226   GetTimeStampOnProfile(const VISU::PMeshImpl& theMesh,
227                         const VISU::PMeshOnEntityImpl& theMeshOnEntity,
228                         const VISU::PFieldImpl& theField,
229                         const VISU::PValForTimeImpl& theValForTime,
230                         const VISU::PUnstructuredGridIDMapperImpl& theIDMapperFilter,
231                         const VISU::PProfileImpl& theProfile,
232                         const VISU::TEntity& theEntity);
233
234   void
235   GetTimeStampOnNodalProfile(const VISU::PMeshImpl& theMesh,
236                              const VISU::PUnstructuredGridIDMapperImpl& theIDMapperFilter,
237                              const VISU::PFieldImpl& theField, 
238                              const VISU::PValForTimeImpl& theValForTime,
239                              const VISU::TEntity& theEntity);
240   
241 protected:
242   //! Implemention of the VISU_Convertor::GetTimeStampSize
243   virtual 
244   size_t 
245   GetTimeStampSize(const std::string& theMeshName, 
246                    const VISU::TEntity& theEntity,
247                    const std::string& theFieldName,
248                    int theStampsNum);
249
250   //! To fill intermeiate representation of TMeshOnEntity from a MED source
251   virtual
252   int
253   LoadMeshOnEntity(VISU::PMeshImpl theMesh,
254                    VISU::PMeshOnEntityImpl theMeshOnEntity) = 0;
255
256   //! To fill intermeiate representation of TFamily from a MED source
257   virtual
258   int
259   LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
260                      VISU::PMeshOnEntityImpl theMeshOnEntity, 
261                      VISU::PFamilyImpl theFamily) = 0;
262
263   //! To fill intermeiate representation of TGroup from a MED source
264   virtual 
265   int
266   LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
267                   const VISU::TFamilySet& theFamilySet) = 0;
268
269   //! To fill intermeiate representation of TValForTime for ordinary mesh from a MED source
270   virtual 
271   int
272   LoadValForTimeOnMesh(VISU::PMeshImpl theMesh, 
273                        VISU::PMeshOnEntityImpl theMeshOnEntity, 
274                        VISU::PFieldImpl theField, 
275                        VISU::PValForTimeImpl theValForTime) = 0;
276
277   //! To fill intermeiate representation of TValForTime for mesh on Gauss Points from a MED source
278   virtual 
279   int
280   LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh, 
281                            VISU::PMeshOnEntityImpl theMeshOnEntity, 
282                            VISU::PFieldImpl theField, 
283                            VISU::PValForTimeImpl theValForTime) = 0;
284 };
285
286 #endif