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