1 // Copyright (C) 2007-2013 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>
42 #include <vtkPassThroughFilter.h>
47 VISUGeom2NbNodes(EGeometry theGeom)
50 #ifndef VISU_ENABLE_QUADRATIC
75 VISUGeom2VTK(EGeometry theGeom)
89 return VTK_HEXAHEDRON;
98 return VTK_CONVEX_POINT_SET;
100 #ifndef VISU_ENABLE_QUADRATIC
110 return VTK_HEXAHEDRON;
119 #if defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)
120 return VTK_QUADRATIC_EDGE;
122 return VTK_POLY_LINE;
126 #if defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)
127 return VTK_QUADRATIC_TRIANGLE;
133 #if defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)
134 return VTK_QUADRATIC_QUAD;
140 #if defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)
141 return VTK_QUADRATIC_TETRA;
143 return VTK_CONVEX_POINT_SET;
147 #if defined(VTK_QUADRATIC_HEXAHEDRON) && defined(VISU_USE_VTK_QUADRATIC)
148 return VTK_QUADRATIC_HEXAHEDRON;
150 return VTK_CONVEX_POINT_SET;
154 #if defined(VTK_QUADRATIC_WEDGE) && defined(VISU_USE_VTK_QUADRATIC)
155 return VTK_QUADRATIC_WEDGE;
157 return VTK_CONVEX_POINT_SET;
161 #if defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)
162 return VTK_QUADRATIC_PYRAMID;
164 return VTK_CONVEX_POINT_SET;
167 #endif //VISU_ENABLE_QUADRATIC
176 VTKGeom2VISU(vtkIdType theGeom)
180 return VISU::ePOINT1;
188 return VISU::eTETRA4;
192 return VISU::ePENTA6;
195 case VTK_HEXAGONAL_PRISM:
196 return VISU::eOCTA12;
200 return VISU::ePOLYGONE;
201 case VTK_CONVEX_POINT_SET:
202 return VISU::ePOLYEDRE;
204 #if defined(VISU_ENABLE_QUADRATIC) && defined(VISU_USE_VTK_QUADRATIC)
206 case VTK_QUADRATIC_EDGE:
209 case VTK_QUADRATIC_TRIANGLE:
212 case VTK_QUADRATIC_QUAD:
215 case VTK_BIQUADRATIC_QUAD:
218 case VTK_QUADRATIC_TETRA:
219 return VISU::eTETRA10;
221 case VTK_QUADRATIC_HEXAHEDRON:
222 return VISU::eHEXA20;
224 case VTK_TRIQUADRATIC_HEXAHEDRON:
225 return VISU::eHEXA27;
227 case VTK_QUADRATIC_WEDGE:
228 return VISU::ePENTA15;
230 case VTK_QUADRATIC_PYRAMID:
231 return VISU::ePYRA13;
233 #endif //VISU_ENABLE_QUADRATIC
236 return EGeometry(-1);
240 //---------------------------------------------------------------
241 /*! Computes number of points by the given number of cells
242 * in assumption of regular hexahedral mesh structure
245 GetNumberOfPoints(size_t theNbCells)
247 return size_t(pow(pow(theNbCells, 1.0/3.0) + 1.0, 3.0));
250 //---------------------------------------------------------------
251 /*! Computes size dataset the given number of mesh macro metrics
252 * in assumption of regular hexahedral mesh structure
255 GetDataSetSize(size_t theNbOfPoints,
258 bool theComputeLinks)
260 size_t aPointsSize = 3*theNbOfPoints*sizeof(VISU::TCoord);
261 size_t aConnectivityAndTypesSize = theCellsSize*sizeof(vtkIdType);
262 size_t aLocationsSize = theNbOfCells*sizeof(int);
263 double aNbCellsPerPoint = theCellsSize / theNbOfCells - 1;
264 size_t aLinksSize = theNbOfPoints * (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(short));
267 size_t aResult = aPointsSize + aConnectivityAndTypesSize + aLocationsSize + aLinksSize;
271 //---------------------------------------------------------------
279 //---------------------------------------------------------------
288 if(!mySource.GetPointer()){
289 mySource = vtkPolyData::New();
297 ::GetPolyDataOutput()
299 return GetSource().GetPointer();
306 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();
333 const PPassThroughFilter&
334 TUnstructuredGridHolder
337 if(!myFilter.GetPointer()){
338 myFilter = vtkPassThroughFilter::New();
340 myFilter->SetInputData( GetSource() );
346 TUnstructuredGridHolder
347 ::GetUnstructuredGridOutput()
349 return GetSource().GetPointer();
353 TUnstructuredGridHolder
356 return GetFilter()->GetOutputPort();
360 TUnstructuredGridHolder
363 if(vtkDataSet* anOutput = GetUnstructuredGridOutput()){
364 return anOutput->GetActualMemorySize() * 1024;
367 size_t aNbPoints = GetNumberOfPoints(myNbCells);
368 return GetDataSetSize(aNbPoints, myNbCells, myCellsSize, false);
370 throw std::runtime_error("TUnstructuredGridHolder::GetMemorySize - myIsDone == false !!!");
374 //---------------------------------------------------------------
380 if(vtkDataSet* anOutput = GetOutput()){
381 return anOutput->GetActualMemorySize() * 1024;
384 throw std::runtime_error("TMemoryCheckIDMapper::GetMemorySize - myIsVTKDone == false !!!");
389 //---------------------------------------------------------------
391 ::TAppendFilterHolder()
398 if(!myFilter.GetPointer()){
399 myFilter = VISU_AppendFilter::New();
401 myFilter->SetMappingInputs(true);
408 ::GetUnstructuredGridOutput()
410 GetFilter()->Update();
411 return GetFilter()->GetOutput();
418 return GetFilter()->GetOutputPort();
421 //---------------------------------------------------------------
422 TAppendPolyDataHolder
423 ::TAppendPolyDataHolder()
426 const PAppendPolyData&
427 TAppendPolyDataHolder
430 if(!myFilter.GetPointer()){
431 myFilter = VISU_AppendPolyData::New();
432 myFilter->SetMappingInputs(true);
439 TAppendPolyDataHolder
440 ::GetPolyDataOutput()
442 GetFilter()->Update();
443 return GetFilter()->GetOutput();
447 TAppendPolyDataHolder
450 return GetFilter()->GetOutputPort();
454 //---------------------------------------------------------------
456 ::TMergeFilterHolder()
463 if(!myFilter.GetPointer()){
464 myFilter = VISU_MergeFilter::New();
474 GetFilter()->Update();
475 return GetFilter()->GetOutput();
482 return GetFilter()->GetOutputPort();
486 //---------------------------------------------------------------
510 return myNamedPointCoords->GetPointSet();
514 //---------------------------------------------------------------
515 TSubProfileImpl::TSubProfileImpl():
523 ::GetElemObjID(vtkIdType theID) const
525 if ( !mySubMeshID.empty() )
526 return mySubMeshID[theID];
534 ::GetElemVTKID(vtkIdType theID) const
536 if ( !mySubMeshID.empty() )
537 for ( size_t anId = 0; anId < mySubMeshID.size(); anId++ )
538 if ( mySubMeshID[ anId ] == theID )
548 size_t aSize = TUnstructuredGridHolder::GetMemorySize();
549 aSize += sizeof(vtkIdType) * mySubMeshID.size();
557 return strcmp(myName.c_str(),"") == 0;
560 //---------------------------------------------------------------
562 operator<(const PSubProfile& theLeft, const PSubProfile& theRight)
564 PSubProfileImpl aLeft(theLeft), aRight(theRight);
566 if(aLeft->myGeom != aRight->myGeom)
567 return aLeft->myGeom < aRight->myGeom;
569 if(aLeft->myStatus != aRight->myStatus)
570 return aLeft->myStatus < aRight->myStatus;
572 return aLeft->myName < aRight->myName;
576 //---------------------------------------------------------------
585 ::GetNodeObjID(vtkIdType theID) const
587 return myNamedPointCoords->GetObjID(theID);
592 ::GetNodeVTKID(vtkIdType theID) const
594 return myNamedPointCoords->GetVTKID(theID);
599 ::GetNodeCoord(vtkIdType theObjID)
602 return myMeshOnEntity->GetNodeCoord(theObjID);
604 vtkIdType aVtkID = GetNodeVTKID(theObjID);
605 return GetFilter()->GetOutput()->GetPoint(aVtkID);
610 ::GetElemObjID(vtkIdType theID) const
612 return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
617 ::GetElemVTKID(vtkIdType theID) const
619 return VISU::GetElemVTKID(GetFilter()->GetOutput(), theID);
624 ::GetElemCell(vtkIdType theObjID)
627 return myMeshOnEntity->GetElemCell(theObjID);
629 vtkIdType aVtkID = GetElemVTKID(theObjID);
630 return GetFilter()->GetOutput()->GetCell(aVtkID);
635 ::GetUnstructuredGridOutput()
637 const PAppendFilter& anAppendFilter = GetFilter();
638 return anAppendFilter->GetOutput();
645 const PAppendFilter& anAppendFilter = GetFilter();
646 return anAppendFilter->GetOutputPort();
653 size_t aSize = TAppendFilterHolder::GetMemorySize();
654 aSize += myNamedPointCoords->GetMemorySize();
655 aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
656 TGeom2SubProfile::const_iterator anIter = myGeom2SubProfile.begin();
657 TGeom2SubProfile::const_iterator anIterEnd = myGeom2SubProfile.end();
658 for(; anIter != anIterEnd; anIter++){
659 const PSubProfileImpl& aSubProfile = anIter->second;
660 aSize += aSubProfile->GetMemorySize();
661 aSize += sizeof(EGeometry);
668 ::GetNodeName(vtkIdType theObjID) const
670 return myNamedPointCoords->GetNodeName(theObjID);
675 ::GetElemName(vtkIdType theObjID) const
677 return myMeshOnEntity->GetElemName(theObjID);
681 //---------------------------------------------------------------
682 TUnstructuredGridIDMapperImpl
683 ::TUnstructuredGridIDMapperImpl()
685 if ( !myCommonCellsFilter.GetPointer() ) {
686 myCommonCellsFilter = VISU_CommonCellsFilter::New();
687 myCommonCellsFilter->Delete();
692 TUnstructuredGridIDMapperImpl
693 ::GetNodeObjID(vtkIdType theID) const
695 return myIDMapper->GetNodeObjID(theID);
699 TUnstructuredGridIDMapperImpl
700 ::GetNodeVTKID(vtkIdType theID) const
702 return myIDMapper->GetNodeVTKID(theID);
706 TUnstructuredGridIDMapperImpl
707 ::GetNodeCoord(vtkIdType theObjID)
709 return myIDMapper->GetNodeCoord(theObjID);
713 TUnstructuredGridIDMapperImpl
714 ::GetElemObjID(vtkIdType theID) const
716 return myIDMapper->GetElemObjID(theID);
720 TUnstructuredGridIDMapperImpl
721 ::GetElemVTKID(vtkIdType theID) const
723 return myIDMapper->GetElemVTKID(theID);
727 TUnstructuredGridIDMapperImpl
728 ::GetElemCell(vtkIdType theObjID)
730 return myIDMapper->GetElemCell(theObjID);
734 TUnstructuredGridIDMapperImpl
735 ::SetReferencedMesh( const PNamedIDMapper& theNamedIDMapper )
737 myCommonCellsFilter->SetCellsUG( theNamedIDMapper->GetOutputPort() );
741 TUnstructuredGridIDMapperImpl
744 if ( !myFilter.GetPointer() ) {
745 const PAppendFilter& anAppendFilter = myIDMapper->GetFilter();
747 vtkAlgorithmOutput* aGeometryConnection = anAppendFilter->GetOutputPort();
748 vtkUnstructuredGrid* aGeometryData = anAppendFilter->GetOutput();
749 anAppendFilter->Update();
751 const PUnstructuredGrid& aSource = mySource.GetSource();
752 vtkUnstructuredGrid* aDataSet = aSource.GetPointer();
753 aDataSet->ShallowCopy( aGeometryData );
755 const PMergeFilter& aFilter = GetFilter();
756 aFilter->SetGeometryConnection( aGeometryConnection );
757 aFilter->SetScalarsData( aDataSet );
758 aFilter->SetVectorsData( aDataSet );
759 aFilter->AddField( "VISU_FIELD", aDataSet );
760 aFilter->AddField( "VISU_FIELD_GAUSS_MIN", aDataSet );
761 aFilter->AddField( "VISU_FIELD_GAUSS_MAX", aDataSet );
762 aFilter->AddField( "VISU_FIELD_GAUSS_MOD", aDataSet );
763 aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet );
764 aFilter->AddField( "ELNO_FIELD", aDataSet );
765 aFilter->AddField( "ELNO_COMPONENT_MAPPER", aDataSet );
766 aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet );
768 myCommonCellsFilter->SetProfileUG( aFilter->GetOutputPort() );
773 TUnstructuredGridIDMapperImpl
774 ::GetUnstructuredGridOutput()
777 vtkUnstructuredGrid* anOutput = myCommonCellsFilter->GetOutput();
778 myCommonCellsFilter->Update();
783 TUnstructuredGridIDMapperImpl
786 return GetUnstructuredGridOutput();
790 TUnstructuredGridIDMapperImpl
793 return myCommonCellsFilter->GetOutputPort();
797 TUnstructuredGridIDMapperImpl
801 return mySource.GetSource();
805 TUnstructuredGridIDMapperImpl
808 size_t aSize = myIDMapper->GetMemorySize();
810 aSize += mySource.GetMemorySize();
812 if ( vtkUnstructuredGrid* anOutput = myCommonCellsFilter->GetOutput() )
813 aSize += anOutput->GetActualMemorySize() * 1024;
818 //---------------------------------------------------------------
820 TPolyDataIDMapperImpl
821 ::GetNodeObjID(vtkIdType theID) const
823 return myIDMapper->GetNodeObjID(theID);
827 TPolyDataIDMapperImpl
828 ::GetNodeVTKID(vtkIdType theID) const
830 return myIDMapper->GetNodeVTKID(theID);
834 TPolyDataIDMapperImpl
835 ::GetNodeCoord(vtkIdType theObjID)
837 return myIDMapper->GetNodeCoord(theObjID);
841 TPolyDataIDMapperImpl
842 ::GetElemObjID(vtkIdType theID) const
844 return myIDMapper->GetElemObjID(theID);
848 TPolyDataIDMapperImpl
849 ::GetElemVTKID(vtkIdType theID) const
851 return myIDMapper->GetElemVTKID(theID);
855 TPolyDataIDMapperImpl
856 ::GetElemCell(vtkIdType theObjID)
858 return myIDMapper->GetElemCell(theObjID);
862 TPolyDataIDMapperImpl
865 if ( !myFilter.GetPointer() ) {
866 const PAppendPolyData& anAppendFilter = myIDMapper->GetFilter();
867 vtkAlgorithmOutput* aGeometryConnection = anAppendFilter->GetOutputPort();
868 vtkPolyData* aGeometryData = anAppendFilter->GetOutput();
869 anAppendFilter->Update();
871 const PPolyData& aSource = mySource.GetSource();
872 vtkPolyData* aDataSet = aSource.GetPointer();
873 aDataSet->ShallowCopy( aGeometryData );
875 const PMergeFilter& aFilter = GetFilter();
876 aFilter->SetGeometryConnection( aGeometryConnection );
877 aFilter->SetScalarsData( aDataSet );
878 aFilter->SetVectorsData( aDataSet );
879 aFilter->AddField( "VISU_FIELD", aDataSet );
880 aFilter->AddField( "VISU_FIELD_GAUSS_MIN", aDataSet );
881 aFilter->AddField( "VISU_FIELD_GAUSS_MAX", aDataSet );
882 aFilter->AddField( "VISU_FIELD_GAUSS_MOD", aDataSet );
883 aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet );
884 aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet );
889 TPolyDataIDMapperImpl
890 ::GetPolyDataOutput()
893 return myFilter->GetPolyDataOutput();
897 TPolyDataIDMapperImpl
900 return GetPolyDataOutput();
904 TPolyDataIDMapperImpl
907 return myFilter->GetOutputPort();
911 TPolyDataIDMapperImpl
915 return mySource.GetSource();
919 TPolyDataIDMapperImpl
922 size_t aSize = myIDMapper->GetMemorySize();
923 aSize += mySource.GetMemorySize();
928 //---------------------------------------------------------------
931 myGeom(EGeometry(-1)),
937 ::LessThan(const PGaussImpl& theGauss,
938 bool& theResult) const
944 //---------------------------------------------------------------
946 ::TGaussSubMeshImpl():
947 myPointCoords(new TPointCoords()),
954 ::GetObjID(vtkIdType theID) const
956 TCellID aCellID = myStartID + theID / myGauss->myNbPoints;
957 TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
959 return TGaussPointID(aCellID, aLocalPntID);
964 ::GetVTKID(const TGaussPointID& theID) const
966 vtkIdType aResult = -1;
968 TCellID aCellID = theID.first;
969 TLocalPntID aLocalPntID = theID.second;
971 vtkIdType aNbPoints = myGauss->myNbPoints;
972 if ( aLocalPntID >= aNbPoints )
975 return ( aCellID - myStartID ) * aNbPoints + aLocalPntID;
979 VISU::TGaussSubMeshImpl
980 ::GetElemObjID(vtkIdType theID) const
982 return mySubProfile->GetElemObjID( theID );
987 VISU::TGaussSubMeshImpl
988 ::GetElemVTKID(vtkIdType theID) const
990 return mySubProfile->GetElemVTKID( theID );
995 ::GetGlobalID(vtkIdType theID) const
997 return myStartID + theID;
1004 size_t aSize = TPolyDataHolder::GetMemorySize();
1005 aSize += myPointCoords->GetMemorySize();
1009 //---------------------------------------------------------------
1011 operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight)
1013 PGaussSubMeshImpl aLeft(theLeft), aRight(theRight);
1014 const PGaussImpl& aGaussLeft = aLeft->myGauss;
1015 const PGaussImpl& aGaussRight = aRight->myGauss;
1017 if(aGaussLeft->myGeom != aGaussRight->myGeom)
1018 return aGaussLeft->myGeom < aGaussRight->myGeom;
1020 if(aLeft->mySubProfile != aRight->mySubProfile)
1021 return aLeft->mySubProfile < aRight->mySubProfile;
1024 aGaussLeft->LessThan(aGaussRight,aResult);
1030 //---------------------------------------------------------------
1038 ::GetObjID(vtkIdType theID) const
1040 const PAppendPolyData& aFilter = GetFilter();
1041 return VISU::GetObjID(aFilter->GetOutput(), theID);
1046 ::GetVTKID(const TGaussPointID& theID) const
1048 vtkIdType aResult = -1;
1050 TCellID aCellID = theID.first;
1052 vtkIdType aVTKCellId = GetParent()->GetElemVTKID( aCellID );
1053 if ( aVTKCellId < 0 )
1056 vtkCell* aCell = GetParent()->GetElemCell( aCellID );
1060 EGeometry aVGeom = VISU::VTKGeom2VISU( aCell->GetCellType() );
1061 if ( aVGeom < EGeometry(0) )
1064 TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.find( aVGeom );
1065 if ( anIter == myGeom2GaussSubMesh.end() )
1068 size_t aSubMeshEnd = myGaussSubMeshArr.size();
1069 const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
1070 for ( size_t aSubMeshId = 0; aSubMeshId < aSubMeshEnd; aSubMeshId++ ) {
1071 const PGaussSubMeshImpl& aSubMesh = myGaussSubMeshArr[aSubMeshId];
1072 if ( aGaussSubMesh.get() == aSubMesh.get() ) {
1073 return aGaussSubMesh->GetVTKID(theID);
1082 ::GetPolyDataOutput()
1084 return TAppendPolyDataHolder::GetPolyDataOutput();
1091 return TAppendPolyDataHolder::GetOutputPort();
1098 size_t aSize = TAppendPolyDataHolder::GetMemorySize();
1099 TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.begin();
1100 TGeom2GaussSubMesh::const_iterator anIterEnd = myGeom2GaussSubMesh.end();
1101 for(; anIter != anIterEnd; anIter++){
1102 const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
1103 aSize += aGaussSubMesh->GetMemorySize();
1104 aSize += sizeof(EGeometry);
1117 //---------------------------------------------------------------
1120 ::GetObjID(vtkIdType theID) const
1122 return myGaussPtsIDMapper->GetObjID(theID);
1127 ::GetVTKID(const TGaussPointID& theID) const
1129 return myGaussPtsIDMapper->GetVTKID(theID);
1136 return myGaussPtsIDMapper->GetParent();
1141 ::GetPolyDataOutput()
1143 return TPolyDataIDMapperImpl::GetPolyDataOutput();
1150 return GetPolyDataOutput();
1154 //---------------------------------------------------------------
1162 ::CopyStructure( PStructured theStructured )
1164 TStructured::CopyStructure( theStructured );
1166 if ( PMeshImpl aMesh = theStructured )
1167 GetSource()->ShallowCopy( aMesh->GetPointSet() );
1172 ::GetElemObjID(vtkIdType theID) const
1174 return myStartID + theID;
1179 ::GetElemName(vtkIdType theObjID) const
1188 size_t aSize = TUnstructuredGridHolder::GetMemorySize();
1189 for(size_t anId = 0; anId < myCell2Connect.size(); anId++){
1190 const TConnect& aConnect = myCell2Connect[anId];
1191 aSize += aConnect.size() * sizeof(vtkIdType);
1196 //---------------------------------------------------------------
1198 ::TMeshOnEntityImpl()
1200 const PAppendFilter& anAppendFilter = GetFilter();
1201 anAppendFilter->SetMappingInputs(true);
1206 ::CopyStructure( PStructured theStructured )
1208 TStructured::CopyStructure( theStructured );
1210 if ( PMeshImpl aMesh = theStructured )
1211 myNamedPointCoords = aMesh->myNamedPointCoords;
1216 ::GetNodeVTKID(vtkIdType theID) const
1218 return myNamedPointCoords->GetVTKID(theID);
1223 ::GetNodeObjID(vtkIdType theID) const
1225 return myNamedPointCoords->GetObjID(theID);
1230 ::GetElemVTKID(vtkIdType theID) const
1232 return VISU::GetElemVTKID(GetFilter()->GetOutput(), theID);
1237 ::GetElemObjID(vtkIdType theID) const
1239 return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
1244 ::GetNodeName(vtkIdType theObjID) const
1246 return myNamedPointCoords->GetNodeName(theObjID);
1251 ::GetElemName(vtkIdType theObjID) const
1253 TInputCellID anInputCellID = VISU::GetInputCellID(GetFilter()->GetOutput(), theObjID);
1254 const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputCellID.first];
1255 return aSubMesh->GetElemName(anInputCellID.second);
1258 vtkUnstructuredGrid*
1260 ::GetUnstructuredGridOutput()
1262 return TAppendFilterHolder::GetUnstructuredGridOutput();
1269 return TAppendFilterHolder::GetOutputPort();
1276 size_t aSize = TAppendFilterHolder::GetMemorySize();
1277 aSize += myNamedPointCoords->GetMemorySize();
1278 aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1279 TGeom2SubMesh::const_iterator anIter = myGeom2SubMesh.begin();
1280 TGeom2SubMesh::const_iterator anIterEnd = myGeom2SubMesh.end();
1281 for(; anIter != anIterEnd; anIter++){
1282 const PSubMeshImpl& aSubMesh = anIter->second;
1283 aSize += aSubMesh->GetMemorySize();
1284 aSize += sizeof(EGeometry);
1289 //---------------------------------------------------------------
1292 ::CopyStructure( PStructured theStructured )
1294 TStructured::CopyStructure( theStructured );
1296 if ( PMeshImpl aMesh = theStructured ) {
1297 myNamedPointCoords = aMesh->myNamedPointCoords;
1298 GetSource()->ShallowCopy( aMesh->GetPointSet() );
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 myMeshID[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 TUnstructuredGridHolder::GetUnstructuredGridOutput();
1348 return TUnstructuredGridHolder::GetOutputPort();
1355 size_t aSize = TUnstructuredGridHolder::GetMemorySize();
1356 aSize += myNamedPointCoords->GetMemorySize();
1357 aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1358 aSize += myMeshID.size() * sizeof(vtkIdType);
1359 TGeom2SubMeshID::const_iterator anIter = myGeom2SubMeshID.begin();
1360 TGeom2SubMeshID::const_iterator anIterEnd = myGeom2SubMeshID.end();
1361 for(; anIter != anIterEnd; anIter++){
1362 const TSubMeshID& aSubMeshID = anIter->second;
1363 aSize += aSubMeshID.size() * sizeof(vtkIdType);
1364 aSize += sizeof(EGeometry);
1370 //---------------------------------------------------------------
1373 ::CopyStructure( PStructured theStructured )
1375 TStructured::CopyStructure( theStructured );
1377 if ( PMeshImpl aMesh = theStructured )
1378 myNamedPointCoords = aMesh->myNamedPointCoords;
1383 ::GetNbASizeCells() const
1385 vtkIdType aNbCells = 0, aCellsSize = 0;
1386 TFamilySet::const_iterator anIter = myFamilySet.begin();
1387 for(; anIter != myFamilySet.end(); anIter++){
1388 PFamilyImpl aFamily = (*anIter).second;
1389 aNbCells += aFamily->myNbCells;
1390 aCellsSize += aFamily->myCellsSize;
1392 return std::make_pair(aNbCells,aCellsSize);
1397 ::GetElemVTKID(vtkIdType theID) const
1399 if(myElemObj2VTKID.empty())
1402 TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
1403 if(anIter != myElemObj2VTKID.end())
1404 return anIter->second;
1411 ::GetElemObjID(vtkIdType theID) const
1413 return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
1418 ::GetNodeObjID(vtkIdType theID) const
1420 return myNamedPointCoords->GetObjID(theID);
1425 ::GetNodeVTKID(vtkIdType theID) const
1427 return myNamedPointCoords->GetVTKID(theID);
1430 vtkUnstructuredGrid*
1432 ::GetUnstructuredGridOutput()
1434 return TAppendFilterHolder::GetUnstructuredGridOutput();
1441 return TAppendFilterHolder::GetOutputPort();
1448 size_t aSize = TAppendFilterHolder::GetMemorySize();
1449 aSize += myNamedPointCoords->GetMemorySize();
1450 aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1451 for(size_t anId = 0; anId < myFamilyArr.size(); anId++){
1452 const PFamilyImpl& aFamily = myFamilyArr[anId];
1453 aSize += aFamily->GetMemorySize();
1460 //---------------------------------------------------------------
1469 ::Init(vtkIdType theNbComp,
1470 vtkIdType theDataType)
1472 myNbComp = theNbComp;
1473 myDataType = theDataType;
1474 myCompNames.resize(theNbComp);
1475 myUnitNames.resize(theNbComp);
1477 myMetric2Comp2MinMax.resize(3);
1478 myMetric2Comp2AverageMinMax.resize(3);
1479 myMetric2Comp2Group2MinMax.resize(3);
1480 myMetric2Comp2Group2AverageMinMax.resize(3);
1481 for(int aGaussMetric = (int)VISU::AVERAGE_METRIC; aGaussMetric <= (int)VISU::MAXIMUM_METRIC; aGaussMetric++){
1482 TComp2MinMax& aComp2MinMax = myMetric2Comp2MinMax[aGaussMetric];
1483 TComp2MinMax& aComp2AverageMinMax = myMetric2Comp2AverageMinMax[aGaussMetric];
1484 TComp2Group2MinMax& aComp2Group2MinMax = myMetric2Comp2Group2MinMax[aGaussMetric];
1485 TComp2Group2MinMax& aComp2Group2AverageMinMax = myMetric2Comp2Group2AverageMinMax[aGaussMetric];
1487 aComp2MinMax.resize(theNbComp + 1);
1488 aComp2AverageMinMax.resize(theNbComp + 1);
1489 aComp2Group2MinMax.resize(theNbComp + 1);
1490 aComp2Group2AverageMinMax.resize(theNbComp + 1);
1491 for(vtkIdType iComp = 0; iComp <= theNbComp; iComp++){
1492 TMinMax& aMinMax = aComp2MinMax[iComp];
1493 aMinMax.first = VTK_LARGE_FLOAT;
1494 aMinMax.second = -VTK_LARGE_FLOAT;
1495 TMinMax& anAverageMinMax = aComp2AverageMinMax[iComp];
1496 anAverageMinMax.first = VTK_LARGE_FLOAT;
1497 anAverageMinMax.second = -VTK_LARGE_FLOAT;
1504 ::GetDataType() const
1511 ::GetMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric)
1514 bool anIsMinMaxInitialized = false;
1515 if( !theGroupNames.empty() ) {
1516 aMinMax.first = VTK_LARGE_FLOAT;
1517 aMinMax.second = -VTK_LARGE_FLOAT;
1519 const TGroup2MinMax& aGroup2MinMax = myMetric2Comp2Group2MinMax[theGaussMetric][theCompID];
1520 TNames::const_iterator aNameIter = theGroupNames.begin();
1521 for( ; aNameIter != theGroupNames.end(); aNameIter++ ) {
1522 TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter );
1523 if( aGroup2MinMaxIter != aGroup2MinMax.end() ) {
1524 const TMinMax& aGroupMinMax = aGroup2MinMaxIter->second;
1525 aMinMax.first = std::min( aMinMax.first, aGroupMinMax.first );
1526 aMinMax.second = std::max( aMinMax.second, aGroupMinMax.second );
1527 anIsMinMaxInitialized = true;
1532 if( !anIsMinMaxInitialized )
1533 aMinMax = myMetric2Comp2MinMax[theGaussMetric][theCompID];
1541 ::GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric)
1544 bool anIsMinMaxInitialized = false;
1545 if( !theGroupNames.empty() ) {
1546 aMinMax.first = VTK_LARGE_FLOAT;
1547 aMinMax.second = -VTK_LARGE_FLOAT;
1549 const TGroup2MinMax& aGroup2MinMax = myMetric2Comp2Group2AverageMinMax[theGaussMetric][theCompID];
1550 TNames::const_iterator aNameIter = theGroupNames.begin();
1551 for( ; aNameIter != theGroupNames.end(); aNameIter++ ) {
1552 TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter );
1553 if( aGroup2MinMaxIter != aGroup2MinMax.end() ) {
1554 const TMinMax& aGroupMinMax = aGroup2MinMaxIter->second;
1555 aMinMax.first = std::min( aMinMax.first, aGroupMinMax.first );
1556 aMinMax.second = std::max( aMinMax.second, aGroupMinMax.second );
1557 anIsMinMaxInitialized = true;
1562 if( !anIsMinMaxInitialized )
1563 aMinMax = myMetric2Comp2AverageMinMax[theGaussMetric][theCompID];
1568 //----------------------------------------------------------------------------
1571 ::GetMeshValue(EGeometry theGeom) const
1573 TGeom2MeshValue::const_iterator anIter = myGeom2MeshValue.find(theGeom);
1574 if(anIter == myGeom2MeshValue.end())
1575 EXCEPTION(std::runtime_error,"TGeom2Value::GetMeshValue - myGeom2MeshValue.find(theGeom) fails");
1576 return anIter->second;
1581 ::GetMeshValue(EGeometry theGeom)
1583 return myGeom2MeshValue[theGeom];
1587 //----------------------------------------------------------------------------
1590 ::GetGeom2MeshValue()
1592 return myGeom2MeshValue;
1595 const TGeom2MeshValue&
1597 ::GetGeom2MeshValue() const
1599 return myGeom2MeshValue;
1604 ::GetFirstMeshValue() const
1606 if(myGeom2MeshValue.size() == 1)
1607 return myGeom2MeshValue.begin()->second;
1608 return PMeshValue();
1612 //---------------------------------------------------------------
1614 ::TValForTimeImpl():
1615 myGaussPtsIDFilter(new TGaussPtsIDFilter()),
1616 myUnstructuredGridIDMapper(new TUnstructuredGridIDMapperImpl()),
1622 ::GetMeshValue(EGeometry theGeom) const
1624 return myGeom2Value.GetMeshValue(theGeom);
1629 ::GetMeshValue(EGeometry theGeom)
1631 return myGeom2Value.GetMeshValue(theGeom);
1636 ::GetGeom2MeshValue()
1638 return myGeom2Value.GetGeom2MeshValue();
1641 const TGeom2MeshValue&
1643 ::GetGeom2MeshValue() const
1645 return myGeom2Value.GetGeom2MeshValue();
1650 ::GetFirstMeshValue() const
1652 return myGeom2Value.GetFirstMeshValue();
1657 ::GetNbGauss(EGeometry theGeom) const
1659 TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.find(theGeom);
1660 if(anIter == myGeom2NbGauss.end()){
1663 return anIter->second;
1668 ::GetMaxNbGauss() const
1671 TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.begin();
1672 for(; anIter != myGeom2NbGauss.end(); anIter++){
1673 aNbGauss = std::max<int>(aNbGauss, anIter->second);
1682 size_t aSize = sizeof(TValForTimeImpl);
1683 const TGeom2MeshValue& aGeom2MeshValue = GetGeom2MeshValue();
1684 TGeom2MeshValue::const_iterator anIter = aGeom2MeshValue.begin();
1685 TGeom2MeshValue::const_iterator anIterEnd = aGeom2MeshValue.end();
1686 for(; anIter != anIterEnd; anIter++){
1687 const PMeshValue& aMeshValue = anIter->second;
1688 aSize += aMeshValue->GetMemorySize();
1689 aSize += sizeof(EGeometry);
1694 //---------------------------------------------------------------