Salome HOME
Merge from V5_1_main 14/05/2010
[modules/visu.git] / src / CONVERTOR / VISU_Structures_impl.cxx
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 #include "VISU_Structures_impl.hxx"
28 #include "VISU_PointCoords.hxx"
29 #include "VISU_MeshValue.hxx"
30
31 #include "VISU_AppendFilter.hxx"
32 #include "VISU_AppendPolyData.hxx"
33 #include "VISU_MergeFilter.hxx"
34
35 #include "VISU_ConvertorUtils.hxx"
36 #include "VISU_CommonCellsFilter.hxx"
37
38 #include <vtkUnstructuredGrid.h>
39 #include <vtkPolyData.h>
40 #include <vtkCellType.h>
41 #include <vtkCell.h>
42
43 namespace VISU
44 {
45   /*  vtkIdType
46   VISUGeom2NbNodes(EGeometry theGeom)
47   {
48     switch(theGeom){
49 #ifndef VISU_ENABLE_QUADRATIC
50     case VISU::eSEG3:
51       return 2;
52     case VISU::eTRIA6:
53       return 3;
54     case VISU::eQUAD8:
55       return 4;
56     case VISU::eTETRA10:
57       return 4;
58     case VISU::eHEXA20:
59       return 8;
60     case VISU::ePENTA15:
61       return 6;
62     case VISU::ePYRA13:
63       return 5;
64 #endif
65     case VISU::ePOLYGONE:
66     case VISU::ePOLYEDRE:
67       return -1;
68     default:
69       return theGeom % 100;
70     }
71   }
72
73   vtkIdType
74   VISUGeom2VTK(EGeometry theGeom)
75   {
76     switch(theGeom){
77     case VISU::ePOINT1:
78       return VTK_VERTEX;
79     case VISU::eSEG2:
80       return VTK_LINE;
81     case VISU::eTRIA3:
82       return VTK_TRIANGLE;
83     case VISU::eQUAD4:
84       return VTK_QUAD;
85     case VISU::eTETRA4:
86       return VTK_TETRA;
87     case VISU::eHEXA8:
88       return VTK_HEXAHEDRON;
89     case VISU::ePENTA6:
90       return VTK_WEDGE;
91     case VISU::ePYRA5:
92       return VTK_PYRAMID;
93
94     case VISU::ePOLYGONE:
95       return VTK_POLYGON;
96     case VISU::ePOLYEDRE:
97       return VTK_CONVEX_POINT_SET;
98
99 #ifndef VISU_ENABLE_QUADRATIC
100     case VISU::eSEG3:
101       return VTK_LINE;
102     case VISU::eTRIA6:
103       return VTK_TRIANGLE;
104     case VISU::eQUAD8:
105       return VTK_QUAD;
106     case VISU::eTETRA10:
107       return VTK_TETRA;
108     case VISU::eHEXA20:
109       return VTK_HEXAHEDRON;
110     case VISU::ePENTA15:
111       return VTK_WEDGE;
112     case VISU::ePYRA13:
113       return VTK_PYRAMID;
114
115 #else
116
117     case VISU::eSEG3:
118 #if defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)
119       return VTK_QUADRATIC_EDGE;
120 #else
121       return VTK_POLY_LINE;
122 #endif
123
124     case VISU::eTRIA6:
125 #if defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)
126       return VTK_QUADRATIC_TRIANGLE;
127 #else
128       return VTK_POLYGON;
129 #endif
130
131     case VISU::eQUAD8:
132 #if defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)
133       return VTK_QUADRATIC_QUAD;
134 #else
135       return VTK_POLYGON;
136 #endif
137
138     case VISU::eTETRA10:
139 #if defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)
140       return VTK_QUADRATIC_TETRA;
141 #else
142       return VTK_CONVEX_POINT_SET;
143 #endif
144
145     case VISU::eHEXA20:
146 #if defined(VTK_QUADRATIC_HEXAHEDRON) && defined(VISU_USE_VTK_QUADRATIC)
147       return VTK_QUADRATIC_HEXAHEDRON;
148 #else
149       return VTK_CONVEX_POINT_SET;
150 #endif
151
152     case VISU::ePENTA15:
153 #if defined(VTK_QUADRATIC_WEDGE) && defined(VISU_USE_VTK_QUADRATIC)
154       return VTK_QUADRATIC_WEDGE;
155 #else
156       return VTK_CONVEX_POINT_SET;
157 #endif
158
159     case VISU::ePYRA13:
160 #if defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)
161       return VTK_QUADRATIC_PYRAMID;
162 #else
163       return VTK_CONVEX_POINT_SET;
164 #endif
165
166 #endif //VISU_ENABLE_QUADRATIC
167
168     default:
169       return -1;
170     }
171     }*/
172
173
174   EGeometry
175   VTKGeom2VISU(vtkIdType theGeom)
176   {
177     switch(theGeom){
178     case VTK_VERTEX:
179       return VISU::ePOINT1;
180     case VTK_LINE:
181       return VISU::eSEG2;
182     case VTK_TRIANGLE:
183       return VISU::eTRIA3;
184     case VTK_QUAD:
185       return VISU::eQUAD4;
186     case VTK_TETRA:
187       return VISU::eTETRA4;
188     case VTK_HEXAHEDRON:
189       return VISU::eHEXA8;
190     case VTK_WEDGE:
191       return VISU::ePENTA6;
192     case VTK_PYRAMID:
193       return VISU::ePYRA5;
194
195     case VTK_POLYGON:
196       return VISU::ePOLYGONE;
197     case VTK_CONVEX_POINT_SET:
198       return VISU::ePOLYEDRE;
199
200 #if defined(VISU_ENABLE_QUADRATIC) && defined(VISU_USE_VTK_QUADRATIC)
201   #if defined(VTK_QUADRATIC_EDGE)
202     case VTK_QUADRATIC_EDGE:
203       return VISU::eSEG3;
204   #endif
205
206   #if defined(VTK_QUADRATIC_TRIANGLE)
207     case VTK_QUADRATIC_TRIANGLE:
208       return VISU::eTRIA6;
209   #endif
210
211   #if defined(VTK_QUADRATIC_QUAD)
212     case VTK_QUADRATIC_QUAD:
213       return VISU::eQUAD8;
214   #endif
215
216   #if defined(VTK_QUADRATIC_TETRA)
217     case VTK_QUADRATIC_TETRA:
218       return VISU::eTETRA10;
219   #endif
220
221   #if defined(VTK_QUADRATIC_HEXAHEDRON)
222     case VTK_QUADRATIC_HEXAHEDRON:
223       return VISU::eHEXA20;
224   #endif
225
226   #if defined(VTK_QUADRATIC_WEDGE)
227     case VTK_QUADRATIC_WEDGE:
228       return VISU::ePENTA15;
229   #endif
230
231   #if defined(VTK_QUADRATIC_PYRAMID)
232     case VTK_QUADRATIC_PYRAMID:
233       return VISU::ePYRA13;
234   #endif
235
236 #endif //VISU_ENABLE_QUADRATIC
237
238     default:
239       return EGeometry(-1);
240     }
241   }
242
243   //---------------------------------------------------------------
244   /*! Computes number of points by the given number of cells
245    *  in assumption of regular hexahedral mesh structure
246    */
247   size_t
248   GetNumberOfPoints(size_t theNbCells)
249   {
250     return size_t(pow(pow(theNbCells, 1.0/3.0) + 1.0, 3.0));
251   }
252
253   //---------------------------------------------------------------
254   /*! Computes size dataset the given number of mesh macro metrics
255    *  in assumption of regular hexahedral mesh structure
256    */
257   size_t
258   GetDataSetSize(size_t theNbOfPoints,
259                  size_t theNbOfCells,
260                  size_t theCellsSize,
261                  bool theComputeLinks)
262   {
263     size_t aPointsSize = 3*theNbOfPoints*sizeof(VISU::TCoord);
264     size_t aConnectivityAndTypesSize = theCellsSize*sizeof(vtkIdType);
265     size_t aLocationsSize = theNbOfCells*sizeof(int);
266     vtkFloatingPointType aNbCellsPerPoint = theCellsSize / theNbOfCells - 1;
267     size_t aLinksSize = theNbOfPoints * (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(short));
268     if(!theComputeLinks)
269       aLinksSize = 0;
270     size_t aResult = aPointsSize + aConnectivityAndTypesSize + aLocationsSize + aLinksSize;
271     return aResult;
272   }
273
274   //---------------------------------------------------------------
275   TSizeCounter
276   ::TSizeCounter():
277     myNbCells(0),
278     myCellsSize(0)
279   {}
280
281
282   //---------------------------------------------------------------
283   TPolyDataHolder
284   ::TPolyDataHolder()
285   {}
286
287   const PPolyData&
288   TPolyDataHolder
289   ::GetSource() const
290   {
291     if(!mySource.GetPointer()){
292       mySource = vtkPolyData::New();
293       mySource->Delete();
294     }
295     return mySource;
296   }
297
298   vtkPolyData*
299   TPolyDataHolder
300   ::GetPolyDataOutput()
301   {
302     return GetSource().GetPointer();
303   }
304
305   unsigned long int
306   TPolyDataHolder
307   ::GetMemorySize()
308   {
309     if(vtkDataSet* anOutput = GetPolyDataOutput()){
310       anOutput->Update();
311       return anOutput->GetActualMemorySize() * 1024;
312     }
313     if(myIsDone){
314       size_t aNbPoints = GetNumberOfPoints(myNbCells);
315       return GetDataSetSize(aNbPoints, myNbCells, myCellsSize, false);
316     }
317     throw std::runtime_error("TUnstructuredGridHolder::GetMemorySize - myIsDone == false !!!");
318     return 0;
319   }
320
321   //---------------------------------------------------------------
322   TUnstructuredGridHolder
323   ::TUnstructuredGridHolder()
324   {}
325
326   const PUnstructuredGrid&
327   TUnstructuredGridHolder
328   ::GetSource() const
329   {
330     if(!mySource.GetPointer()){
331       mySource = vtkUnstructuredGrid::New();
332       mySource->Delete();
333     }
334     return mySource;
335   }
336
337   vtkUnstructuredGrid*
338   TUnstructuredGridHolder
339   ::GetUnstructuredGridOutput()
340   {
341     return GetSource().GetPointer();
342   }
343
344   unsigned long int
345   TUnstructuredGridHolder
346   ::GetMemorySize()
347   {
348     if(vtkDataSet* anOutput = GetUnstructuredGridOutput()){
349       anOutput->Update();
350       return anOutput->GetActualMemorySize() * 1024;
351     }
352     if(myIsDone){
353       size_t aNbPoints = GetNumberOfPoints(myNbCells);
354       return GetDataSetSize(aNbPoints, myNbCells, myCellsSize, false);
355     }
356     throw std::runtime_error("TUnstructuredGridHolder::GetMemorySize - myIsDone == false !!!");
357     return 0;
358   }
359
360   //---------------------------------------------------------------
361   unsigned long int
362   TMemoryCheckIDMapper
363   ::GetMemorySize()
364   {
365     if(myIsVTKDone){
366       if(vtkDataSet* anOutput = GetOutput()){
367         anOutput->Update();
368         return anOutput->GetActualMemorySize() * 1024;
369       }
370     }
371     throw std::runtime_error("TMemoryCheckIDMapper::GetMemorySize - myIsVTKDone == false !!!");
372     return 0;
373   }
374
375
376   //---------------------------------------------------------------
377   TAppendFilterHolder
378   ::TAppendFilterHolder()
379   {}
380
381   const PAppendFilter&
382   TAppendFilterHolder
383   ::GetFilter() const
384   {
385     if(!myFilter.GetPointer()){
386       myFilter = VISU_AppendFilter::New();
387       myFilter->Delete();
388       myFilter->SetMappingInputs(true);
389     }
390     return myFilter;
391   }
392
393   vtkUnstructuredGrid*
394   TAppendFilterHolder
395   ::GetUnstructuredGridOutput()
396   {
397     GetFilter()->Update();
398     return GetFilter()->GetOutput();
399   }
400
401   //---------------------------------------------------------------
402   TAppendPolyDataHolder
403   ::TAppendPolyDataHolder()
404   {}
405
406   const PAppendPolyData&
407   TAppendPolyDataHolder
408   ::GetFilter() const
409   {
410     if(!myFilter.GetPointer()){
411       myFilter = VISU_AppendPolyData::New();
412       myFilter->SetMappingInputs(true);
413       myFilter->Delete();
414     }
415     return myFilter;
416   }
417
418   vtkPolyData*
419   TAppendPolyDataHolder
420   ::GetPolyDataOutput()
421   {
422     GetFilter()->Update();
423     return GetFilter()->GetOutput();
424   }
425
426
427   //---------------------------------------------------------------
428   TMergeFilterHolder
429   ::TMergeFilterHolder()
430   {}
431
432   const PMergeFilter&
433   TMergeFilterHolder
434   ::GetFilter() const
435   {
436     if(!myFilter.GetPointer()){
437       myFilter = VISU_MergeFilter::New();
438       myFilter->Delete();
439     }
440     return myFilter;
441   }
442
443   vtkDataSet*
444   TMergeFilterHolder
445   ::GetOutput()
446   {
447     GetFilter()->Update();
448     return GetFilter()->GetOutput();
449   }
450
451
452   //---------------------------------------------------------------
453   TMeshImpl
454   ::TMeshImpl():
455     myNbPoints(0)
456   {}
457
458   vtkIdType
459   TMeshImpl::
460   GetNbPoints() const
461   {
462     return myNbPoints;
463   }
464
465   vtkIdType
466   TMeshImpl::
467   GetDim() const
468   {
469     return myDim;
470   }
471
472   vtkPointSet*
473   TMeshImpl::
474   GetPointSet()
475   {
476     return myNamedPointCoords->GetPointSet();
477   }
478
479
480   //---------------------------------------------------------------
481   TSubProfileImpl::TSubProfileImpl():
482     myStatus(eNone),
483     myGeom(eNONE)
484   {}
485
486
487   vtkIdType
488   TSubProfileImpl
489   ::GetElemObjID(vtkIdType theID) const
490   {
491     if ( !mySubMeshID.empty() )
492       return mySubMeshID[theID];
493
494     return theID;
495   }
496
497
498   vtkIdType
499   TSubProfileImpl
500   ::GetElemVTKID(vtkIdType theID) const
501   {
502     if ( !mySubMeshID.empty() )
503       for ( size_t anId = 0; anId < mySubMeshID.size(); anId++ )
504         if ( mySubMeshID[ anId ] == theID )
505           return anId;
506
507     return theID;
508   }
509
510   unsigned long int
511   TSubProfileImpl
512   ::GetMemorySize()
513   {
514     size_t aSize = TUnstructuredGridHolder::GetMemorySize();
515     aSize += sizeof(vtkIdType) * mySubMeshID.size();
516     return aSize;
517   }
518
519
520   //---------------------------------------------------------------
521   bool
522   operator<(const PSubProfile& theLeft, const PSubProfile& theRight)
523   {
524     PSubProfileImpl aLeft(theLeft), aRight(theRight);
525
526     if(aLeft->myGeom != aRight->myGeom)
527       return aLeft->myGeom < aRight->myGeom;
528
529     if(aLeft->myStatus != aRight->myStatus)
530       return aLeft->myStatus < aRight->myStatus;
531
532     return aLeft->myName < aRight->myName;
533   }
534
535
536   //---------------------------------------------------------------
537   TProfileImpl
538   ::TProfileImpl():
539     myIsAll(true),
540     myMeshOnEntity(NULL)
541   {}
542
543   vtkIdType
544   TProfileImpl
545   ::GetNodeObjID(vtkIdType theID) const
546   {
547     return myNamedPointCoords->GetObjID(theID);
548   }
549
550   vtkIdType
551   TProfileImpl
552   ::GetNodeVTKID(vtkIdType theID) const
553   {
554     return myNamedPointCoords->GetVTKID(theID);
555   }
556
557   vtkFloatingPointType*
558   TProfileImpl
559   ::GetNodeCoord(vtkIdType theObjID)
560   {
561     if(myIsAll)
562       return myMeshOnEntity->GetNodeCoord(theObjID);
563
564     vtkIdType aVtkID = GetNodeVTKID(theObjID);
565     return GetFilter()->GetOutput()->GetPoint(aVtkID);
566   }
567
568   vtkIdType
569   TProfileImpl
570   ::GetElemObjID(vtkIdType theID) const
571   {
572     return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
573   }
574
575   vtkIdType
576   TProfileImpl
577   ::GetElemVTKID(vtkIdType theID) const
578   {
579     return VISU::GetElemVTKID(GetFilter()->GetOutput(), theID);
580   }
581
582   vtkCell*
583   TProfileImpl
584   ::GetElemCell(vtkIdType theObjID)
585   {
586     if(myIsAll)
587       return myMeshOnEntity->GetElemCell(theObjID);
588
589     vtkIdType aVtkID = GetElemVTKID(theObjID);
590     return GetFilter()->GetOutput()->GetCell(aVtkID);
591   }
592
593   vtkUnstructuredGrid*
594   TProfileImpl
595   ::GetUnstructuredGridOutput()
596   {
597     const PAppendFilter& anAppendFilter = GetFilter();
598     return anAppendFilter->GetOutput();
599   }
600
601   unsigned long int
602   TProfileImpl
603   ::GetMemorySize()
604   {
605     size_t aSize = TAppendFilterHolder::GetMemorySize();
606     aSize += myNamedPointCoords->GetMemorySize();
607     aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
608     TGeom2SubProfile::const_iterator anIter = myGeom2SubProfile.begin();
609     TGeom2SubProfile::const_iterator anIterEnd = myGeom2SubProfile.end();
610     for(; anIter != anIterEnd; anIter++){
611       const PSubProfileImpl& aSubProfile = anIter->second;
612       aSize += aSubProfile->GetMemorySize();
613       aSize += sizeof(EGeometry);
614     }
615     return aSize;
616   }
617
618   std::string
619   TProfileImpl
620   ::GetNodeName(vtkIdType theObjID) const
621   {
622     return myNamedPointCoords->GetNodeName(theObjID);
623   }
624
625   std::string
626   TProfileImpl
627   ::GetElemName(vtkIdType theObjID) const
628   {
629     return myMeshOnEntity->GetElemName(theObjID);
630   }
631
632
633   //---------------------------------------------------------------
634   TUnstructuredGridIDMapperImpl
635   ::TUnstructuredGridIDMapperImpl()
636   {
637     if ( !myCommonCellsFilter.GetPointer() ) {
638       myCommonCellsFilter = VISU_CommonCellsFilter::New();
639       myCommonCellsFilter->Delete();
640     }
641   }
642
643   vtkIdType
644   TUnstructuredGridIDMapperImpl
645   ::GetNodeObjID(vtkIdType theID) const
646   {
647     return myIDMapper->GetNodeObjID(theID);
648   }
649
650   vtkIdType
651   TUnstructuredGridIDMapperImpl
652   ::GetNodeVTKID(vtkIdType theID) const
653   {
654     return myIDMapper->GetNodeVTKID(theID);
655   }
656
657   vtkFloatingPointType*
658   TUnstructuredGridIDMapperImpl
659   ::GetNodeCoord(vtkIdType theObjID)
660   {
661     return myIDMapper->GetNodeCoord(theObjID);
662   }
663
664   vtkIdType
665   TUnstructuredGridIDMapperImpl
666   ::GetElemObjID(vtkIdType theID) const
667   {
668     return myIDMapper->GetElemObjID(theID);
669   }
670
671   vtkIdType
672   TUnstructuredGridIDMapperImpl
673   ::GetElemVTKID(vtkIdType theID) const
674   {
675     return myIDMapper->GetElemVTKID(theID);
676   }
677
678   vtkCell*
679   TUnstructuredGridIDMapperImpl
680   ::GetElemCell(vtkIdType theObjID)
681   {
682     return myIDMapper->GetElemCell(theObjID);
683   }
684
685   void
686   TUnstructuredGridIDMapperImpl
687   ::SetReferencedMesh( const PNamedIDMapper& theNamedIDMapper )
688   {
689     myCommonCellsFilter->SetCellsUG( theNamedIDMapper->GetUnstructuredGridOutput() );
690   }
691
692   void
693   TUnstructuredGridIDMapperImpl
694   ::Build()
695   {
696     if ( !myFilter.GetPointer() ) {
697       const PAppendFilter& anAppendFilter = myIDMapper->GetFilter();
698
699       vtkUnstructuredGrid* aGeometry = anAppendFilter->GetOutput();
700       const PUnstructuredGrid& aSource = mySource.GetSource();
701       vtkUnstructuredGrid* aDataSet = aSource.GetPointer();
702       aDataSet->ShallowCopy( aGeometry );
703
704       const PMergeFilter& aFilter = GetFilter();
705       aFilter->SetGeometry( aGeometry );
706       aFilter->SetScalars( aDataSet );
707       aFilter->SetVectors( aDataSet );
708       aFilter->AddField( "VISU_FIELD", aDataSet );
709       aFilter->AddField( "VISU_FIELD_GAUSS_MIN", aDataSet );
710       aFilter->AddField( "VISU_FIELD_GAUSS_MAX", aDataSet );
711       aFilter->AddField( "VISU_FIELD_GAUSS_MOD", aDataSet );
712       aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet );
713       aFilter->AddField( "ELNO_FIELD", aDataSet );
714       aFilter->AddField( "ELNO_COMPONENT_MAPPER", aDataSet );
715       aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet );
716
717       myCommonCellsFilter->SetProfileUG( aFilter->GetUnstructuredGridOutput() );
718     }
719   }
720
721   vtkUnstructuredGrid*
722   TUnstructuredGridIDMapperImpl
723   ::GetUnstructuredGridOutput()
724   {
725     Build();
726     return myCommonCellsFilter->GetOutput();
727   }
728
729   vtkDataSet*
730   TUnstructuredGridIDMapperImpl
731   ::GetOutput()
732   {
733     return GetUnstructuredGridOutput();
734   }
735
736   PUnstructuredGrid
737   TUnstructuredGridIDMapperImpl
738   ::GetSource()
739   {
740     Build();
741     return mySource.GetSource();
742   }
743
744   unsigned long int
745   TUnstructuredGridIDMapperImpl
746   ::GetMemorySize()
747   {
748     size_t aSize = myIDMapper->GetMemorySize();
749
750     aSize += mySource.GetMemorySize();
751
752     if ( vtkUnstructuredGrid* anOutput = myCommonCellsFilter->GetOutput() )
753       aSize += anOutput->GetActualMemorySize() * 1024;
754
755     return aSize;
756   }
757
758   //---------------------------------------------------------------
759   vtkIdType
760   TPolyDataIDMapperImpl
761   ::GetNodeObjID(vtkIdType theID) const
762   {
763     return myIDMapper->GetNodeObjID(theID);
764   }
765
766   vtkIdType
767   TPolyDataIDMapperImpl
768   ::GetNodeVTKID(vtkIdType theID) const
769   {
770     return myIDMapper->GetNodeVTKID(theID);
771   }
772
773   vtkFloatingPointType*
774   TPolyDataIDMapperImpl
775   ::GetNodeCoord(vtkIdType theObjID)
776   {
777     return myIDMapper->GetNodeCoord(theObjID);
778   }
779
780   vtkIdType
781   TPolyDataIDMapperImpl
782   ::GetElemObjID(vtkIdType theID) const
783   {
784     return myIDMapper->GetElemObjID(theID);
785   }
786
787   vtkIdType
788   TPolyDataIDMapperImpl
789   ::GetElemVTKID(vtkIdType theID) const
790   {
791     return myIDMapper->GetElemVTKID(theID);
792   }
793
794   vtkCell*
795   TPolyDataIDMapperImpl
796   ::GetElemCell(vtkIdType theObjID)
797   {
798     return myIDMapper->GetElemCell(theObjID);
799   }
800
801   void
802   TPolyDataIDMapperImpl
803   ::Build()
804   {
805     if ( !myFilter.GetPointer() ) {
806       const PAppendPolyData& anAppendFilter = myIDMapper->GetFilter();
807       vtkPolyData* aGeometry = anAppendFilter->GetOutput();
808
809       const PPolyData& aSource = mySource.GetSource();
810       vtkPolyData* aDataSet = aSource.GetPointer();
811       aDataSet->ShallowCopy( aGeometry );
812
813       const PMergeFilter& aFilter = GetFilter();
814       aFilter->SetGeometry( aGeometry );
815       aFilter->SetScalars( aDataSet );
816       aFilter->SetVectors( aDataSet );
817       aFilter->AddField( "VISU_FIELD", aDataSet );
818       aFilter->AddField( "VISU_FIELD_GAUSS_MIN", aDataSet );
819       aFilter->AddField( "VISU_FIELD_GAUSS_MAX", aDataSet );
820       aFilter->AddField( "VISU_FIELD_GAUSS_MOD", aDataSet );
821       aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet );
822       aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet );
823     }
824   }
825
826   vtkPolyData*
827   TPolyDataIDMapperImpl
828   ::GetPolyDataOutput()
829   {
830     Build();
831     return myFilter->GetPolyDataOutput();
832   }
833
834   vtkDataSet*
835   TPolyDataIDMapperImpl
836   ::GetOutput()
837   {
838     return GetPolyDataOutput();
839   }
840
841   PPolyData
842   TPolyDataIDMapperImpl
843   ::GetSource()
844   {
845     Build();
846     return mySource.GetSource();
847   }
848
849   unsigned long int
850   TPolyDataIDMapperImpl
851   ::GetMemorySize()
852   {
853     size_t aSize = myIDMapper->GetMemorySize();
854     aSize += mySource.GetMemorySize();
855     return aSize;
856   }
857
858
859   //---------------------------------------------------------------
860   TGaussImpl
861   ::TGaussImpl():
862     myGeom(EGeometry(-1)),
863     myNbPoints(0)
864   {}
865
866   void
867   TGaussImpl
868   ::LessThan(const PGaussImpl& theGauss,
869              bool& theResult) const
870   {
871     theResult = false;
872   }
873
874
875   //---------------------------------------------------------------
876   TGaussSubMeshImpl
877   ::TGaussSubMeshImpl():
878     myPointCoords(new TPointCoords()),
879     myStatus(eNone),
880     myStartID(0)
881   {}
882
883   TGaussPointID
884   TGaussSubMeshImpl
885   ::GetObjID(vtkIdType theID) const
886   {
887     TCellID aCellID = myStartID + theID / myGauss->myNbPoints;
888     TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
889
890     return TGaussPointID(aCellID, aLocalPntID);
891   }
892
893   vtkIdType
894   TGaussSubMeshImpl
895   ::GetVTKID(const TGaussPointID& theID) const
896   {
897     vtkIdType aResult = -1;
898
899     TCellID aCellID = theID.first;
900     TLocalPntID aLocalPntID = theID.second;
901
902     vtkIdType aNbPoints = myGauss->myNbPoints;
903     if ( aLocalPntID >= aNbPoints )
904       return aResult;
905
906     return ( aCellID - myStartID ) * aNbPoints + aLocalPntID;
907   }
908
909   vtkIdType
910   VISU::TGaussSubMeshImpl
911   ::GetElemObjID(vtkIdType theID) const
912   {
913     return mySubProfile->GetElemObjID( theID );
914   }
915
916
917   vtkIdType
918   VISU::TGaussSubMeshImpl
919   ::GetElemVTKID(vtkIdType theID) const
920   {
921     return mySubProfile->GetElemVTKID( theID );
922   }
923
924   vtkIdType
925   TGaussSubMeshImpl
926   ::GetGlobalID(vtkIdType theID) const
927   {
928     return myStartID + theID;
929   }
930
931   unsigned long int
932   TGaussSubMeshImpl
933   ::GetMemorySize()
934   {
935     size_t aSize = TPolyDataHolder::GetMemorySize();
936     aSize += myPointCoords->GetMemorySize();
937     return aSize;
938   }
939
940   //---------------------------------------------------------------
941   bool
942   operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight)
943   {
944     PGaussSubMeshImpl aLeft(theLeft), aRight(theRight);
945     const PGaussImpl& aGaussLeft = aLeft->myGauss;
946     const PGaussImpl& aGaussRight = aRight->myGauss;
947
948     if(aGaussLeft->myGeom != aGaussRight->myGeom)
949       return aGaussLeft->myGeom < aGaussRight->myGeom;
950
951     if(aLeft->mySubProfile != aRight->mySubProfile)
952       return aLeft->mySubProfile < aRight->mySubProfile;
953
954     bool aResult;
955     aGaussLeft->LessThan(aGaussRight,aResult);
956
957     return aResult;
958   }
959
960
961   //---------------------------------------------------------------
962   TGaussMeshImpl
963   ::TGaussMeshImpl():
964     myParent(NULL)
965   {}
966
967   TGaussPointID
968   TGaussMeshImpl
969   ::GetObjID(vtkIdType theID) const
970   {
971     const PAppendPolyData& aFilter = GetFilter();
972     return VISU::GetObjID(aFilter->GetOutput(), theID);
973   }
974
975   vtkIdType
976   TGaussMeshImpl
977   ::GetVTKID(const TGaussPointID& theID) const
978   {
979     vtkIdType aResult = -1;
980
981     TCellID aCellID = theID.first;
982
983     vtkIdType aVTKCellId = GetParent()->GetElemVTKID( aCellID );
984     if ( aVTKCellId < 0 )
985       return aResult;
986
987     vtkCell* aCell = GetParent()->GetElemCell( aCellID );
988     if ( !aCell )
989       return aResult;
990
991     EGeometry aVGeom = VISU::VTKGeom2VISU( aCell->GetCellType() );
992     if ( aVGeom < EGeometry(0) )
993       return aResult;
994
995     TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.find( aVGeom );
996     if ( anIter == myGeom2GaussSubMesh.end() )
997       return aResult;
998
999     size_t aSubMeshEnd = myGaussSubMeshArr.size();
1000     const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
1001     for ( size_t aSubMeshId = 0; aSubMeshId < aSubMeshEnd; aSubMeshId++ ) {
1002       const PGaussSubMeshImpl& aSubMesh = myGaussSubMeshArr[aSubMeshId];
1003       if ( aGaussSubMesh.get() == aSubMesh.get() ) {
1004         return aGaussSubMesh->GetVTKID(theID);
1005       }
1006     }
1007
1008     return aResult;
1009   }
1010
1011   vtkPolyData*
1012   TGaussMeshImpl
1013   ::GetPolyDataOutput()
1014   {
1015     return TAppendPolyDataHolder::GetPolyDataOutput();
1016   }
1017
1018   unsigned long int
1019   TGaussMeshImpl
1020   ::GetMemorySize()
1021   {
1022     size_t aSize = TAppendPolyDataHolder::GetMemorySize();
1023     TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.begin();
1024     TGeom2GaussSubMesh::const_iterator anIterEnd = myGeom2GaussSubMesh.end();
1025     for(; anIter != anIterEnd; anIter++){
1026       const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
1027       aSize += aGaussSubMesh->GetMemorySize();
1028       aSize += sizeof(EGeometry);
1029     }
1030     return aSize;
1031   }
1032
1033   TNamedIDMapper*
1034   TGaussMeshImpl
1035   ::GetParent() const
1036   {
1037     return myParent;
1038   }
1039
1040
1041   //---------------------------------------------------------------
1042   TGaussPointID
1043   TGaussPtsIDFilter
1044   ::GetObjID(vtkIdType theID) const
1045   {
1046     return myGaussPtsIDMapper->GetObjID(theID);
1047   }
1048
1049   vtkIdType
1050   TGaussPtsIDFilter
1051   ::GetVTKID(const TGaussPointID& theID) const
1052   {
1053     return myGaussPtsIDMapper->GetVTKID(theID);
1054   }
1055
1056   TNamedIDMapper*
1057   TGaussPtsIDFilter
1058   ::GetParent() const
1059   {
1060     return myGaussPtsIDMapper->GetParent();
1061   }
1062
1063   vtkPolyData*
1064   TGaussPtsIDFilter
1065   ::GetPolyDataOutput()
1066   {
1067     return TPolyDataIDMapperImpl::GetPolyDataOutput();
1068   }
1069
1070   vtkDataSet*
1071   TGaussPtsIDFilter
1072   ::GetOutput()
1073   {
1074     return GetPolyDataOutput();
1075   }
1076
1077
1078   //---------------------------------------------------------------
1079   TSubMeshImpl
1080   ::TSubMeshImpl():
1081     myStartID(0)
1082   {}
1083
1084   void
1085   TSubMeshImpl
1086   ::CopyStructure( PStructured theStructured )
1087   {
1088     TStructured::CopyStructure( theStructured );
1089
1090     if ( PMeshImpl aMesh = theStructured )
1091       GetSource()->ShallowCopy( aMesh->GetPointSet() );
1092   }
1093
1094   vtkIdType
1095   TSubMeshImpl
1096   ::GetElemObjID(vtkIdType theID) const
1097   {
1098     return myStartID + theID;
1099   }
1100
1101   std::string
1102   TSubMeshImpl
1103   ::GetElemName(vtkIdType theObjID) const
1104   {
1105     return "";
1106   }
1107
1108   unsigned long int
1109   TSubMeshImpl
1110   ::GetMemorySize()
1111   {
1112     size_t aSize = TUnstructuredGridHolder::GetMemorySize();
1113     for(size_t anId = 0; anId < myCell2Connect.size(); anId++){
1114       const TConnect& aConnect = myCell2Connect[anId];
1115       aSize += aConnect.size() * sizeof(vtkIdType);
1116     }
1117     return aSize;
1118   }
1119
1120   //---------------------------------------------------------------
1121   TMeshOnEntityImpl
1122   ::TMeshOnEntityImpl()
1123   {
1124     const PAppendFilter& anAppendFilter = GetFilter();
1125     anAppendFilter->SetMappingInputs(true);
1126   }
1127
1128   void
1129   TMeshOnEntityImpl
1130   ::CopyStructure( PStructured theStructured )
1131   {
1132     TStructured::CopyStructure( theStructured );
1133
1134     if ( PMeshImpl aMesh = theStructured )
1135       myNamedPointCoords = aMesh->myNamedPointCoords;
1136   }
1137
1138   vtkIdType
1139   TMeshOnEntityImpl
1140   ::GetNodeVTKID(vtkIdType theID) const
1141   {
1142     return myNamedPointCoords->GetVTKID(theID);
1143   }
1144
1145   vtkIdType
1146   TMeshOnEntityImpl
1147   ::GetNodeObjID(vtkIdType theID) const
1148   {
1149     return myNamedPointCoords->GetObjID(theID);
1150   }
1151
1152   vtkIdType
1153   TMeshOnEntityImpl
1154   ::GetElemVTKID(vtkIdType theID) const
1155   {
1156     return VISU::GetElemVTKID(GetFilter()->GetOutput(), theID);
1157   }
1158
1159   vtkIdType
1160   TMeshOnEntityImpl
1161   ::GetElemObjID(vtkIdType theID) const
1162   {
1163     return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
1164   }
1165
1166   std::string
1167   TMeshOnEntityImpl
1168   ::GetNodeName(vtkIdType theObjID) const
1169   {
1170     return myNamedPointCoords->GetNodeName(theObjID);
1171   }
1172
1173   std::string
1174   TMeshOnEntityImpl
1175   ::GetElemName(vtkIdType theObjID) const
1176   {
1177     TInputCellID anInputCellID = VISU::GetInputCellID(GetFilter()->GetOutput(), theObjID);
1178     const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputCellID.first];
1179     return aSubMesh->GetElemName(anInputCellID.second);
1180   }
1181
1182   vtkUnstructuredGrid*
1183   TMeshOnEntityImpl
1184   ::GetUnstructuredGridOutput()
1185   {
1186     return TAppendFilterHolder::GetUnstructuredGridOutput();
1187   }
1188
1189   unsigned long int
1190   TMeshOnEntityImpl
1191   ::GetMemorySize()
1192   {
1193     size_t aSize = TAppendFilterHolder::GetMemorySize();
1194     aSize += myNamedPointCoords->GetMemorySize();
1195     aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1196     TGeom2SubMesh::const_iterator anIter = myGeom2SubMesh.begin();
1197     TGeom2SubMesh::const_iterator anIterEnd = myGeom2SubMesh.end();
1198     for(; anIter != anIterEnd; anIter++){
1199       const PSubMeshImpl& aSubMesh = anIter->second;
1200       aSize += aSubMesh->GetMemorySize();
1201       aSize += sizeof(EGeometry);
1202     }
1203     return aSize;
1204   }
1205
1206   //---------------------------------------------------------------
1207   void
1208   TFamilyImpl
1209   ::CopyStructure( PStructured theStructured )
1210   {
1211     TStructured::CopyStructure( theStructured );
1212
1213     if ( PMeshImpl aMesh = theStructured ) {
1214       myNamedPointCoords = aMesh->myNamedPointCoords;
1215       GetSource()->ShallowCopy( aMesh->GetPointSet() );
1216     }
1217   }
1218
1219   vtkIdType
1220   TFamilyImpl
1221   ::GetElemVTKID(vtkIdType theID) const
1222   {
1223     if(myElemObj2VTKID.empty())
1224       return theID;
1225     else{
1226       TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
1227       if(anIter != myElemObj2VTKID.end())
1228         return anIter->second;
1229     }
1230     return -1;
1231   }
1232
1233   vtkIdType
1234   TFamilyImpl
1235   ::GetElemObjID(vtkIdType theID) const
1236   {
1237     return myMeshID[theID];
1238   }
1239
1240   vtkIdType
1241   TFamilyImpl
1242   ::GetNodeObjID(vtkIdType theID) const
1243   {
1244     return myNamedPointCoords->GetObjID(theID);
1245   }
1246
1247   vtkIdType
1248   TFamilyImpl
1249   ::GetNodeVTKID(vtkIdType theID) const
1250   {
1251     return myNamedPointCoords->GetVTKID(theID);
1252   }
1253
1254   vtkUnstructuredGrid*
1255   TFamilyImpl
1256   ::GetUnstructuredGridOutput()
1257   {
1258     return TUnstructuredGridHolder::GetUnstructuredGridOutput();
1259   }
1260
1261   unsigned long int
1262   TFamilyImpl
1263   ::GetMemorySize()
1264   {
1265     size_t aSize = TUnstructuredGridHolder::GetMemorySize();
1266     aSize += myNamedPointCoords->GetMemorySize();
1267     aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1268     aSize += myMeshID.size() * sizeof(vtkIdType);
1269     TGeom2SubMeshID::const_iterator anIter = myGeom2SubMeshID.begin();
1270     TGeom2SubMeshID::const_iterator anIterEnd = myGeom2SubMeshID.end();
1271     for(; anIter != anIterEnd; anIter++){
1272       const TSubMeshID& aSubMeshID = anIter->second;
1273       aSize += aSubMeshID.size() * sizeof(vtkIdType);
1274       aSize += sizeof(EGeometry);
1275     }
1276     return aSize;
1277   }
1278
1279
1280   //---------------------------------------------------------------
1281   void
1282   TGroupImpl
1283   ::CopyStructure( PStructured theStructured )
1284   {
1285     TStructured::CopyStructure( theStructured );
1286
1287     if ( PMeshImpl aMesh = theStructured )
1288       myNamedPointCoords = aMesh->myNamedPointCoords;
1289   }
1290
1291   TNbASizeCells
1292   TGroupImpl
1293   ::GetNbASizeCells() const
1294   {
1295     vtkIdType aNbCells = 0, aCellsSize = 0;
1296     TFamilySet::const_iterator anIter = myFamilySet.begin();
1297     for(; anIter != myFamilySet.end(); anIter++){
1298       PFamilyImpl aFamily = (*anIter).second;
1299       aNbCells += aFamily->myNbCells;
1300       aCellsSize += aFamily->myCellsSize;
1301     }
1302     return std::make_pair(aNbCells,aCellsSize);
1303   }
1304
1305   vtkIdType
1306   TGroupImpl
1307   ::GetElemVTKID(vtkIdType theID) const
1308   {
1309     if(myElemObj2VTKID.empty())
1310       return theID;
1311     else{
1312       TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
1313       if(anIter != myElemObj2VTKID.end())
1314         return anIter->second;
1315     }
1316     return -1;
1317   }
1318
1319   vtkIdType
1320   TGroupImpl
1321   ::GetElemObjID(vtkIdType theID) const
1322   {
1323     return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
1324   }
1325
1326   vtkIdType
1327   TGroupImpl
1328   ::GetNodeObjID(vtkIdType theID) const
1329   {
1330     return myNamedPointCoords->GetObjID(theID);
1331   }
1332
1333   vtkIdType
1334   TGroupImpl
1335   ::GetNodeVTKID(vtkIdType theID) const
1336   {
1337     return myNamedPointCoords->GetVTKID(theID);
1338   }
1339
1340   vtkUnstructuredGrid*
1341   TGroupImpl
1342   ::GetUnstructuredGridOutput()
1343   {
1344     return TAppendFilterHolder::GetUnstructuredGridOutput();
1345   }
1346
1347   unsigned long int
1348   TGroupImpl
1349   ::GetMemorySize()
1350   {
1351     size_t aSize = TAppendFilterHolder::GetMemorySize();
1352     aSize += myNamedPointCoords->GetMemorySize();
1353     aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1354     for(size_t anId = 0; anId < myFamilyArr.size(); anId++){
1355       const PFamilyImpl& aFamily = myFamilyArr[anId];
1356       aSize += aFamily->GetMemorySize();
1357     }
1358     return aSize;
1359   }
1360
1361
1362
1363   //---------------------------------------------------------------
1364   TFieldImpl
1365   ::TFieldImpl()
1366     : myDataSize( 0 )
1367     , myDataType( 0 )
1368   {}
1369
1370   void
1371   TFieldImpl
1372   ::Init(vtkIdType theNbComp,
1373          vtkIdType theDataType)
1374   {
1375     myNbComp = theNbComp;
1376     myDataType = theDataType;
1377     myCompNames.resize(theNbComp);
1378     myUnitNames.resize(theNbComp);
1379
1380     myMetric2Comp2MinMax.resize(3);
1381     myMetric2Comp2AverageMinMax.resize(3);
1382     myMetric2Comp2Group2MinMax.resize(3);
1383     myMetric2Comp2Group2AverageMinMax.resize(3);
1384     for(int aGaussMetric = (int)VISU::AVERAGE_METRIC; aGaussMetric <= (int)VISU::MAXIMUM_METRIC; aGaussMetric++){
1385       TComp2MinMax& aComp2MinMax = myMetric2Comp2MinMax[aGaussMetric];
1386       TComp2MinMax& aComp2AverageMinMax = myMetric2Comp2AverageMinMax[aGaussMetric];
1387       TComp2Group2MinMax& aComp2Group2MinMax = myMetric2Comp2Group2MinMax[aGaussMetric];
1388       TComp2Group2MinMax& aComp2Group2AverageMinMax = myMetric2Comp2Group2AverageMinMax[aGaussMetric];
1389
1390       aComp2MinMax.resize(theNbComp + 1);
1391       aComp2AverageMinMax.resize(theNbComp + 1);
1392       aComp2Group2MinMax.resize(theNbComp + 1);
1393       aComp2Group2AverageMinMax.resize(theNbComp + 1);
1394       for(vtkIdType iComp = 0; iComp <= theNbComp; iComp++){
1395         TMinMax& aMinMax = aComp2MinMax[iComp];
1396         aMinMax.first = VTK_LARGE_FLOAT;
1397         aMinMax.second = -VTK_LARGE_FLOAT;
1398         TMinMax& anAverageMinMax = aComp2AverageMinMax[iComp];
1399         anAverageMinMax.first = VTK_LARGE_FLOAT;
1400         anAverageMinMax.second = -VTK_LARGE_FLOAT;
1401       }
1402     }
1403   }
1404
1405   vtkIdType
1406   TFieldImpl
1407   ::GetDataType() const
1408   {
1409     return myDataType;
1410   }
1411
1412   TMinMax
1413   TFieldImpl
1414   ::GetMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric)
1415   {
1416     TMinMax aMinMax;
1417     bool anIsMinMaxInitialized = false;
1418     if( !theGroupNames.empty() ) {
1419       aMinMax.first = VTK_LARGE_FLOAT;
1420       aMinMax.second = -VTK_LARGE_FLOAT;
1421
1422       const TGroup2MinMax& aGroup2MinMax = myMetric2Comp2Group2MinMax[theGaussMetric][theCompID];
1423       TNames::const_iterator aNameIter = theGroupNames.begin();
1424       for( ; aNameIter != theGroupNames.end(); aNameIter++ ) {
1425         TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter );
1426         if( aGroup2MinMaxIter != aGroup2MinMax.end() ) {
1427           const TMinMax& aGroupMinMax = aGroup2MinMaxIter->second;
1428           aMinMax.first = std::min( aMinMax.first, aGroupMinMax.first );
1429           aMinMax.second = std::max( aMinMax.second, aGroupMinMax.second );
1430           anIsMinMaxInitialized = true;
1431         }
1432       }
1433     }
1434
1435     if( !anIsMinMaxInitialized )
1436       aMinMax = myMetric2Comp2MinMax[theGaussMetric][theCompID];
1437
1438     return aMinMax;
1439   }
1440
1441
1442   TMinMax
1443   TFieldImpl
1444   ::GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric)
1445   {
1446     TMinMax aMinMax;
1447     bool anIsMinMaxInitialized = false;
1448     if( !theGroupNames.empty() ) {
1449       aMinMax.first = VTK_LARGE_FLOAT;
1450       aMinMax.second = -VTK_LARGE_FLOAT;
1451
1452       const TGroup2MinMax& aGroup2MinMax = myMetric2Comp2Group2AverageMinMax[theGaussMetric][theCompID];
1453       TNames::const_iterator aNameIter = theGroupNames.begin();
1454       for( ; aNameIter != theGroupNames.end(); aNameIter++ ) {
1455         TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter );
1456         if( aGroup2MinMaxIter != aGroup2MinMax.end() ) {
1457           const TMinMax& aGroupMinMax = aGroup2MinMaxIter->second;
1458           aMinMax.first = std::min( aMinMax.first, aGroupMinMax.first );
1459           aMinMax.second = std::max( aMinMax.second, aGroupMinMax.second );
1460           anIsMinMaxInitialized = true;
1461         }
1462       }
1463     }
1464
1465     if( !anIsMinMaxInitialized )
1466       aMinMax = myMetric2Comp2AverageMinMax[theGaussMetric][theCompID];
1467
1468     return aMinMax;
1469   }
1470
1471   //----------------------------------------------------------------------------
1472   const PMeshValue&
1473   TGeom2Value
1474   ::GetMeshValue(EGeometry theGeom) const
1475   {
1476     TGeom2MeshValue::const_iterator anIter = myGeom2MeshValue.find(theGeom);
1477     if(anIter == myGeom2MeshValue.end())
1478       EXCEPTION(std::runtime_error,"TGeom2Value::GetMeshValue - myGeom2MeshValue.find(theGeom) fails");
1479     return anIter->second;
1480   }
1481
1482   PMeshValue&
1483   TGeom2Value
1484   ::GetMeshValue(EGeometry theGeom)
1485   {
1486     return myGeom2MeshValue[theGeom];
1487   }
1488
1489
1490   //----------------------------------------------------------------------------
1491   TGeom2MeshValue&
1492   TGeom2Value
1493   ::GetGeom2MeshValue()
1494   {
1495     return myGeom2MeshValue;
1496   }
1497
1498   const TGeom2MeshValue&
1499   TGeom2Value
1500   ::GetGeom2MeshValue() const
1501   {
1502     return myGeom2MeshValue;
1503   }
1504
1505   PMeshValue
1506   TGeom2Value
1507   ::GetFirstMeshValue() const
1508   {
1509     if(myGeom2MeshValue.size() == 1)
1510       return myGeom2MeshValue.begin()->second;
1511     return PMeshValue();
1512   }
1513
1514
1515   //---------------------------------------------------------------
1516   TValForTimeImpl
1517   ::TValForTimeImpl():
1518     myGaussPtsIDFilter(new TGaussPtsIDFilter()),
1519     myUnstructuredGridIDMapper(new TUnstructuredGridIDMapperImpl())
1520   {}
1521
1522   const PMeshValue&
1523   TValForTimeImpl
1524   ::GetMeshValue(EGeometry theGeom) const
1525   {
1526     return myGeom2Value.GetMeshValue(theGeom);
1527   }
1528
1529   PMeshValue&
1530   TValForTimeImpl
1531   ::GetMeshValue(EGeometry theGeom)
1532   {
1533     return myGeom2Value.GetMeshValue(theGeom);
1534   }
1535
1536   TGeom2MeshValue&
1537   TValForTimeImpl
1538   ::GetGeom2MeshValue()
1539   {
1540     return myGeom2Value.GetGeom2MeshValue();
1541   }
1542
1543   const TGeom2MeshValue&
1544   TValForTimeImpl
1545   ::GetGeom2MeshValue() const
1546   {
1547     return myGeom2Value.GetGeom2MeshValue();
1548   }
1549
1550   PMeshValue
1551   TValForTimeImpl
1552   ::GetFirstMeshValue() const
1553   {
1554     return myGeom2Value.GetFirstMeshValue();
1555   }
1556
1557   int
1558   TValForTimeImpl
1559   ::GetNbGauss(EGeometry theGeom) const
1560   {
1561     TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.find(theGeom);
1562     if(anIter == myGeom2NbGauss.end()){
1563       return 1;
1564     }
1565     return anIter->second;
1566   }
1567
1568   int
1569   TValForTimeImpl
1570   ::GetMaxNbGauss() const
1571   {
1572     int aNbGauss = 1;
1573     TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.begin();
1574     for(; anIter != myGeom2NbGauss.end(); anIter++){
1575       aNbGauss = std::max<int>(aNbGauss, anIter->second);
1576     }
1577     return aNbGauss;
1578   }
1579
1580   unsigned long int
1581   TValForTimeImpl
1582   ::GetMemorySize()
1583   {
1584     size_t aSize = sizeof(TValForTimeImpl);
1585     const TGeom2MeshValue& aGeom2MeshValue = GetGeom2MeshValue();
1586     TGeom2MeshValue::const_iterator anIter = aGeom2MeshValue.begin();
1587     TGeom2MeshValue::const_iterator anIterEnd = aGeom2MeshValue.end();
1588     for(; anIter != anIterEnd; anIter++){
1589       const PMeshValue& aMeshValue = anIter->second;
1590       aSize += aMeshValue->GetMemorySize();
1591       aSize += sizeof(EGeometry);
1592     }
1593     return aSize;
1594   }
1595
1596   //---------------------------------------------------------------
1597 }