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_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 );
715 myCommonCellsFilter->SetProfileUG( aFilter->GetUnstructuredGridOutput() );
720 TUnstructuredGridIDMapperImpl
721 ::GetUnstructuredGridOutput()
724 return myCommonCellsFilter->GetOutput();
728 TUnstructuredGridIDMapperImpl
731 return GetUnstructuredGridOutput();
735 TUnstructuredGridIDMapperImpl
739 return mySource.GetSource();
743 TUnstructuredGridIDMapperImpl
746 size_t aSize = myIDMapper->GetMemorySize();
748 aSize += mySource.GetMemorySize();
750 if ( vtkUnstructuredGrid* anOutput = myCommonCellsFilter->GetOutput() )
751 aSize += anOutput->GetActualMemorySize() * 1024;
756 //---------------------------------------------------------------
758 TPolyDataIDMapperImpl
759 ::GetNodeObjID(vtkIdType theID) const
761 return myIDMapper->GetNodeObjID(theID);
765 TPolyDataIDMapperImpl
766 ::GetNodeVTKID(vtkIdType theID) const
768 return myIDMapper->GetNodeVTKID(theID);
771 vtkFloatingPointType*
772 TPolyDataIDMapperImpl
773 ::GetNodeCoord(vtkIdType theObjID)
775 return myIDMapper->GetNodeCoord(theObjID);
779 TPolyDataIDMapperImpl
780 ::GetElemObjID(vtkIdType theID) const
782 return myIDMapper->GetElemObjID(theID);
786 TPolyDataIDMapperImpl
787 ::GetElemVTKID(vtkIdType theID) const
789 return myIDMapper->GetElemVTKID(theID);
793 TPolyDataIDMapperImpl
794 ::GetElemCell(vtkIdType theObjID)
796 return myIDMapper->GetElemCell(theObjID);
800 TPolyDataIDMapperImpl
803 if ( !myFilter.GetPointer() ) {
804 const PAppendPolyData& anAppendFilter = myIDMapper->GetFilter();
805 vtkPolyData* aGeometry = anAppendFilter->GetOutput();
807 const PPolyData& aSource = mySource.GetSource();
808 vtkPolyData* aDataSet = aSource.GetPointer();
809 aDataSet->ShallowCopy( aGeometry );
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 );
824 TPolyDataIDMapperImpl
825 ::GetPolyDataOutput()
828 return myFilter->GetPolyDataOutput();
832 TPolyDataIDMapperImpl
835 return GetPolyDataOutput();
839 TPolyDataIDMapperImpl
843 return mySource.GetSource();
847 TPolyDataIDMapperImpl
850 size_t aSize = myIDMapper->GetMemorySize();
851 aSize += mySource.GetMemorySize();
856 //---------------------------------------------------------------
859 myGeom(EGeometry(-1)),
865 ::LessThan(const PGaussImpl& theGauss,
866 bool& theResult) const
872 //---------------------------------------------------------------
874 ::TGaussSubMeshImpl():
875 myPointCoords(new TPointCoords()),
882 ::GetObjID(vtkIdType theID) const
884 TCellID aCellID = myStartID + theID / myGauss->myNbPoints;
885 TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
887 return TGaussPointID(aCellID, aLocalPntID);
892 ::GetVTKID(const TGaussPointID& theID) const
894 vtkIdType aResult = -1;
896 TCellID aCellID = theID.first;
897 TLocalPntID aLocalPntID = theID.second;
899 vtkIdType aNbPoints = myGauss->myNbPoints;
900 if ( aLocalPntID >= aNbPoints )
903 return ( aCellID - myStartID ) * aNbPoints + aLocalPntID;
907 VISU::TGaussSubMeshImpl
908 ::GetElemObjID(vtkIdType theID) const
910 return mySubProfile->GetElemObjID( theID );
915 VISU::TGaussSubMeshImpl
916 ::GetElemVTKID(vtkIdType theID) const
918 return mySubProfile->GetElemVTKID( theID );
923 ::GetGlobalID(vtkIdType theID) const
925 return myStartID + theID;
932 size_t aSize = TPolyDataHolder::GetMemorySize();
933 aSize += myPointCoords->GetMemorySize();
937 //---------------------------------------------------------------
939 operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight)
941 PGaussSubMeshImpl aLeft(theLeft), aRight(theRight);
942 const PGaussImpl& aGaussLeft = aLeft->myGauss;
943 const PGaussImpl& aGaussRight = aRight->myGauss;
945 if(aGaussLeft->myGeom != aGaussRight->myGeom)
946 return aGaussLeft->myGeom < aGaussRight->myGeom;
948 if(aLeft->mySubProfile != aRight->mySubProfile)
949 return aLeft->mySubProfile < aRight->mySubProfile;
952 aGaussLeft->LessThan(aGaussRight,aResult);
958 //---------------------------------------------------------------
966 ::GetObjID(vtkIdType theID) const
968 const PAppendPolyData& aFilter = GetFilter();
969 return VISU::GetObjID(aFilter->GetOutput(), theID);
974 ::GetVTKID(const TGaussPointID& theID) const
976 vtkIdType aResult = -1;
978 TCellID aCellID = theID.first;
980 vtkIdType aVTKCellId = GetParent()->GetElemVTKID( aCellID );
981 if ( aVTKCellId < 0 )
984 vtkCell* aCell = GetParent()->GetElemCell( aCellID );
988 EGeometry aVGeom = VISU::VTKGeom2VISU( aCell->GetCellType() );
989 if ( aVGeom < EGeometry(0) )
992 TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.find( aVGeom );
993 if ( anIter == myGeom2GaussSubMesh.end() )
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);
1010 ::GetPolyDataOutput()
1012 return TAppendPolyDataHolder::GetPolyDataOutput();
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);
1038 //---------------------------------------------------------------
1041 ::GetObjID(vtkIdType theID) const
1043 return myGaussPtsIDMapper->GetObjID(theID);
1048 ::GetVTKID(const TGaussPointID& theID) const
1050 return myGaussPtsIDMapper->GetVTKID(theID);
1057 return myGaussPtsIDMapper->GetParent();
1062 ::GetPolyDataOutput()
1064 return TPolyDataIDMapperImpl::GetPolyDataOutput();
1071 return GetPolyDataOutput();
1075 //---------------------------------------------------------------
1083 ::CopyStructure( PStructured theStructured )
1085 TStructured::CopyStructure( theStructured );
1087 if ( PMeshImpl aMesh = theStructured )
1088 GetSource()->ShallowCopy( aMesh->GetPointSet() );
1093 ::GetElemObjID(vtkIdType theID) const
1095 return myStartID + theID;
1100 ::GetElemName(vtkIdType theObjID) const
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);
1117 //---------------------------------------------------------------
1119 ::TMeshOnEntityImpl()
1121 const PAppendFilter& anAppendFilter = GetFilter();
1122 anAppendFilter->SetMappingInputs(true);
1127 ::CopyStructure( PStructured theStructured )
1129 TStructured::CopyStructure( theStructured );
1131 if ( PMeshImpl aMesh = theStructured )
1132 myNamedPointCoords = aMesh->myNamedPointCoords;
1137 ::GetNodeVTKID(vtkIdType theID) const
1139 return myNamedPointCoords->GetVTKID(theID);
1144 ::GetNodeObjID(vtkIdType theID) const
1146 return myNamedPointCoords->GetObjID(theID);
1151 ::GetElemVTKID(vtkIdType theID) const
1153 return VISU::GetElemVTKID(GetFilter()->GetOutput(), theID);
1158 ::GetElemObjID(vtkIdType theID) const
1160 return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
1165 ::GetNodeName(vtkIdType theObjID) const
1167 return myNamedPointCoords->GetNodeName(theObjID);
1172 ::GetElemName(vtkIdType theObjID) const
1174 TInputCellID anInputCellID = VISU::GetInputCellID(GetFilter()->GetOutput(), theObjID);
1175 const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputCellID.first];
1176 return aSubMesh->GetElemName(anInputCellID.second);
1179 vtkUnstructuredGrid*
1181 ::GetUnstructuredGridOutput()
1183 return TAppendFilterHolder::GetUnstructuredGridOutput();
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);
1203 //---------------------------------------------------------------
1206 ::CopyStructure( PStructured theStructured )
1208 TStructured::CopyStructure( theStructured );
1210 if ( PMeshImpl aMesh = theStructured ) {
1211 myNamedPointCoords = aMesh->myNamedPointCoords;
1212 GetSource()->ShallowCopy( aMesh->GetPointSet() );
1218 ::GetElemVTKID(vtkIdType theID) const
1220 if(myElemObj2VTKID.empty())
1223 TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
1224 if(anIter != myElemObj2VTKID.end())
1225 return anIter->second;
1232 ::GetElemObjID(vtkIdType theID) const
1234 return myMeshID[theID];
1239 ::GetNodeObjID(vtkIdType theID) const
1241 return myNamedPointCoords->GetObjID(theID);
1246 ::GetNodeVTKID(vtkIdType theID) const
1248 return myNamedPointCoords->GetVTKID(theID);
1251 vtkUnstructuredGrid*
1253 ::GetUnstructuredGridOutput()
1255 return TUnstructuredGridHolder::GetUnstructuredGridOutput();
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);
1277 //---------------------------------------------------------------
1280 ::CopyStructure( PStructured theStructured )
1282 TStructured::CopyStructure( theStructured );
1284 if ( PMeshImpl aMesh = theStructured )
1285 myNamedPointCoords = aMesh->myNamedPointCoords;
1290 ::GetNbASizeCells() const
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;
1299 return std::make_pair(aNbCells,aCellsSize);
1304 ::GetElemVTKID(vtkIdType theID) const
1306 if(myElemObj2VTKID.empty())
1309 TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
1310 if(anIter != myElemObj2VTKID.end())
1311 return anIter->second;
1318 ::GetElemObjID(vtkIdType theID) const
1320 return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
1325 ::GetNodeObjID(vtkIdType theID) const
1327 return myNamedPointCoords->GetObjID(theID);
1332 ::GetNodeVTKID(vtkIdType theID) const
1334 return myNamedPointCoords->GetVTKID(theID);
1337 vtkUnstructuredGrid*
1339 ::GetUnstructuredGridOutput()
1341 return TAppendFilterHolder::GetUnstructuredGridOutput();
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();
1360 //---------------------------------------------------------------
1369 ::Init(vtkIdType theNbComp,
1370 vtkIdType theDataType)
1372 myNbComp = theNbComp;
1373 myDataType = theDataType;
1374 myCompNames.resize(theNbComp);
1375 myUnitNames.resize(theNbComp);
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];
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;
1404 ::GetDataType() const
1411 ::GetMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric)
1414 bool anIsMinMaxInitialized = false;
1415 if( !theGroupNames.empty() ) {
1416 aMinMax.first = VTK_LARGE_FLOAT;
1417 aMinMax.second = -VTK_LARGE_FLOAT;
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;
1432 if( !anIsMinMaxInitialized )
1433 aMinMax = myMetric2Comp2MinMax[theGaussMetric][theCompID];
1441 ::GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric)
1444 bool anIsMinMaxInitialized = false;
1445 if( !theGroupNames.empty() ) {
1446 aMinMax.first = VTK_LARGE_FLOAT;
1447 aMinMax.second = -VTK_LARGE_FLOAT;
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;
1462 if( !anIsMinMaxInitialized )
1463 aMinMax = myMetric2Comp2AverageMinMax[theGaussMetric][theCompID];
1468 //----------------------------------------------------------------------------
1471 ::GetMeshValue(EGeometry theGeom) const
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;
1481 ::GetMeshValue(EGeometry theGeom)
1483 return myGeom2MeshValue[theGeom];
1487 //----------------------------------------------------------------------------
1490 ::GetGeom2MeshValue()
1492 return myGeom2MeshValue;
1495 const TGeom2MeshValue&
1497 ::GetGeom2MeshValue() const
1499 return myGeom2MeshValue;
1504 ::GetFirstMeshValue() const
1506 if(myGeom2MeshValue.size() == 1)
1507 return myGeom2MeshValue.begin()->second;
1508 return PMeshValue();
1512 //---------------------------------------------------------------
1514 ::TValForTimeImpl():
1515 myGaussPtsIDFilter(new TGaussPtsIDFilter()),
1516 myUnstructuredGridIDMapper(new TUnstructuredGridIDMapperImpl())
1521 ::GetMeshValue(EGeometry theGeom) const
1523 return myGeom2Value.GetMeshValue(theGeom);
1528 ::GetMeshValue(EGeometry theGeom)
1530 return myGeom2Value.GetMeshValue(theGeom);
1535 ::GetGeom2MeshValue()
1537 return myGeom2Value.GetGeom2MeshValue();
1540 const TGeom2MeshValue&
1542 ::GetGeom2MeshValue() const
1544 return myGeom2Value.GetGeom2MeshValue();
1549 ::GetFirstMeshValue() const
1551 return myGeom2Value.GetFirstMeshValue();
1556 ::GetNbGauss(EGeometry theGeom) const
1558 TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.find(theGeom);
1559 if(anIter == myGeom2NbGauss.end()){
1562 return anIter->second;
1567 ::GetMaxNbGauss() const
1570 TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.begin();
1571 for(; anIter != myGeom2NbGauss.end(); anIter++){
1572 aNbGauss = std::max(aNbGauss, anIter->second);
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);
1594 //---------------------------------------------------------------