]> SALOME platform Git repositories - modules/visu.git/blob - src/CONVERTOR/VISU_Structures_impl.cxx
Salome HOME
Merge from V6_3_BR 06/06/2011
[modules/visu.git] / src / CONVERTOR / VISU_Structures_impl.cxx
1 // Copyright (C) 2007-2011  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   bool 
520   TSubProfileImpl
521   ::isDefault() const
522   {
523     return strcmp(myName.c_str(),"") == 0;
524   }
525   
526   //---------------------------------------------------------------
527   bool
528   operator<(const PSubProfile& theLeft, const PSubProfile& theRight)
529   {
530     PSubProfileImpl aLeft(theLeft), aRight(theRight);
531
532     if(aLeft->myGeom != aRight->myGeom)
533       return aLeft->myGeom < aRight->myGeom;
534
535     if(aLeft->myStatus != aRight->myStatus)
536       return aLeft->myStatus < aRight->myStatus;
537
538     return aLeft->myName < aRight->myName;
539   }
540
541
542   //---------------------------------------------------------------
543   TProfileImpl
544   ::TProfileImpl():
545     myIsAll(true),
546     myMeshOnEntity(NULL)
547   {}
548
549   vtkIdType
550   TProfileImpl
551   ::GetNodeObjID(vtkIdType theID) const
552   {
553     return myNamedPointCoords->GetObjID(theID);
554   }
555
556   vtkIdType
557   TProfileImpl
558   ::GetNodeVTKID(vtkIdType theID) const
559   {
560     return myNamedPointCoords->GetVTKID(theID);
561   }
562
563   vtkFloatingPointType*
564   TProfileImpl
565   ::GetNodeCoord(vtkIdType theObjID)
566   {
567     if(myIsAll)
568       return myMeshOnEntity->GetNodeCoord(theObjID);
569
570     vtkIdType aVtkID = GetNodeVTKID(theObjID);
571     return GetFilter()->GetOutput()->GetPoint(aVtkID);
572   }
573
574   vtkIdType
575   TProfileImpl
576   ::GetElemObjID(vtkIdType theID) const
577   {
578     return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
579   }
580
581   vtkIdType
582   TProfileImpl
583   ::GetElemVTKID(vtkIdType theID) const
584   {
585     return VISU::GetElemVTKID(GetFilter()->GetOutput(), theID);
586   }
587
588   vtkCell*
589   TProfileImpl
590   ::GetElemCell(vtkIdType theObjID)
591   {
592     if(myIsAll)
593       return myMeshOnEntity->GetElemCell(theObjID);
594
595     vtkIdType aVtkID = GetElemVTKID(theObjID);
596     return GetFilter()->GetOutput()->GetCell(aVtkID);
597   }
598
599   vtkUnstructuredGrid*
600   TProfileImpl
601   ::GetUnstructuredGridOutput()
602   {
603     const PAppendFilter& anAppendFilter = GetFilter();
604     return anAppendFilter->GetOutput();
605   }
606
607   unsigned long int
608   TProfileImpl
609   ::GetMemorySize()
610   {
611     size_t aSize = TAppendFilterHolder::GetMemorySize();
612     aSize += myNamedPointCoords->GetMemorySize();
613     aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
614     TGeom2SubProfile::const_iterator anIter = myGeom2SubProfile.begin();
615     TGeom2SubProfile::const_iterator anIterEnd = myGeom2SubProfile.end();
616     for(; anIter != anIterEnd; anIter++){
617       const PSubProfileImpl& aSubProfile = anIter->second;
618       aSize += aSubProfile->GetMemorySize();
619       aSize += sizeof(EGeometry);
620     }
621     return aSize;
622   }
623
624   std::string
625   TProfileImpl
626   ::GetNodeName(vtkIdType theObjID) const
627   {
628     return myNamedPointCoords->GetNodeName(theObjID);
629   }
630
631   std::string
632   TProfileImpl
633   ::GetElemName(vtkIdType theObjID) const
634   {
635     return myMeshOnEntity->GetElemName(theObjID);
636   }
637
638
639   //---------------------------------------------------------------
640   TUnstructuredGridIDMapperImpl
641   ::TUnstructuredGridIDMapperImpl()
642   {
643     if ( !myCommonCellsFilter.GetPointer() ) {
644       myCommonCellsFilter = VISU_CommonCellsFilter::New();
645       myCommonCellsFilter->Delete();
646     }
647   }
648
649   vtkIdType
650   TUnstructuredGridIDMapperImpl
651   ::GetNodeObjID(vtkIdType theID) const
652   {
653     return myIDMapper->GetNodeObjID(theID);
654   }
655
656   vtkIdType
657   TUnstructuredGridIDMapperImpl
658   ::GetNodeVTKID(vtkIdType theID) const
659   {
660     return myIDMapper->GetNodeVTKID(theID);
661   }
662
663   vtkFloatingPointType*
664   TUnstructuredGridIDMapperImpl
665   ::GetNodeCoord(vtkIdType theObjID)
666   {
667     return myIDMapper->GetNodeCoord(theObjID);
668   }
669
670   vtkIdType
671   TUnstructuredGridIDMapperImpl
672   ::GetElemObjID(vtkIdType theID) const
673   {
674     return myIDMapper->GetElemObjID(theID);
675   }
676
677   vtkIdType
678   TUnstructuredGridIDMapperImpl
679   ::GetElemVTKID(vtkIdType theID) const
680   {
681     return myIDMapper->GetElemVTKID(theID);
682   }
683
684   vtkCell*
685   TUnstructuredGridIDMapperImpl
686   ::GetElemCell(vtkIdType theObjID)
687   {
688     return myIDMapper->GetElemCell(theObjID);
689   }
690
691   void
692   TUnstructuredGridIDMapperImpl
693   ::SetReferencedMesh( const PNamedIDMapper& theNamedIDMapper )
694   {
695     myCommonCellsFilter->SetCellsUG( theNamedIDMapper->GetUnstructuredGridOutput() );
696   }
697
698   void
699   TUnstructuredGridIDMapperImpl
700   ::Build()
701   {
702     if ( !myFilter.GetPointer() ) {
703       const PAppendFilter& anAppendFilter = myIDMapper->GetFilter();
704
705       vtkUnstructuredGrid* aGeometry = anAppendFilter->GetOutput();
706       const PUnstructuredGrid& aSource = mySource.GetSource();
707       vtkUnstructuredGrid* aDataSet = aSource.GetPointer();
708       aDataSet->ShallowCopy( aGeometry );
709
710       const PMergeFilter& aFilter = GetFilter();
711       aFilter->SetGeometry( aGeometry );
712       aFilter->SetScalars( aDataSet );
713       aFilter->SetVectors( aDataSet );
714       aFilter->AddField( "VISU_FIELD", aDataSet );
715       aFilter->AddField( "VISU_FIELD_GAUSS_MIN", aDataSet );
716       aFilter->AddField( "VISU_FIELD_GAUSS_MAX", aDataSet );
717       aFilter->AddField( "VISU_FIELD_GAUSS_MOD", aDataSet );
718       aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet );
719       aFilter->AddField( "ELNO_FIELD", aDataSet );
720       aFilter->AddField( "ELNO_COMPONENT_MAPPER", aDataSet );
721       aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet );
722
723       myCommonCellsFilter->SetProfileUG( aFilter->GetUnstructuredGridOutput() );
724     }
725   }
726
727   vtkUnstructuredGrid*
728   TUnstructuredGridIDMapperImpl
729   ::GetUnstructuredGridOutput()
730   {
731     Build();
732     return myCommonCellsFilter->GetOutput();
733   }
734
735   vtkDataSet*
736   TUnstructuredGridIDMapperImpl
737   ::GetOutput()
738   {
739     return GetUnstructuredGridOutput();
740   }
741
742   PUnstructuredGrid
743   TUnstructuredGridIDMapperImpl
744   ::GetSource()
745   {
746     Build();
747     return mySource.GetSource();
748   }
749
750   unsigned long int
751   TUnstructuredGridIDMapperImpl
752   ::GetMemorySize()
753   {
754     size_t aSize = myIDMapper->GetMemorySize();
755
756     aSize += mySource.GetMemorySize();
757
758     if ( vtkUnstructuredGrid* anOutput = myCommonCellsFilter->GetOutput() )
759       aSize += anOutput->GetActualMemorySize() * 1024;
760
761     return aSize;
762   }
763
764   //---------------------------------------------------------------
765   vtkIdType
766   TPolyDataIDMapperImpl
767   ::GetNodeObjID(vtkIdType theID) const
768   {
769     return myIDMapper->GetNodeObjID(theID);
770   }
771
772   vtkIdType
773   TPolyDataIDMapperImpl
774   ::GetNodeVTKID(vtkIdType theID) const
775   {
776     return myIDMapper->GetNodeVTKID(theID);
777   }
778
779   vtkFloatingPointType*
780   TPolyDataIDMapperImpl
781   ::GetNodeCoord(vtkIdType theObjID)
782   {
783     return myIDMapper->GetNodeCoord(theObjID);
784   }
785
786   vtkIdType
787   TPolyDataIDMapperImpl
788   ::GetElemObjID(vtkIdType theID) const
789   {
790     return myIDMapper->GetElemObjID(theID);
791   }
792
793   vtkIdType
794   TPolyDataIDMapperImpl
795   ::GetElemVTKID(vtkIdType theID) const
796   {
797     return myIDMapper->GetElemVTKID(theID);
798   }
799
800   vtkCell*
801   TPolyDataIDMapperImpl
802   ::GetElemCell(vtkIdType theObjID)
803   {
804     return myIDMapper->GetElemCell(theObjID);
805   }
806
807   void
808   TPolyDataIDMapperImpl
809   ::Build()
810   {
811     if ( !myFilter.GetPointer() ) {
812       const PAppendPolyData& anAppendFilter = myIDMapper->GetFilter();
813       vtkPolyData* aGeometry = anAppendFilter->GetOutput();
814
815       const PPolyData& aSource = mySource.GetSource();
816       vtkPolyData* aDataSet = aSource.GetPointer();
817       aDataSet->ShallowCopy( aGeometry );
818
819       const PMergeFilter& aFilter = GetFilter();
820       aFilter->SetGeometry( aGeometry );
821       aFilter->SetScalars( aDataSet );
822       aFilter->SetVectors( aDataSet );
823       aFilter->AddField( "VISU_FIELD", aDataSet );
824       aFilter->AddField( "VISU_FIELD_GAUSS_MIN", aDataSet );
825       aFilter->AddField( "VISU_FIELD_GAUSS_MAX", aDataSet );
826       aFilter->AddField( "VISU_FIELD_GAUSS_MOD", aDataSet );
827       aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet );
828       aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet );
829     }
830   }
831
832   vtkPolyData*
833   TPolyDataIDMapperImpl
834   ::GetPolyDataOutput()
835   {
836     Build();
837     return myFilter->GetPolyDataOutput();
838   }
839
840   vtkDataSet*
841   TPolyDataIDMapperImpl
842   ::GetOutput()
843   {
844     return GetPolyDataOutput();
845   }
846
847   PPolyData
848   TPolyDataIDMapperImpl
849   ::GetSource()
850   {
851     Build();
852     return mySource.GetSource();
853   }
854
855   unsigned long int
856   TPolyDataIDMapperImpl
857   ::GetMemorySize()
858   {
859     size_t aSize = myIDMapper->GetMemorySize();
860     aSize += mySource.GetMemorySize();
861     return aSize;
862   }
863
864
865   //---------------------------------------------------------------
866   TGaussImpl
867   ::TGaussImpl():
868     myGeom(EGeometry(-1)),
869     myNbPoints(0)
870   {}
871
872   void
873   TGaussImpl
874   ::LessThan(const PGaussImpl& theGauss,
875              bool& theResult) const
876   {
877     theResult = false;
878   }
879
880
881   //---------------------------------------------------------------
882   TGaussSubMeshImpl
883   ::TGaussSubMeshImpl():
884     myPointCoords(new TPointCoords()),
885     myStatus(eNone),
886     myStartID(0)
887   {}
888
889   TGaussPointID
890   TGaussSubMeshImpl
891   ::GetObjID(vtkIdType theID) const
892   {
893     TCellID aCellID = myStartID + theID / myGauss->myNbPoints;
894     TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
895
896     return TGaussPointID(aCellID, aLocalPntID);
897   }
898
899   vtkIdType
900   TGaussSubMeshImpl
901   ::GetVTKID(const TGaussPointID& theID) const
902   {
903     vtkIdType aResult = -1;
904
905     TCellID aCellID = theID.first;
906     TLocalPntID aLocalPntID = theID.second;
907
908     vtkIdType aNbPoints = myGauss->myNbPoints;
909     if ( aLocalPntID >= aNbPoints )
910       return aResult;
911
912     return ( aCellID - myStartID ) * aNbPoints + aLocalPntID;
913   }
914
915   vtkIdType
916   VISU::TGaussSubMeshImpl
917   ::GetElemObjID(vtkIdType theID) const
918   {
919     return mySubProfile->GetElemObjID( theID );
920   }
921
922
923   vtkIdType
924   VISU::TGaussSubMeshImpl
925   ::GetElemVTKID(vtkIdType theID) const
926   {
927     return mySubProfile->GetElemVTKID( theID );
928   }
929
930   vtkIdType
931   TGaussSubMeshImpl
932   ::GetGlobalID(vtkIdType theID) const
933   {
934     return myStartID + theID;
935   }
936
937   unsigned long int
938   TGaussSubMeshImpl
939   ::GetMemorySize()
940   {
941     size_t aSize = TPolyDataHolder::GetMemorySize();
942     aSize += myPointCoords->GetMemorySize();
943     return aSize;
944   }
945
946   //---------------------------------------------------------------
947   bool
948   operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight)
949   {
950     PGaussSubMeshImpl aLeft(theLeft), aRight(theRight);
951     const PGaussImpl& aGaussLeft = aLeft->myGauss;
952     const PGaussImpl& aGaussRight = aRight->myGauss;
953
954     if(aGaussLeft->myGeom != aGaussRight->myGeom)
955       return aGaussLeft->myGeom < aGaussRight->myGeom;
956
957     if(aLeft->mySubProfile != aRight->mySubProfile)
958       return aLeft->mySubProfile < aRight->mySubProfile;
959
960     bool aResult;
961     aGaussLeft->LessThan(aGaussRight,aResult);
962
963     return aResult;
964   }
965
966
967   //---------------------------------------------------------------
968   TGaussMeshImpl
969   ::TGaussMeshImpl():
970     myParent(NULL)
971   {}
972
973   TGaussPointID
974   TGaussMeshImpl
975   ::GetObjID(vtkIdType theID) const
976   {
977     const PAppendPolyData& aFilter = GetFilter();
978     return VISU::GetObjID(aFilter->GetOutput(), theID);
979   }
980
981   vtkIdType
982   TGaussMeshImpl
983   ::GetVTKID(const TGaussPointID& theID) const
984   {
985     vtkIdType aResult = -1;
986
987     TCellID aCellID = theID.first;
988
989     vtkIdType aVTKCellId = GetParent()->GetElemVTKID( aCellID );
990     if ( aVTKCellId < 0 )
991       return aResult;
992
993     vtkCell* aCell = GetParent()->GetElemCell( aCellID );
994     if ( !aCell )
995       return aResult;
996
997     EGeometry aVGeom = VISU::VTKGeom2VISU( aCell->GetCellType() );
998     if ( aVGeom < EGeometry(0) )
999       return aResult;
1000
1001     TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.find( aVGeom );
1002     if ( anIter == myGeom2GaussSubMesh.end() )
1003       return aResult;
1004
1005     size_t aSubMeshEnd = myGaussSubMeshArr.size();
1006     const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
1007     for ( size_t aSubMeshId = 0; aSubMeshId < aSubMeshEnd; aSubMeshId++ ) {
1008       const PGaussSubMeshImpl& aSubMesh = myGaussSubMeshArr[aSubMeshId];
1009       if ( aGaussSubMesh.get() == aSubMesh.get() ) {
1010         return aGaussSubMesh->GetVTKID(theID);
1011       }
1012     }
1013
1014     return aResult;
1015   }
1016
1017   vtkPolyData*
1018   TGaussMeshImpl
1019   ::GetPolyDataOutput()
1020   {
1021     return TAppendPolyDataHolder::GetPolyDataOutput();
1022   }
1023
1024   unsigned long int
1025   TGaussMeshImpl
1026   ::GetMemorySize()
1027   {
1028     size_t aSize = TAppendPolyDataHolder::GetMemorySize();
1029     TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.begin();
1030     TGeom2GaussSubMesh::const_iterator anIterEnd = myGeom2GaussSubMesh.end();
1031     for(; anIter != anIterEnd; anIter++){
1032       const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
1033       aSize += aGaussSubMesh->GetMemorySize();
1034       aSize += sizeof(EGeometry);
1035     }
1036     return aSize;
1037   }
1038
1039   TNamedIDMapper*
1040   TGaussMeshImpl
1041   ::GetParent() const
1042   {
1043     return myParent;
1044   }
1045
1046
1047   //---------------------------------------------------------------
1048   TGaussPointID
1049   TGaussPtsIDFilter
1050   ::GetObjID(vtkIdType theID) const
1051   {
1052     return myGaussPtsIDMapper->GetObjID(theID);
1053   }
1054
1055   vtkIdType
1056   TGaussPtsIDFilter
1057   ::GetVTKID(const TGaussPointID& theID) const
1058   {
1059     return myGaussPtsIDMapper->GetVTKID(theID);
1060   }
1061
1062   TNamedIDMapper*
1063   TGaussPtsIDFilter
1064   ::GetParent() const
1065   {
1066     return myGaussPtsIDMapper->GetParent();
1067   }
1068
1069   vtkPolyData*
1070   TGaussPtsIDFilter
1071   ::GetPolyDataOutput()
1072   {
1073     return TPolyDataIDMapperImpl::GetPolyDataOutput();
1074   }
1075
1076   vtkDataSet*
1077   TGaussPtsIDFilter
1078   ::GetOutput()
1079   {
1080     return GetPolyDataOutput();
1081   }
1082
1083
1084   //---------------------------------------------------------------
1085   TSubMeshImpl
1086   ::TSubMeshImpl():
1087     myStartID(0)
1088   {}
1089
1090   void
1091   TSubMeshImpl
1092   ::CopyStructure( PStructured theStructured )
1093   {
1094     TStructured::CopyStructure( theStructured );
1095
1096     if ( PMeshImpl aMesh = theStructured )
1097       GetSource()->ShallowCopy( aMesh->GetPointSet() );
1098   }
1099
1100   vtkIdType
1101   TSubMeshImpl
1102   ::GetElemObjID(vtkIdType theID) const
1103   {
1104     return myStartID + theID;
1105   }
1106
1107   std::string
1108   TSubMeshImpl
1109   ::GetElemName(vtkIdType theObjID) const
1110   {
1111     return "";
1112   }
1113
1114   unsigned long int
1115   TSubMeshImpl
1116   ::GetMemorySize()
1117   {
1118     size_t aSize = TUnstructuredGridHolder::GetMemorySize();
1119     for(size_t anId = 0; anId < myCell2Connect.size(); anId++){
1120       const TConnect& aConnect = myCell2Connect[anId];
1121       aSize += aConnect.size() * sizeof(vtkIdType);
1122     }
1123     return aSize;
1124   }
1125
1126   //---------------------------------------------------------------
1127   TMeshOnEntityImpl
1128   ::TMeshOnEntityImpl()
1129   {
1130     const PAppendFilter& anAppendFilter = GetFilter();
1131     anAppendFilter->SetMappingInputs(true);
1132   }
1133
1134   void
1135   TMeshOnEntityImpl
1136   ::CopyStructure( PStructured theStructured )
1137   {
1138     TStructured::CopyStructure( theStructured );
1139
1140     if ( PMeshImpl aMesh = theStructured )
1141       myNamedPointCoords = aMesh->myNamedPointCoords;
1142   }
1143
1144   vtkIdType
1145   TMeshOnEntityImpl
1146   ::GetNodeVTKID(vtkIdType theID) const
1147   {
1148     return myNamedPointCoords->GetVTKID(theID);
1149   }
1150
1151   vtkIdType
1152   TMeshOnEntityImpl
1153   ::GetNodeObjID(vtkIdType theID) const
1154   {
1155     return myNamedPointCoords->GetObjID(theID);
1156   }
1157
1158   vtkIdType
1159   TMeshOnEntityImpl
1160   ::GetElemVTKID(vtkIdType theID) const
1161   {
1162     return VISU::GetElemVTKID(GetFilter()->GetOutput(), theID);
1163   }
1164
1165   vtkIdType
1166   TMeshOnEntityImpl
1167   ::GetElemObjID(vtkIdType theID) const
1168   {
1169     return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
1170   }
1171
1172   std::string
1173   TMeshOnEntityImpl
1174   ::GetNodeName(vtkIdType theObjID) const
1175   {
1176     return myNamedPointCoords->GetNodeName(theObjID);
1177   }
1178
1179   std::string
1180   TMeshOnEntityImpl
1181   ::GetElemName(vtkIdType theObjID) const
1182   {
1183     TInputCellID anInputCellID = VISU::GetInputCellID(GetFilter()->GetOutput(), theObjID);
1184     const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputCellID.first];
1185     return aSubMesh->GetElemName(anInputCellID.second);
1186   }
1187
1188   vtkUnstructuredGrid*
1189   TMeshOnEntityImpl
1190   ::GetUnstructuredGridOutput()
1191   {
1192     return TAppendFilterHolder::GetUnstructuredGridOutput();
1193   }
1194
1195   unsigned long int
1196   TMeshOnEntityImpl
1197   ::GetMemorySize()
1198   {
1199     size_t aSize = TAppendFilterHolder::GetMemorySize();
1200     aSize += myNamedPointCoords->GetMemorySize();
1201     aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1202     TGeom2SubMesh::const_iterator anIter = myGeom2SubMesh.begin();
1203     TGeom2SubMesh::const_iterator anIterEnd = myGeom2SubMesh.end();
1204     for(; anIter != anIterEnd; anIter++){
1205       const PSubMeshImpl& aSubMesh = anIter->second;
1206       aSize += aSubMesh->GetMemorySize();
1207       aSize += sizeof(EGeometry);
1208     }
1209     return aSize;
1210   }
1211
1212   //---------------------------------------------------------------
1213   void
1214   TFamilyImpl
1215   ::CopyStructure( PStructured theStructured )
1216   {
1217     TStructured::CopyStructure( theStructured );
1218
1219     if ( PMeshImpl aMesh = theStructured ) {
1220       myNamedPointCoords = aMesh->myNamedPointCoords;
1221       GetSource()->ShallowCopy( aMesh->GetPointSet() );
1222     }
1223   }
1224
1225   vtkIdType
1226   TFamilyImpl
1227   ::GetElemVTKID(vtkIdType theID) const
1228   {
1229     if(myElemObj2VTKID.empty())
1230       return theID;
1231     else{
1232       TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
1233       if(anIter != myElemObj2VTKID.end())
1234         return anIter->second;
1235     }
1236     return -1;
1237   }
1238
1239   vtkIdType
1240   TFamilyImpl
1241   ::GetElemObjID(vtkIdType theID) const
1242   {
1243     return myMeshID[theID];
1244   }
1245
1246   vtkIdType
1247   TFamilyImpl
1248   ::GetNodeObjID(vtkIdType theID) const
1249   {
1250     return myNamedPointCoords->GetObjID(theID);
1251   }
1252
1253   vtkIdType
1254   TFamilyImpl
1255   ::GetNodeVTKID(vtkIdType theID) const
1256   {
1257     return myNamedPointCoords->GetVTKID(theID);
1258   }
1259
1260   vtkUnstructuredGrid*
1261   TFamilyImpl
1262   ::GetUnstructuredGridOutput()
1263   {
1264     return TUnstructuredGridHolder::GetUnstructuredGridOutput();
1265   }
1266
1267   unsigned long int
1268   TFamilyImpl
1269   ::GetMemorySize()
1270   {
1271     size_t aSize = TUnstructuredGridHolder::GetMemorySize();
1272     aSize += myNamedPointCoords->GetMemorySize();
1273     aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1274     aSize += myMeshID.size() * sizeof(vtkIdType);
1275     TGeom2SubMeshID::const_iterator anIter = myGeom2SubMeshID.begin();
1276     TGeom2SubMeshID::const_iterator anIterEnd = myGeom2SubMeshID.end();
1277     for(; anIter != anIterEnd; anIter++){
1278       const TSubMeshID& aSubMeshID = anIter->second;
1279       aSize += aSubMeshID.size() * sizeof(vtkIdType);
1280       aSize += sizeof(EGeometry);
1281     }
1282     return aSize;
1283   }
1284
1285
1286   //---------------------------------------------------------------
1287   void
1288   TGroupImpl
1289   ::CopyStructure( PStructured theStructured )
1290   {
1291     TStructured::CopyStructure( theStructured );
1292
1293     if ( PMeshImpl aMesh = theStructured )
1294       myNamedPointCoords = aMesh->myNamedPointCoords;
1295   }
1296
1297   TNbASizeCells
1298   TGroupImpl
1299   ::GetNbASizeCells() const
1300   {
1301     vtkIdType aNbCells = 0, aCellsSize = 0;
1302     TFamilySet::const_iterator anIter = myFamilySet.begin();
1303     for(; anIter != myFamilySet.end(); anIter++){
1304       PFamilyImpl aFamily = (*anIter).second;
1305       aNbCells += aFamily->myNbCells;
1306       aCellsSize += aFamily->myCellsSize;
1307     }
1308     return std::make_pair(aNbCells,aCellsSize);
1309   }
1310
1311   vtkIdType
1312   TGroupImpl
1313   ::GetElemVTKID(vtkIdType theID) const
1314   {
1315     if(myElemObj2VTKID.empty())
1316       return theID;
1317     else{
1318       TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
1319       if(anIter != myElemObj2VTKID.end())
1320         return anIter->second;
1321     }
1322     return -1;
1323   }
1324
1325   vtkIdType
1326   TGroupImpl
1327   ::GetElemObjID(vtkIdType theID) const
1328   {
1329     return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
1330   }
1331
1332   vtkIdType
1333   TGroupImpl
1334   ::GetNodeObjID(vtkIdType theID) const
1335   {
1336     return myNamedPointCoords->GetObjID(theID);
1337   }
1338
1339   vtkIdType
1340   TGroupImpl
1341   ::GetNodeVTKID(vtkIdType theID) const
1342   {
1343     return myNamedPointCoords->GetVTKID(theID);
1344   }
1345
1346   vtkUnstructuredGrid*
1347   TGroupImpl
1348   ::GetUnstructuredGridOutput()
1349   {
1350     return TAppendFilterHolder::GetUnstructuredGridOutput();
1351   }
1352
1353   unsigned long int
1354   TGroupImpl
1355   ::GetMemorySize()
1356   {
1357     size_t aSize = TAppendFilterHolder::GetMemorySize();
1358     aSize += myNamedPointCoords->GetMemorySize();
1359     aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1360     for(size_t anId = 0; anId < myFamilyArr.size(); anId++){
1361       const PFamilyImpl& aFamily = myFamilyArr[anId];
1362       aSize += aFamily->GetMemorySize();
1363     }
1364     return aSize;
1365   }
1366
1367
1368
1369   //---------------------------------------------------------------
1370   TFieldImpl
1371   ::TFieldImpl()
1372     : myDataSize( 0 )
1373     , myDataType( 0 )
1374   {}
1375
1376   void
1377   TFieldImpl
1378   ::Init(vtkIdType theNbComp,
1379          vtkIdType theDataType)
1380   {
1381     myNbComp = theNbComp;
1382     myDataType = theDataType;
1383     myCompNames.resize(theNbComp);
1384     myUnitNames.resize(theNbComp);
1385
1386     myMetric2Comp2MinMax.resize(3);
1387     myMetric2Comp2AverageMinMax.resize(3);
1388     myMetric2Comp2Group2MinMax.resize(3);
1389     myMetric2Comp2Group2AverageMinMax.resize(3);
1390     for(int aGaussMetric = (int)VISU::AVERAGE_METRIC; aGaussMetric <= (int)VISU::MAXIMUM_METRIC; aGaussMetric++){
1391       TComp2MinMax& aComp2MinMax = myMetric2Comp2MinMax[aGaussMetric];
1392       TComp2MinMax& aComp2AverageMinMax = myMetric2Comp2AverageMinMax[aGaussMetric];
1393       TComp2Group2MinMax& aComp2Group2MinMax = myMetric2Comp2Group2MinMax[aGaussMetric];
1394       TComp2Group2MinMax& aComp2Group2AverageMinMax = myMetric2Comp2Group2AverageMinMax[aGaussMetric];
1395
1396       aComp2MinMax.resize(theNbComp + 1);
1397       aComp2AverageMinMax.resize(theNbComp + 1);
1398       aComp2Group2MinMax.resize(theNbComp + 1);
1399       aComp2Group2AverageMinMax.resize(theNbComp + 1);
1400       for(vtkIdType iComp = 0; iComp <= theNbComp; iComp++){
1401         TMinMax& aMinMax = aComp2MinMax[iComp];
1402         aMinMax.first = VTK_LARGE_FLOAT;
1403         aMinMax.second = -VTK_LARGE_FLOAT;
1404         TMinMax& anAverageMinMax = aComp2AverageMinMax[iComp];
1405         anAverageMinMax.first = VTK_LARGE_FLOAT;
1406         anAverageMinMax.second = -VTK_LARGE_FLOAT;
1407       }
1408     }
1409   }
1410
1411   vtkIdType
1412   TFieldImpl
1413   ::GetDataType() const
1414   {
1415     return myDataType;
1416   }
1417
1418   TMinMax
1419   TFieldImpl
1420   ::GetMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric)
1421   {
1422     TMinMax aMinMax;
1423     bool anIsMinMaxInitialized = false;
1424     if( !theGroupNames.empty() ) {
1425       aMinMax.first = VTK_LARGE_FLOAT;
1426       aMinMax.second = -VTK_LARGE_FLOAT;
1427
1428       const TGroup2MinMax& aGroup2MinMax = myMetric2Comp2Group2MinMax[theGaussMetric][theCompID];
1429       TNames::const_iterator aNameIter = theGroupNames.begin();
1430       for( ; aNameIter != theGroupNames.end(); aNameIter++ ) {
1431         TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter );
1432         if( aGroup2MinMaxIter != aGroup2MinMax.end() ) {
1433           const TMinMax& aGroupMinMax = aGroup2MinMaxIter->second;
1434           aMinMax.first = std::min( aMinMax.first, aGroupMinMax.first );
1435           aMinMax.second = std::max( aMinMax.second, aGroupMinMax.second );
1436           anIsMinMaxInitialized = true;
1437         }
1438       }
1439     }
1440
1441     if( !anIsMinMaxInitialized )
1442       aMinMax = myMetric2Comp2MinMax[theGaussMetric][theCompID];
1443
1444     return aMinMax;
1445   }
1446
1447
1448   TMinMax
1449   TFieldImpl
1450   ::GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric)
1451   {
1452     TMinMax aMinMax;
1453     bool anIsMinMaxInitialized = false;
1454     if( !theGroupNames.empty() ) {
1455       aMinMax.first = VTK_LARGE_FLOAT;
1456       aMinMax.second = -VTK_LARGE_FLOAT;
1457
1458       const TGroup2MinMax& aGroup2MinMax = myMetric2Comp2Group2AverageMinMax[theGaussMetric][theCompID];
1459       TNames::const_iterator aNameIter = theGroupNames.begin();
1460       for( ; aNameIter != theGroupNames.end(); aNameIter++ ) {
1461         TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter );
1462         if( aGroup2MinMaxIter != aGroup2MinMax.end() ) {
1463           const TMinMax& aGroupMinMax = aGroup2MinMaxIter->second;
1464           aMinMax.first = std::min( aMinMax.first, aGroupMinMax.first );
1465           aMinMax.second = std::max( aMinMax.second, aGroupMinMax.second );
1466           anIsMinMaxInitialized = true;
1467         }
1468       }
1469     }
1470
1471     if( !anIsMinMaxInitialized )
1472       aMinMax = myMetric2Comp2AverageMinMax[theGaussMetric][theCompID];
1473
1474     return aMinMax;
1475   }
1476
1477   //----------------------------------------------------------------------------
1478   const PMeshValue&
1479   TGeom2Value
1480   ::GetMeshValue(EGeometry theGeom) const
1481   {
1482     TGeom2MeshValue::const_iterator anIter = myGeom2MeshValue.find(theGeom);
1483     if(anIter == myGeom2MeshValue.end())
1484       EXCEPTION(std::runtime_error,"TGeom2Value::GetMeshValue - myGeom2MeshValue.find(theGeom) fails");
1485     return anIter->second;
1486   }
1487
1488   PMeshValue&
1489   TGeom2Value
1490   ::GetMeshValue(EGeometry theGeom)
1491   {
1492     return myGeom2MeshValue[theGeom];
1493   }
1494
1495
1496   //----------------------------------------------------------------------------
1497   TGeom2MeshValue&
1498   TGeom2Value
1499   ::GetGeom2MeshValue()
1500   {
1501     return myGeom2MeshValue;
1502   }
1503
1504   const TGeom2MeshValue&
1505   TGeom2Value
1506   ::GetGeom2MeshValue() const
1507   {
1508     return myGeom2MeshValue;
1509   }
1510
1511   PMeshValue
1512   TGeom2Value
1513   ::GetFirstMeshValue() const
1514   {
1515     if(myGeom2MeshValue.size() == 1)
1516       return myGeom2MeshValue.begin()->second;
1517     return PMeshValue();
1518   }
1519
1520
1521   //---------------------------------------------------------------
1522   TValForTimeImpl
1523   ::TValForTimeImpl():
1524     myGaussPtsIDFilter(new TGaussPtsIDFilter()),
1525     myUnstructuredGridIDMapper(new TUnstructuredGridIDMapperImpl()),
1526         myIsFilled(false)
1527   {}
1528
1529   const PMeshValue&
1530   TValForTimeImpl
1531   ::GetMeshValue(EGeometry theGeom) const
1532   {
1533     return myGeom2Value.GetMeshValue(theGeom);
1534   }
1535
1536   PMeshValue&
1537   TValForTimeImpl
1538   ::GetMeshValue(EGeometry theGeom)
1539   {
1540     return myGeom2Value.GetMeshValue(theGeom);
1541   }
1542
1543   TGeom2MeshValue&
1544   TValForTimeImpl
1545   ::GetGeom2MeshValue()
1546   {
1547     return myGeom2Value.GetGeom2MeshValue();
1548   }
1549
1550   const TGeom2MeshValue&
1551   TValForTimeImpl
1552   ::GetGeom2MeshValue() const
1553   {
1554     return myGeom2Value.GetGeom2MeshValue();
1555   }
1556
1557   PMeshValue
1558   TValForTimeImpl
1559   ::GetFirstMeshValue() const
1560   {
1561     return myGeom2Value.GetFirstMeshValue();
1562   }
1563
1564   int
1565   TValForTimeImpl
1566   ::GetNbGauss(EGeometry theGeom) const
1567   {
1568     TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.find(theGeom);
1569     if(anIter == myGeom2NbGauss.end()){
1570       return 1;
1571     }
1572     return anIter->second;
1573   }
1574
1575   int
1576   TValForTimeImpl
1577   ::GetMaxNbGauss() const
1578   {
1579     int aNbGauss = 1;
1580     TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.begin();
1581     for(; anIter != myGeom2NbGauss.end(); anIter++){
1582       aNbGauss = std::max<int>(aNbGauss, anIter->second);
1583     }
1584     return aNbGauss;
1585   }
1586
1587   unsigned long int
1588   TValForTimeImpl
1589   ::GetMemorySize()
1590   {
1591     size_t aSize = sizeof(TValForTimeImpl);
1592     const TGeom2MeshValue& aGeom2MeshValue = GetGeom2MeshValue();
1593     TGeom2MeshValue::const_iterator anIter = aGeom2MeshValue.begin();
1594     TGeom2MeshValue::const_iterator anIterEnd = aGeom2MeshValue.end();
1595     for(; anIter != anIterEnd; anIter++){
1596       const PMeshValue& aMeshValue = anIter->second;
1597       aSize += aMeshValue->GetMemorySize();
1598       aSize += sizeof(EGeometry);
1599     }
1600     return aSize;
1601   }
1602
1603   //---------------------------------------------------------------
1604 }