namespace VISU
{
+ //---------------------------------------------------------------
+ vtkIdType
+ VISUGeom2NbNodes(EGeometry theGeom)
+ {
+ switch(theGeom){
+#ifndef VISU_ENABLE_QUADRATIC
+ case VISU::eSEG3:
+ return 2;
+ case VISU::eTRIA6:
+ return 3;
+ case VISU::eQUAD8:
+ return 4;
+ case VISU::eTETRA10:
+ return 4;
+ case VISU::eHEXA20:
+ return 8;
+ case VISU::ePENTA15:
+ return 6;
+ case VISU::ePYRA13:
+ return 5;
+#endif
+ case VISU::ePOLYGONE:
+ case VISU::ePOLYEDRE:
+ return -1;
+ default:
+ return theGeom % 100;
+ }
+ }
+
+ vtkIdType
+ VISUGeom2VTK(EGeometry theGeom)
+ {
+ switch(theGeom){
+ case VISU::ePOINT1:
+ return VTK_VERTEX;
+ case VISU::eSEG2:
+ return VTK_LINE;
+ case VISU::eTRIA3:
+ return VTK_TRIANGLE;
+ case VISU::eQUAD4:
+ return VTK_QUAD;
+ case VISU::eTETRA4:
+ return VTK_TETRA;
+ case VISU::eHEXA8:
+ return VTK_HEXAHEDRON;
+ case VISU::ePENTA6:
+ return VTK_WEDGE;
+ case VISU::ePYRA5:
+ return VTK_PYRAMID;
+
+ case VISU::ePOLYGONE:
+ return VTK_POLYGON;
+ case VISU::ePOLYEDRE:
+ return VTK_CONVEX_POINT_SET;
+
+#ifndef VISU_ENABLE_QUADRATIC
+ case VISU::eSEG3:
+ return VTK_LINE;
+ case VISU::eTRIA6:
+ return VTK_TRIANGLE;
+ case VISU::eQUAD8:
+ return VTK_QUAD;
+ case VISU::eTETRA10:
+ return VTK_TETRA;
+ case VISU::eHEXA20:
+ return VTK_HEXAHEDRON;
+ case VISU::ePENTA15:
+ return VTK_WEDGE;
+ case VISU::ePYRA13:
+ return VTK_PYRAMID;
+
+#else
+
+ case VISU::eSEG3:
+#if defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)
+ return VTK_QUADRATIC_EDGE;
+#else
+ return VTK_POLY_LINE;
+#endif
+
+ case VISU::eTRIA6:
+#if defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)
+ return VTK_QUADRATIC_TRIANGLE;
+#else
+ return VTK_POLYGON;
+#endif
+
+ case VISU::eQUAD8:
+#if defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)
+ return VTK_QUADRATIC_QUAD;
+#else
+ return VTK_POLYGON;
+#endif
+
+ case VISU::eTETRA10:
+#if defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)
+ return VTK_QUADRATIC_TETRA;
+#else
+ return VTK_CONVEX_POINT_SET;
+#endif
+
+ case VISU::eHEXA20:
+#if defined(VTK_QUADRATIC_HEXAHEDRON) && defined(VISU_USE_VTK_QUADRATIC)
+ return VTK_QUADRATIC_HEXAHEDRON;
+#else
+ return VTK_CONVEX_POINT_SET;
+#endif
+
+ case VISU::ePENTA15:
+#if defined(VTK_QUADRATIC_WEDGE) && defined(VISU_USE_VTK_QUADRATIC)
+ return VTK_QUADRATIC_WEDGE;
+#else
+ return VTK_CONVEX_POINT_SET;
+#endif
+
+ case VISU::ePYRA13:
+#if defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)
+ return VTK_QUADRATIC_PYRAMID;
+#else
+ return VTK_CONVEX_POINT_SET;
+#endif
+
+#endif //VISU_ENABLE_QUADRATIC
+
+ default:
+ return -1;
+ }
+ }
+
+
+ EGeometry
+ VTKGeom2VISU(vtkIdType theGeom)
+ {
+ switch(theGeom){
+ case VTK_VERTEX:
+ return VISU::ePOINT1;
+ case VTK_LINE:
+ return VISU::eSEG2;
+ case VTK_TRIANGLE:
+ return VISU::eTRIA3;
+ case VTK_QUAD:
+ return VISU::eQUAD4;
+ case VTK_TETRA:
+ return VISU::eTETRA4;
+ case VTK_HEXAHEDRON:
+ return VISU::eHEXA8;
+ case VTK_WEDGE:
+ return VISU::ePENTA6;
+ case VTK_PYRAMID:
+ return VISU::ePYRA5;
+
+ case VTK_POLYGON:
+ return VISU::ePOLYGONE;
+ case VTK_CONVEX_POINT_SET:
+ return VISU::ePOLYEDRE;
+
+#if defined(VISU_ENABLE_QUADRATIC) && defined(VISU_USE_VTK_QUADRATIC)
+ #if defined(VTK_QUADRATIC_EDGE)
+ case VTK_QUADRATIC_EDGE:
+ return VISU::eSEG3;
+ #endif
+
+ #if defined(VTK_QUADRATIC_TRIANGLE)
+ case VTK_QUADRATIC_TRIANGLE:
+ return VISU::eTRIA6;
+ #endif
+
+ #if defined(VTK_QUADRATIC_QUAD)
+ case VTK_QUADRATIC_QUAD:
+ return VISU::eQUAD8;
+ #endif
+
+ #if defined(VTK_QUADRATIC_TETRA)
+ case VTK_QUADRATIC_TETRA:
+ return VISU::eTETRA10;
+ #endif
+
+ #if defined(VTK_QUADRATIC_HEXAHEDRON)
+ case VTK_QUADRATIC_HEXAHEDRON:
+ return VISU::eHEXA20;
+ #endif
+
+ #if defined(VTK_QUADRATIC_WEDGE)
+ case VTK_QUADRATIC_WEDGE:
+ return VISU::ePENTA15;
+ #endif
+
+ #if defined(VTK_QUADRATIC_PYRAMID)
+ case VTK_QUADRATIC_PYRAMID:
+ return VISU::ePYRA13;
+ #endif
+
+#endif //VISU_ENABLE_QUADRATIC
+
+ default:
+ return EGeometry(-1);
+ }
+ }
+
+
//---------------------------------------------------------------
TIsVTKDone::TIsVTKDone():
myIsVTKDone(false),
TSubProfileImpl
::GetElemObjID(vtkIdType theID) const
{
+ if ( !mySubMeshID.empty() )
+ return mySubMeshID[theID];
+
+ return theID;
+ }
+
+
+ vtkIdType
+ TSubProfileImpl
+ ::GetElemVTKID(vtkIdType theID) const
+ {
+ if ( !mySubMeshID.empty() )
+ for ( size_t anId = 0; anId < mySubMeshID.size(); anId++ )
+ if ( mySubMeshID[ anId ] == theID )
+ return anId;
+
return theID;
}
TCellID aCellID = theStartID + theID / myGauss->myNbPoints;
TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
- return TGaussPointID(aCellID,aLocalPntID);
+ return TGaussPointID(aCellID, aLocalPntID);
+ }
+
+
+ vtkIdType
+ TGaussSubMeshImpl
+ ::GetVTKID(const TGaussPointID& theID,
+ vtkIdType theStartID) const
+ {
+ vtkIdType aResult = -1;
+
+ TCellID aCellID = theID.first;
+ TLocalPntID aLocalPntID = theID.second;
+
+ vtkIdType aNbPoints = myGauss->myNbPoints;
+ if ( aLocalPntID >= aNbPoints )
+ return aResult;
+
+ return ( aCellID - theStartID ) * aNbPoints + aLocalPntID;
}
+
//---------------------------------------------------------------
bool
operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight)
return aSubMeshImpl.GetObjID(anInputID,aStartId);
}
+ vtkIdType
+ TGaussMeshImpl
+ ::GetVTKID(const TGaussPointID& theID) const
+ {
+ vtkIdType aResult = -1;
+
+ TCellID aCellID = theID.first;
+
+ vtkIdType aVTKCellId = GetParent()->GetElemVTKID( aCellID );
+ if ( aVTKCellId < 0 )
+ return aResult;
+
+ vtkCell* aCell = GetParent()->GetElemCell( aCellID );
+ if ( !aCell )
+ return aResult;
+
+ EGeometry aVGeom = VISU::VTKGeom2VISU( aCell->GetCellType() );
+ if ( aVGeom < EGeometry(0) )
+ return aResult;
+
+ TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.find( aVGeom );
+ if ( anIter == myGeom2GaussSubMesh.end() )
+ return aResult;
+
+ size_t aSubMeshEnd = myGaussSubMeshArr.size();
+ const TVTKAppendFilter& anAppendFilter = GetFilter();
+ const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
+ for ( size_t aSubMeshId = 0; aSubMeshId < aSubMeshEnd; aSubMeshId++ ) {
+ const PGaussSubMeshImpl& aSubMesh = myGaussSubMeshArr[aSubMeshId];
+ if ( aGaussSubMesh.get() == aSubMesh.get() ) {
+ vtkIdType aStartId = anAppendFilter->GetCellOutputID( 0, aSubMeshId );
+ return aGaussSubMesh->GetVTKID(theID, aStartId);
+ }
+ }
+
+ return aResult;
+ }
+
TVTKOutput*
TGaussMeshImpl
::GetVTKOutput()
TNamedIDMapper*
TGaussMeshImpl::
- GetParent()
+ GetParent() const
{
return myParent;
}
return myGaussPtsIDMapper->GetObjID(theID);
}
+ vtkIdType
+ TGaussPtsIDFilter
+ ::GetVTKID(const TGaussPointID& theID) const
+ {
+ return myGaussPtsIDMapper->GetVTKID(theID);
+ }
+
TNamedIDMapper*
TGaussPtsIDFilter::
- GetParent()
+ GetParent() const
{
return myGaussPtsIDMapper->GetParent();
}
}
return anIter->second;
}
-
-
- //---------------------------------------------------------------
- vtkIdType
- VISUGeom2NbNodes(EGeometry theGeom)
- {
- switch(theGeom){
-#ifndef VISU_ENABLE_QUADRATIC
- case VISU::eSEG3:
- return 2;
- case VISU::eTRIA6:
- return 3;
- case VISU::eQUAD8:
- return 4;
- case VISU::eTETRA10:
- return 4;
- case VISU::eHEXA20:
- return 8;
- case VISU::ePENTA15:
- return 6;
- case VISU::ePYRA13:
- return 5;
-#endif
- case VISU::ePOLYGONE:
- case VISU::ePOLYEDRE:
- return -1;
- default:
- return theGeom % 100;
- }
- }
-
- vtkIdType
- VISUGeom2VTK(EGeometry theGeom)
- {
- switch(theGeom){
- case VISU::ePOINT1:
- return VTK_VERTEX;
- case VISU::eSEG2:
- return VTK_LINE;
- case VISU::eTRIA3:
- return VTK_TRIANGLE;
- case VISU::eQUAD4:
- return VTK_QUAD;
- case VISU::eTETRA4:
- return VTK_TETRA;
- case VISU::eHEXA8:
- return VTK_HEXAHEDRON;
- case VISU::ePENTA6:
- return VTK_WEDGE;
- case VISU::ePYRA5:
- return VTK_PYRAMID;
-
- case VISU::ePOLYGONE:
- return VTK_POLYGON;
- case VISU::ePOLYEDRE:
- return VTK_CONVEX_POINT_SET;
-
-#ifndef VISU_ENABLE_QUADRATIC
- case VISU::eSEG3:
- return VTK_LINE;
- case VISU::eTRIA6:
- return VTK_TRIANGLE;
- case VISU::eQUAD8:
- return VTK_QUAD;
- case VISU::eTETRA10:
- return VTK_TETRA;
- case VISU::eHEXA20:
- return VTK_HEXAHEDRON;
- case VISU::ePENTA15:
- return VTK_WEDGE;
- case VISU::ePYRA13:
- return VTK_PYRAMID;
-
-#else
-
- case VISU::eSEG3:
-#if defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)
- return VTK_QUADRATIC_EDGE;
-#else
- return VTK_POLY_LINE;
-#endif
-
- case VISU::eTRIA6:
-#if defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)
- return VTK_QUADRATIC_TRIANGLE;
-#else
- return VTK_POLYGON;
-#endif
-
- case VISU::eQUAD8:
-#if defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)
- return VTK_QUADRATIC_QUAD;
-#else
- return VTK_POLYGON;
-#endif
-
- case VISU::eTETRA10:
-#if defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)
- return VTK_QUADRATIC_TETRA;
-#else
- return VTK_CONVEX_POINT_SET;
-#endif
-
- case VISU::eHEXA20:
-#if defined(VTK_QUADRATIC_HEXAHEDRON) && defined(VISU_USE_VTK_QUADRATIC)
- return VTK_QUADRATIC_HEXAHEDRON;
-#else
- return VTK_CONVEX_POINT_SET;
-#endif
- case VISU::ePENTA15:
-#if defined(VTK_QUADRATIC_WEDGE) && defined(VISU_USE_VTK_QUADRATIC)
- return VTK_QUADRATIC_WEDGE;
-#else
- return VTK_CONVEX_POINT_SET;
-#endif
-
- case VISU::ePYRA13:
-#if defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)
- return VTK_QUADRATIC_PYRAMID;
-#else
- return VTK_CONVEX_POINT_SET;
-#endif
-
-#endif //VISU_ENABLE_QUADRATIC
-
- default:
- return -1;
- }
- }
}
vtkIdType aNbCells = aSource->GetNumberOfCells();
for(vtkIdType aCell = 0; aCell < aNbCells; aCell++, aCellID++){
- anElemObj2VTKID[aSubProfile->GetElemObjID(aCell)] = aCellID;
+ vtkIdType anObjID = aSubProfile->GetElemObjID(aCell);
+ anElemObj2VTKID[anObjID] = aCellID;
}
aSubProfileArr[anInputID++] = aSubProfile;
EGeometry myGeom; //!< Defines to what geometrical type the MED PROFILE belong to
std::string myName; //!< Keeps its name
- //! Get object number of mesh cell by its VTK one
+ //! Reimplement the TSubProfile::GetElemObjID
virtual
vtkIdType
- GetElemObjID(int theVtkI) const;
+ GetElemObjID(vtkIdType theID) const;
+
+ //! Reimplement the TSubProfile::GetElemVTKID
+ virtual
+ vtkIdType
+ GetElemVTKID(vtkIdType theID) const;
//! Keeps status of the structure
/*!
GetObjID(vtkIdType theID,
vtkIdType theStartID) const;
+ //! To implement the TGaussPtsIDMapper::GetVTKID
+ virtual
+ vtkIdType
+ GetVTKID(const TGaussPointID& theID,
+ vtkIdType theStartID) const;
+
PGaussImpl myGauss; //<! Keep reference to corresponding TGauss structure
//! Keeps status of the structure
{
TGaussMeshImpl();
- //! Reimplement the TGaussPtsIDMapper::GetObjID
+ //! Reimplements the TGaussPtsIDMapper::GetObjID
virtual
TGaussPointID
GetObjID(vtkIdType theID) const;
- //! Reimplement the TIDMapper::GetVTKOutput
+ //! Reimplements the TGaussPtsIDMapper::GetVTKID
+ virtual
+ vtkIdType
+ GetVTKID(const TGaussPointID& theID) const;
+
+ //! Reimplements the TIDMapper::GetVTKOutput
virtual
TVTKOutput*
GetVTKOutput();
- //! Reimplement the TGaussPtsIDMapper::GetParent
+ //! Reimplements the TGaussPtsIDMapper::GetParent
virtual
TNamedIDMapper*
- GetParent();
+ GetParent() const;
TSource mySource; //!< Keeps VTK representation of the Gauss Points
TNamedIDMapper* myParent; //!< Refer to parent mesh
{
PGaussPtsIDMapper myGaussPtsIDMapper;
- //! Reimplement the TGaussPtsIDMapper::GetObjID
+ //! Reimplements the TGaussPtsIDMapper::GetObjID
virtual
TGaussPointID
GetObjID(vtkIdType theID) const;
- //! Reimplement the TGaussPtsIDMapper::GetParent
+ //! Reimplements the TGaussPtsIDMapper::GetVTKID
+ virtual
+ vtkIdType
+ GetVTKID(const TGaussPointID& theID) const;
+
+ //! Reimplements the TGaussPtsIDMapper::GetParent
virtual
TNamedIDMapper*
- GetParent();
+ GetParent() const;
};
typedef SharedPtr<TGaussPtsIDFilter> PGaussPtsIDFilter;
TMEDSubProfile
::GetElemObjID(vtkIdType theID) const
{
- if(mySubMeshID.empty())
- if(myIsElemNum)
- return myElemNum[theID];
- else
- return theID;
- return mySubMeshID[theID];
+ if ( !mySubMeshID.empty() )
+ theID = mySubMeshID[theID];
+
+ if ( myIsElemNum )
+ return myElemNum[theID];
+ else
+ return theID;
+ }
+
+
+ //---------------------------------------------------------------
+ vtkIdType
+ TMEDSubProfile
+ ::GetElemVTKID(vtkIdType theID) const
+ {
+ if ( myIsElemNum )
+ for ( size_t anId = 0; anId < myElemNum.size(); anId++ )
+ if ( myElemNum[ anId ] == theID ) {
+ theID = anId;
+ break;
+ }
+
+ return TSubProfileImpl::GetElemVTKID( theID );
}
::GetObjID(vtkIdType theID,
vtkIdType theStartID) const
{
- TCellID aCellID = theID / myGauss->myNbPoints;
- TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
+ vtkIdType aNbPoints = myGauss->myNbPoints;
+ TCellID aCellID = theID / aNbPoints;
+ TLocalPntID aLocalPntID = theID % aNbPoints;
- if(myIsElemNum)
- aCellID = myElemNum[aCellID];
- else
+ if ( myIsElemNum ) {
+ aCellID = GetElemObjID(aCellID);
+ } else
aCellID += theStartID;
return TGaussPointID(aCellID,aLocalPntID);
}
+ //---------------------------------------------------------------
+ vtkIdType
+ TMEDGaussSubMesh
+ ::GetVTKID(const TGaussPointID& theID,
+ vtkIdType theStartID) const
+ {
+ vtkIdType aResult = -1;
+
+ TCellID aCellID = theID.first;
+ TLocalPntID aLocalPntID = theID.second;
+
+ vtkIdType aNbPoints = myGauss->myNbPoints;
+ if ( aLocalPntID >= aNbPoints )
+ return aResult;
+
+ if ( myIsElemNum ) {
+ aCellID = GetElemVTKID( aCellID );
+ } else
+ aCellID -= theStartID;
+
+ return aCellID * aNbPoints + aLocalPntID + theStartID;
+ }
+
+
//---------------------------------------------------------------
void
TMEDSubMesh