1 // Copyright (C) 2007-2011 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;
196 return VISU::ePOLYGONE;
197 case VTK_CONVEX_POINT_SET:
198 return VISU::ePOLYEDRE;
200 #if defined(VISU_ENABLE_QUADRATIC) && defined(VISU_USE_VTK_QUADRATIC)
201 #if defined(VTK_QUADRATIC_EDGE)
202 case VTK_QUADRATIC_EDGE:
206 #if defined(VTK_QUADRATIC_TRIANGLE)
207 case VTK_QUADRATIC_TRIANGLE:
211 #if defined(VTK_QUADRATIC_QUAD)
212 case VTK_QUADRATIC_QUAD:
216 #if defined(VTK_QUADRATIC_TETRA)
217 case VTK_QUADRATIC_TETRA:
218 return VISU::eTETRA10;
221 #if defined(VTK_QUADRATIC_HEXAHEDRON)
222 case VTK_QUADRATIC_HEXAHEDRON:
223 return VISU::eHEXA20;
226 #if defined(VTK_QUADRATIC_WEDGE)
227 case VTK_QUADRATIC_WEDGE:
228 return VISU::ePENTA15;
231 #if defined(VTK_QUADRATIC_PYRAMID)
232 case VTK_QUADRATIC_PYRAMID:
233 return VISU::ePYRA13;
236 #endif //VISU_ENABLE_QUADRATIC
239 return EGeometry(-1);
243 //---------------------------------------------------------------
244 /*! Computes number of points by the given number of cells
245 * in assumption of regular hexahedral mesh structure
248 GetNumberOfPoints(size_t theNbCells)
250 return size_t(pow(pow(theNbCells, 1.0/3.0) + 1.0, 3.0));
253 //---------------------------------------------------------------
254 /*! Computes size dataset the given number of mesh macro metrics
255 * in assumption of regular hexahedral mesh structure
258 GetDataSetSize(size_t theNbOfPoints,
261 bool theComputeLinks)
263 size_t aPointsSize = 3*theNbOfPoints*sizeof(VISU::TCoord);
264 size_t aConnectivityAndTypesSize = theCellsSize*sizeof(vtkIdType);
265 size_t aLocationsSize = theNbOfCells*sizeof(int);
266 vtkFloatingPointType aNbCellsPerPoint = theCellsSize / theNbOfCells - 1;
267 size_t aLinksSize = theNbOfPoints * (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(short));
270 size_t aResult = aPointsSize + aConnectivityAndTypesSize + aLocationsSize + aLinksSize;
274 //---------------------------------------------------------------
282 //---------------------------------------------------------------
291 if(!mySource.GetPointer()){
292 mySource = vtkPolyData::New();
300 ::GetPolyDataOutput()
302 return GetSource().GetPointer();
309 if(vtkDataSet* anOutput = GetPolyDataOutput()){
311 return anOutput->GetActualMemorySize() * 1024;
314 size_t aNbPoints = GetNumberOfPoints(myNbCells);
315 return GetDataSetSize(aNbPoints, myNbCells, myCellsSize, false);
317 throw std::runtime_error("TUnstructuredGridHolder::GetMemorySize - myIsDone == false !!!");
321 //---------------------------------------------------------------
322 TUnstructuredGridHolder
323 ::TUnstructuredGridHolder()
326 const PUnstructuredGrid&
327 TUnstructuredGridHolder
330 if(!mySource.GetPointer()){
331 mySource = vtkUnstructuredGrid::New();
338 TUnstructuredGridHolder
339 ::GetUnstructuredGridOutput()
341 return GetSource().GetPointer();
345 TUnstructuredGridHolder
348 if(vtkDataSet* anOutput = GetUnstructuredGridOutput()){
350 return anOutput->GetActualMemorySize() * 1024;
353 size_t aNbPoints = GetNumberOfPoints(myNbCells);
354 return GetDataSetSize(aNbPoints, myNbCells, myCellsSize, false);
356 throw std::runtime_error("TUnstructuredGridHolder::GetMemorySize - myIsDone == false !!!");
360 //---------------------------------------------------------------
366 if(vtkDataSet* anOutput = GetOutput()){
368 return anOutput->GetActualMemorySize() * 1024;
371 throw std::runtime_error("TMemoryCheckIDMapper::GetMemorySize - myIsVTKDone == false !!!");
376 //---------------------------------------------------------------
378 ::TAppendFilterHolder()
385 if(!myFilter.GetPointer()){
386 myFilter = VISU_AppendFilter::New();
388 myFilter->SetMappingInputs(true);
395 ::GetUnstructuredGridOutput()
397 GetFilter()->Update();
398 return GetFilter()->GetOutput();
401 //---------------------------------------------------------------
402 TAppendPolyDataHolder
403 ::TAppendPolyDataHolder()
406 const PAppendPolyData&
407 TAppendPolyDataHolder
410 if(!myFilter.GetPointer()){
411 myFilter = VISU_AppendPolyData::New();
412 myFilter->SetMappingInputs(true);
419 TAppendPolyDataHolder
420 ::GetPolyDataOutput()
422 GetFilter()->Update();
423 return GetFilter()->GetOutput();
427 //---------------------------------------------------------------
429 ::TMergeFilterHolder()
436 if(!myFilter.GetPointer()){
437 myFilter = VISU_MergeFilter::New();
447 GetFilter()->Update();
448 return GetFilter()->GetOutput();
452 //---------------------------------------------------------------
476 return myNamedPointCoords->GetPointSet();
480 //---------------------------------------------------------------
481 TSubProfileImpl::TSubProfileImpl():
489 ::GetElemObjID(vtkIdType theID) const
491 if ( !mySubMeshID.empty() )
492 return mySubMeshID[theID];
500 ::GetElemVTKID(vtkIdType theID) const
502 if ( !mySubMeshID.empty() )
503 for ( size_t anId = 0; anId < mySubMeshID.size(); anId++ )
504 if ( mySubMeshID[ anId ] == theID )
514 size_t aSize = TUnstructuredGridHolder::GetMemorySize();
515 aSize += sizeof(vtkIdType) * mySubMeshID.size();
523 return strcmp(myName.c_str(),"") == 0;
526 //---------------------------------------------------------------
528 operator<(const PSubProfile& theLeft, const PSubProfile& theRight)
530 PSubProfileImpl aLeft(theLeft), aRight(theRight);
532 if(aLeft->myGeom != aRight->myGeom)
533 return aLeft->myGeom < aRight->myGeom;
535 if(aLeft->myStatus != aRight->myStatus)
536 return aLeft->myStatus < aRight->myStatus;
538 return aLeft->myName < aRight->myName;
542 //---------------------------------------------------------------
551 ::GetNodeObjID(vtkIdType theID) const
553 return myNamedPointCoords->GetObjID(theID);
558 ::GetNodeVTKID(vtkIdType theID) const
560 return myNamedPointCoords->GetVTKID(theID);
563 vtkFloatingPointType*
565 ::GetNodeCoord(vtkIdType theObjID)
568 return myMeshOnEntity->GetNodeCoord(theObjID);
570 vtkIdType aVtkID = GetNodeVTKID(theObjID);
571 return GetFilter()->GetOutput()->GetPoint(aVtkID);
576 ::GetElemObjID(vtkIdType theID) const
578 return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
583 ::GetElemVTKID(vtkIdType theID) const
585 return VISU::GetElemVTKID(GetFilter()->GetOutput(), theID);
590 ::GetElemCell(vtkIdType theObjID)
593 return myMeshOnEntity->GetElemCell(theObjID);
595 vtkIdType aVtkID = GetElemVTKID(theObjID);
596 return GetFilter()->GetOutput()->GetCell(aVtkID);
601 ::GetUnstructuredGridOutput()
603 const PAppendFilter& anAppendFilter = GetFilter();
604 return anAppendFilter->GetOutput();
611 size_t aSize = TAppendFilterHolder::GetMemorySize();
612 aSize += myNamedPointCoords->GetMemorySize();
613 aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
614 TGeom2SubProfile::const_iterator anIter = myGeom2SubProfile.begin();
615 TGeom2SubProfile::const_iterator anIterEnd = myGeom2SubProfile.end();
616 for(; anIter != anIterEnd; anIter++){
617 const PSubProfileImpl& aSubProfile = anIter->second;
618 aSize += aSubProfile->GetMemorySize();
619 aSize += sizeof(EGeometry);
626 ::GetNodeName(vtkIdType theObjID) const
628 return myNamedPointCoords->GetNodeName(theObjID);
633 ::GetElemName(vtkIdType theObjID) const
635 return myMeshOnEntity->GetElemName(theObjID);
639 //---------------------------------------------------------------
640 TUnstructuredGridIDMapperImpl
641 ::TUnstructuredGridIDMapperImpl()
643 if ( !myCommonCellsFilter.GetPointer() ) {
644 myCommonCellsFilter = VISU_CommonCellsFilter::New();
645 myCommonCellsFilter->Delete();
650 TUnstructuredGridIDMapperImpl
651 ::GetNodeObjID(vtkIdType theID) const
653 return myIDMapper->GetNodeObjID(theID);
657 TUnstructuredGridIDMapperImpl
658 ::GetNodeVTKID(vtkIdType theID) const
660 return myIDMapper->GetNodeVTKID(theID);
663 vtkFloatingPointType*
664 TUnstructuredGridIDMapperImpl
665 ::GetNodeCoord(vtkIdType theObjID)
667 return myIDMapper->GetNodeCoord(theObjID);
671 TUnstructuredGridIDMapperImpl
672 ::GetElemObjID(vtkIdType theID) const
674 return myIDMapper->GetElemObjID(theID);
678 TUnstructuredGridIDMapperImpl
679 ::GetElemVTKID(vtkIdType theID) const
681 return myIDMapper->GetElemVTKID(theID);
685 TUnstructuredGridIDMapperImpl
686 ::GetElemCell(vtkIdType theObjID)
688 return myIDMapper->GetElemCell(theObjID);
692 TUnstructuredGridIDMapperImpl
693 ::SetReferencedMesh( const PNamedIDMapper& theNamedIDMapper )
695 myCommonCellsFilter->SetCellsUG( theNamedIDMapper->GetUnstructuredGridOutput() );
699 TUnstructuredGridIDMapperImpl
702 if ( !myFilter.GetPointer() ) {
703 const PAppendFilter& anAppendFilter = myIDMapper->GetFilter();
705 vtkUnstructuredGrid* aGeometry = anAppendFilter->GetOutput();
706 const PUnstructuredGrid& aSource = mySource.GetSource();
707 vtkUnstructuredGrid* aDataSet = aSource.GetPointer();
708 aDataSet->ShallowCopy( aGeometry );
710 const PMergeFilter& aFilter = GetFilter();
711 aFilter->SetGeometry( aGeometry );
712 aFilter->SetScalars( aDataSet );
713 aFilter->SetVectors( aDataSet );
714 aFilter->AddField( "VISU_FIELD", aDataSet );
715 aFilter->AddField( "VISU_FIELD_GAUSS_MIN", aDataSet );
716 aFilter->AddField( "VISU_FIELD_GAUSS_MAX", aDataSet );
717 aFilter->AddField( "VISU_FIELD_GAUSS_MOD", aDataSet );
718 aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet );
719 aFilter->AddField( "ELNO_FIELD", aDataSet );
720 aFilter->AddField( "ELNO_COMPONENT_MAPPER", aDataSet );
721 aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet );
723 myCommonCellsFilter->SetProfileUG( aFilter->GetUnstructuredGridOutput() );
728 TUnstructuredGridIDMapperImpl
729 ::GetUnstructuredGridOutput()
732 return myCommonCellsFilter->GetOutput();
736 TUnstructuredGridIDMapperImpl
739 return GetUnstructuredGridOutput();
743 TUnstructuredGridIDMapperImpl
747 return mySource.GetSource();
751 TUnstructuredGridIDMapperImpl
754 size_t aSize = myIDMapper->GetMemorySize();
756 aSize += mySource.GetMemorySize();
758 if ( vtkUnstructuredGrid* anOutput = myCommonCellsFilter->GetOutput() )
759 aSize += anOutput->GetActualMemorySize() * 1024;
764 //---------------------------------------------------------------
766 TPolyDataIDMapperImpl
767 ::GetNodeObjID(vtkIdType theID) const
769 return myIDMapper->GetNodeObjID(theID);
773 TPolyDataIDMapperImpl
774 ::GetNodeVTKID(vtkIdType theID) const
776 return myIDMapper->GetNodeVTKID(theID);
779 vtkFloatingPointType*
780 TPolyDataIDMapperImpl
781 ::GetNodeCoord(vtkIdType theObjID)
783 return myIDMapper->GetNodeCoord(theObjID);
787 TPolyDataIDMapperImpl
788 ::GetElemObjID(vtkIdType theID) const
790 return myIDMapper->GetElemObjID(theID);
794 TPolyDataIDMapperImpl
795 ::GetElemVTKID(vtkIdType theID) const
797 return myIDMapper->GetElemVTKID(theID);
801 TPolyDataIDMapperImpl
802 ::GetElemCell(vtkIdType theObjID)
804 return myIDMapper->GetElemCell(theObjID);
808 TPolyDataIDMapperImpl
811 if ( !myFilter.GetPointer() ) {
812 const PAppendPolyData& anAppendFilter = myIDMapper->GetFilter();
813 vtkPolyData* aGeometry = anAppendFilter->GetOutput();
815 const PPolyData& aSource = mySource.GetSource();
816 vtkPolyData* aDataSet = aSource.GetPointer();
817 aDataSet->ShallowCopy( aGeometry );
819 const PMergeFilter& aFilter = GetFilter();
820 aFilter->SetGeometry( aGeometry );
821 aFilter->SetScalars( aDataSet );
822 aFilter->SetVectors( aDataSet );
823 aFilter->AddField( "VISU_FIELD", aDataSet );
824 aFilter->AddField( "VISU_FIELD_GAUSS_MIN", aDataSet );
825 aFilter->AddField( "VISU_FIELD_GAUSS_MAX", aDataSet );
826 aFilter->AddField( "VISU_FIELD_GAUSS_MOD", aDataSet );
827 aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet );
828 aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet );
833 TPolyDataIDMapperImpl
834 ::GetPolyDataOutput()
837 return myFilter->GetPolyDataOutput();
841 TPolyDataIDMapperImpl
844 return GetPolyDataOutput();
848 TPolyDataIDMapperImpl
852 return mySource.GetSource();
856 TPolyDataIDMapperImpl
859 size_t aSize = myIDMapper->GetMemorySize();
860 aSize += mySource.GetMemorySize();
865 //---------------------------------------------------------------
868 myGeom(EGeometry(-1)),
874 ::LessThan(const PGaussImpl& theGauss,
875 bool& theResult) const
881 //---------------------------------------------------------------
883 ::TGaussSubMeshImpl():
884 myPointCoords(new TPointCoords()),
891 ::GetObjID(vtkIdType theID) const
893 TCellID aCellID = myStartID + theID / myGauss->myNbPoints;
894 TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
896 return TGaussPointID(aCellID, aLocalPntID);
901 ::GetVTKID(const TGaussPointID& theID) const
903 vtkIdType aResult = -1;
905 TCellID aCellID = theID.first;
906 TLocalPntID aLocalPntID = theID.second;
908 vtkIdType aNbPoints = myGauss->myNbPoints;
909 if ( aLocalPntID >= aNbPoints )
912 return ( aCellID - myStartID ) * aNbPoints + aLocalPntID;
916 VISU::TGaussSubMeshImpl
917 ::GetElemObjID(vtkIdType theID) const
919 return mySubProfile->GetElemObjID( theID );
924 VISU::TGaussSubMeshImpl
925 ::GetElemVTKID(vtkIdType theID) const
927 return mySubProfile->GetElemVTKID( theID );
932 ::GetGlobalID(vtkIdType theID) const
934 return myStartID + theID;
941 size_t aSize = TPolyDataHolder::GetMemorySize();
942 aSize += myPointCoords->GetMemorySize();
946 //---------------------------------------------------------------
948 operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight)
950 PGaussSubMeshImpl aLeft(theLeft), aRight(theRight);
951 const PGaussImpl& aGaussLeft = aLeft->myGauss;
952 const PGaussImpl& aGaussRight = aRight->myGauss;
954 if(aGaussLeft->myGeom != aGaussRight->myGeom)
955 return aGaussLeft->myGeom < aGaussRight->myGeom;
957 if(aLeft->mySubProfile != aRight->mySubProfile)
958 return aLeft->mySubProfile < aRight->mySubProfile;
961 aGaussLeft->LessThan(aGaussRight,aResult);
967 //---------------------------------------------------------------
975 ::GetObjID(vtkIdType theID) const
977 const PAppendPolyData& aFilter = GetFilter();
978 return VISU::GetObjID(aFilter->GetOutput(), theID);
983 ::GetVTKID(const TGaussPointID& theID) const
985 vtkIdType aResult = -1;
987 TCellID aCellID = theID.first;
989 vtkIdType aVTKCellId = GetParent()->GetElemVTKID( aCellID );
990 if ( aVTKCellId < 0 )
993 vtkCell* aCell = GetParent()->GetElemCell( aCellID );
997 EGeometry aVGeom = VISU::VTKGeom2VISU( aCell->GetCellType() );
998 if ( aVGeom < EGeometry(0) )
1001 TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.find( aVGeom );
1002 if ( anIter == myGeom2GaussSubMesh.end() )
1005 size_t aSubMeshEnd = myGaussSubMeshArr.size();
1006 const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
1007 for ( size_t aSubMeshId = 0; aSubMeshId < aSubMeshEnd; aSubMeshId++ ) {
1008 const PGaussSubMeshImpl& aSubMesh = myGaussSubMeshArr[aSubMeshId];
1009 if ( aGaussSubMesh.get() == aSubMesh.get() ) {
1010 return aGaussSubMesh->GetVTKID(theID);
1019 ::GetPolyDataOutput()
1021 return TAppendPolyDataHolder::GetPolyDataOutput();
1028 size_t aSize = TAppendPolyDataHolder::GetMemorySize();
1029 TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.begin();
1030 TGeom2GaussSubMesh::const_iterator anIterEnd = myGeom2GaussSubMesh.end();
1031 for(; anIter != anIterEnd; anIter++){
1032 const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
1033 aSize += aGaussSubMesh->GetMemorySize();
1034 aSize += sizeof(EGeometry);
1047 //---------------------------------------------------------------
1050 ::GetObjID(vtkIdType theID) const
1052 return myGaussPtsIDMapper->GetObjID(theID);
1057 ::GetVTKID(const TGaussPointID& theID) const
1059 return myGaussPtsIDMapper->GetVTKID(theID);
1066 return myGaussPtsIDMapper->GetParent();
1071 ::GetPolyDataOutput()
1073 return TPolyDataIDMapperImpl::GetPolyDataOutput();
1080 return GetPolyDataOutput();
1084 //---------------------------------------------------------------
1092 ::CopyStructure( PStructured theStructured )
1094 TStructured::CopyStructure( theStructured );
1096 if ( PMeshImpl aMesh = theStructured )
1097 GetSource()->ShallowCopy( aMesh->GetPointSet() );
1102 ::GetElemObjID(vtkIdType theID) const
1104 return myStartID + theID;
1109 ::GetElemName(vtkIdType theObjID) const
1118 size_t aSize = TUnstructuredGridHolder::GetMemorySize();
1119 for(size_t anId = 0; anId < myCell2Connect.size(); anId++){
1120 const TConnect& aConnect = myCell2Connect[anId];
1121 aSize += aConnect.size() * sizeof(vtkIdType);
1126 //---------------------------------------------------------------
1128 ::TMeshOnEntityImpl()
1130 const PAppendFilter& anAppendFilter = GetFilter();
1131 anAppendFilter->SetMappingInputs(true);
1136 ::CopyStructure( PStructured theStructured )
1138 TStructured::CopyStructure( theStructured );
1140 if ( PMeshImpl aMesh = theStructured )
1141 myNamedPointCoords = aMesh->myNamedPointCoords;
1146 ::GetNodeVTKID(vtkIdType theID) const
1148 return myNamedPointCoords->GetVTKID(theID);
1153 ::GetNodeObjID(vtkIdType theID) const
1155 return myNamedPointCoords->GetObjID(theID);
1160 ::GetElemVTKID(vtkIdType theID) const
1162 return VISU::GetElemVTKID(GetFilter()->GetOutput(), theID);
1167 ::GetElemObjID(vtkIdType theID) const
1169 return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
1174 ::GetNodeName(vtkIdType theObjID) const
1176 return myNamedPointCoords->GetNodeName(theObjID);
1181 ::GetElemName(vtkIdType theObjID) const
1183 TInputCellID anInputCellID = VISU::GetInputCellID(GetFilter()->GetOutput(), theObjID);
1184 const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputCellID.first];
1185 return aSubMesh->GetElemName(anInputCellID.second);
1188 vtkUnstructuredGrid*
1190 ::GetUnstructuredGridOutput()
1192 return TAppendFilterHolder::GetUnstructuredGridOutput();
1199 size_t aSize = TAppendFilterHolder::GetMemorySize();
1200 aSize += myNamedPointCoords->GetMemorySize();
1201 aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1202 TGeom2SubMesh::const_iterator anIter = myGeom2SubMesh.begin();
1203 TGeom2SubMesh::const_iterator anIterEnd = myGeom2SubMesh.end();
1204 for(; anIter != anIterEnd; anIter++){
1205 const PSubMeshImpl& aSubMesh = anIter->second;
1206 aSize += aSubMesh->GetMemorySize();
1207 aSize += sizeof(EGeometry);
1212 //---------------------------------------------------------------
1215 ::CopyStructure( PStructured theStructured )
1217 TStructured::CopyStructure( theStructured );
1219 if ( PMeshImpl aMesh = theStructured ) {
1220 myNamedPointCoords = aMesh->myNamedPointCoords;
1221 GetSource()->ShallowCopy( aMesh->GetPointSet() );
1227 ::GetElemVTKID(vtkIdType theID) const
1229 if(myElemObj2VTKID.empty())
1232 TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
1233 if(anIter != myElemObj2VTKID.end())
1234 return anIter->second;
1241 ::GetElemObjID(vtkIdType theID) const
1243 return myMeshID[theID];
1248 ::GetNodeObjID(vtkIdType theID) const
1250 return myNamedPointCoords->GetObjID(theID);
1255 ::GetNodeVTKID(vtkIdType theID) const
1257 return myNamedPointCoords->GetVTKID(theID);
1260 vtkUnstructuredGrid*
1262 ::GetUnstructuredGridOutput()
1264 return TUnstructuredGridHolder::GetUnstructuredGridOutput();
1271 size_t aSize = TUnstructuredGridHolder::GetMemorySize();
1272 aSize += myNamedPointCoords->GetMemorySize();
1273 aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1274 aSize += myMeshID.size() * sizeof(vtkIdType);
1275 TGeom2SubMeshID::const_iterator anIter = myGeom2SubMeshID.begin();
1276 TGeom2SubMeshID::const_iterator anIterEnd = myGeom2SubMeshID.end();
1277 for(; anIter != anIterEnd; anIter++){
1278 const TSubMeshID& aSubMeshID = anIter->second;
1279 aSize += aSubMeshID.size() * sizeof(vtkIdType);
1280 aSize += sizeof(EGeometry);
1286 //---------------------------------------------------------------
1289 ::CopyStructure( PStructured theStructured )
1291 TStructured::CopyStructure( theStructured );
1293 if ( PMeshImpl aMesh = theStructured )
1294 myNamedPointCoords = aMesh->myNamedPointCoords;
1299 ::GetNbASizeCells() const
1301 vtkIdType aNbCells = 0, aCellsSize = 0;
1302 TFamilySet::const_iterator anIter = myFamilySet.begin();
1303 for(; anIter != myFamilySet.end(); anIter++){
1304 PFamilyImpl aFamily = (*anIter).second;
1305 aNbCells += aFamily->myNbCells;
1306 aCellsSize += aFamily->myCellsSize;
1308 return std::make_pair(aNbCells,aCellsSize);
1313 ::GetElemVTKID(vtkIdType theID) const
1315 if(myElemObj2VTKID.empty())
1318 TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
1319 if(anIter != myElemObj2VTKID.end())
1320 return anIter->second;
1327 ::GetElemObjID(vtkIdType theID) const
1329 return VISU::GetElemObjID(GetFilter()->GetOutput(), theID);
1334 ::GetNodeObjID(vtkIdType theID) const
1336 return myNamedPointCoords->GetObjID(theID);
1341 ::GetNodeVTKID(vtkIdType theID) const
1343 return myNamedPointCoords->GetVTKID(theID);
1346 vtkUnstructuredGrid*
1348 ::GetUnstructuredGridOutput()
1350 return TAppendFilterHolder::GetUnstructuredGridOutput();
1357 size_t aSize = TAppendFilterHolder::GetMemorySize();
1358 aSize += myNamedPointCoords->GetMemorySize();
1359 aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
1360 for(size_t anId = 0; anId < myFamilyArr.size(); anId++){
1361 const PFamilyImpl& aFamily = myFamilyArr[anId];
1362 aSize += aFamily->GetMemorySize();
1369 //---------------------------------------------------------------
1378 ::Init(vtkIdType theNbComp,
1379 vtkIdType theDataType)
1381 myNbComp = theNbComp;
1382 myDataType = theDataType;
1383 myCompNames.resize(theNbComp);
1384 myUnitNames.resize(theNbComp);
1386 myMetric2Comp2MinMax.resize(3);
1387 myMetric2Comp2AverageMinMax.resize(3);
1388 myMetric2Comp2Group2MinMax.resize(3);
1389 myMetric2Comp2Group2AverageMinMax.resize(3);
1390 for(int aGaussMetric = (int)VISU::AVERAGE_METRIC; aGaussMetric <= (int)VISU::MAXIMUM_METRIC; aGaussMetric++){
1391 TComp2MinMax& aComp2MinMax = myMetric2Comp2MinMax[aGaussMetric];
1392 TComp2MinMax& aComp2AverageMinMax = myMetric2Comp2AverageMinMax[aGaussMetric];
1393 TComp2Group2MinMax& aComp2Group2MinMax = myMetric2Comp2Group2MinMax[aGaussMetric];
1394 TComp2Group2MinMax& aComp2Group2AverageMinMax = myMetric2Comp2Group2AverageMinMax[aGaussMetric];
1396 aComp2MinMax.resize(theNbComp + 1);
1397 aComp2AverageMinMax.resize(theNbComp + 1);
1398 aComp2Group2MinMax.resize(theNbComp + 1);
1399 aComp2Group2AverageMinMax.resize(theNbComp + 1);
1400 for(vtkIdType iComp = 0; iComp <= theNbComp; iComp++){
1401 TMinMax& aMinMax = aComp2MinMax[iComp];
1402 aMinMax.first = VTK_LARGE_FLOAT;
1403 aMinMax.second = -VTK_LARGE_FLOAT;
1404 TMinMax& anAverageMinMax = aComp2AverageMinMax[iComp];
1405 anAverageMinMax.first = VTK_LARGE_FLOAT;
1406 anAverageMinMax.second = -VTK_LARGE_FLOAT;
1413 ::GetDataType() const
1420 ::GetMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric)
1423 bool anIsMinMaxInitialized = false;
1424 if( !theGroupNames.empty() ) {
1425 aMinMax.first = VTK_LARGE_FLOAT;
1426 aMinMax.second = -VTK_LARGE_FLOAT;
1428 const TGroup2MinMax& aGroup2MinMax = myMetric2Comp2Group2MinMax[theGaussMetric][theCompID];
1429 TNames::const_iterator aNameIter = theGroupNames.begin();
1430 for( ; aNameIter != theGroupNames.end(); aNameIter++ ) {
1431 TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter );
1432 if( aGroup2MinMaxIter != aGroup2MinMax.end() ) {
1433 const TMinMax& aGroupMinMax = aGroup2MinMaxIter->second;
1434 aMinMax.first = std::min( aMinMax.first, aGroupMinMax.first );
1435 aMinMax.second = std::max( aMinMax.second, aGroupMinMax.second );
1436 anIsMinMaxInitialized = true;
1441 if( !anIsMinMaxInitialized )
1442 aMinMax = myMetric2Comp2MinMax[theGaussMetric][theCompID];
1450 ::GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric)
1453 bool anIsMinMaxInitialized = false;
1454 if( !theGroupNames.empty() ) {
1455 aMinMax.first = VTK_LARGE_FLOAT;
1456 aMinMax.second = -VTK_LARGE_FLOAT;
1458 const TGroup2MinMax& aGroup2MinMax = myMetric2Comp2Group2AverageMinMax[theGaussMetric][theCompID];
1459 TNames::const_iterator aNameIter = theGroupNames.begin();
1460 for( ; aNameIter != theGroupNames.end(); aNameIter++ ) {
1461 TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter );
1462 if( aGroup2MinMaxIter != aGroup2MinMax.end() ) {
1463 const TMinMax& aGroupMinMax = aGroup2MinMaxIter->second;
1464 aMinMax.first = std::min( aMinMax.first, aGroupMinMax.first );
1465 aMinMax.second = std::max( aMinMax.second, aGroupMinMax.second );
1466 anIsMinMaxInitialized = true;
1471 if( !anIsMinMaxInitialized )
1472 aMinMax = myMetric2Comp2AverageMinMax[theGaussMetric][theCompID];
1477 //----------------------------------------------------------------------------
1480 ::GetMeshValue(EGeometry theGeom) const
1482 TGeom2MeshValue::const_iterator anIter = myGeom2MeshValue.find(theGeom);
1483 if(anIter == myGeom2MeshValue.end())
1484 EXCEPTION(std::runtime_error,"TGeom2Value::GetMeshValue - myGeom2MeshValue.find(theGeom) fails");
1485 return anIter->second;
1490 ::GetMeshValue(EGeometry theGeom)
1492 return myGeom2MeshValue[theGeom];
1496 //----------------------------------------------------------------------------
1499 ::GetGeom2MeshValue()
1501 return myGeom2MeshValue;
1504 const TGeom2MeshValue&
1506 ::GetGeom2MeshValue() const
1508 return myGeom2MeshValue;
1513 ::GetFirstMeshValue() const
1515 if(myGeom2MeshValue.size() == 1)
1516 return myGeom2MeshValue.begin()->second;
1517 return PMeshValue();
1521 //---------------------------------------------------------------
1523 ::TValForTimeImpl():
1524 myGaussPtsIDFilter(new TGaussPtsIDFilter()),
1525 myUnstructuredGridIDMapper(new TUnstructuredGridIDMapperImpl()),
1531 ::GetMeshValue(EGeometry theGeom) const
1533 return myGeom2Value.GetMeshValue(theGeom);
1538 ::GetMeshValue(EGeometry theGeom)
1540 return myGeom2Value.GetMeshValue(theGeom);
1545 ::GetGeom2MeshValue()
1547 return myGeom2Value.GetGeom2MeshValue();
1550 const TGeom2MeshValue&
1552 ::GetGeom2MeshValue() const
1554 return myGeom2Value.GetGeom2MeshValue();
1559 ::GetFirstMeshValue() const
1561 return myGeom2Value.GetFirstMeshValue();
1566 ::GetNbGauss(EGeometry theGeom) const
1568 TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.find(theGeom);
1569 if(anIter == myGeom2NbGauss.end()){
1572 return anIter->second;
1577 ::GetMaxNbGauss() const
1580 TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.begin();
1581 for(; anIter != myGeom2NbGauss.end(); anIter++){
1582 aNbGauss = std::max<int>(aNbGauss, anIter->second);
1591 size_t aSize = sizeof(TValForTimeImpl);
1592 const TGeom2MeshValue& aGeom2MeshValue = GetGeom2MeshValue();
1593 TGeom2MeshValue::const_iterator anIter = aGeom2MeshValue.begin();
1594 TGeom2MeshValue::const_iterator anIterEnd = aGeom2MeshValue.end();
1595 for(; anIter != anIterEnd; anIter++){
1596 const PMeshValue& aMeshValue = anIter->second;
1597 aSize += aMeshValue->GetMemorySize();
1598 aSize += sizeof(EGeometry);
1603 //---------------------------------------------------------------