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_FIELD_GAUSS_MOD", aDataSet );
711 aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet );
712 aFilter->AddField( "ELNO_FIELD", aDataSet );
713 aFilter->AddField( "ELNO_COMPONENT_MAPPER", aDataSet );
714 aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet );
716 myCommonCellsFilter->SetProfileUG( aFilter->GetUnstructuredGridOutput() );
721 TUnstructuredGridIDMapperImpl
722 ::GetUnstructuredGridOutput()
725 return myCommonCellsFilter->GetOutput();
729 TUnstructuredGridIDMapperImpl
732 return GetUnstructuredGridOutput();
736 TUnstructuredGridIDMapperImpl
740 return mySource.GetSource();
744 TUnstructuredGridIDMapperImpl
747 size_t aSize = myIDMapper->GetMemorySize();
749 aSize += mySource.GetMemorySize();
751 if ( vtkUnstructuredGrid* anOutput = myCommonCellsFilter->GetOutput() )
752 aSize += anOutput->GetActualMemorySize() * 1024;
757 //---------------------------------------------------------------
759 TPolyDataIDMapperImpl
760 ::GetNodeObjID(vtkIdType theID) const
762 return myIDMapper->GetNodeObjID(theID);
766 TPolyDataIDMapperImpl
767 ::GetNodeVTKID(vtkIdType theID) const
769 return myIDMapper->GetNodeVTKID(theID);
772 vtkFloatingPointType*
773 TPolyDataIDMapperImpl
774 ::GetNodeCoord(vtkIdType theObjID)
776 return myIDMapper->GetNodeCoord(theObjID);
780 TPolyDataIDMapperImpl
781 ::GetElemObjID(vtkIdType theID) const
783 return myIDMapper->GetElemObjID(theID);
787 TPolyDataIDMapperImpl
788 ::GetElemVTKID(vtkIdType theID) const
790 return myIDMapper->GetElemVTKID(theID);
794 TPolyDataIDMapperImpl
795 ::GetElemCell(vtkIdType theObjID)
797 return myIDMapper->GetElemCell(theObjID);
801 TPolyDataIDMapperImpl
804 if ( !myFilter.GetPointer() ) {
805 const PAppendPolyData& anAppendFilter = myIDMapper->GetFilter();
806 vtkPolyData* aGeometry = anAppendFilter->GetOutput();
808 const PPolyData& aSource = mySource.GetSource();
809 vtkPolyData* aDataSet = aSource.GetPointer();
810 aDataSet->ShallowCopy( aGeometry );
812 const PMergeFilter& aFilter = GetFilter();
813 aFilter->SetGeometry( aGeometry );
814 aFilter->SetScalars( aDataSet );
815 aFilter->SetVectors( aDataSet );
816 aFilter->AddField( "VISU_FIELD", aDataSet );
817 aFilter->AddField( "VISU_FIELD_GAUSS_MIN", aDataSet );
818 aFilter->AddField( "VISU_FIELD_GAUSS_MAX", aDataSet );
819 aFilter->AddField( "VISU_FIELD_GAUSS_MOD", aDataSet );
820 aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet );
821 aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet );
826 TPolyDataIDMapperImpl
827 ::GetPolyDataOutput()
830 return myFilter->GetPolyDataOutput();
834 TPolyDataIDMapperImpl
837 return GetPolyDataOutput();
841 TPolyDataIDMapperImpl
845 return mySource.GetSource();
849 TPolyDataIDMapperImpl
852 size_t aSize = myIDMapper->GetMemorySize();
853 aSize += mySource.GetMemorySize();
858 //---------------------------------------------------------------
861 myGeom(EGeometry(-1)),
867 ::LessThan(const PGaussImpl& theGauss,
868 bool& theResult) const
874 //---------------------------------------------------------------
876 ::TGaussSubMeshImpl():
877 myPointCoords(new TPointCoords()),
884 ::GetObjID(vtkIdType theID) const
886 TCellID aCellID = myStartID + theID / myGauss->myNbPoints;
887 TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
889 return TGaussPointID(aCellID, aLocalPntID);
894 ::GetVTKID(const TGaussPointID& theID) const
896 vtkIdType aResult = -1;
898 TCellID aCellID = theID.first;
899 TLocalPntID aLocalPntID = theID.second;
901 vtkIdType aNbPoints = myGauss->myNbPoints;
902 if ( aLocalPntID >= aNbPoints )
905 return ( aCellID - myStartID ) * aNbPoints + aLocalPntID;
909 VISU::TGaussSubMeshImpl
910 ::GetElemObjID(vtkIdType theID) const
912 return mySubProfile->GetElemObjID( theID );
917 VISU::TGaussSubMeshImpl
918 ::GetElemVTKID(vtkIdType theID) const
920 return mySubProfile->GetElemVTKID( theID );
925 ::GetGlobalID(vtkIdType theID) const
927 return myStartID + theID;
934 size_t aSize = TPolyDataHolder::GetMemorySize();
935 aSize += myPointCoords->GetMemorySize();
939 //---------------------------------------------------------------
941 operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight)
943 PGaussSubMeshImpl aLeft(theLeft), aRight(theRight);
944 const PGaussImpl& aGaussLeft = aLeft->myGauss;
945 const PGaussImpl& aGaussRight = aRight->myGauss;
947 if(aGaussLeft->myGeom != aGaussRight->myGeom)
948 return aGaussLeft->myGeom < aGaussRight->myGeom;
950 if(aLeft->mySubProfile != aRight->mySubProfile)
951 return aLeft->mySubProfile < aRight->mySubProfile;
954 aGaussLeft->LessThan(aGaussRight,aResult);
960 //---------------------------------------------------------------
968 ::GetObjID(vtkIdType theID) const
970 const PAppendPolyData& aFilter = GetFilter();
971 return VISU::GetObjID(aFilter->GetOutput(), theID);
976 ::GetVTKID(const TGaussPointID& theID) const
978 vtkIdType aResult = -1;
980 TCellID aCellID = theID.first;
982 vtkIdType aVTKCellId = GetParent()->GetElemVTKID( aCellID );
983 if ( aVTKCellId < 0 )
986 vtkCell* aCell = GetParent()->GetElemCell( aCellID );
990 EGeometry aVGeom = VISU::VTKGeom2VISU( aCell->GetCellType() );
991 if ( aVGeom < EGeometry(0) )
994 TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.find( aVGeom );
995 if ( anIter == myGeom2GaussSubMesh.end() )
998 size_t aSubMeshEnd = myGaussSubMeshArr.size();
999 const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
1000 for ( size_t aSubMeshId = 0; aSubMeshId < aSubMeshEnd; aSubMeshId++ ) {
1001 const PGaussSubMeshImpl& aSubMesh = myGaussSubMeshArr[aSubMeshId];
1002 if ( aGaussSubMesh.get() == aSubMesh.get() ) {
1003 return aGaussSubMesh->GetVTKID(theID);
1012 ::GetPolyDataOutput()
1014 return TAppendPolyDataHolder::GetPolyDataOutput();
1021 size_t aSize = TAppendPolyDataHolder::GetMemorySize();
1022 TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.begin();
1023 TGeom2GaussSubMesh::const_iterator anIterEnd = myGeom2GaussSubMesh.end();
1024 for(; anIter != anIterEnd; anIter++){
1025 const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
1026 aSize += aGaussSubMesh->GetMemorySize();
1027 aSize += sizeof(EGeometry);
1040 //---------------------------------------------------------------
1043 ::GetObjID(vtkIdType theID) const
1045 return myGaussPtsIDMapper->GetObjID(theID);
1050 ::GetVTKID(const TGaussPointID& theID) const
1052 return myGaussPtsIDMapper->GetVTKID(theID);
1059 return myGaussPtsIDMapper->GetParent();
1064 ::GetPolyDataOutput()
1066 return TPolyDataIDMapperImpl::GetPolyDataOutput();
1073 return GetPolyDataOutput();
1077 //---------------------------------------------------------------
1085 ::CopyStructure( PStructured theStructured )
1087 TStructured::CopyStructure( theStructured );
1089 if ( PMeshImpl aMesh = theStructured )
1090 GetSource()->ShallowCopy( aMesh->GetPointSet() );
1095 ::GetElemObjID(vtkIdType theID) const
1097 return myStartID + theID;
1102 ::GetElemName(vtkIdType theObjID) const
1111 size_t aSize = TUnstructuredGridHolder::GetMemorySize();
1112 for(size_t anId = 0; anId < myCell2Connect.size(); anId++){
1113 const TConnect& aConnect = myCell2Connect[anId];
1114 aSize += aConnect.size() * sizeof(vtkIdType);
1119 //---------------------------------------------------------------
1121 ::TMeshOnEntityImpl()
1123 const PAppendFilter& anAppendFilter = GetFilter();
1124 anAppendFilter->SetMappingInputs(true);
1129 ::CopyStructure( PStructured theStructured )
1131 TStructured::CopyStructure( theStructured );
1133 if ( PMeshImpl aMesh = theStructured )
1134 myNamedPointCoords = aMesh->myNamedPointCoords;
1139 ::GetNodeVTKID(vtkIdType theID) const
1141 return myNamedPointCoords->GetVTKID(theID);
1146 ::GetNodeObjID(vtkIdType theID) const
1148 return myNamedPointCoords->GetObjID(theID);
1153 ::GetElemVTKID(vtkIdType theID) const
1155 return VISU::GetElemVTKID(GetFilter()->GetOutput(), theID);
1160 ::GetElemObjID(vtkIdType theID) const
1162 return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
1167 ::GetNodeName(vtkIdType theObjID) const
1169 return myNamedPointCoords->GetNodeName(theObjID);
1174 ::GetElemName(vtkIdType theObjID) const
1176 TInputCellID anInputCellID = VISU::GetInputCellID(GetFilter()->GetOutput(), theObjID);
1177 const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputCellID.first];
1178 return aSubMesh->GetElemName(anInputCellID.second);
1181 vtkUnstructuredGrid*
1183 ::GetUnstructuredGridOutput()
1185 return TAppendFilterHolder::GetUnstructuredGridOutput();
1192 size_t aSize = TAppendFilterHolder::GetMemorySize();
1193 aSize += myNamedPointCoords->GetMemorySize();
1194 aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1195 TGeom2SubMesh::const_iterator anIter = myGeom2SubMesh.begin();
1196 TGeom2SubMesh::const_iterator anIterEnd = myGeom2SubMesh.end();
1197 for(; anIter != anIterEnd; anIter++){
1198 const PSubMeshImpl& aSubMesh = anIter->second;
1199 aSize += aSubMesh->GetMemorySize();
1200 aSize += sizeof(EGeometry);
1205 //---------------------------------------------------------------
1208 ::CopyStructure( PStructured theStructured )
1210 TStructured::CopyStructure( theStructured );
1212 if ( PMeshImpl aMesh = theStructured ) {
1213 myNamedPointCoords = aMesh->myNamedPointCoords;
1214 GetSource()->ShallowCopy( aMesh->GetPointSet() );
1220 ::GetElemVTKID(vtkIdType theID) const
1222 if(myElemObj2VTKID.empty())
1225 TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
1226 if(anIter != myElemObj2VTKID.end())
1227 return anIter->second;
1234 ::GetElemObjID(vtkIdType theID) const
1236 return myMeshID[theID];
1241 ::GetNodeObjID(vtkIdType theID) const
1243 return myNamedPointCoords->GetObjID(theID);
1248 ::GetNodeVTKID(vtkIdType theID) const
1250 return myNamedPointCoords->GetVTKID(theID);
1253 vtkUnstructuredGrid*
1255 ::GetUnstructuredGridOutput()
1257 return TUnstructuredGridHolder::GetUnstructuredGridOutput();
1264 size_t aSize = TUnstructuredGridHolder::GetMemorySize();
1265 aSize += myNamedPointCoords->GetMemorySize();
1266 aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1267 aSize += myMeshID.size() * sizeof(vtkIdType);
1268 TGeom2SubMeshID::const_iterator anIter = myGeom2SubMeshID.begin();
1269 TGeom2SubMeshID::const_iterator anIterEnd = myGeom2SubMeshID.end();
1270 for(; anIter != anIterEnd; anIter++){
1271 const TSubMeshID& aSubMeshID = anIter->second;
1272 aSize += aSubMeshID.size() * sizeof(vtkIdType);
1273 aSize += sizeof(EGeometry);
1279 //---------------------------------------------------------------
1282 ::CopyStructure( PStructured theStructured )
1284 TStructured::CopyStructure( theStructured );
1286 if ( PMeshImpl aMesh = theStructured )
1287 myNamedPointCoords = aMesh->myNamedPointCoords;
1292 ::GetNbASizeCells() const
1294 vtkIdType aNbCells = 0, aCellsSize = 0;
1295 TFamilySet::const_iterator anIter = myFamilySet.begin();
1296 for(; anIter != myFamilySet.end(); anIter++){
1297 PFamilyImpl aFamily = *anIter;
1298 aNbCells += aFamily->myNbCells;
1299 aCellsSize += aFamily->myCellsSize;
1301 return std::make_pair(aNbCells,aCellsSize);
1306 ::GetElemVTKID(vtkIdType theID) const
1308 if(myElemObj2VTKID.empty())
1311 TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
1312 if(anIter != myElemObj2VTKID.end())
1313 return anIter->second;
1320 ::GetElemObjID(vtkIdType theID) const
1322 return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
1327 ::GetNodeObjID(vtkIdType theID) const
1329 return myNamedPointCoords->GetObjID(theID);
1334 ::GetNodeVTKID(vtkIdType theID) const
1336 return myNamedPointCoords->GetVTKID(theID);
1339 vtkUnstructuredGrid*
1341 ::GetUnstructuredGridOutput()
1343 return TAppendFilterHolder::GetUnstructuredGridOutput();
1350 size_t aSize = TAppendFilterHolder::GetMemorySize();
1351 aSize += myNamedPointCoords->GetMemorySize();
1352 aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1353 for(size_t anId = 0; anId < myFamilyArr.size(); anId++){
1354 const PFamilyImpl& aFamily = myFamilyArr[anId];
1355 aSize += aFamily->GetMemorySize();
1362 //---------------------------------------------------------------
1371 ::Init(vtkIdType theNbComp,
1372 vtkIdType theDataType)
1374 myNbComp = theNbComp;
1375 myDataType = theDataType;
1376 myCompNames.resize(theNbComp);
1377 myUnitNames.resize(theNbComp);
1379 myMetric2Comp2MinMax.resize(3);
1380 myMetric2Comp2AverageMinMax.resize(3);
1381 myMetric2Comp2Group2MinMax.resize(3);
1382 myMetric2Comp2Group2AverageMinMax.resize(3);
1383 for(int aGaussMetric = (int)VISU::AVERAGE_METRIC; aGaussMetric <= (int)VISU::MAXIMUM_METRIC; aGaussMetric++){
1384 TComp2MinMax& aComp2MinMax = myMetric2Comp2MinMax[aGaussMetric];
1385 TComp2MinMax& aComp2AverageMinMax = myMetric2Comp2AverageMinMax[aGaussMetric];
1386 TComp2Group2MinMax& aComp2Group2MinMax = myMetric2Comp2Group2MinMax[aGaussMetric];
1387 TComp2Group2MinMax& aComp2Group2AverageMinMax = myMetric2Comp2Group2AverageMinMax[aGaussMetric];
1389 aComp2MinMax.resize(theNbComp + 1);
1390 aComp2AverageMinMax.resize(theNbComp + 1);
1391 aComp2Group2MinMax.resize(theNbComp + 1);
1392 aComp2Group2AverageMinMax.resize(theNbComp + 1);
1393 for(vtkIdType iComp = 0; iComp <= theNbComp; iComp++){
1394 TMinMax& aMinMax = aComp2MinMax[iComp];
1395 aMinMax.first = VTK_LARGE_FLOAT;
1396 aMinMax.second = -VTK_LARGE_FLOAT;
1397 TMinMax& anAverageMinMax = aComp2AverageMinMax[iComp];
1398 anAverageMinMax.first = VTK_LARGE_FLOAT;
1399 anAverageMinMax.second = -VTK_LARGE_FLOAT;
1406 ::GetDataType() const
1413 ::GetMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric)
1416 bool anIsMinMaxInitialized = false;
1417 if( !theGroupNames.empty() ) {
1418 aMinMax.first = VTK_LARGE_FLOAT;
1419 aMinMax.second = -VTK_LARGE_FLOAT;
1421 const TGroup2MinMax& aGroup2MinMax = myMetric2Comp2Group2MinMax[theGaussMetric][theCompID];
1422 TNames::const_iterator aNameIter = theGroupNames.begin();
1423 for( ; aNameIter != theGroupNames.end(); aNameIter++ ) {
1424 TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter );
1425 if( aGroup2MinMaxIter != aGroup2MinMax.end() ) {
1426 const TMinMax& aGroupMinMax = aGroup2MinMaxIter->second;
1427 aMinMax.first = std::min( aMinMax.first, aGroupMinMax.first );
1428 aMinMax.second = std::max( aMinMax.second, aGroupMinMax.second );
1429 anIsMinMaxInitialized = true;
1434 if( !anIsMinMaxInitialized )
1435 aMinMax = myMetric2Comp2MinMax[theGaussMetric][theCompID];
1443 ::GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric)
1446 bool anIsMinMaxInitialized = false;
1447 if( !theGroupNames.empty() ) {
1448 aMinMax.first = VTK_LARGE_FLOAT;
1449 aMinMax.second = -VTK_LARGE_FLOAT;
1451 const TGroup2MinMax& aGroup2MinMax = myMetric2Comp2Group2AverageMinMax[theGaussMetric][theCompID];
1452 TNames::const_iterator aNameIter = theGroupNames.begin();
1453 for( ; aNameIter != theGroupNames.end(); aNameIter++ ) {
1454 TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter );
1455 if( aGroup2MinMaxIter != aGroup2MinMax.end() ) {
1456 const TMinMax& aGroupMinMax = aGroup2MinMaxIter->second;
1457 aMinMax.first = std::min( aMinMax.first, aGroupMinMax.first );
1458 aMinMax.second = std::max( aMinMax.second, aGroupMinMax.second );
1459 anIsMinMaxInitialized = true;
1464 if( !anIsMinMaxInitialized )
1465 aMinMax = myMetric2Comp2AverageMinMax[theGaussMetric][theCompID];
1470 //----------------------------------------------------------------------------
1473 ::GetMeshValue(EGeometry theGeom) const
1475 TGeom2MeshValue::const_iterator anIter = myGeom2MeshValue.find(theGeom);
1476 if(anIter == myGeom2MeshValue.end())
1477 EXCEPTION(std::runtime_error,"TGeom2Value::GetMeshValue - myGeom2MeshValue.find(theGeom) fails");
1478 return anIter->second;
1483 ::GetMeshValue(EGeometry theGeom)
1485 return myGeom2MeshValue[theGeom];
1489 //----------------------------------------------------------------------------
1492 ::GetGeom2MeshValue()
1494 return myGeom2MeshValue;
1497 const TGeom2MeshValue&
1499 ::GetGeom2MeshValue() const
1501 return myGeom2MeshValue;
1506 ::GetFirstMeshValue() const
1508 if(myGeom2MeshValue.size() == 1)
1509 return myGeom2MeshValue.begin()->second;
1510 return PMeshValue();
1514 //---------------------------------------------------------------
1516 ::TValForTimeImpl():
1517 myGaussPtsIDFilter(new TGaussPtsIDFilter()),
1518 myUnstructuredGridIDMapper(new TUnstructuredGridIDMapperImpl())
1523 ::GetMeshValue(EGeometry theGeom) const
1525 return myGeom2Value.GetMeshValue(theGeom);
1530 ::GetMeshValue(EGeometry theGeom)
1532 return myGeom2Value.GetMeshValue(theGeom);
1537 ::GetGeom2MeshValue()
1539 return myGeom2Value.GetGeom2MeshValue();
1542 const TGeom2MeshValue&
1544 ::GetGeom2MeshValue() const
1546 return myGeom2Value.GetGeom2MeshValue();
1551 ::GetFirstMeshValue() const
1553 return myGeom2Value.GetFirstMeshValue();
1558 ::GetNbGauss(EGeometry theGeom) const
1560 TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.find(theGeom);
1561 if(anIter == myGeom2NbGauss.end()){
1564 return anIter->second;
1569 ::GetMaxNbGauss() const
1572 TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.begin();
1573 for(; anIter != myGeom2NbGauss.end(); anIter++){
1574 aNbGauss = std::max(aNbGauss, anIter->second);
1583 size_t aSize = sizeof(TValForTimeImpl);
1584 const TGeom2MeshValue& aGeom2MeshValue = GetGeom2MeshValue();
1585 TGeom2MeshValue::const_iterator anIter = aGeom2MeshValue.begin();
1586 TGeom2MeshValue::const_iterator anIterEnd = aGeom2MeshValue.end();
1587 for(; anIter != anIterEnd; anIter++){
1588 const PMeshValue& aMeshValue = anIter->second;
1589 aSize += aMeshValue->GetMemorySize();
1590 aSize += sizeof(EGeometry);
1595 //---------------------------------------------------------------