]> SALOME platform Git repositories - modules/visu.git/blob - src/CONVERTOR/VISU_Structures_impl.hxx
Salome HOME
8b96bd1b894aad598c517226754093ba2626f802
[modules/visu.git] / src / CONVERTOR / VISU_Structures_impl.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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 //  File   : 
23 //  Author : Alexey PETROV
24 //  Module : VISU
25 //
26 #ifndef VISU_Structures_impl_HeaderFile
27 #define VISU_Structures_impl_HeaderFile
28
29 /*! 
30   \file VISU_Structures_impl.hxx
31   \brief The file contains definitions for basic classes of the implementation of VISU CONVERTER package
32 */
33
34 #include "VISUConvertor.hxx"
35 #include "VISU_Structures.hxx"
36 #include "VISU_ConvertorDef_impl.hxx"
37
38 class vtkPointSet;
39
40
41 namespace VISU
42 {
43   //---------------------------------------------------------------
44   //! Define an utility base class which allow to keep calculated number of cells and their size
45   struct VISU_CONVERTOR_EXPORT TSizeCounter: virtual TIsVTKDone
46   {
47     TSizeCounter();
48     vtkIdType myNbCells; //!< Number of cells contained into corresponding sublclass
49     vtkIdType myCellsSize; //!< Size of cells contained into corresponding sublclass
50   };
51
52
53   //---------------------------------------------------------------
54   //! Define a container for VTK representation
55   class TPolyDataHolder: public virtual TSizeCounter
56   {
57   protected:
58     mutable PPolyData mySource;
59   public:
60     TPolyDataHolder();
61
62     //! This method allow to create corresponding VTK data set by demand (not at once)
63     const PPolyData& 
64     GetSource() const;
65
66     virtual
67     vtkPolyData* 
68     GetPolyDataOutput();
69
70     //! Gets memory size used by the instance (bytes).
71     virtual
72     unsigned long int
73     GetMemorySize();
74   };
75
76
77   //---------------------------------------------------------------
78   //! Define a container for VTK representation
79   class VISU_CONVERTOR_EXPORT TUnstructuredGridHolder: public virtual TSizeCounter
80   {
81   public:
82     TUnstructuredGridHolder();
83
84     //! This method allow to create corresponding VTK data set by demand (not at once)
85     const PUnstructuredGrid& 
86     GetSource() const;
87
88     virtual
89     vtkUnstructuredGrid* 
90     GetUnstructuredGridOutput();
91
92     //! Gets memory size used by the instance (bytes).
93     virtual
94     unsigned long int
95     GetMemorySize();
96
97   protected:
98     mutable PUnstructuredGrid mySource;
99   };
100
101
102   //---------------------------------------------------------------
103   //! Define an intermediate class which unifies memory size calculation
104   struct VISU_CONVERTOR_EXPORT TMemoryCheckIDMapper: public virtual TIsVTKDone,
105                                public virtual TIDMapper
106   {
107     //! Gets memory size used by the instance (bytes).
108     virtual
109     unsigned long int
110     GetMemorySize();
111   };
112
113
114   //---------------------------------------------------------------
115   //! Define a container for VTK representation
116   /*!
117     This container allow to combine other VTK representation into single one.
118   */
119   class VISU_CONVERTOR_EXPORT TAppendFilterHolder: public virtual TMemoryCheckIDMapper
120   {
121   protected:
122     mutable PAppendFilter myFilter;
123   public:
124     TAppendFilterHolder();
125
126     //! This method allow to create corresponding VTK filter by demand (not at once)
127     const PAppendFilter& 
128     GetFilter() const;
129
130     //! Reimplement the TNamedIDMapper::GetUnstructuredGridOutput
131     virtual
132     vtkUnstructuredGrid* 
133     GetUnstructuredGridOutput();
134   };
135
136   /*!
137     This container allow to combine other VTK representation into single one.
138   */
139   //---------------------------------------------------------------
140   //! Define a container for VTK representation
141   /*!
142     This container allow to combine other VTK representation into single one.
143   */
144   class TAppendPolyDataHolder: public virtual TMemoryCheckIDMapper
145   {
146   protected:
147     mutable PAppendPolyData myFilter;
148   public:
149     TAppendPolyDataHolder();
150
151     //! This method allow to create corresponding VTK filter by demand (not at once)
152     const PAppendPolyData& 
153     GetFilter() const;
154
155     //! Reimplement the TGaussPtsIDMapper::GetPolyDataOutput
156     virtual
157     vtkPolyData* 
158     GetPolyDataOutput();
159   };
160
161
162   //---------------------------------------------------------------
163   //! Define a container for VTK representation
164   /*!
165     This container allow to assign data to mesh and represent them into single VTK representation
166   */
167   class TMergeFilterHolder: public virtual TMemoryCheckIDMapper
168   {
169   protected:
170     mutable PMergeFilter myFilter;
171   public:
172     TMergeFilterHolder();
173
174     //! This method allow to create corresponding VTK filter by demand (not at once)
175     const PMergeFilter& 
176     GetFilter() const;
177
178     //! Gets output of the filter as vtkDataSet
179     virtual
180     vtkDataSet*
181     GetOutput();
182   };
183
184
185   //---------------------------------------------------------------
186   //! Specialize TMesh to provide VTK mapping for nodes
187   struct VISU_CONVERTOR_EXPORT TMeshImpl: virtual TMesh, 
188                     virtual TIsVTKDone
189   {
190     PNamedPointCoords myNamedPointCoords; //!< Keeps intermediate representation of the nodes
191     vtkIdType myNbPoints; //!< Keeps number of the nodes
192
193     TMeshImpl();
194
195     vtkIdType
196     GetNbPoints() const;
197
198     vtkIdType
199     GetDim() const;
200
201     vtkPointSet*
202     GetPointSet(); //!< Gets initialized corresponding VTK structure
203   };
204
205
206   //---------------------------------------------------------------
207   typedef TVector<vtkIdType> TSubMeshID;
208   typedef enum {eRemoveAll, eAddAll, eAddPart, eNone} ESubMeshStatus; 
209
210   //! Specialize TSubProfile to provide VTK mapping
211   struct VISU_CONVERTOR_EXPORT TSubProfileImpl: virtual TSubProfile, 
212                           virtual TUnstructuredGridHolder
213   {
214     TSubProfileImpl();
215
216     EGeometry myGeom; //!< Defines to what geometrical type the MED PROFILE belong to
217     std::string myName; //!< Keeps its name
218
219     //! Get object number of mesh cell by its VTK one
220     virtual 
221     vtkIdType 
222     GetElemObjID(vtkIdType theVtkI) const;
223
224     //! Get cell VTK ID for corresponding object ID
225     virtual
226     vtkIdType 
227     GetElemVTKID(vtkIdType theID) const;
228
229     //! Gets memory size used by the instance (bytes).
230     virtual
231     unsigned long int
232     GetMemorySize();
233
234     //! Keeps status of the structure
235     /*!
236       In some cases MED file does not use MED PROFILES, but at VISU creates corresponding data strucutre
237       in order to construct mesh for MED TIEMSTAMPS in uniform way.
238     */
239     ESubMeshStatus myStatus; 
240     TSubMeshID mySubMeshID; //!< Keeps numbers of mesh cell which contain the MED PROFILE
241   };
242
243
244   //---------------------------------------------------------------
245   typedef std::map<vtkIdType,vtkIdType> TID2ID;
246   typedef TVector<PSubProfileImpl> TSubProfileArr;
247   typedef std::map<EGeometry,PSubProfileImpl> TGeom2SubProfile;
248
249   //! Specialize TProfile to provide VTK mapping for MED TIMESTAMP mesh
250   struct VISU_CONVERTOR_EXPORT TProfileImpl: virtual TProfile, 
251                        virtual TAppendFilterHolder
252   {
253     TProfileImpl();
254     bool myIsAll; //!< Say, whether the MED TIMESTAMP defined on all MED ENTITY or not
255    
256     //! Reimplement the TIDMapper::GetNodeObjID
257     virtual 
258     vtkIdType 
259     GetNodeObjID(vtkIdType theID) const;
260
261     //! Reimplement the TIDMapper::GetNodeVTKID
262     virtual 
263     vtkIdType 
264     GetNodeVTKID(vtkIdType theID) const;
265
266     //! Reimplement the TIDMapper::GetNodeCoord
267     virtual 
268     vtkFloatingPointType*  
269     GetNodeCoord(vtkIdType theObjID);
270
271     //! Reimplement the TIDMapper::GetElemObjID
272     virtual 
273     vtkIdType 
274     GetElemObjID(vtkIdType theID) const;
275
276     //! Reimplement the TIDMapper::GetElemVTKID
277     virtual 
278     vtkIdType 
279     GetElemVTKID(vtkIdType theID) const;
280
281     //! Reimplement the TIDMapper::GetElemCell
282     virtual
283     vtkCell* 
284     GetElemCell(vtkIdType theObjID);
285     
286     //! Reimplement the TNamedIDMapper::GetUnstructuredGridOutput
287     virtual
288     vtkUnstructuredGrid* 
289     GetUnstructuredGridOutput();
290
291     //! Gets memory size used by the instance (bytes).
292     virtual
293     unsigned long int
294     GetMemorySize();
295
296     //! Reimplement the TNamedIDMapper::GetNodeName
297     virtual
298     std::string 
299     GetNodeName(vtkIdType theObjID) const;
300
301     //! Reimplement the TNamedIDMapper::GetElemName
302     virtual
303     std::string 
304     GetElemName(vtkIdType theObjID) const;
305
306     TID2ID myElemObj2VTKID; //!< Keeps object to VTK numeration mapping
307     TSubProfileArr mySubProfileArr; //!< Keeps sequence of TSubProfiles as they were added into TAppendFilterHolder
308     PNamedPointCoords myNamedPointCoords; //!< Keeps reference on the same TNamedPointCoords as TMesh
309     TMeshOnEntityImpl* myMeshOnEntity; //<! Keeps backward reference to corresponding MED ENTITY mesh
310
311     TGeom2SubProfile myGeom2SubProfile; //!< Keeps TSubProfiles according to their geometrical type
312   };
313
314
315   //---------------------------------------------------------------
316   //! Specialize TIDMapper to provide VTK mapping for MED TIMESTAMP mesh
317   struct TUnstructuredGridIDMapperImpl: virtual TMergeFilterHolder,
318                                         virtual TUnstructuredGridIDMapper
319   {
320     PAppendFilterHolder myIDMapper; //!< Responsible for numbering
321     PCommonCellsFilter myCommonCellsFilter;
322
323     TUnstructuredGridIDMapperImpl();
324     
325     //! Reimplement the TIDMapper::GetNodeObjID
326     virtual 
327     vtkIdType 
328     GetNodeObjID(vtkIdType theID) const;
329
330     //! Reimplement the TIDMapper::GetNodeVTKID
331     virtual 
332     vtkIdType 
333     GetNodeVTKID(vtkIdType theID) const;
334
335     //! Reimplement the TIDMapper::GetNodeCoord
336     virtual 
337     vtkFloatingPointType*  
338     GetNodeCoord(vtkIdType theObjID);
339
340     //! Reimplement the TIDMapper::GetElemObjID
341     virtual 
342     vtkIdType 
343     GetElemObjID(vtkIdType theID) const;
344
345     //! Reimplement the TIDMapper::GetElemVTKID
346     virtual 
347     vtkIdType 
348     GetElemVTKID(vtkIdType theID) const;
349
350     //! Reimplement the TIDMapper::GetElemCell
351     virtual
352     vtkCell* 
353     GetElemCell(vtkIdType theObjID);
354     
355     //! Reimplement the TUnstructuredGridIDMapper::GetUnstructuredGridOutput
356     virtual
357     vtkUnstructuredGrid* 
358     GetUnstructuredGridOutput();
359
360     //! Reimplement the TIDMapper::GetOutput
361     virtual
362     vtkDataSet* 
363     GetOutput();
364
365     //! Gets memory size used by the instance (bytes).
366     virtual
367     unsigned long int
368     GetMemorySize();
369     
370     void 
371     SetReferencedMesh( const PNamedIDMapper& theNamedIDMapper );
372
373     PUnstructuredGrid 
374     GetSource();
375
376   protected:
377     void Build();
378
379     TUnstructuredGridHolder mySource; //!< Keeps assigned data
380   };
381
382   //---------------------------------------------------------------
383   //! Specialize TIDMapper to provide VTK mapping for MED TIMESTAMP mesh
384   struct TPolyDataIDMapperImpl: virtual TMergeFilterHolder,
385                                 virtual TPolyDataIDMapper
386   {
387     PAppendPolyDataHolder myIDMapper; //!< Responsible for numbering
388
389     //! Reimplement the TIDMapper::GetNodeObjID
390     virtual 
391     vtkIdType 
392     GetNodeObjID(vtkIdType theID) const;
393
394     //! Reimplement the TIDMapper::GetNodeVTKID
395     virtual 
396     vtkIdType 
397     GetNodeVTKID(vtkIdType theID) const;
398
399     //! Reimplement the TIDMapper::GetNodeCoord
400     virtual 
401     vtkFloatingPointType*  
402     GetNodeCoord(vtkIdType theObjID);
403
404     //! Reimplement the TIDMapper::GetElemObjID
405     virtual 
406     vtkIdType 
407     GetElemObjID(vtkIdType theID) const;
408
409     //! Reimplement the TIDMapper::GetElemVTKID
410     virtual 
411     vtkIdType 
412     GetElemVTKID(vtkIdType theID) const;
413
414     //! Reimplement the TIDMapper::GetElemCell
415     virtual
416     vtkCell* 
417     GetElemCell(vtkIdType theObjID);
418     
419     //! Reimplement the TPolyDataIDMapper::GetPolyDataOutput
420     virtual
421     vtkPolyData* 
422     GetPolyDataOutput();
423
424     //! Reimplement the TIDMapper::GetOutput
425     virtual
426     vtkDataSet* 
427     GetOutput();
428
429     //! Gets memory size used by the instance (bytes).
430     virtual
431     unsigned long int
432     GetMemorySize();
433
434     PPolyData 
435     GetSource();
436
437   protected:
438     void Build();
439
440     TPolyDataHolder mySource; //!< Keeps assigned data
441   };
442
443
444   //---------------------------------------------------------------
445   //! Specialize TGauss to provide more detail information of the MED GAUSS entity for VTK mapping
446   struct VISU_CONVERTOR_EXPORT TGaussImpl: virtual TGauss
447   {
448     EGeometry myGeom; //!< Define, to which geometrical type the MED GAUSS entity belongs
449     std::string myName; //!< Keeps name of the MED GAUSS entity
450     vtkIdType myNbPoints; //<! Keeps number of points for the MED GAUSS entity
451
452     TGaussImpl();
453
454     //! To define a way to implement more detail comparision of the TGaussSubMesh instances
455     virtual
456     void
457     LessThan(const PGaussImpl& theGauss,
458              bool& theResult) const;
459   };
460
461
462   //---------------------------------------------------------------
463   //! Specialize TGaussSubMesh to provide VTK mapping for the entity
464   struct VISU_CONVERTOR_EXPORT TGaussSubMeshImpl: virtual TGaussSubMesh, 
465                             virtual TPolyDataHolder
466   {
467     TGaussSubMeshImpl();
468
469     //! To implement the TGaussPtsIDMapper::GetObjID
470     virtual
471     TGaussPointID
472     GetObjID(vtkIdType theID) const;
473
474     //! To implement the TGaussPtsIDMapper::GetVTKID
475     virtual
476     vtkIdType
477     GetVTKID(const TGaussPointID& theID) const;
478     
479     virtual 
480     vtkIdType 
481     GetElemObjID(vtkIdType theID) const;
482
483     virtual 
484     vtkIdType 
485     GetElemVTKID(vtkIdType theID) const;
486     
487     virtual
488     vtkIdType
489     GetGlobalID(vtkIdType theID) const;
490     
491     //! Gets memory size used by the instance (bytes).
492     virtual
493     unsigned long int
494     GetMemorySize();
495
496     PGaussImpl myGauss; //<! Keep reference to corresponding TGauss structure
497
498     //! Keeps status of the structure
499     /*!
500       In some cases MED file does not use MED GAUSS, but at VISU creates corresponding data strucutre
501       in order to construct mesh for MED TIEMSTAMPS in uniform way.
502     */
503     ESubMeshStatus myStatus;
504
505     vtkIdType myStartID;
506     PPointCoords myPointCoords; //!< Keeps coordinates of Gauss Points
507   };
508
509
510   //---------------------------------------------------------------
511   typedef TVector<PGaussSubMeshImpl> TGaussSubMeshArr;
512   typedef std::map<EGeometry, PGaussSubMeshImpl> TGeom2GaussSubMesh;
513
514   //! Specialize TGaussMesh to provide VTK mapping for the entity
515   struct VISU_CONVERTOR_EXPORT TGaussMeshImpl: virtual TGaussMesh, 
516                          virtual TAppendPolyDataHolder
517   {
518     TGaussMeshImpl();
519
520     //! Reimplement the TGaussPtsIDMapper::GetObjID
521     virtual
522     TGaussPointID
523     GetObjID(vtkIdType theID) const;
524
525     //! Reimplements the TGaussPtsIDMapper::GetVTKID
526     virtual
527     vtkIdType 
528     GetVTKID(const TGaussPointID& theID) const;
529
530     //! Reimplement the TGaussPtsIDMapper::GetPolyDataOutput
531     virtual
532     vtkPolyData* 
533     GetPolyDataOutput();
534
535     //! Gets memory size used by the instance (bytes).
536     virtual
537     unsigned long int
538     GetMemorySize();
539
540     //! Reimplement the TGaussPtsIDMapper::GetParent
541     virtual 
542     TNamedIDMapper*
543     GetParent() const;
544
545     TNamedIDMapper* myParent; //!< Refer to parent mesh
546     TGaussSubMeshArr myGaussSubMeshArr; //!< Keeps sequence of TGaussSubMesh as they were added into TAppendFilterHolder
547     TGeom2GaussSubMesh myGeom2GaussSubMesh; //!< Keeps TGaussSubMesh according to their geometrical type
548   };
549
550
551   //---------------------------------------------------------------
552   //! Specialize TGaussPtsIDMapper to provide VTK mapping for MED TIMESTAMP mesh
553   struct VISU_CONVERTOR_EXPORT TGaussPtsIDFilter: virtual TPolyDataIDMapperImpl,
554                             virtual TGaussPtsIDMapper
555   { 
556     PGaussPtsIDMapper myGaussPtsIDMapper;
557
558     //! Reimplement the TGaussPtsIDMapper::GetObjID
559     virtual 
560     TGaussPointID 
561     GetObjID(vtkIdType theID) const;
562
563     //! Reimplements the TGaussPtsIDMapper::GetVTKID
564     virtual 
565     vtkIdType 
566     GetVTKID(const TGaussPointID& theID) const;
567
568     //! Reimplements the TGaussPtsIDMapper::GetParent
569     //! Reimplement the TGaussPtsIDMapper::GetParent
570     virtual 
571     TNamedIDMapper*
572     GetParent() const;
573
574     //! Reimplement the TNamedIDMapper::GetUnstructuredGridOutput
575     virtual
576     vtkPolyData* 
577     GetPolyDataOutput();
578
579     //! Reimplement the TIDMapper::GetOutput
580     virtual
581     vtkDataSet*
582     GetOutput();
583   };
584
585
586   //---------------------------------------------------------------
587   typedef TVector<vtkIdType> TConnect;
588   typedef TVector<TConnect> TCell2Connect;
589
590   //! The class is responsible for mapping of cells of defined geometrical type  
591   struct VISU_CONVERTOR_EXPORT TSubMeshImpl: virtual TUnstructuredGridHolder
592   {
593     TSubMeshImpl();
594
595     //! Reimplements the TStructured::CopyStructure
596     virtual
597     void
598     CopyStructure( PStructured theStructured );
599
600     //! To implement the TIDMapper::GetElemObjID
601     virtual 
602     vtkIdType 
603     GetElemObjID(vtkIdType theID) const;
604
605     //! To implement the TNamedIDMapper::GetElemName
606     virtual
607     std::string 
608     GetElemName(vtkIdType theObjID) const;
609
610     //! Gets memory size used by the instance (bytes).
611     virtual
612     unsigned long int
613     GetMemorySize();
614
615     vtkIdType myStartID;
616     TCell2Connect myCell2Connect; //!< Contains connectivity for the cells
617   };
618
619
620   //---------------------------------------------------------------
621   typedef std::map<EGeometry,PSubMeshImpl> TGeom2SubMesh;
622   typedef TVector<PSubMeshImpl> TSubMeshArr;
623
624   //! Specialize TMeshOnEntity to provide VTK mapping for the entity
625   struct VISU_CONVERTOR_EXPORT TMeshOnEntityImpl: virtual TMeshOnEntity, 
626                             virtual TAppendFilterHolder, 
627                             virtual TSizeCounter
628   {
629     TMeshOnEntityImpl();
630
631     //! Reimplements the TStructured::CopyStructure
632     virtual
633     void
634     CopyStructure( PStructured theStructured );
635
636     //! Reimplement the TIDMapper::GetNodeVTKID
637     virtual 
638     vtkIdType 
639     GetNodeVTKID(vtkIdType theID) const;
640
641     //! Reimplement the TIDMapper::GetNodeObjID
642     virtual 
643     vtkIdType 
644     GetNodeObjID(vtkIdType theID) const;
645
646     //! Reimplement the TIDMapper::GetElemVTKID
647     virtual 
648     vtkIdType 
649     GetElemVTKID(vtkIdType theID) const;
650
651     //! Reimplement the TIDMapper::GetElemObjID
652     virtual 
653     vtkIdType 
654     GetElemObjID(vtkIdType theID) const;
655
656     //! Reimplement the TNamedIDMapper::GetNodeName
657     virtual
658     std::string 
659     GetNodeName(vtkIdType theObjID) const;
660
661     //! Reimplement the TNamedIDMapper::GetElemName
662     virtual
663     std::string 
664     GetElemName(vtkIdType theObjID) const;
665
666     //! Reimplement the TNamedIDMapper::GetUnstructuredGridOutput
667     virtual
668     vtkUnstructuredGrid* 
669     GetUnstructuredGridOutput();
670
671     //! Gets memory size used by the instance (bytes).
672     virtual
673     unsigned long int
674     GetMemorySize();
675
676     TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping 
677     TSubMeshArr mySubMeshArr; //!< Keeps sequence of TSubMeshImpl as they were added into TAppendFilterHolder
678     PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping
679
680     TGeom2SubMesh myGeom2SubMesh; //!< Keeps TSubMeshImpl according to their geometrical type
681   };
682
683
684   //---------------------------------------------------------------
685   typedef std::map<EGeometry,TSubMeshID> TGeom2SubMeshID;
686
687   //! Specialize TFamily to provide VTK mapping for the entity
688   struct VISU_CONVERTOR_EXPORT TFamilyImpl: virtual TFamily, 
689                       virtual TUnstructuredGridHolder
690   {
691     //! Reimplements the TStructured::CopyStructure
692     virtual
693     void
694     CopyStructure( PStructured theStructured );
695
696     //! Reimplement the TIDMapper::GetNodeObjID
697     vtkIdType 
698     GetNodeObjID(vtkIdType theID) const ;
699
700     //! Reimplement the TIDMapper::GetNodeVTKID
701     virtual 
702     vtkIdType 
703     GetNodeVTKID(vtkIdType theID) const ;
704
705     //! Reimplement the TIDMapper::GetElemVTKID
706     virtual 
707     vtkIdType 
708     GetElemVTKID(vtkIdType theID) const;
709
710     //! Reimplement the TIDMapper::GetElemObjID
711     virtual 
712     vtkIdType 
713     GetElemObjID(vtkIdType theID) const;
714
715     //! Reimplement the TUnstructuredGridIDMapper::GetUnstructuredGridOutput
716     virtual
717     vtkUnstructuredGrid* 
718     GetUnstructuredGridOutput();
719
720     //! Gets memory size used by the instance (bytes).
721     virtual
722     unsigned long int
723     GetMemorySize();
724
725     PNamedPointCoords myNamedPointCoords;  //!< Share the same instance with TMesh to implement nodal mapping
726     TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping
727     TSubMeshID myMeshID; //!< Keeps numbers of mesh elements that belongs to the MED FAMILY
728
729     TGeom2SubMeshID myGeom2SubMeshID; //!< Keeps TSubMeshID according to their geometrical type
730
731     TNames myGroupNames; //!< Keeps names of groups that refer to the family
732   };
733
734
735   //---------------------------------------------------------------
736   typedef std::pair<vtkIdType,vtkIdType> TNbASizeCells;
737   typedef TVector<PFamilyImpl> TFamilyArr;
738
739   //! Specialize TGroup to provide VTK mapping for the entity
740   struct VISU_CONVERTOR_EXPORT TGroupImpl: virtual TGroup, 
741                      virtual TAppendFilterHolder
742   {
743     //! Reimplements the TStructured::CopyStructure
744     virtual
745     void
746     CopyStructure( PStructured theStructured );
747
748     //! Calculate pair of values - number of cells and its size
749     TNbASizeCells 
750     GetNbASizeCells() const;
751
752     //! Reimplement the TIDMapper::GetElemVTKID
753     virtual 
754     vtkIdType 
755     GetElemVTKID(vtkIdType theID) const;
756
757     //! Reimplement the TIDMapper::GetElemObjID
758     virtual 
759     vtkIdType 
760     GetElemObjID(vtkIdType theID) const;
761
762     //! Reimplement the TIDMapper::GetNodeObjID
763     virtual 
764     vtkIdType 
765     GetNodeObjID(vtkIdType theID) const;
766
767     //! Reimplement the TIDMapper::GetNodeVTKID
768     virtual 
769     vtkIdType 
770     GetNodeVTKID(vtkIdType theID) const;
771
772     //! Reimplement the TUnstructuredGridIDMapper::GetUnstructuredGridOutput
773     virtual
774     vtkUnstructuredGrid* 
775     GetUnstructuredGridOutput();
776
777     //! Gets memory size used by the instance (bytes).
778     virtual
779     unsigned long int
780     GetMemorySize();
781
782     TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping
783     TFamilyArr myFamilyArr; //!< Keeps sequence of TFamily as they were added into TAppendFilterHolder
784     PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping
785   };
786
787
788   //---------------------------------------------------------------
789   typedef            TVector<TMinMax>              TComp2MinMax;
790   typedef       TVector<TComp2MinMax>       TMetric2Comp2MinMax;
791
792   typedef     std::map<TName,TMinMax>             TGroup2MinMax;
793   typedef      TVector<TGroup2MinMax>        TComp2Group2MinMax;
794   typedef TVector<TComp2Group2MinMax> TMetric2Comp2Group2MinMax;
795
796   //! Specialize TField to provide VTK mapping for the entity
797   struct VISU_CONVERTOR_EXPORT TFieldImpl: virtual TField
798   {
799     TFieldImpl();
800
801     //! To initialize the data structure    
802     void 
803     Init(vtkIdType theNbComp,
804          vtkIdType theDataType);
805
806     //! Gets type idetificator of the mesh data.
807     vtkIdType
808     GetDataType() const;
809
810     //! Implement the TField::GetMinMax
811     virtual
812     TMinMax 
813     GetMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric = VISU::AVERAGE_METRIC);
814
815     //! Implement the TField::GetAverageMinMax
816     virtual
817     TMinMax 
818     GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric = VISU::AVERAGE_METRIC);
819
820     vtkIdType myDataSize; //!< Keeps size of the assigned data
821     vtkIdType myDataType; //!< Keeps type idetificator of the mesh data
822     TMetric2Comp2MinMax myMetric2Comp2MinMax; //!< Keeps min/max values for each component of the MED FIELD
823     TMetric2Comp2MinMax myMetric2Comp2AverageMinMax; //!< Keeps average by Gauss Points min/max values for each component of the MED FIELD
824                                                      //!< If Nb of Gauss Points <=1 myAverageMinMaxArr equal myMinMaxArr
825
826     TMetric2Comp2Group2MinMax myMetric2Comp2Group2MinMax;
827     TMetric2Comp2Group2MinMax myMetric2Comp2Group2AverageMinMax;
828   };
829
830
831   //---------------------------------------------------------------
832   typedef std::map<EGeometry, PMeshValue> TGeom2MeshValue;
833
834   class TGeom2Value: public virtual TBaseStructure
835   {
836     TGeom2MeshValue myGeom2MeshValue;
837   public:
838
839     //! Gets mesh data for defined geometrical type (constant version)
840     const PMeshValue& 
841     GetMeshValue(EGeometry theGeom) const;
842
843     //! Gets mesh data for defined geometrical type
844     PMeshValue& 
845     GetMeshValue(EGeometry theGeom);
846
847     //! Gets container of the whole mesh data
848     TGeom2MeshValue& 
849     GetGeom2MeshValue();
850     
851     //! Gets container of the whole mesh data (constant version)
852     const TGeom2MeshValue& 
853     GetGeom2MeshValue() const;
854
855     //! Gets mesh data for the first geometry
856     PMeshValue
857     GetFirstMeshValue() const;
858   };
859
860
861   //---------------------------------------------------------------
862   typedef std::map<EGeometry,vtkIdType> TGeom2NbGauss;
863
864   //! Specialize TValForTime to provide VTK mapping for the entity
865   struct VISU_CONVERTOR_EXPORT TValForTimeImpl: virtual TValForTime
866   {
867     PGaussPtsIDFilter myGaussPtsIDFilter; //!< Keep VTK representation for mesh and data on Gauss Points
868     PUnstructuredGridIDMapperImpl myUnstructuredGridIDMapper; //!< Keep VTK representation for ordinary mesh and data
869     TGeom2Value myGeom2Value; //!< Keep value that is assigned to the mesh
870     TGeom2NbGauss myGeom2NbGauss; //!< Keep number of Gauss Points
871    
872     TValForTimeImpl();
873
874     TGeom2MeshValue& 
875     GetGeom2MeshValue();
876     
877     const TGeom2MeshValue& 
878     GetGeom2MeshValue() const;
879     
880     //! Get mesh data for defined geometrical type (constant version)
881     const PMeshValue& 
882     GetMeshValue(EGeometry theGeom) const;
883
884     //! Get mesh data for defined geometrical type
885     PMeshValue& 
886     GetMeshValue(EGeometry theGeom);
887
888     //! Gets mesh data for the first geometry
889     PMeshValue
890     GetFirstMeshValue() const;
891
892     //! Get number of Gauss Points for defined geometrical type
893     virtual
894     int
895     GetNbGauss(EGeometry theGeom) const;
896
897     //! Get maximum number of Gauss Points among all geometrical types (provided for convenience)
898     virtual
899     int
900     GetMaxNbGauss() const;
901
902     //! Gets memory size used by the instance (bytes).
903     virtual
904     unsigned long int
905     GetMemorySize();
906   };
907
908
909   //---------------------------------------------------------------
910 }
911
912
913 #endif