Salome HOME
MPV: Merge V1_2d
[modules/visu.git] / src / CONVERTOR / VISU_Convertor_impl.cxx
1 //  VISU OBJECT : interactive object for VISU entities implementation
2 //
3 //  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //  File   : VISU_Convertor_impl.cxx
24 //  Author : Alexey PETROV
25 //  Module : VISU
26
27 #include "VISU_Convertor_impl.hxx"
28 #include "VISU_ConvertorUtils.hxx"
29
30 #include <vtkIdList.h>
31 #include <vtkCellType.h>
32 #include <vtkIntArray.h>
33 #include <vtkCellArray.h>
34 #include <vtkFloatArray.h>
35 #include <vtkUnsignedCharArray.h>
36 #include <vtkPointData.h>
37 #include <vtkCellData.h>
38 #include <vtkCellLinks.h>
39
40 #include <vtkMergeDataObjectFilter.h>
41
42 #include <vtkUnstructuredGridWriter.h>
43
44 #include <qstring.h>
45 #include <qfileinfo.h>
46
47 #include <valarray>     
48 #include <memory>
49
50 using namespace std;
51
52 static float ERR_SIZE_CALC = 1.00;
53
54 static int MYVTKDEBUG = 0;
55
56 #ifdef _DEBUG_
57 static int MYDEBUG = 0;
58 static int MYDEBUGWITHFILES = 0;
59 #else
60 static int MYDEBUG = 0;
61 static int MYDEBUGWITHFILES = 0;
62 #endif
63
64 void VISU::WriteToFile(vtkUnstructuredGrid* theDataSet, const string& theFileName){
65   //vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
66   //if(MYVTKDEBUG) aWriter->DebugOn();
67   ////aWriter->SetFileType(VTK_BINARY);
68   //aWriter->SetFileName(theFileName.c_str());
69   //aWriter->SetInput(theDataSet);
70   //aWriter->Write();
71   //aWriter->Delete();
72 }
73
74 namespace{
75   void GetPoints(VISU::TVTKSource& theStorage, VISU::TMesh& theMesh) 
76     throw (std::runtime_error&)
77   {
78     vtkPoints* aPoints = theMesh.myPoints.GetPointer();
79     if(!aPoints){
80       aPoints = vtkPoints::New();
81       if(MYVTKDEBUG) aPoints->DebugOn();
82       const VISU::TMesh::TPointsCoord& anArray = theMesh.myPointsCoord;
83       vtkIdType iEnd = theMesh.myPointsCoord.size();
84       vtkIdType aNbPoints = iEnd / theMesh.myDim;
85       aPoints->SetNumberOfPoints(aNbPoints);
86       if(MYDEBUG) 
87         MESSAGE("GetPoints - aNbPoints = "<<aNbPoints<<"; myDim = "<<theMesh.myDim);
88       switch(theMesh.myDim) {
89       case 1:
90         for (vtkIdType i = 0, j = 0; i < iEnd; i += theMesh.myDim, j++) 
91           aPoints->SetPoint(j,anArray[i],0.0,0.0);
92         break;
93       case 2:
94         for (vtkIdType i = 0, j = 0; i < iEnd; i += theMesh.myDim, j++) 
95           aPoints->SetPoint(j,anArray[i],anArray[i+1],0.0);
96         break;
97       case 3: 
98         for (vtkIdType i = 0, j = 0; i < iEnd; i += theMesh.myDim, j++) 
99           aPoints->SetPoint(j,anArray[i],anArray[i+1],anArray[i+2]);
100         break;
101       }
102       theMesh.myPoints = aPoints;
103     }
104     theStorage->SetPoints(aPoints);
105   }
106   
107   
108   inline void PrintCells(int& theStartId,
109                          vtkCellArray* theConnectivity, 
110                          const VISU::TMeshOnEntity::TConnect& theVector)
111   {
112     vtkIdList *anIdList = vtkIdList::New();
113     int kEnd = theVector.size();
114     anIdList->SetNumberOfIds(kEnd);
115     for(int k = 0; k < kEnd; k++)
116       anIdList->SetId(k,theVector[k]);
117     theConnectivity->InsertNextCell(anIdList);
118     anIdList->Delete();
119   }
120
121   void GetCellsOnEntity(VISU::TVTKSource& theStorage,
122                         const VISU::TMeshOnEntity& theMeshOnEntity, 
123                         const string& theFamilyName) 
124     throw (std::runtime_error&)
125   {
126     //Check on existing family
127     const VISU::TFamily* pFamily = VISU::GetFamily(theMeshOnEntity,theFamilyName);
128     bool isFamilyPresent = (pFamily != NULL);
129     const VISU::TFamily& aFamily = *pFamily;
130     //Main part of code
131     pair<int,int> aCellsDim = theMeshOnEntity.GetCellsDims(theFamilyName);
132     int aNbCells = aCellsDim.first, aCellsSize = aCellsDim.second;
133     vtkCellArray* aConnectivity = vtkCellArray::New();
134     aConnectivity->Allocate(aCellsSize,0);
135     vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
136     aCellTypesArray->SetNumberOfComponents(1);
137     aCellTypesArray->SetNumberOfTuples(aNbCells);
138     if(MYDEBUG) MESSAGE("GetCellsOnEntity - isFamilyPresent = "<<isFamilyPresent);
139     const VISU::TMeshOnEntity::TCellsConn &aCellsConn = theMeshOnEntity.myCellsConn;
140     VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
141     for(int i = 0, j = 0; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
142       const VISU::TMeshOnEntity::TConnForCellType& anArray = aCellsConnIter->second;
143       int aVtkType = aCellsConnIter->first;
144       if(MYDEBUG) 
145         MESSAGE("GetCellsOnEntity - aVtkType = "<<aVtkType<<"; anArray.size() = "<<anArray.size());
146       if(!isFamilyPresent)
147         for(int k = 0, kEnd = anArray.size(); k < kEnd; k++, i++){
148           PrintCells(i,aConnectivity,anArray[k]);
149           aCellTypesArray->SetValue(j++,(unsigned char)aVtkType);
150         }
151       else{
152         const VISU::TFamily::TSubMesh& aSubMesh = aFamily.mySubMesh;
153         if(aSubMesh.empty()) 
154           throw std::runtime_error(EXCEPTION("GetCells >> There is no elements on the family !!!"));
155         VISU::TFamily::TSubMesh::const_iterator aSubMeshIter = aSubMesh.find(aVtkType);
156         if(aSubMeshIter == aSubMesh.end()) continue;
157         const VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
158         if(MYDEBUG) 
159           MESSAGE("GetCellsOnEntity - aSubMeshOnCellType.size() = "<<aSubMeshOnCellType.size());
160         VISU::TFamily::TSubMeshOnCellType::const_iterator aSubMeshOnCellTypeIter = aSubMeshOnCellType.begin();
161         for(; aSubMeshOnCellTypeIter != aSubMeshOnCellType.end(); aSubMeshOnCellTypeIter++, i++){
162           PrintCells(i,aConnectivity,anArray[*aSubMeshOnCellTypeIter]);
163           aCellTypesArray->SetValue(j++,(unsigned char)aVtkType);
164         }
165       }
166     }
167     vtkIdType *pts = 0, npts = 0;
168     vtkIntArray* aCellLocationsArray = vtkIntArray::New();
169     aCellLocationsArray->SetNumberOfComponents(1);
170     aCellLocationsArray->SetNumberOfTuples(aNbCells);
171     aConnectivity->InitTraversal();
172     for(int i=0; aConnectivity->GetNextCell(npts,pts); i++)
173       aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
174     theStorage->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
175     if(MYVTKDEBUG) aConnectivity->DebugOn();
176     aCellLocationsArray->Delete();
177     aCellTypesArray->Delete();
178     aConnectivity->Delete();
179   } 
180   
181   
182   void GetCellsOnGroup(VISU::TVTKSource& theStorage,
183                        const VISU::TMesh& theMesh,
184                        const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet) 
185     throw (std::runtime_error&)
186   {
187     //Calculate dimentions of the group
188     int aNbCells = 0, aCellsSize = 0;
189     VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin();
190     for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
191       const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
192       const string& aFamilyName = aFamilyAndEntity.first;
193       const VISU::TEntity& anEntity = aFamilyAndEntity.second;
194       const VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap.find(anEntity)->second;
195       pair<int,int> aCellsDim = aMeshOnEntity.GetCellsDims(aFamilyName);
196       aNbCells += aCellsDim.first;
197       aCellsSize += aCellsDim.second;
198     }
199     vtkCellArray* aConnectivity = vtkCellArray::New();
200     aConnectivity->Allocate(aCellsSize,0);
201     vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
202     aCellTypesArray->SetNumberOfComponents(1);
203     aCellTypesArray->SetNumberOfTuples(aNbCells);
204     aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin();
205     for(int i = 0, j = 0; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
206       const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
207       const string& aFamilyName = aFamilyAndEntity.first;
208       const VISU::TEntity& anEntity = aFamilyAndEntity.second;
209       const VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap.find(anEntity)->second;
210       const VISU::TFamily& aFamily = *(VISU::GetFamily(aMeshOnEntity,aFamilyName));
211       const VISU::TMeshOnEntity::TCellsConn &aCellsConn = aMeshOnEntity.myCellsConn;
212       VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
213       for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
214         const VISU::TMeshOnEntity::TConnForCellType& anArray = aCellsConnIter->second;
215         int aVtkType = aCellsConnIter->first;
216         if(MYDEBUG) 
217           MESSAGE("GetCellsOnGroup - aVtkType = "<<aVtkType<<"; anArray.size() = "<<anArray.size());
218         const VISU::TFamily::TSubMesh& aSubMesh = aFamily.mySubMesh;
219         if(aSubMesh.empty()) 
220           throw std::runtime_error(EXCEPTION("GetCells >> There is no elements on the family !!!"));
221         VISU::TFamily::TSubMesh::const_iterator aSubMeshIter = aSubMesh.find(aVtkType);
222         if(aSubMeshIter == aSubMesh.end()) continue;
223         const VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
224         if(MYDEBUG) 
225           MESSAGE("GetCellsOnGroup - aSubMeshOnCellType.size() = "<<aSubMeshOnCellType.size());
226         VISU::TFamily::TSubMeshOnCellType::const_iterator aSubMeshOnCellTypeIter = aSubMeshOnCellType.begin();
227         for(; aSubMeshOnCellTypeIter != aSubMeshOnCellType.end(); aSubMeshOnCellTypeIter++, i++){
228           PrintCells(i,aConnectivity,anArray[*aSubMeshOnCellTypeIter]);
229           aCellTypesArray->SetValue(j++,(unsigned char)aVtkType);
230         }
231       }
232     }
233     vtkIdType *pts = 0, npts = 0;
234     vtkIntArray* aCellLocationsArray = vtkIntArray::New();
235     aCellLocationsArray->SetNumberOfComponents(1);
236     aCellLocationsArray->SetNumberOfTuples(aNbCells);
237     aConnectivity->InitTraversal();
238     for(int i = 0; aConnectivity->GetNextCell(npts,pts); i++)
239       aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
240     theStorage->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
241     aCellLocationsArray->Delete();
242     aCellTypesArray->Delete();
243     aConnectivity->Delete();
244   } 
245   
246   
247   void InitProfile(VISU::TVTKExtractFilter& theFilter,
248                    const VISU::TMeshOnEntity& theMeshOnEntity, 
249                    const VISU::TField::TValForTime& theValForTime)
250     throw (std::runtime_error&)
251   {
252     const VISU::TField::TValForCells& aValForCells = theValForTime.myValForCells;
253     const VISU::TMeshOnEntity::TCellsConn &aCellsConn = theMeshOnEntity.myCellsConn;
254     VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
255     for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
256       const vtkIdType& aCellType = aCellsConnIter->first;
257       if(aValForCells.find(aCellType) == aValForCells.end())
258         theFilter->RemoveCellsWithType(aCellType);
259     }
260   }
261
262
263   void GetValsOnTimeStamp(vtkFloatArray *theFloatArray, 
264                           const vtkIdType& theNumberOfTuples,
265                           const std::string& theFieldName,
266                           const VISU::TField& theField,
267                           const VISU::TField::TValForTime& theValForTime)
268     throw (std::runtime_error&)
269   {
270     //theFloatArray->DebugOn();
271     theFloatArray->SetNumberOfTuples(theNumberOfTuples);
272     theFloatArray->SetName(theFieldName.c_str());
273     if(MYDEBUG) MESSAGE("GetValsOnTimeStamp - theNumberOfTuples = "<<theNumberOfTuples);
274     const VISU::TField::TValForCells& aValForCells = theValForTime.myValForCells;
275     VISU::TField::TValForCells::const_iterator aValForCellsIter = aValForCells.begin();
276     for(int k = 0; aValForCellsIter != aValForCells.end(); aValForCellsIter++) {
277       const VISU::TField::TValForCellsWithType& anArray = aValForCellsIter->second;
278       int iEnd = anArray.size()/theField.myNbComp;
279       int aVtkType = aValForCellsIter->first;
280       if(MYDEBUG) MESSAGE("GetValsOnTimeStamp -  iEnd = "<<iEnd<<"; aVtkType = "<<aVtkType);
281       switch(theField.myNbComp) {
282       case 1:
283         for (int i = 0; i < iEnd; i++) 
284           theFloatArray->SetTuple1(k++,anArray[i]);
285         break;
286       case 2:
287         for (int i = 0, ji = 0; i < iEnd; ++i, ji = i*2)
288           theFloatArray->SetTuple3(k++,anArray[ji],anArray[ji+1],0.0);
289         break;
290       case 3:
291         for (int i = 0, ji = 0; i < iEnd; ++i, ji = i*3)
292           theFloatArray->SetTuple3(k++,anArray[ji],anArray[ji+1],anArray[ji+2]);
293         break;
294       case 4:
295         for (int i = 0, ji = 0; i < iEnd; ++i, ji = i*4)
296           theFloatArray->SetTuple3(k++,anArray[ji],anArray[ji+2],0.0);
297         break;
298       case 6:
299         for (int i = 0, ji = 0; i < iEnd; ++i, ji = i*4)
300           theFloatArray->SetTuple3(k++,anArray[ji],anArray[ji+2],anArray[ji+5]);
301         break;
302       default:
303         throw std::runtime_error(EXCEPTION("GetValsOnTimeStamp - There is no an algorithm for representation of the field !!!"));
304       }
305     }
306   }
307
308   string GenerateFieldName(const VISU::TField& theField,
309                            const VISU::TField::TValForTime& theValForTime)
310   {
311     const VISU::TField::TTime& aTime = theValForTime.myTime;
312     string aFieldName = theField.myMeshName + ", " + theField.myName + ": " + 
313       VISU_Convertor::GenerateName(aTime);
314     return aFieldName;
315   }
316
317   void GetTimeStamp(VISU::TVTKSource& theStorage,
318                     const VISU::TMesh& theMesh,
319                     const VISU::TMeshOnEntity& theMeshOnEntity, 
320                     const VISU::TField& theField, 
321                     const VISU::TField::TValForTime& theValForTime)
322     throw (std::runtime_error&)
323   {
324     int aNumberOfTuples = theField.myDataSize/theField.myNbComp;
325     string aFieldName = GenerateFieldName(theField,theValForTime);
326     if(MYDEBUG) 
327       MESSAGE("GetTimeStamp(TVTKSource) - aFieldName = "<<aFieldName<<
328               "; aNumberOfTuples = "<<aNumberOfTuples);
329
330     vtkDataSetAttributes* aDataSetAttributes;
331     switch(theField.myEntity){
332     case VISU::NODE_ENTITY : 
333       aDataSetAttributes = theStorage->GetPointData();
334       break;
335     default: 
336       aDataSetAttributes = theStorage->GetCellData();
337     }
338
339     vtkFloatArray *aFloatArray = vtkFloatArray::New();
340     switch(theField.myNbComp) {
341     case 1:
342       aFloatArray->SetNumberOfComponents(1);
343       aDataSetAttributes->SetScalars(aFloatArray);
344       break;
345     default:
346       aFloatArray->SetNumberOfComponents(3);
347       aDataSetAttributes->SetVectors(aFloatArray);
348     }
349
350     GetValsOnTimeStamp(aFloatArray,aNumberOfTuples,aFieldName,theField,theValForTime);
351   }
352
353   void GetTimeStamp(VISU::TVTKAttribyteFilter& theAttribyteFilter,
354                     VISU::TVTKMergetFilter& theMergeFilter,
355                     VISU::TVTKExtractFilter& theExtractFilter,
356                     const VISU::TMesh& theMesh,
357                     const VISU::TMeshOnEntity& theMeshOnEntity, 
358                     const VISU::TField& theField, 
359                     const VISU::TField::TValForTime& theValForTime)
360     throw (std::runtime_error&)
361   {
362     int aNumberOfTuples = theField.myDataSize/theField.myNbComp;
363     string aFieldName = GenerateFieldName(theField,theValForTime);
364     if(MYDEBUG) 
365       MESSAGE("GetTimeStamp(TVTKAttribyteFilter) - aFieldName = "<<aFieldName<<
366               "; aNumberOfTuples = "<<aNumberOfTuples);
367
368     vtkDataObject* aDataObject = vtkDataObject::New();
369     theMergeFilter->SetDataObject(aDataObject);
370     aDataObject->Delete();
371
372     theMergeFilter->SetInput(theExtractFilter->GetOutput());
373     theAttribyteFilter->SetInput(theMergeFilter->GetOutput());
374
375     switch(theField.myEntity){
376     case VISU::NODE_ENTITY : 
377       theMergeFilter->SetOutputFieldToPointDataField();
378       theAttribyteFilter->SetInputFieldToPointDataField();
379       theAttribyteFilter->SetOutputAttributeDataToPointData();
380       break;
381     default: 
382       theMergeFilter->SetOutputFieldToCellDataField();
383       theAttribyteFilter->SetInputFieldToCellDataField();
384       theAttribyteFilter->SetOutputAttributeDataToCellData();
385     }
386
387     vtkFloatArray *aFloatArray = vtkFloatArray::New();
388     switch(theField.myNbComp) {
389     case 1:
390       aFloatArray->SetNumberOfComponents(1);
391       theAttribyteFilter->SetScalarComponent(0,aFieldName.c_str(),0);
392       break;
393     default:
394       aFloatArray->SetNumberOfComponents(3);
395       theAttribyteFilter->SetVectorComponent(0,aFieldName.c_str(),0);
396       theAttribyteFilter->SetVectorComponent(1,aFieldName.c_str(),1);
397       theAttribyteFilter->SetVectorComponent(2,aFieldName.c_str(),2);
398     }
399
400     vtkFieldData* aFieldData = aDataObject->GetFieldData();
401     aFieldData->AddArray(aFloatArray);
402     aFloatArray->Delete();
403
404     GetValsOnTimeStamp(aFloatArray,aNumberOfTuples,aFieldName,theField,theValForTime);
405   }
406 }
407
408 VISU_Convertor_impl::VISU_Convertor_impl() {
409   myIsDone = false;
410 }
411
412 VISU_Convertor_impl::~VISU_Convertor_impl() {}
413
414 VISU_Convertor::TOutput* 
415 VISU_Convertor_impl::GetMeshOnEntity(const string& theMeshName, 
416                                      const VISU::TEntity& theEntity,
417                                      const string& theFamilyName)
418   throw (std::runtime_error&)
419 {
420   if(MYDEBUG) 
421     MESSAGE("GetMeshOnEntity - theMeshName = '"<<theMeshName<<
422             "'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
423   //Cheching possibility do the query
424   VISU::TMesh* pMesh = NULL;
425   VISU::TFamily* pFamily = NULL;
426   VISU::TMeshOnEntity* pMeshOnEntity = NULL;
427   FindMeshOnEntity(theMeshName,pMesh,theEntity,pMeshOnEntity,theFamilyName,pFamily);
428   VISU::TMesh& aMesh = *pMesh;
429   VISU::TMeshOnEntity& aMeshOnEntity = *pMeshOnEntity;
430   VISU::TVTKSource* pSource;
431   if(pFamily != NULL)
432     pSource = &(pFamily->myStorage);
433   else
434     pSource = &(aMeshOnEntity.myStorage);
435   VISU::TVTKSource& aSource = *pSource;
436   //Main part of code
437   try{
438     if(aSource.GetPointer() == NULL){
439       aSource = TOutput::New();
440       aSource->Delete();
441       if(MYVTKDEBUG) aSource->DebugOn();
442       LoadMeshOnEntity(aMeshOnEntity,theFamilyName);
443       GetPoints(aSource,aMesh);
444       GetCellsOnEntity(aSource,aMeshOnEntity,theFamilyName);
445       if(MYDEBUGWITHFILES){
446         string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
447         string aFamilyName = QString(theFamilyName.c_str()).simplifyWhiteSpace().latin1();
448         string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
449         aFileName += aMeshName + dtos("-%d-",int(theEntity)) + aFamilyName + "-Conv.vtk";
450         VISU::WriteToFile(aSource.GetPointer(),aFileName);
451       }
452     }
453     if(MYVTKDEBUG){
454       GetMeshOnEntitySize(theMeshName,theEntity,theFamilyName);
455       vtkUnstructuredGrid* aDataSet = aSource.GetPointer();
456       aDataSet->Update();
457       MESSAGE("GetMeshOnEntity - GetPoints() = "<<float(aDataSet->GetPoints()->GetActualMemorySize()*1000));
458       MESSAGE("GetMeshOnEntity - GetCells() = "<<float(aDataSet->GetCells()->GetActualMemorySize()*1000));
459       MESSAGE("GetMeshOnEntity - GetCellTypesArray() = "<<float(aDataSet->GetCellTypesArray()->GetActualMemorySize()*1000));
460       MESSAGE("GetMeshOnEntity - GetCellLocationsArray() = "<<float(aDataSet->GetCellLocationsArray()->GetActualMemorySize()*1000));
461       aDataSet->BuildLinks();
462       MESSAGE("GetMeshOnEntity - GetCellLinks() = "<<float(aDataSet->GetCellLinks()->GetActualMemorySize()*1000));
463       MESSAGE("GetMeshOnEntity - GetActualMemorySize() = "<<float(aDataSet->GetActualMemorySize()*1000));
464     }
465   }catch(...){
466     aSource = vtkSmartPointerBase();
467     throw;
468   }
469   return aSource.GetPointer();
470 }
471
472 VISU_Convertor::TOutput* 
473 VISU_Convertor_impl::GetMeshOnGroup(const string& theMeshName, 
474                                     const string& theGroupName)
475      throw(std::runtime_error&)
476 {
477   if(MYDEBUG) MESSAGE("GetMeshOnGroup - theMeshName = '"<<theMeshName<<
478                       "'; theGroupName = '"<<theGroupName<<"'");
479   //Cheching possibility do the query
480   VISU::TMesh* pMesh = NULL;
481   VISU::TGroup* pGroup = NULL;
482   FindMeshOnGroup(theMeshName,pMesh,theGroupName,pGroup);
483   VISU::TMesh& aMesh = *pMesh;
484   VISU::TGroup& aGroup = *pGroup;
485   const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup.myFamilyAndEntitySet;
486   VISU::TVTKSource& aSource = aGroup.myStorage;
487   //Main part of code
488   try{
489     if(aSource.GetPointer() == NULL){
490       aSource = TOutput::New();
491       aSource->Delete();
492       LoadMeshOnGroup(aMesh,aFamilyAndEntitySet);
493       GetPoints(aSource,aMesh);
494       GetCellsOnGroup(aSource,aMesh,aFamilyAndEntitySet);
495       if(MYDEBUGWITHFILES){
496         string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
497         string aGroupName = QString(theGroupName.c_str()).simplifyWhiteSpace().latin1();
498         string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
499         aFileName += aMeshName + "-" + aGroupName + "-Conv.vtk";
500         VISU::WriteToFile(aSource.GetPointer(),aFileName);
501       }
502     }
503   }catch(...){
504     aSource = vtkSmartPointerBase();
505     throw;
506   }
507   return aSource.GetPointer();
508 }
509
510 VISU_Convertor::TOutput* 
511 VISU_Convertor_impl::GetTimeStampOnMesh(const string& theMeshName, 
512                                         const VISU::TEntity& theEntity,
513                                         const string& theFieldName,
514                                         int theStampsNum)
515      throw(std::runtime_error&)
516 {
517   if(MYDEBUG){
518     MESSAGE("GetTimeStampOnMesh - theMeshName = '"<<theMeshName<<"; theEntity = "<<theEntity);
519     MESSAGE("GetTimeStampOnMesh - theFieldName = '"<<theFieldName<<"'; theStampsNum = "<<theStampsNum);
520   }
521   //Cheching possibility do the query
522   VISU::TMesh* pMesh = NULL;
523   VISU::TField* pField = NULL;
524   VISU::TMeshOnEntity *pMeshOnEntity = NULL, *pVTKMeshOnEntity = NULL;
525   VISU::TField::TValForTime* pValForTime = NULL;
526   FindTimeStamp(theMeshName,pMesh,theEntity,pMeshOnEntity,pVTKMeshOnEntity,
527                 theFieldName,pField,theStampsNum,pValForTime);
528   VISU::TMesh& aMesh = *pMesh;
529   VISU::TMeshOnEntity& aMeshOnEntity = *pMeshOnEntity;
530   VISU::TField& aField = *pField;
531   VISU::TField::TValForTime& aValForTime = *pValForTime;
532   VISU::TVTKAttribyteFilter& anAttribyteFilter = aValForTime.myAttribyteFilter;
533   VISU::TVTKSource& aSource = aValForTime.myStorage;
534   TOutput* anOutput = NULL;
535   //Main part of code
536   try{
537     if(aSource.GetPointer())
538       return aSource.GetPointer();
539     else if(anAttribyteFilter.GetPointer())
540       return anAttribyteFilter->GetUnstructuredGridOutput();
541     else{
542       LoadFieldOnMesh(aMesh,aMeshOnEntity,aField,aValForTime);
543
544       VISU::TVTKExtractFilter& anExtractFilter = aField.myExtractFilter;
545       if(anExtractFilter.GetPointer() == NULL){
546         anExtractFilter = VISU_ExtractUnstructuredGrid::New();
547         anExtractFilter->Delete();
548         //anExtractFilter->DebugOn();
549         try{
550           LoadMeshOnEntity(*pVTKMeshOnEntity);
551         }catch(std::runtime_error& exc){
552           pVTKMeshOnEntity = pMeshOnEntity;
553           MESSAGE("Follow exception was accured :\n"<<exc.what());
554         }catch(...){
555           pVTKMeshOnEntity = pMeshOnEntity;
556           MESSAGE("Unknown exception was accured!");
557         }
558         GetMeshOnEntity(pVTKMeshOnEntity->myMeshName,pVTKMeshOnEntity->myEntity);
559         
560         anExtractFilter->SetInput(pVTKMeshOnEntity->myStorage.GetPointer());
561         ::InitProfile(anExtractFilter,*pMeshOnEntity,aValForTime);
562       }      
563       if(!anExtractFilter->IsRemoving()){
564         aSource = TOutput::New();
565         aSource->Delete();
566         aSource->ShallowCopy(pVTKMeshOnEntity->myStorage.GetPointer());
567         ::GetTimeStamp(aSource,aMesh,*pVTKMeshOnEntity,aField,aValForTime);
568         anOutput = aSource.GetPointer();
569       }else{
570         anAttribyteFilter = vtkFieldDataToAttributeDataFilter::New();
571         anAttribyteFilter->Delete();
572         //anAttribyteFilter->DebugOn();
573         
574         VISU::TVTKMergetFilter& aMergeFilter = aValForTime.myMergeFilter;
575         aMergeFilter = vtkMergeDataObjectFilter::New();
576         aMergeFilter->Delete();
577         //aMergeFilter->DebugOn();
578
579         ::GetTimeStamp(anAttribyteFilter,aMergeFilter,anExtractFilter,
580                        aMesh,*pVTKMeshOnEntity,aField,aValForTime);
581         anOutput = anAttribyteFilter->GetUnstructuredGridOutput();
582       }
583       if(MYDEBUGWITHFILES){
584         string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
585         string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
586         string aPrefix = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
587         string aFileName = aPrefix + aMeshName + dtos("-%d-",int(theEntity)) + 
588           aFieldName + dtos("-%d",theStampsNum) + "-Conv.vtk";
589         VISU::WriteToFile(anOutput,aFileName);
590       }
591       if(MYVTKDEBUG){
592         GetTimeStampSize(theMeshName,theEntity,theFieldName,theStampsNum);
593         vtkUnstructuredGrid *aDataSet = anAttribyteFilter->GetUnstructuredGridOutput();
594         aDataSet->Update();
595         if(theEntity == VISU::NODE_ENTITY)
596           MESSAGE("GetTimeStampOnMesh - GetData() = "<<float(aDataSet->GetPointData()->GetActualMemorySize()*1000));
597         else
598           MESSAGE("GetMeshOnEntity - GetData() = "<<float(aDataSet->GetCellData()->GetActualMemorySize()*1000));
599         MESSAGE("GetTimeStampOnMesh - GetActualMemorySize() = "<<float(aDataSet->GetActualMemorySize()*1000));
600       }
601     }
602   }catch(...){
603     aSource = vtkSmartPointerBase();
604     anAttribyteFilter = vtkSmartPointerBase();
605     throw;
606   }
607   return anOutput;
608 }
609
610 void VISU_Convertor_impl::FindMesh(const string& theMeshName, VISU::TMesh*& theMesh)
611   throw (std::runtime_error&)
612 {
613   GetMeshMap();
614   if(myMeshMap.find(theMeshName) == myMeshMap.end())
615     throw std::runtime_error(EXCEPT("FindMesh >> There is no mesh with the name - '%1'!!!").
616                              arg(theMeshName.c_str()).latin1());
617   theMesh = &myMeshMap[theMeshName];
618 }
619
620
621 void VISU_Convertor_impl::FindMeshOnEntity(const string& theMeshName, 
622                                            VISU::TMesh*& theMesh,
623                                            const VISU::TEntity& theEntity, 
624                                            VISU::TMeshOnEntity*& theMeshOnEntity,
625                                            const string& theFamilyName, 
626                                            VISU::TFamily*& theFamily)
627   throw (std::runtime_error&)
628 {
629   FindMesh(theMeshName,theMesh);
630   VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
631   if(aMeshOnEntityMap.find(theEntity) == aMeshOnEntityMap.end())
632     throw std::runtime_error(EXCEPT("FindMeshOnEntity >> There is no mesh on the entity - %1!!!").
633                              arg(int(theEntity)).latin1());
634   theMeshOnEntity = &aMeshOnEntityMap[theEntity];
635   theFamily = VISU::GetFamily(*theMeshOnEntity,theFamilyName);
636 }
637
638
639 float VISU_Convertor_impl::GetSize() throw (std::runtime_error&){
640   float aResult = 0.0;
641   const VISU::TMeshMap& aMeshMap = GetMeshMap();
642   VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
643   for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
644     const string& aMeshName = aMeshMapIter->first;
645     const VISU::TMesh& aMesh = aMeshMapIter->second;
646     const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
647     VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
648     //Import fields
649     aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
650     for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
651       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
652       const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
653       const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
654       VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
655       for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
656         const string& aFieldName = aFieldMapIter->first;
657         const VISU::TField& aField = aFieldMapIter->second;
658         const VISU::TField::TValField& aValField = aField.myValField;
659         VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
660         for(; aValFieldIter != aValField.end(); aValFieldIter++){
661           int aTimeStamp = aValFieldIter->first;
662           aResult += GetTimeStampSize(aMeshName,anEntity,aFieldName,aTimeStamp);
663         }
664       }
665       //Importing groups
666       const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
667       VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
668       for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
669         const string& aGroupName = aGroupMapIter->first;
670         aResult += GetMeshOnGroupSize(aMeshName,aGroupName);
671       }
672       //Import families
673       const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
674       VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
675       for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
676         const string& aFamilyName = aFamilyMapIter->first;
677         aResult += GetMeshOnEntitySize(aMeshName,anEntity,aFamilyName);
678       }
679       //Import mesh on entity
680       aResult += GetMeshOnEntitySize(aMeshName,anEntity);
681     }
682   }
683   if(MYDEBUG)
684     MESSAGE("GetSize - aResult = "<<float(aResult));
685   return aResult;
686 }
687
688
689 float VISU_Convertor_impl::GetMeshOnEntitySize(const std::string& theMeshName, 
690                                                const VISU::TEntity& theEntity,
691                                                const std::string& theFamilyName)
692   throw (std::runtime_error&)
693 {
694   VISU::TMesh* pMesh = NULL;
695   VISU::TFamily* pFamily = NULL;
696   VISU::TMeshOnEntity* pMeshOnEntity = NULL;
697   FindMeshOnEntity(theMeshName,pMesh,theEntity,pMeshOnEntity,theFamilyName,pFamily);
698   vtkIdType aPointsSize = 3*pMesh->myNbPoints*sizeof(VISU::TMesh::TCoord);
699   vtkIdType aNbCells, aCellsSize;
700   if(!pFamily){
701     aNbCells = pMeshOnEntity->myNbCells;
702     aCellsSize = pMeshOnEntity->myCellsSize;
703   }else{
704     aNbCells = pFamily->myNbCells;
705     aCellsSize = pFamily->myCellsSize;
706   }
707   vtkIdType aConnectivitySize = aCellsSize*sizeof(vtkIdType);
708   vtkIdType aTypesSize = aNbCells*sizeof(char);
709   vtkIdType aLocationsSize = aNbCells*sizeof(int);
710   float aNbCellsPerPoint = aCellsSize / aNbCells - 1;
711   vtkIdType aLinksSize = pMesh->myNbPoints * 
712     (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(vtkCellLinks::Link));
713   aLinksSize = 0;
714   vtkIdType aResult = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize + aLinksSize;
715   if(MYDEBUG){
716     if(MYVTKDEBUG){
717       MESSAGE("GetMeshOnEntitySize - aPointsSize = "<<float(aPointsSize));
718       MESSAGE("GetMeshOnEntitySize - aConnectivitySize = "<<float(aConnectivitySize));
719       MESSAGE("GetMeshOnEntitySize - aTypesSize = "<<float(aTypesSize));
720       MESSAGE("GetMeshOnEntitySize - aLocationsSize = "<<float(aLocationsSize));
721       MESSAGE("GetMeshOnEntitySize - aLinksSize = "<<float(aLinksSize));
722     }
723     MESSAGE("GetMeshOnEntitySize - aResult = "<<float(aResult)<<"; theMeshName = '"<<theMeshName<<
724             "'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
725   }
726   aResult = vtkIdType(aResult*ERR_SIZE_CALC);
727   return aResult;
728 }
729
730
731 void VISU_Convertor_impl::FindMeshOnGroup(const std::string& theMeshName, VISU::TMesh*& theMesh,
732                                           const std::string& theGroupName, VISU::TGroup*& theGroup)
733   throw (std::runtime_error&)
734 {
735   FindMesh(theMeshName,theMesh);
736   VISU::TGroupMap& aGroupMap = theMesh->myGroupMap;
737   VISU::TGroupMap::iterator aGroupMapIter = aGroupMap.find(theGroupName);
738   if(aGroupMapIter == aGroupMap.end())
739     throw std::runtime_error(EXCEPT("FindMesh >> There is no the group in the mesh!!! - '%1'").arg(theGroupName.c_str()).latin1());
740   theGroup = &aGroupMapIter->second;
741 }
742
743
744 float VISU_Convertor_impl::GetMeshOnGroupSize(const std::string& theMeshName, 
745                                               const std::string& theGroupName)
746   throw (std::runtime_error&)
747 {
748   VISU::TMesh* pMesh = NULL;
749   VISU::TGroup* pGroup = NULL;
750   FindMeshOnGroup(theMeshName,pMesh,theGroupName,pGroup);
751   vtkIdType aPointsSize = 3*pMesh->myNbPoints*sizeof(VISU::TMesh::TCoord);
752   vtkIdType aNbCells = pGroup->myNbCells, aCellsSize = pGroup->myCellsSize;
753   vtkIdType aConnectivityAndTypesSize = aCellsSize*sizeof(vtkIdType);
754   vtkIdType aLocationsSize = aNbCells*sizeof(int);
755   float aNbCellsPerPoint = aCellsSize / aNbCells - 1;
756   vtkIdType aLinksSize = pMesh->myNbPoints * 
757     (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(short));
758   aLinksSize = 0;
759   vtkIdType aResult = aPointsSize + aConnectivityAndTypesSize + aLocationsSize + aLinksSize;
760   if(MYDEBUG){
761     if(MYVTKDEBUG){
762       MESSAGE("GetMeshOnGroupSize - aPointsSize = "<<float(aPointsSize));
763       MESSAGE("GetMeshOnGroupSize - aConnectivityAndTypesSize = "<<float(aConnectivityAndTypesSize));
764       MESSAGE("GetMeshOnGroupSize - aLocationsSize = "<<float(aLocationsSize));
765       MESSAGE("GetMeshOnGroupSize - aLinksSize = "<<float(aLinksSize));
766     }
767     MESSAGE("GetMeshOnGroupSize - aResult = "<<float(aResult)<<"; theMeshName = '"
768             <<theMeshName<<"'; theGroupName = '"<<theGroupName<<"'");
769   }
770   aResult = vtkIdType(aResult*ERR_SIZE_CALC);
771   return aResult;
772 }
773
774
775 void VISU_Convertor_impl::FindField(const string& theMeshName, VISU::TMesh*& theMesh,
776                                     const VISU::TEntity& theEntity, 
777                                     VISU::TMeshOnEntity*& theMeshOnEntity,
778                                     VISU::TMeshOnEntity*& theVTKMeshOnEntity,
779                                     const string& theFieldName, VISU::TField*& theField)
780   throw (std::runtime_error&)
781 {
782   VISU::TFamily* pFamily = NULL;
783   VISU::TMeshOnEntity* pMeshOnEntity = NULL;
784   FindMeshOnEntity(theMeshName,theMesh,theEntity,pMeshOnEntity,"",pFamily);
785   theMeshOnEntity = pMeshOnEntity;
786   VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
787   if(theEntity == VISU::NODE_ENTITY){
788     if(aMeshOnEntityMap.find(VISU::CELL_ENTITY) != aMeshOnEntityMap.end())
789       pMeshOnEntity = &aMeshOnEntityMap[VISU::CELL_ENTITY];
790     else if(aMeshOnEntityMap.find(VISU::FACE_ENTITY) != aMeshOnEntityMap.end())
791       pMeshOnEntity = &aMeshOnEntityMap[VISU::FACE_ENTITY];
792     else if(aMeshOnEntityMap.find(VISU::NODE_ENTITY) != aMeshOnEntityMap.end())
793       pMeshOnEntity = &aMeshOnEntityMap[VISU::EDGE_ENTITY];
794   }
795   theVTKMeshOnEntity = pMeshOnEntity;
796   VISU::TFieldMap& aFieldMap = theMeshOnEntity->myFieldMap;
797   if(aFieldMap.find(theFieldName) == aFieldMap.end())
798     throw std::runtime_error(EXCEPTION("FindField >> There is no field on the mesh!!!"));
799   theField = &aFieldMap[theFieldName];
800 }
801
802
803 float VISU_Convertor_impl::GetFieldOnMeshSize(const std::string& theMeshName, 
804                                               const VISU::TEntity& theEntity,
805                                               const std::string& theFieldName)
806   throw(std::runtime_error&)
807 {
808   VISU::TMesh* pMesh = NULL;
809   VISU::TField* pField = NULL;
810   VISU::TMeshOnEntity *pMeshOnEntity = NULL, *pVTKMeshOnEntity = NULL;
811   FindField(theMeshName,pMesh,theEntity,pMeshOnEntity,pVTKMeshOnEntity,
812             theFieldName,pField);
813   float aMeshSize = GetMeshOnEntitySize(theMeshName,pVTKMeshOnEntity->myEntity);
814   float aFieldOnMeshSize = float(pField->myDataSize*sizeof(float)*pField->myNbValField * ERR_SIZE_CALC);
815   float aResult = aMeshSize + aFieldOnMeshSize;
816   if(MYDEBUG){
817     if(MYVTKDEBUG)
818       MESSAGE("GetFieldOnMeshSize - aFieldOnMeshSize = "<<float(aFieldOnMeshSize));
819     MESSAGE("GetFieldOnMeshSize - aResult = "<<float(aResult)<<"; theMeshName = '"<<theMeshName<<
820             "'; theEntity = "<<theEntity<<"; theFieldName = '"<<theFieldName<<"'");
821   }
822   return aResult;
823 }
824
825
826 void VISU_Convertor_impl::FindTimeStamp(const std::string& theMeshName, VISU::TMesh*& theMesh,
827                                         const VISU::TEntity& theEntity, 
828                                         VISU::TMeshOnEntity*& theMeshOnEntity,
829                                         VISU::TMeshOnEntity*& theVTKMeshOnEntity,
830                                         const std::string& theFieldName, VISU::TField*& theField,
831                                         int theStampsNum, VISU::TField::TValForTime*& theValForTime)
832   throw (std::runtime_error&)
833 {
834   FindField(theMeshName,theMesh,theEntity,theMeshOnEntity,theVTKMeshOnEntity,theFieldName,theField);
835   VISU::TField::TValField& aValField = theField->myValField;
836   if(aValField.find(theStampsNum) == aValField.end())
837     throw std::runtime_error(EXCEPTION("FindTimeStamp >> There is no field with the timestamp!!!"));
838   theValForTime = &aValField[theStampsNum];
839 }
840
841
842 float VISU_Convertor_impl::GetTimeStampSize(const std::string& theMeshName, 
843                                             const VISU::TEntity& theEntity,
844                                             const std::string& theFieldName,
845                                             int theStampsNum)
846   throw (std::runtime_error&)
847 {
848   VISU::TMesh* pMesh = NULL;
849   VISU::TField* pField = NULL;
850   VISU::TMeshOnEntity *pMeshOnEntity = NULL, *pVTKMeshOnEntity = NULL;
851   VISU::TField::TValForTime* pValForTime = NULL;
852   FindTimeStamp(theMeshName,pMesh,theEntity,pMeshOnEntity,pVTKMeshOnEntity,
853                 theFieldName,pField,theStampsNum,pValForTime);
854   float aMeshSize = GetMeshOnEntitySize(theMeshName,pVTKMeshOnEntity->myEntity);
855   float aTimeStampSize = float(pField->myDataSize*sizeof(float) * ERR_SIZE_CALC);
856   float aResult = aMeshSize + aTimeStampSize;
857   if(MYDEBUG){
858     if(MYVTKDEBUG)
859       MESSAGE("GetTimeStampSize - aTimeStampSize = "<<float(aTimeStampSize));
860     MESSAGE("GetTimeStampSize - aResult = "<<float(aResult)<<"; theMeshName = '"<<theMeshName<<"'; theEntity = "<<theEntity<<
861             "; theFieldName = '"<<theFieldName<<"'; theStampsNum = "<<theStampsNum);
862   }
863   return aResult;
864 }
865
866
867 const VISU::TField& 
868 VISU_Convertor_impl::GetField(const string& theMeshName, 
869                               VISU::TEntity theEntity, 
870                               const string& theFieldName) 
871   throw (std::runtime_error&)
872 {
873   VISU::TMesh* pMesh = NULL;
874   VISU::TField* pField = NULL;
875   VISU::TFamily* pFamily = NULL;
876   VISU::TMeshOnEntity *pMeshOnEntity = NULL, *pVTKMeshOnEntity = NULL;
877   FindField(theMeshName,pMesh,theEntity,pMeshOnEntity,pVTKMeshOnEntity,
878             theFieldName,pField);
879   return *pField;
880 }
881
882
883 const VISU::TField::TValForTime& 
884 VISU_Convertor_impl::GetTimeStamp(const std::string& theMeshName, 
885                                   const VISU::TEntity& theEntity,
886                                   const std::string& theFieldName,
887                                   int theStampsNum)
888   throw (std::runtime_error&)
889 {
890   VISU::TMesh* pMesh = NULL;
891   VISU::TField* pField = NULL;
892   VISU::TMeshOnEntity *pMeshOnEntity = NULL, *pVTKMeshOnEntity = NULL;
893   VISU::TField::TValForTime* pValForTime = NULL;
894   FindTimeStamp(theMeshName,pMesh,theEntity,pMeshOnEntity,pVTKMeshOnEntity,
895                 theFieldName,pField,theStampsNum,pValForTime);
896   return *pValForTime;
897 }
898
899