1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // Author: Alexey PETROV
26 #include "VISU_Structures_impl.hxx"
27 #include "VISU_PointCoords.hxx"
28 #include "VISU_MeshValue.hxx"
30 #include "VISU_AppendFilter.hxx"
31 #include "VISU_AppendPolyData.hxx"
32 #include "VISU_MergeFilter.hxx"
34 #include "VISU_ConvertorUtils.hxx"
35 #include "VISU_CommonCellsFilter.hxx"
37 #include <vtkUnstructuredGrid.h>
38 #include <vtkPolyData.h>
39 #include <vtkCellType.h>
45 VISUGeom2NbNodes(EGeometry theGeom)
48 #ifndef VISU_ENABLE_QUADRATIC
73 VISUGeom2VTK(EGeometry theGeom)
87 return VTK_HEXAHEDRON;
96 return VTK_CONVEX_POINT_SET;
98 #ifndef VISU_ENABLE_QUADRATIC
108 return VTK_HEXAHEDRON;
117 #if defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)
118 return VTK_QUADRATIC_EDGE;
120 return VTK_POLY_LINE;
124 #if defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)
125 return VTK_QUADRATIC_TRIANGLE;
131 #if defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)
132 return VTK_QUADRATIC_QUAD;
138 #if defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)
139 return VTK_QUADRATIC_TETRA;
141 return VTK_CONVEX_POINT_SET;
145 #if defined(VTK_QUADRATIC_HEXAHEDRON) && defined(VISU_USE_VTK_QUADRATIC)
146 return VTK_QUADRATIC_HEXAHEDRON;
148 return VTK_CONVEX_POINT_SET;
152 #if defined(VTK_QUADRATIC_WEDGE) && defined(VISU_USE_VTK_QUADRATIC)
153 return VTK_QUADRATIC_WEDGE;
155 return VTK_CONVEX_POINT_SET;
159 #if defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)
160 return VTK_QUADRATIC_PYRAMID;
162 return VTK_CONVEX_POINT_SET;
165 #endif //VISU_ENABLE_QUADRATIC
174 VTKGeom2VISU(vtkIdType theGeom)
178 return VISU::ePOINT1;
186 return VISU::eTETRA4;
190 return VISU::ePENTA6;
195 return VISU::ePOLYGONE;
196 case VTK_CONVEX_POINT_SET:
197 return VISU::ePOLYEDRE;
199 #if defined(VISU_ENABLE_QUADRATIC) && defined(VISU_USE_VTK_QUADRATIC)
200 #if defined(VTK_QUADRATIC_EDGE)
201 case VTK_QUADRATIC_EDGE:
205 #if defined(VTK_QUADRATIC_TRIANGLE)
206 case VTK_QUADRATIC_TRIANGLE:
210 #if defined(VTK_QUADRATIC_QUAD)
211 case VTK_QUADRATIC_QUAD:
215 #if defined(VTK_QUADRATIC_TETRA)
216 case VTK_QUADRATIC_TETRA:
217 return VISU::eTETRA10;
220 #if defined(VTK_QUADRATIC_HEXAHEDRON)
221 case VTK_QUADRATIC_HEXAHEDRON:
222 return VISU::eHEXA20;
225 #if defined(VTK_QUADRATIC_WEDGE)
226 case VTK_QUADRATIC_WEDGE:
227 return VISU::ePENTA15;
230 #if defined(VTK_QUADRATIC_PYRAMID)
231 case VTK_QUADRATIC_PYRAMID:
232 return VISU::ePYRA13;
235 #endif //VISU_ENABLE_QUADRATIC
238 return EGeometry(-1);
242 //---------------------------------------------------------------
243 /*! Computes number of points by the given number of cells
244 * in assumption of regular hexahedral mesh structure
247 GetNumberOfPoints(size_t theNbCells)
249 return size_t(pow(pow(theNbCells, 1.0/3.0) + 1.0, 3.0));
252 //---------------------------------------------------------------
253 /*! Computes size dataset the given number of mesh macro metrics
254 * in assumption of regular hexahedral mesh structure
257 GetDataSetSize(size_t theNbOfPoints,
260 bool theComputeLinks)
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));
269 size_t aResult = aPointsSize + aConnectivityAndTypesSize + aLocationsSize + aLinksSize;
273 //---------------------------------------------------------------
281 //---------------------------------------------------------------
290 if(!mySource.GetPointer()){
291 mySource = vtkPolyData::New();
299 ::GetPolyDataOutput()
301 return GetSource().GetPointer();
308 if(vtkDataSet* anOutput = GetPolyDataOutput()){
310 return anOutput->GetActualMemorySize() * 1024;
313 size_t aNbPoints = GetNumberOfPoints(myNbCells);
314 return GetDataSetSize(aNbPoints, myNbCells, myCellsSize, false);
316 throw std::runtime_error("TUnstructuredGridHolder::GetMemorySize - myIsDone == false !!!");
320 //---------------------------------------------------------------
321 TUnstructuredGridHolder
322 ::TUnstructuredGridHolder()
325 const PUnstructuredGrid&
326 TUnstructuredGridHolder
329 if(!mySource.GetPointer()){
330 mySource = vtkUnstructuredGrid::New();
337 TUnstructuredGridHolder
338 ::GetUnstructuredGridOutput()
340 return GetSource().GetPointer();
344 TUnstructuredGridHolder
347 if(vtkDataSet* anOutput = GetUnstructuredGridOutput()){
349 return anOutput->GetActualMemorySize() * 1024;
352 size_t aNbPoints = GetNumberOfPoints(myNbCells);
353 return GetDataSetSize(aNbPoints, myNbCells, myCellsSize, false);
355 throw std::runtime_error("TUnstructuredGridHolder::GetMemorySize - myIsDone == false !!!");
359 //---------------------------------------------------------------
365 if(vtkDataSet* anOutput = GetOutput()){
367 return anOutput->GetActualMemorySize() * 1024;
370 throw std::runtime_error("TMemoryCheckIDMapper::GetMemorySize - myIsVTKDone == false !!!");
375 //---------------------------------------------------------------
377 ::TAppendFilterHolder()
384 if(!myFilter.GetPointer()){
385 myFilter = VISU_AppendFilter::New();
387 myFilter->SetMappingInputs(true);
394 ::GetUnstructuredGridOutput()
396 GetFilter()->Update();
397 return GetFilter()->GetOutput();
400 //---------------------------------------------------------------
401 TAppendPolyDataHolder
402 ::TAppendPolyDataHolder()
405 const PAppendPolyData&
406 TAppendPolyDataHolder
409 if(!myFilter.GetPointer()){
410 myFilter = VISU_AppendPolyData::New();
411 myFilter->SetMappingInputs(true);
418 TAppendPolyDataHolder
419 ::GetPolyDataOutput()
421 GetFilter()->Update();
422 return GetFilter()->GetOutput();
426 //---------------------------------------------------------------
428 ::TMergeFilterHolder()
435 if(!myFilter.GetPointer()){
436 myFilter = VISU_MergeFilter::New();
446 GetFilter()->Update();
447 return GetFilter()->GetOutput();
451 //---------------------------------------------------------------
475 return myNamedPointCoords->GetPointSet();
479 //---------------------------------------------------------------
480 TSubProfileImpl::TSubProfileImpl():
488 ::GetElemObjID(vtkIdType theID) const
490 if ( !mySubMeshID.empty() )
491 return mySubMeshID[theID];
499 ::GetElemVTKID(vtkIdType theID) const
501 if ( !mySubMeshID.empty() )
502 for ( size_t anId = 0; anId < mySubMeshID.size(); anId++ )
503 if ( mySubMeshID[ anId ] == theID )
513 size_t aSize = TUnstructuredGridHolder::GetMemorySize();
514 aSize += sizeof(vtkIdType) * mySubMeshID.size();
519 //---------------------------------------------------------------
521 operator<(const PSubProfile& theLeft, const PSubProfile& theRight)
523 PSubProfileImpl aLeft(theLeft), aRight(theRight);
525 if(aLeft->myGeom != aRight->myGeom)
526 return aLeft->myGeom < aRight->myGeom;
528 if(aLeft->myStatus != aRight->myStatus)
529 return aLeft->myStatus < aRight->myStatus;
531 return aLeft->myName < aRight->myName;
535 //---------------------------------------------------------------
544 ::GetNodeObjID(vtkIdType theID) const
546 return myNamedPointCoords->GetObjID(theID);
551 ::GetNodeVTKID(vtkIdType theID) const
553 return myNamedPointCoords->GetVTKID(theID);
556 vtkFloatingPointType*
558 ::GetNodeCoord(vtkIdType theObjID)
561 return myMeshOnEntity->GetNodeCoord(theObjID);
563 vtkIdType aVtkID = GetNodeVTKID(theObjID);
564 return GetFilter()->GetOutput()->GetPoint(aVtkID);
569 ::GetElemObjID(vtkIdType theID) const
571 return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
576 ::GetElemVTKID(vtkIdType theID) const
578 return VISU::GetElemVTKID(GetFilter()->GetOutput(), theID);
583 ::GetElemCell(vtkIdType theObjID)
586 return myMeshOnEntity->GetElemCell(theObjID);
588 vtkIdType aVtkID = GetElemVTKID(theObjID);
589 return GetFilter()->GetOutput()->GetCell(aVtkID);
594 ::GetUnstructuredGridOutput()
596 const PAppendFilter& anAppendFilter = GetFilter();
597 return anAppendFilter->GetOutput();
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);
619 ::GetNodeName(vtkIdType theObjID) const
621 return myNamedPointCoords->GetNodeName(theObjID);
626 ::GetElemName(vtkIdType theObjID) const
628 return myMeshOnEntity->GetElemName(theObjID);
632 //---------------------------------------------------------------
633 TUnstructuredGridIDMapperImpl
634 ::TUnstructuredGridIDMapperImpl()
636 if ( !myCommonCellsFilter.GetPointer() ) {
637 myCommonCellsFilter = VISU_CommonCellsFilter::New();
638 myCommonCellsFilter->Delete();
643 TUnstructuredGridIDMapperImpl
644 ::GetNodeObjID(vtkIdType theID) const
646 return myIDMapper->GetNodeObjID(theID);
650 TUnstructuredGridIDMapperImpl
651 ::GetNodeVTKID(vtkIdType theID) const
653 return myIDMapper->GetNodeVTKID(theID);
656 vtkFloatingPointType*
657 TUnstructuredGridIDMapperImpl
658 ::GetNodeCoord(vtkIdType theObjID)
660 return myIDMapper->GetNodeCoord(theObjID);
664 TUnstructuredGridIDMapperImpl
665 ::GetElemObjID(vtkIdType theID) const
667 return myIDMapper->GetElemObjID(theID);
671 TUnstructuredGridIDMapperImpl
672 ::GetElemVTKID(vtkIdType theID) const
674 return myIDMapper->GetElemVTKID(theID);
678 TUnstructuredGridIDMapperImpl
679 ::GetElemCell(vtkIdType theObjID)
681 return myIDMapper->GetElemCell(theObjID);
685 TUnstructuredGridIDMapperImpl
686 ::SetReferencedMesh( const PNamedIDMapper& theNamedIDMapper )
688 myCommonCellsFilter->SetCellsUG( theNamedIDMapper->GetUnstructuredGridOutput() );
692 TUnstructuredGridIDMapperImpl
695 if ( !myFilter.GetPointer() ) {
696 const PAppendFilter& anAppendFilter = myIDMapper->GetFilter();
698 vtkUnstructuredGrid* aGeometry = anAppendFilter->GetOutput();
699 const PUnstructuredGrid& aSource = mySource.GetSource();
700 vtkUnstructuredGrid* aDataSet = aSource.GetPointer();
701 aDataSet->ShallowCopy( aGeometry );
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_CELLS_MAPPER", aDataSet );
709 aFilter->AddField( "ELNO_FIELD", aDataSet );
710 aFilter->AddField( "ELNO_COMPONENT_MAPPER", aDataSet );
711 aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet );
713 myCommonCellsFilter->SetProfileUG( aFilter->GetUnstructuredGridOutput() );
718 TUnstructuredGridIDMapperImpl
719 ::GetUnstructuredGridOutput()
722 return myCommonCellsFilter->GetOutput();
726 TUnstructuredGridIDMapperImpl
729 return GetUnstructuredGridOutput();
733 TUnstructuredGridIDMapperImpl
737 return mySource.GetSource();
741 TUnstructuredGridIDMapperImpl
744 size_t aSize = myIDMapper->GetMemorySize();
746 aSize += mySource.GetMemorySize();
748 if ( vtkUnstructuredGrid* anOutput = myCommonCellsFilter->GetOutput() )
749 aSize += anOutput->GetActualMemorySize() * 1024;
754 //---------------------------------------------------------------
756 TPolyDataIDMapperImpl
757 ::GetNodeObjID(vtkIdType theID) const
759 return myIDMapper->GetNodeObjID(theID);
763 TPolyDataIDMapperImpl
764 ::GetNodeVTKID(vtkIdType theID) const
766 return myIDMapper->GetNodeVTKID(theID);
769 vtkFloatingPointType*
770 TPolyDataIDMapperImpl
771 ::GetNodeCoord(vtkIdType theObjID)
773 return myIDMapper->GetNodeCoord(theObjID);
777 TPolyDataIDMapperImpl
778 ::GetElemObjID(vtkIdType theID) const
780 return myIDMapper->GetElemObjID(theID);
784 TPolyDataIDMapperImpl
785 ::GetElemVTKID(vtkIdType theID) const
787 return myIDMapper->GetElemVTKID(theID);
791 TPolyDataIDMapperImpl
792 ::GetElemCell(vtkIdType theObjID)
794 return myIDMapper->GetElemCell(theObjID);
798 TPolyDataIDMapperImpl
801 if ( !myFilter.GetPointer() ) {
802 const PAppendPolyData& anAppendFilter = myIDMapper->GetFilter();
803 vtkPolyData* aGeometry = anAppendFilter->GetOutput();
805 const PPolyData& aSource = mySource.GetSource();
806 vtkPolyData* aDataSet = aSource.GetPointer();
807 aDataSet->ShallowCopy( aGeometry );
809 const PMergeFilter& aFilter = GetFilter();
810 aFilter->SetGeometry( aGeometry );
811 aFilter->SetScalars( aDataSet );
812 aFilter->SetVectors( aDataSet );
813 aFilter->AddField( "VISU_FIELD", aDataSet );
814 aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet );
815 aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet );
820 TPolyDataIDMapperImpl
821 ::GetPolyDataOutput()
824 return myFilter->GetPolyDataOutput();
828 TPolyDataIDMapperImpl
831 return GetPolyDataOutput();
835 TPolyDataIDMapperImpl
839 return mySource.GetSource();
843 TPolyDataIDMapperImpl
846 size_t aSize = myIDMapper->GetMemorySize();
847 aSize += mySource.GetMemorySize();
852 //---------------------------------------------------------------
855 myGeom(EGeometry(-1)),
861 ::LessThan(const PGaussImpl& theGauss,
862 bool& theResult) const
868 //---------------------------------------------------------------
870 ::TGaussSubMeshImpl():
871 myPointCoords(new TPointCoords()),
878 ::GetObjID(vtkIdType theID) const
880 TCellID aCellID = myStartID + theID / myGauss->myNbPoints;
881 TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
883 return TGaussPointID(aCellID, aLocalPntID);
888 ::GetVTKID(const TGaussPointID& theID) const
890 vtkIdType aResult = -1;
892 TCellID aCellID = theID.first;
893 TLocalPntID aLocalPntID = theID.second;
895 vtkIdType aNbPoints = myGauss->myNbPoints;
896 if ( aLocalPntID >= aNbPoints )
899 return ( aCellID - myStartID ) * aNbPoints + aLocalPntID;
903 VISU::TGaussSubMeshImpl
904 ::GetElemObjID(vtkIdType theID) const
906 return mySubProfile->GetElemObjID( theID );
911 VISU::TGaussSubMeshImpl
912 ::GetElemVTKID(vtkIdType theID) const
914 return mySubProfile->GetElemVTKID( theID );
919 ::GetGlobalID(vtkIdType theID) const
921 return myStartID + theID;
928 size_t aSize = TPolyDataHolder::GetMemorySize();
929 aSize += myPointCoords->GetMemorySize();
933 //---------------------------------------------------------------
935 operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight)
937 PGaussSubMeshImpl aLeft(theLeft), aRight(theRight);
938 const PGaussImpl& aGaussLeft = aLeft->myGauss;
939 const PGaussImpl& aGaussRight = aRight->myGauss;
941 if(aGaussLeft->myGeom != aGaussRight->myGeom)
942 return aGaussLeft->myGeom < aGaussRight->myGeom;
944 if(aLeft->mySubProfile != aRight->mySubProfile)
945 return aLeft->mySubProfile < aRight->mySubProfile;
948 aGaussLeft->LessThan(aGaussRight,aResult);
954 //---------------------------------------------------------------
962 ::GetObjID(vtkIdType theID) const
964 const PAppendPolyData& aFilter = GetFilter();
965 return VISU::GetObjID(aFilter->GetOutput(), theID);
970 ::GetVTKID(const TGaussPointID& theID) const
972 vtkIdType aResult = -1;
974 TCellID aCellID = theID.first;
976 vtkIdType aVTKCellId = GetParent()->GetElemVTKID( aCellID );
977 if ( aVTKCellId < 0 )
980 vtkCell* aCell = GetParent()->GetElemCell( aCellID );
984 EGeometry aVGeom = VISU::VTKGeom2VISU( aCell->GetCellType() );
985 if ( aVGeom < EGeometry(0) )
988 TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.find( aVGeom );
989 if ( anIter == myGeom2GaussSubMesh.end() )
992 size_t aSubMeshEnd = myGaussSubMeshArr.size();
993 const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
994 for ( size_t aSubMeshId = 0; aSubMeshId < aSubMeshEnd; aSubMeshId++ ) {
995 const PGaussSubMeshImpl& aSubMesh = myGaussSubMeshArr[aSubMeshId];
996 if ( aGaussSubMesh.get() == aSubMesh.get() ) {
997 return aGaussSubMesh->GetVTKID(theID);
1006 ::GetPolyDataOutput()
1008 return TAppendPolyDataHolder::GetPolyDataOutput();
1015 size_t aSize = TAppendPolyDataHolder::GetMemorySize();
1016 TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.begin();
1017 TGeom2GaussSubMesh::const_iterator anIterEnd = myGeom2GaussSubMesh.end();
1018 for(; anIter != anIterEnd; anIter++){
1019 const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
1020 aSize += aGaussSubMesh->GetMemorySize();
1021 aSize += sizeof(EGeometry);
1034 //---------------------------------------------------------------
1037 ::GetObjID(vtkIdType theID) const
1039 return myGaussPtsIDMapper->GetObjID(theID);
1044 ::GetVTKID(const TGaussPointID& theID) const
1046 return myGaussPtsIDMapper->GetVTKID(theID);
1053 return myGaussPtsIDMapper->GetParent();
1058 ::GetPolyDataOutput()
1060 return TPolyDataIDMapperImpl::GetPolyDataOutput();
1067 return GetPolyDataOutput();
1071 //---------------------------------------------------------------
1079 ::CopyStructure( PStructured theStructured )
1081 TStructured::CopyStructure( theStructured );
1083 if ( PMeshImpl aMesh = theStructured )
1084 GetSource()->ShallowCopy( aMesh->GetPointSet() );
1089 ::GetElemObjID(vtkIdType theID) const
1091 return myStartID + theID;
1096 ::GetElemName(vtkIdType theObjID) const
1105 size_t aSize = TUnstructuredGridHolder::GetMemorySize();
1106 for(size_t anId = 0; anId < myCell2Connect.size(); anId++){
1107 const TConnect& aConnect = myCell2Connect[anId];
1108 aSize += aConnect.size() * sizeof(vtkIdType);
1113 //---------------------------------------------------------------
1115 ::TMeshOnEntityImpl()
1117 const PAppendFilter& anAppendFilter = GetFilter();
1118 anAppendFilter->SetMappingInputs(true);
1123 ::CopyStructure( PStructured theStructured )
1125 TStructured::CopyStructure( theStructured );
1127 if ( PMeshImpl aMesh = theStructured )
1128 myNamedPointCoords = aMesh->myNamedPointCoords;
1133 ::GetNodeVTKID(vtkIdType theID) const
1135 return myNamedPointCoords->GetVTKID(theID);
1140 ::GetNodeObjID(vtkIdType theID) const
1142 return myNamedPointCoords->GetObjID(theID);
1147 ::GetElemVTKID(vtkIdType theID) const
1149 return VISU::GetElemVTKID(GetFilter()->GetOutput(), theID);
1154 ::GetElemObjID(vtkIdType theID) const
1156 return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
1161 ::GetNodeName(vtkIdType theObjID) const
1163 return myNamedPointCoords->GetNodeName(theObjID);
1168 ::GetElemName(vtkIdType theObjID) const
1170 TInputCellID anInputCellID = VISU::GetInputCellID(GetFilter()->GetOutput(), theObjID);
1171 const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputCellID.first];
1172 return aSubMesh->GetElemName(anInputCellID.second);
1175 vtkUnstructuredGrid*
1177 ::GetUnstructuredGridOutput()
1179 return TAppendFilterHolder::GetUnstructuredGridOutput();
1186 size_t aSize = TAppendFilterHolder::GetMemorySize();
1187 aSize += myNamedPointCoords->GetMemorySize();
1188 aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1189 TGeom2SubMesh::const_iterator anIter = myGeom2SubMesh.begin();
1190 TGeom2SubMesh::const_iterator anIterEnd = myGeom2SubMesh.end();
1191 for(; anIter != anIterEnd; anIter++){
1192 const PSubMeshImpl& aSubMesh = anIter->second;
1193 aSize += aSubMesh->GetMemorySize();
1194 aSize += sizeof(EGeometry);
1199 //---------------------------------------------------------------
1202 ::CopyStructure( PStructured theStructured )
1204 TStructured::CopyStructure( theStructured );
1206 if ( PMeshImpl aMesh = theStructured ) {
1207 myNamedPointCoords = aMesh->myNamedPointCoords;
1208 GetSource()->ShallowCopy( aMesh->GetPointSet() );
1214 ::GetElemVTKID(vtkIdType theID) const
1216 if(myElemObj2VTKID.empty())
1219 TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
1220 if(anIter != myElemObj2VTKID.end())
1221 return anIter->second;
1228 ::GetElemObjID(vtkIdType theID) const
1230 return myMeshID[theID];
1235 ::GetNodeObjID(vtkIdType theID) const
1237 return myNamedPointCoords->GetObjID(theID);
1242 ::GetNodeVTKID(vtkIdType theID) const
1244 return myNamedPointCoords->GetVTKID(theID);
1247 vtkUnstructuredGrid*
1249 ::GetUnstructuredGridOutput()
1251 return TUnstructuredGridHolder::GetUnstructuredGridOutput();
1258 size_t aSize = TUnstructuredGridHolder::GetMemorySize();
1259 aSize += myNamedPointCoords->GetMemorySize();
1260 aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1261 aSize += myMeshID.size() * sizeof(vtkIdType);
1262 TGeom2SubMeshID::const_iterator anIter = myGeom2SubMeshID.begin();
1263 TGeom2SubMeshID::const_iterator anIterEnd = myGeom2SubMeshID.end();
1264 for(; anIter != anIterEnd; anIter++){
1265 const TSubMeshID& aSubMeshID = anIter->second;
1266 aSize += aSubMeshID.size() * sizeof(vtkIdType);
1267 aSize += sizeof(EGeometry);
1273 //---------------------------------------------------------------
1276 ::CopyStructure( PStructured theStructured )
1278 TStructured::CopyStructure( theStructured );
1280 if ( PMeshImpl aMesh = theStructured )
1281 myNamedPointCoords = aMesh->myNamedPointCoords;
1286 ::GetNbASizeCells() const
1288 vtkIdType aNbCells = 0, aCellsSize = 0;
1289 TFamilySet::const_iterator anIter = myFamilySet.begin();
1290 for(; anIter != myFamilySet.end(); anIter++){
1291 PFamilyImpl aFamily = *anIter;
1292 aNbCells += aFamily->myNbCells;
1293 aCellsSize += aFamily->myCellsSize;
1295 return std::make_pair(aNbCells,aCellsSize);
1300 ::GetElemVTKID(vtkIdType theID) const
1302 if(myElemObj2VTKID.empty())
1305 TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
1306 if(anIter != myElemObj2VTKID.end())
1307 return anIter->second;
1314 ::GetElemObjID(vtkIdType theID) const
1316 return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
1321 ::GetNodeObjID(vtkIdType theID) const
1323 return myNamedPointCoords->GetObjID(theID);
1328 ::GetNodeVTKID(vtkIdType theID) const
1330 return myNamedPointCoords->GetVTKID(theID);
1333 vtkUnstructuredGrid*
1335 ::GetUnstructuredGridOutput()
1337 return TAppendFilterHolder::GetUnstructuredGridOutput();
1344 size_t aSize = TAppendFilterHolder::GetMemorySize();
1345 aSize += myNamedPointCoords->GetMemorySize();
1346 aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1347 for(size_t anId = 0; anId < myFamilyArr.size(); anId++){
1348 const PFamilyImpl& aFamily = myFamilyArr[anId];
1349 aSize += aFamily->GetMemorySize();
1356 //---------------------------------------------------------------
1365 ::Init(vtkIdType theNbComp,
1366 vtkIdType theDataType)
1368 myNbComp = theNbComp;
1369 myDataType = theDataType;
1370 myCompNames.resize(theNbComp);
1371 myUnitNames.resize(theNbComp);
1372 myMinMaxArr.resize(theNbComp + 1);
1373 myAverageMinMaxArr.resize(theNbComp + 1);
1374 for(vtkIdType iComp = 0; iComp <= theNbComp; iComp++){
1375 TMinMax& aMinMax = myMinMaxArr[iComp];
1376 aMinMax.first = VTK_LARGE_FLOAT;
1377 aMinMax.second = -VTK_LARGE_FLOAT;
1378 TMinMax& anAverageMinMax = myAverageMinMaxArr[iComp];
1379 anAverageMinMax.first = VTK_LARGE_FLOAT;
1380 anAverageMinMax.second = -VTK_LARGE_FLOAT;
1386 ::GetDataType() const
1393 ::GetMinMax(vtkIdType theCompID)
1395 return myMinMaxArr[theCompID];
1401 ::GetAverageMinMax(vtkIdType theCompID)
1403 return myAverageMinMaxArr[theCompID];
1406 //----------------------------------------------------------------------------
1409 ::GetMeshValue(EGeometry theGeom) const
1411 TGeom2MeshValue::const_iterator anIter = myGeom2MeshValue.find(theGeom);
1412 if(anIter == myGeom2MeshValue.end())
1413 EXCEPTION(std::runtime_error,"TGeom2Value::GetMeshValue - myGeom2MeshValue.find(theGeom) fails");
1414 return anIter->second;
1419 ::GetMeshValue(EGeometry theGeom)
1421 return myGeom2MeshValue[theGeom];
1425 //----------------------------------------------------------------------------
1428 ::GetGeom2MeshValue()
1430 return myGeom2MeshValue;
1433 const TGeom2MeshValue&
1435 ::GetGeom2MeshValue() const
1437 return myGeom2MeshValue;
1442 ::GetFirstMeshValue() const
1444 if(myGeom2MeshValue.size() == 1)
1445 return myGeom2MeshValue.begin()->second;
1446 return PMeshValue();
1450 //---------------------------------------------------------------
1452 ::TValForTimeImpl():
1453 myGaussPtsIDFilter(new TGaussPtsIDFilter()),
1454 myUnstructuredGridIDMapper(new TUnstructuredGridIDMapperImpl())
1459 ::GetMeshValue(EGeometry theGeom) const
1461 return myGeom2Value.GetMeshValue(theGeom);
1466 ::GetMeshValue(EGeometry theGeom)
1468 return myGeom2Value.GetMeshValue(theGeom);
1473 ::GetGeom2MeshValue()
1475 return myGeom2Value.GetGeom2MeshValue();
1478 const TGeom2MeshValue&
1480 ::GetGeom2MeshValue() const
1482 return myGeom2Value.GetGeom2MeshValue();
1487 ::GetFirstMeshValue() const
1489 return myGeom2Value.GetFirstMeshValue();
1494 ::GetNbGauss(EGeometry theGeom) const
1496 TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.find(theGeom);
1497 if(anIter == myGeom2NbGauss.end()){
1500 return anIter->second;
1507 size_t aSize = sizeof(TValForTimeImpl);
1508 const TGeom2MeshValue& aGeom2MeshValue = GetGeom2MeshValue();
1509 TGeom2MeshValue::const_iterator anIter = aGeom2MeshValue.begin();
1510 TGeom2MeshValue::const_iterator anIterEnd = aGeom2MeshValue.end();
1511 for(; anIter != anIterEnd; anIter++){
1512 const PMeshValue& aMeshValue = anIter->second;
1513 aSize += aMeshValue->GetMemorySize();
1514 aSize += sizeof(EGeometry);
1520 //---------------------------------------------------------------