1 // Copyright (C) 2007-2012 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
24 // Author: Alexey PETROV
27 #include "VISU_Structures_impl.hxx"
28 #include "VISU_PointCoords.hxx"
29 #include "VISU_MeshValue.hxx"
31 #include "VISU_AppendFilter.hxx"
32 #include "VISU_AppendPolyData.hxx"
33 #include "VISU_MergeFilter.hxx"
35 #include "VISU_ConvertorUtils.hxx"
36 #include "VISU_CommonCellsFilter.hxx"
38 #include <vtkUnstructuredGrid.h>
39 #include <vtkPolyData.h>
40 #include <vtkCellType.h>
46 VISUGeom2NbNodes(EGeometry theGeom)
49 #ifndef VISU_ENABLE_QUADRATIC
74 VISUGeom2VTK(EGeometry theGeom)
88 return VTK_HEXAHEDRON;
97 return VTK_CONVEX_POINT_SET;
99 #ifndef VISU_ENABLE_QUADRATIC
109 return VTK_HEXAHEDRON;
118 #if defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)
119 return VTK_QUADRATIC_EDGE;
121 return VTK_POLY_LINE;
125 #if defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)
126 return VTK_QUADRATIC_TRIANGLE;
132 #if defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)
133 return VTK_QUADRATIC_QUAD;
139 #if defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)
140 return VTK_QUADRATIC_TETRA;
142 return VTK_CONVEX_POINT_SET;
146 #if defined(VTK_QUADRATIC_HEXAHEDRON) && defined(VISU_USE_VTK_QUADRATIC)
147 return VTK_QUADRATIC_HEXAHEDRON;
149 return VTK_CONVEX_POINT_SET;
153 #if defined(VTK_QUADRATIC_WEDGE) && defined(VISU_USE_VTK_QUADRATIC)
154 return VTK_QUADRATIC_WEDGE;
156 return VTK_CONVEX_POINT_SET;
160 #if defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)
161 return VTK_QUADRATIC_PYRAMID;
163 return VTK_CONVEX_POINT_SET;
166 #endif //VISU_ENABLE_QUADRATIC
175 VTKGeom2VISU(vtkIdType theGeom)
179 return VISU::ePOINT1;
187 return VISU::eTETRA4;
191 return VISU::ePENTA6;
194 case VTK_HEXAGONAL_PRISM:
195 return VISU::eOCTA12;
199 return VISU::ePOLYGONE;
200 case VTK_CONVEX_POINT_SET:
201 return VISU::ePOLYEDRE;
203 #if defined(VISU_ENABLE_QUADRATIC) && defined(VISU_USE_VTK_QUADRATIC)
205 case VTK_QUADRATIC_EDGE:
208 case VTK_QUADRATIC_TRIANGLE:
211 case VTK_QUADRATIC_QUAD:
214 case VTK_BIQUADRATIC_QUAD:
217 case VTK_QUADRATIC_TETRA:
218 return VISU::eTETRA10;
220 case VTK_QUADRATIC_HEXAHEDRON:
221 return VISU::eHEXA20;
223 case VTK_TRIQUADRATIC_HEXAHEDRON:
224 return VISU::eHEXA27;
226 case VTK_QUADRATIC_WEDGE:
227 return VISU::ePENTA15;
229 case VTK_QUADRATIC_PYRAMID:
230 return VISU::ePYRA13;
232 #endif //VISU_ENABLE_QUADRATIC
235 return EGeometry(-1);
239 //---------------------------------------------------------------
240 /*! Computes number of points by the given number of cells
241 * in assumption of regular hexahedral mesh structure
244 GetNumberOfPoints(size_t theNbCells)
246 return size_t(pow(pow(theNbCells, 1.0/3.0) + 1.0, 3.0));
249 //---------------------------------------------------------------
250 /*! Computes size dataset the given number of mesh macro metrics
251 * in assumption of regular hexahedral mesh structure
254 GetDataSetSize(size_t theNbOfPoints,
257 bool theComputeLinks)
259 size_t aPointsSize = 3*theNbOfPoints*sizeof(VISU::TCoord);
260 size_t aConnectivityAndTypesSize = theCellsSize*sizeof(vtkIdType);
261 size_t aLocationsSize = theNbOfCells*sizeof(int);
262 double aNbCellsPerPoint = theCellsSize / theNbOfCells - 1;
263 size_t aLinksSize = theNbOfPoints * (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(short));
266 size_t aResult = aPointsSize + aConnectivityAndTypesSize + aLocationsSize + aLinksSize;
270 //---------------------------------------------------------------
278 //---------------------------------------------------------------
287 if(!mySource.GetPointer()){
288 mySource = vtkPolyData::New();
296 ::GetPolyDataOutput()
298 return GetSource().GetPointer();
305 if(vtkDataSet* anOutput = GetPolyDataOutput()){
307 return anOutput->GetActualMemorySize() * 1024;
310 size_t aNbPoints = GetNumberOfPoints(myNbCells);
311 return GetDataSetSize(aNbPoints, myNbCells, myCellsSize, false);
313 throw std::runtime_error("TUnstructuredGridHolder::GetMemorySize - myIsDone == false !!!");
317 //---------------------------------------------------------------
318 TUnstructuredGridHolder
319 ::TUnstructuredGridHolder()
322 const PUnstructuredGrid&
323 TUnstructuredGridHolder
326 if(!mySource.GetPointer()){
327 mySource = vtkUnstructuredGrid::New();
334 TUnstructuredGridHolder
335 ::GetUnstructuredGridOutput()
337 return GetSource().GetPointer();
341 TUnstructuredGridHolder
344 if(vtkDataSet* anOutput = GetUnstructuredGridOutput()){
346 return anOutput->GetActualMemorySize() * 1024;
349 size_t aNbPoints = GetNumberOfPoints(myNbCells);
350 return GetDataSetSize(aNbPoints, myNbCells, myCellsSize, false);
352 throw std::runtime_error("TUnstructuredGridHolder::GetMemorySize - myIsDone == false !!!");
356 //---------------------------------------------------------------
362 if(vtkDataSet* anOutput = GetOutput()){
364 return anOutput->GetActualMemorySize() * 1024;
367 throw std::runtime_error("TMemoryCheckIDMapper::GetMemorySize - myIsVTKDone == false !!!");
372 //---------------------------------------------------------------
374 ::TAppendFilterHolder()
381 if(!myFilter.GetPointer()){
382 myFilter = VISU_AppendFilter::New();
384 myFilter->SetMappingInputs(true);
391 ::GetUnstructuredGridOutput()
393 GetFilter()->Update();
394 return GetFilter()->GetOutput();
397 //---------------------------------------------------------------
398 TAppendPolyDataHolder
399 ::TAppendPolyDataHolder()
402 const PAppendPolyData&
403 TAppendPolyDataHolder
406 if(!myFilter.GetPointer()){
407 myFilter = VISU_AppendPolyData::New();
408 myFilter->SetMappingInputs(true);
415 TAppendPolyDataHolder
416 ::GetPolyDataOutput()
418 GetFilter()->Update();
419 return GetFilter()->GetOutput();
423 //---------------------------------------------------------------
425 ::TMergeFilterHolder()
432 if(!myFilter.GetPointer()){
433 myFilter = VISU_MergeFilter::New();
443 GetFilter()->Update();
444 return GetFilter()->GetOutput();
448 //---------------------------------------------------------------
472 return myNamedPointCoords->GetPointSet();
476 //---------------------------------------------------------------
477 TSubProfileImpl::TSubProfileImpl():
485 ::GetElemObjID(vtkIdType theID) const
487 if ( !mySubMeshID.empty() )
488 return mySubMeshID[theID];
496 ::GetElemVTKID(vtkIdType theID) const
498 if ( !mySubMeshID.empty() )
499 for ( size_t anId = 0; anId < mySubMeshID.size(); anId++ )
500 if ( mySubMeshID[ anId ] == theID )
510 size_t aSize = TUnstructuredGridHolder::GetMemorySize();
511 aSize += sizeof(vtkIdType) * mySubMeshID.size();
519 return strcmp(myName.c_str(),"") == 0;
522 //---------------------------------------------------------------
524 operator<(const PSubProfile& theLeft, const PSubProfile& theRight)
526 PSubProfileImpl aLeft(theLeft), aRight(theRight);
528 if(aLeft->myGeom != aRight->myGeom)
529 return aLeft->myGeom < aRight->myGeom;
531 if(aLeft->myStatus != aRight->myStatus)
532 return aLeft->myStatus < aRight->myStatus;
534 return aLeft->myName < aRight->myName;
538 //---------------------------------------------------------------
547 ::GetNodeObjID(vtkIdType theID) const
549 return myNamedPointCoords->GetObjID(theID);
554 ::GetNodeVTKID(vtkIdType theID) const
556 return myNamedPointCoords->GetVTKID(theID);
561 ::GetNodeCoord(vtkIdType theObjID)
564 return myMeshOnEntity->GetNodeCoord(theObjID);
566 vtkIdType aVtkID = GetNodeVTKID(theObjID);
567 return GetFilter()->GetOutput()->GetPoint(aVtkID);
572 ::GetElemObjID(vtkIdType theID) const
574 return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
579 ::GetElemVTKID(vtkIdType theID) const
581 return VISU::GetElemVTKID(GetFilter()->GetOutput(), theID);
586 ::GetElemCell(vtkIdType theObjID)
589 return myMeshOnEntity->GetElemCell(theObjID);
591 vtkIdType aVtkID = GetElemVTKID(theObjID);
592 return GetFilter()->GetOutput()->GetCell(aVtkID);
597 ::GetUnstructuredGridOutput()
599 const PAppendFilter& anAppendFilter = GetFilter();
600 return anAppendFilter->GetOutput();
607 size_t aSize = TAppendFilterHolder::GetMemorySize();
608 aSize += myNamedPointCoords->GetMemorySize();
609 aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
610 TGeom2SubProfile::const_iterator anIter = myGeom2SubProfile.begin();
611 TGeom2SubProfile::const_iterator anIterEnd = myGeom2SubProfile.end();
612 for(; anIter != anIterEnd; anIter++){
613 const PSubProfileImpl& aSubProfile = anIter->second;
614 aSize += aSubProfile->GetMemorySize();
615 aSize += sizeof(EGeometry);
622 ::GetNodeName(vtkIdType theObjID) const
624 return myNamedPointCoords->GetNodeName(theObjID);
629 ::GetElemName(vtkIdType theObjID) const
631 return myMeshOnEntity->GetElemName(theObjID);
635 //---------------------------------------------------------------
636 TUnstructuredGridIDMapperImpl
637 ::TUnstructuredGridIDMapperImpl()
639 if ( !myCommonCellsFilter.GetPointer() ) {
640 myCommonCellsFilter = VISU_CommonCellsFilter::New();
641 myCommonCellsFilter->Delete();
646 TUnstructuredGridIDMapperImpl
647 ::GetNodeObjID(vtkIdType theID) const
649 return myIDMapper->GetNodeObjID(theID);
653 TUnstructuredGridIDMapperImpl
654 ::GetNodeVTKID(vtkIdType theID) const
656 return myIDMapper->GetNodeVTKID(theID);
660 TUnstructuredGridIDMapperImpl
661 ::GetNodeCoord(vtkIdType theObjID)
663 return myIDMapper->GetNodeCoord(theObjID);
667 TUnstructuredGridIDMapperImpl
668 ::GetElemObjID(vtkIdType theID) const
670 return myIDMapper->GetElemObjID(theID);
674 TUnstructuredGridIDMapperImpl
675 ::GetElemVTKID(vtkIdType theID) const
677 return myIDMapper->GetElemVTKID(theID);
681 TUnstructuredGridIDMapperImpl
682 ::GetElemCell(vtkIdType theObjID)
684 return myIDMapper->GetElemCell(theObjID);
688 TUnstructuredGridIDMapperImpl
689 ::SetReferencedMesh( const PNamedIDMapper& theNamedIDMapper )
691 myCommonCellsFilter->SetCellsUG( theNamedIDMapper->GetUnstructuredGridOutput() );
695 TUnstructuredGridIDMapperImpl
698 if ( !myFilter.GetPointer() ) {
699 const PAppendFilter& anAppendFilter = myIDMapper->GetFilter();
701 vtkUnstructuredGrid* aGeometry = anAppendFilter->GetOutput();
702 const PUnstructuredGrid& aSource = mySource.GetSource();
703 vtkUnstructuredGrid* aDataSet = aSource.GetPointer();
704 aDataSet->ShallowCopy( aGeometry );
706 const PMergeFilter& aFilter = GetFilter();
707 aFilter->SetGeometry( aGeometry );
708 aFilter->SetScalars( aDataSet );
709 aFilter->SetVectors( aDataSet );
710 aFilter->AddField( "VISU_FIELD", aDataSet );
711 aFilter->AddField( "VISU_FIELD_GAUSS_MIN", aDataSet );
712 aFilter->AddField( "VISU_FIELD_GAUSS_MAX", aDataSet );
713 aFilter->AddField( "VISU_FIELD_GAUSS_MOD", aDataSet );
714 aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet );
715 aFilter->AddField( "ELNO_FIELD", aDataSet );
716 aFilter->AddField( "ELNO_COMPONENT_MAPPER", aDataSet );
717 aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet );
719 myCommonCellsFilter->SetProfileUG( aFilter->GetUnstructuredGridOutput() );
724 TUnstructuredGridIDMapperImpl
725 ::GetUnstructuredGridOutput()
728 return myCommonCellsFilter->GetOutput();
732 TUnstructuredGridIDMapperImpl
735 return GetUnstructuredGridOutput();
739 TUnstructuredGridIDMapperImpl
743 return mySource.GetSource();
747 TUnstructuredGridIDMapperImpl
750 size_t aSize = myIDMapper->GetMemorySize();
752 aSize += mySource.GetMemorySize();
754 if ( vtkUnstructuredGrid* anOutput = myCommonCellsFilter->GetOutput() )
755 aSize += anOutput->GetActualMemorySize() * 1024;
760 //---------------------------------------------------------------
762 TPolyDataIDMapperImpl
763 ::GetNodeObjID(vtkIdType theID) const
765 return myIDMapper->GetNodeObjID(theID);
769 TPolyDataIDMapperImpl
770 ::GetNodeVTKID(vtkIdType theID) const
772 return myIDMapper->GetNodeVTKID(theID);
776 TPolyDataIDMapperImpl
777 ::GetNodeCoord(vtkIdType theObjID)
779 return myIDMapper->GetNodeCoord(theObjID);
783 TPolyDataIDMapperImpl
784 ::GetElemObjID(vtkIdType theID) const
786 return myIDMapper->GetElemObjID(theID);
790 TPolyDataIDMapperImpl
791 ::GetElemVTKID(vtkIdType theID) const
793 return myIDMapper->GetElemVTKID(theID);
797 TPolyDataIDMapperImpl
798 ::GetElemCell(vtkIdType theObjID)
800 return myIDMapper->GetElemCell(theObjID);
804 TPolyDataIDMapperImpl
807 if ( !myFilter.GetPointer() ) {
808 const PAppendPolyData& anAppendFilter = myIDMapper->GetFilter();
809 vtkPolyData* aGeometry = anAppendFilter->GetOutput();
811 const PPolyData& aSource = mySource.GetSource();
812 vtkPolyData* aDataSet = aSource.GetPointer();
813 aDataSet->ShallowCopy( aGeometry );
815 const PMergeFilter& aFilter = GetFilter();
816 aFilter->SetGeometry( aGeometry );
817 aFilter->SetScalars( aDataSet );
818 aFilter->SetVectors( aDataSet );
819 aFilter->AddField( "VISU_FIELD", aDataSet );
820 aFilter->AddField( "VISU_FIELD_GAUSS_MIN", aDataSet );
821 aFilter->AddField( "VISU_FIELD_GAUSS_MAX", aDataSet );
822 aFilter->AddField( "VISU_FIELD_GAUSS_MOD", aDataSet );
823 aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet );
824 aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet );
829 TPolyDataIDMapperImpl
830 ::GetPolyDataOutput()
833 return myFilter->GetPolyDataOutput();
837 TPolyDataIDMapperImpl
840 return GetPolyDataOutput();
844 TPolyDataIDMapperImpl
848 return mySource.GetSource();
852 TPolyDataIDMapperImpl
855 size_t aSize = myIDMapper->GetMemorySize();
856 aSize += mySource.GetMemorySize();
861 //---------------------------------------------------------------
864 myGeom(EGeometry(-1)),
870 ::LessThan(const PGaussImpl& theGauss,
871 bool& theResult) const
877 //---------------------------------------------------------------
879 ::TGaussSubMeshImpl():
880 myPointCoords(new TPointCoords()),
887 ::GetObjID(vtkIdType theID) const
889 TCellID aCellID = myStartID + theID / myGauss->myNbPoints;
890 TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
892 return TGaussPointID(aCellID, aLocalPntID);
897 ::GetVTKID(const TGaussPointID& theID) const
899 vtkIdType aResult = -1;
901 TCellID aCellID = theID.first;
902 TLocalPntID aLocalPntID = theID.second;
904 vtkIdType aNbPoints = myGauss->myNbPoints;
905 if ( aLocalPntID >= aNbPoints )
908 return ( aCellID - myStartID ) * aNbPoints + aLocalPntID;
912 VISU::TGaussSubMeshImpl
913 ::GetElemObjID(vtkIdType theID) const
915 return mySubProfile->GetElemObjID( theID );
920 VISU::TGaussSubMeshImpl
921 ::GetElemVTKID(vtkIdType theID) const
923 return mySubProfile->GetElemVTKID( theID );
928 ::GetGlobalID(vtkIdType theID) const
930 return myStartID + theID;
937 size_t aSize = TPolyDataHolder::GetMemorySize();
938 aSize += myPointCoords->GetMemorySize();
942 //---------------------------------------------------------------
944 operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight)
946 PGaussSubMeshImpl aLeft(theLeft), aRight(theRight);
947 const PGaussImpl& aGaussLeft = aLeft->myGauss;
948 const PGaussImpl& aGaussRight = aRight->myGauss;
950 if(aGaussLeft->myGeom != aGaussRight->myGeom)
951 return aGaussLeft->myGeom < aGaussRight->myGeom;
953 if(aLeft->mySubProfile != aRight->mySubProfile)
954 return aLeft->mySubProfile < aRight->mySubProfile;
957 aGaussLeft->LessThan(aGaussRight,aResult);
963 //---------------------------------------------------------------
971 ::GetObjID(vtkIdType theID) const
973 const PAppendPolyData& aFilter = GetFilter();
974 return VISU::GetObjID(aFilter->GetOutput(), theID);
979 ::GetVTKID(const TGaussPointID& theID) const
981 vtkIdType aResult = -1;
983 TCellID aCellID = theID.first;
985 vtkIdType aVTKCellId = GetParent()->GetElemVTKID( aCellID );
986 if ( aVTKCellId < 0 )
989 vtkCell* aCell = GetParent()->GetElemCell( aCellID );
993 EGeometry aVGeom = VISU::VTKGeom2VISU( aCell->GetCellType() );
994 if ( aVGeom < EGeometry(0) )
997 TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.find( aVGeom );
998 if ( anIter == myGeom2GaussSubMesh.end() )
1001 size_t aSubMeshEnd = myGaussSubMeshArr.size();
1002 const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
1003 for ( size_t aSubMeshId = 0; aSubMeshId < aSubMeshEnd; aSubMeshId++ ) {
1004 const PGaussSubMeshImpl& aSubMesh = myGaussSubMeshArr[aSubMeshId];
1005 if ( aGaussSubMesh.get() == aSubMesh.get() ) {
1006 return aGaussSubMesh->GetVTKID(theID);
1015 ::GetPolyDataOutput()
1017 return TAppendPolyDataHolder::GetPolyDataOutput();
1024 size_t aSize = TAppendPolyDataHolder::GetMemorySize();
1025 TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.begin();
1026 TGeom2GaussSubMesh::const_iterator anIterEnd = myGeom2GaussSubMesh.end();
1027 for(; anIter != anIterEnd; anIter++){
1028 const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
1029 aSize += aGaussSubMesh->GetMemorySize();
1030 aSize += sizeof(EGeometry);
1043 //---------------------------------------------------------------
1046 ::GetObjID(vtkIdType theID) const
1048 return myGaussPtsIDMapper->GetObjID(theID);
1053 ::GetVTKID(const TGaussPointID& theID) const
1055 return myGaussPtsIDMapper->GetVTKID(theID);
1062 return myGaussPtsIDMapper->GetParent();
1067 ::GetPolyDataOutput()
1069 return TPolyDataIDMapperImpl::GetPolyDataOutput();
1076 return GetPolyDataOutput();
1080 //---------------------------------------------------------------
1088 ::CopyStructure( PStructured theStructured )
1090 TStructured::CopyStructure( theStructured );
1092 if ( PMeshImpl aMesh = theStructured )
1093 GetSource()->ShallowCopy( aMesh->GetPointSet() );
1098 ::GetElemObjID(vtkIdType theID) const
1100 return myStartID + theID;
1105 ::GetElemName(vtkIdType theObjID) const
1114 size_t aSize = TUnstructuredGridHolder::GetMemorySize();
1115 for(size_t anId = 0; anId < myCell2Connect.size(); anId++){
1116 const TConnect& aConnect = myCell2Connect[anId];
1117 aSize += aConnect.size() * sizeof(vtkIdType);
1122 //---------------------------------------------------------------
1124 ::TMeshOnEntityImpl()
1126 const PAppendFilter& anAppendFilter = GetFilter();
1127 anAppendFilter->SetMappingInputs(true);
1132 ::CopyStructure( PStructured theStructured )
1134 TStructured::CopyStructure( theStructured );
1136 if ( PMeshImpl aMesh = theStructured )
1137 myNamedPointCoords = aMesh->myNamedPointCoords;
1142 ::GetNodeVTKID(vtkIdType theID) const
1144 return myNamedPointCoords->GetVTKID(theID);
1149 ::GetNodeObjID(vtkIdType theID) const
1151 return myNamedPointCoords->GetObjID(theID);
1156 ::GetElemVTKID(vtkIdType theID) const
1158 return VISU::GetElemVTKID(GetFilter()->GetOutput(), theID);
1163 ::GetElemObjID(vtkIdType theID) const
1165 return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
1170 ::GetNodeName(vtkIdType theObjID) const
1172 return myNamedPointCoords->GetNodeName(theObjID);
1177 ::GetElemName(vtkIdType theObjID) const
1179 TInputCellID anInputCellID = VISU::GetInputCellID(GetFilter()->GetOutput(), theObjID);
1180 const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputCellID.first];
1181 return aSubMesh->GetElemName(anInputCellID.second);
1184 vtkUnstructuredGrid*
1186 ::GetUnstructuredGridOutput()
1188 return TAppendFilterHolder::GetUnstructuredGridOutput();
1195 size_t aSize = TAppendFilterHolder::GetMemorySize();
1196 aSize += myNamedPointCoords->GetMemorySize();
1197 aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1198 TGeom2SubMesh::const_iterator anIter = myGeom2SubMesh.begin();
1199 TGeom2SubMesh::const_iterator anIterEnd = myGeom2SubMesh.end();
1200 for(; anIter != anIterEnd; anIter++){
1201 const PSubMeshImpl& aSubMesh = anIter->second;
1202 aSize += aSubMesh->GetMemorySize();
1203 aSize += sizeof(EGeometry);
1208 //---------------------------------------------------------------
1211 ::CopyStructure( PStructured theStructured )
1213 TStructured::CopyStructure( theStructured );
1215 if ( PMeshImpl aMesh = theStructured ) {
1216 myNamedPointCoords = aMesh->myNamedPointCoords;
1217 GetSource()->ShallowCopy( aMesh->GetPointSet() );
1223 ::GetElemVTKID(vtkIdType theID) const
1225 if(myElemObj2VTKID.empty())
1228 TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
1229 if(anIter != myElemObj2VTKID.end())
1230 return anIter->second;
1237 ::GetElemObjID(vtkIdType theID) const
1239 return myMeshID[theID];
1244 ::GetNodeObjID(vtkIdType theID) const
1246 return myNamedPointCoords->GetObjID(theID);
1251 ::GetNodeVTKID(vtkIdType theID) const
1253 return myNamedPointCoords->GetVTKID(theID);
1256 vtkUnstructuredGrid*
1258 ::GetUnstructuredGridOutput()
1260 return TUnstructuredGridHolder::GetUnstructuredGridOutput();
1267 size_t aSize = TUnstructuredGridHolder::GetMemorySize();
1268 aSize += myNamedPointCoords->GetMemorySize();
1269 aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1270 aSize += myMeshID.size() * sizeof(vtkIdType);
1271 TGeom2SubMeshID::const_iterator anIter = myGeom2SubMeshID.begin();
1272 TGeom2SubMeshID::const_iterator anIterEnd = myGeom2SubMeshID.end();
1273 for(; anIter != anIterEnd; anIter++){
1274 const TSubMeshID& aSubMeshID = anIter->second;
1275 aSize += aSubMeshID.size() * sizeof(vtkIdType);
1276 aSize += sizeof(EGeometry);
1282 //---------------------------------------------------------------
1285 ::CopyStructure( PStructured theStructured )
1287 TStructured::CopyStructure( theStructured );
1289 if ( PMeshImpl aMesh = theStructured )
1290 myNamedPointCoords = aMesh->myNamedPointCoords;
1295 ::GetNbASizeCells() const
1297 vtkIdType aNbCells = 0, aCellsSize = 0;
1298 TFamilySet::const_iterator anIter = myFamilySet.begin();
1299 for(; anIter != myFamilySet.end(); anIter++){
1300 PFamilyImpl aFamily = (*anIter).second;
1301 aNbCells += aFamily->myNbCells;
1302 aCellsSize += aFamily->myCellsSize;
1304 return std::make_pair(aNbCells,aCellsSize);
1309 ::GetElemVTKID(vtkIdType theID) const
1311 if(myElemObj2VTKID.empty())
1314 TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
1315 if(anIter != myElemObj2VTKID.end())
1316 return anIter->second;
1323 ::GetElemObjID(vtkIdType theID) const
1325 return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
1330 ::GetNodeObjID(vtkIdType theID) const
1332 return myNamedPointCoords->GetObjID(theID);
1337 ::GetNodeVTKID(vtkIdType theID) const
1339 return myNamedPointCoords->GetVTKID(theID);
1342 vtkUnstructuredGrid*
1344 ::GetUnstructuredGridOutput()
1346 return TAppendFilterHolder::GetUnstructuredGridOutput();
1353 size_t aSize = TAppendFilterHolder::GetMemorySize();
1354 aSize += myNamedPointCoords->GetMemorySize();
1355 aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1356 for(size_t anId = 0; anId < myFamilyArr.size(); anId++){
1357 const PFamilyImpl& aFamily = myFamilyArr[anId];
1358 aSize += aFamily->GetMemorySize();
1365 //---------------------------------------------------------------
1374 ::Init(vtkIdType theNbComp,
1375 vtkIdType theDataType)
1377 myNbComp = theNbComp;
1378 myDataType = theDataType;
1379 myCompNames.resize(theNbComp);
1380 myUnitNames.resize(theNbComp);
1382 myMetric2Comp2MinMax.resize(3);
1383 myMetric2Comp2AverageMinMax.resize(3);
1384 myMetric2Comp2Group2MinMax.resize(3);
1385 myMetric2Comp2Group2AverageMinMax.resize(3);
1386 for(int aGaussMetric = (int)VISU::AVERAGE_METRIC; aGaussMetric <= (int)VISU::MAXIMUM_METRIC; aGaussMetric++){
1387 TComp2MinMax& aComp2MinMax = myMetric2Comp2MinMax[aGaussMetric];
1388 TComp2MinMax& aComp2AverageMinMax = myMetric2Comp2AverageMinMax[aGaussMetric];
1389 TComp2Group2MinMax& aComp2Group2MinMax = myMetric2Comp2Group2MinMax[aGaussMetric];
1390 TComp2Group2MinMax& aComp2Group2AverageMinMax = myMetric2Comp2Group2AverageMinMax[aGaussMetric];
1392 aComp2MinMax.resize(theNbComp + 1);
1393 aComp2AverageMinMax.resize(theNbComp + 1);
1394 aComp2Group2MinMax.resize(theNbComp + 1);
1395 aComp2Group2AverageMinMax.resize(theNbComp + 1);
1396 for(vtkIdType iComp = 0; iComp <= theNbComp; iComp++){
1397 TMinMax& aMinMax = aComp2MinMax[iComp];
1398 aMinMax.first = VTK_LARGE_FLOAT;
1399 aMinMax.second = -VTK_LARGE_FLOAT;
1400 TMinMax& anAverageMinMax = aComp2AverageMinMax[iComp];
1401 anAverageMinMax.first = VTK_LARGE_FLOAT;
1402 anAverageMinMax.second = -VTK_LARGE_FLOAT;
1409 ::GetDataType() const
1416 ::GetMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric)
1419 bool anIsMinMaxInitialized = false;
1420 if( !theGroupNames.empty() ) {
1421 aMinMax.first = VTK_LARGE_FLOAT;
1422 aMinMax.second = -VTK_LARGE_FLOAT;
1424 const TGroup2MinMax& aGroup2MinMax = myMetric2Comp2Group2MinMax[theGaussMetric][theCompID];
1425 TNames::const_iterator aNameIter = theGroupNames.begin();
1426 for( ; aNameIter != theGroupNames.end(); aNameIter++ ) {
1427 TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter );
1428 if( aGroup2MinMaxIter != aGroup2MinMax.end() ) {
1429 const TMinMax& aGroupMinMax = aGroup2MinMaxIter->second;
1430 aMinMax.first = std::min( aMinMax.first, aGroupMinMax.first );
1431 aMinMax.second = std::max( aMinMax.second, aGroupMinMax.second );
1432 anIsMinMaxInitialized = true;
1437 if( !anIsMinMaxInitialized )
1438 aMinMax = myMetric2Comp2MinMax[theGaussMetric][theCompID];
1446 ::GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric)
1449 bool anIsMinMaxInitialized = false;
1450 if( !theGroupNames.empty() ) {
1451 aMinMax.first = VTK_LARGE_FLOAT;
1452 aMinMax.second = -VTK_LARGE_FLOAT;
1454 const TGroup2MinMax& aGroup2MinMax = myMetric2Comp2Group2AverageMinMax[theGaussMetric][theCompID];
1455 TNames::const_iterator aNameIter = theGroupNames.begin();
1456 for( ; aNameIter != theGroupNames.end(); aNameIter++ ) {
1457 TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter );
1458 if( aGroup2MinMaxIter != aGroup2MinMax.end() ) {
1459 const TMinMax& aGroupMinMax = aGroup2MinMaxIter->second;
1460 aMinMax.first = std::min( aMinMax.first, aGroupMinMax.first );
1461 aMinMax.second = std::max( aMinMax.second, aGroupMinMax.second );
1462 anIsMinMaxInitialized = true;
1467 if( !anIsMinMaxInitialized )
1468 aMinMax = myMetric2Comp2AverageMinMax[theGaussMetric][theCompID];
1473 //----------------------------------------------------------------------------
1476 ::GetMeshValue(EGeometry theGeom) const
1478 TGeom2MeshValue::const_iterator anIter = myGeom2MeshValue.find(theGeom);
1479 if(anIter == myGeom2MeshValue.end())
1480 EXCEPTION(std::runtime_error,"TGeom2Value::GetMeshValue - myGeom2MeshValue.find(theGeom) fails");
1481 return anIter->second;
1486 ::GetMeshValue(EGeometry theGeom)
1488 return myGeom2MeshValue[theGeom];
1492 //----------------------------------------------------------------------------
1495 ::GetGeom2MeshValue()
1497 return myGeom2MeshValue;
1500 const TGeom2MeshValue&
1502 ::GetGeom2MeshValue() const
1504 return myGeom2MeshValue;
1509 ::GetFirstMeshValue() const
1511 if(myGeom2MeshValue.size() == 1)
1512 return myGeom2MeshValue.begin()->second;
1513 return PMeshValue();
1517 //---------------------------------------------------------------
1519 ::TValForTimeImpl():
1520 myGaussPtsIDFilter(new TGaussPtsIDFilter()),
1521 myUnstructuredGridIDMapper(new TUnstructuredGridIDMapperImpl()),
1527 ::GetMeshValue(EGeometry theGeom) const
1529 return myGeom2Value.GetMeshValue(theGeom);
1534 ::GetMeshValue(EGeometry theGeom)
1536 return myGeom2Value.GetMeshValue(theGeom);
1541 ::GetGeom2MeshValue()
1543 return myGeom2Value.GetGeom2MeshValue();
1546 const TGeom2MeshValue&
1548 ::GetGeom2MeshValue() const
1550 return myGeom2Value.GetGeom2MeshValue();
1555 ::GetFirstMeshValue() const
1557 return myGeom2Value.GetFirstMeshValue();
1562 ::GetNbGauss(EGeometry theGeom) const
1564 TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.find(theGeom);
1565 if(anIter == myGeom2NbGauss.end()){
1568 return anIter->second;
1573 ::GetMaxNbGauss() const
1576 TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.begin();
1577 for(; anIter != myGeom2NbGauss.end(); anIter++){
1578 aNbGauss = std::max<int>(aNbGauss, anIter->second);
1587 size_t aSize = sizeof(TValForTimeImpl);
1588 const TGeom2MeshValue& aGeom2MeshValue = GetGeom2MeshValue();
1589 TGeom2MeshValue::const_iterator anIter = aGeom2MeshValue.begin();
1590 TGeom2MeshValue::const_iterator anIterEnd = aGeom2MeshValue.end();
1591 for(; anIter != anIterEnd; anIter++){
1592 const PMeshValue& aMeshValue = anIter->second;
1593 aSize += aMeshValue->GetMemorySize();
1594 aSize += sizeof(EGeometry);
1599 //---------------------------------------------------------------