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