X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FStdMeshers%2FStdMeshers_RadialPrism_3D.cxx;h=3334af950e7b1ab61dbb8a95dee0bf798767c240;hp=ebddcf2b31e872360197a3f03b6917c07a58b8e2;hb=38a77c4a9810f4715212368ac53315689ba9150f;hpb=b0a908c0d20341651771d0249fb10882f54b2aad diff --git a/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx b/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx index ebddcf2b3..3334af950 100644 --- a/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx +++ b/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -57,11 +57,7 @@ #include #include #include -#if OCC_VERSION_LARGE > 0x06050400 #include -#else -#include -#endif using namespace std; @@ -169,11 +165,7 @@ bool StdMeshers_RadialPrism_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& a // get 2 shells TopoDS_Solid solid = TopoDS::Solid( aShape ); -#if OCC_VERSION_LARGE > 0x06050400 TopoDS_Shell outerShell = BRepClass3d::OuterShell( solid ); -#else - TopoDS_Shell outerShell = BRepTools::OuterShell( solid ); -#endif TopoDS_Shape innerShell; int nbShells = 0; for ( TopoDS_Iterator It (solid); It.More(); It.Next(), ++nbShells ) @@ -187,13 +179,13 @@ bool StdMeshers_RadialPrism_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& a // ---------------------------------- ProjectionUtils::TShapeShapeMap shape2ShapeMaps[2]; - if ( !ProjectionUtils::FindSubShapeAssociation( innerShell, &aMesh, - outerShell, &aMesh, - shape2ShapeMaps[0]) - && - !ProjectionUtils::FindSubShapeAssociation( innerShell.Reversed(), &aMesh, - outerShell, &aMesh, - shape2ShapeMaps[1])) + bool mapOk1 = ProjectionUtils::FindSubShapeAssociation( innerShell, &aMesh, + outerShell, &aMesh, + shape2ShapeMaps[0]); + bool mapOk2 = ProjectionUtils::FindSubShapeAssociation( innerShell.Reversed(), &aMesh, + outerShell, &aMesh, + shape2ShapeMaps[1]); + if ( !mapOk1 && !mapOk2 ) return error(COMPERR_BAD_SHAPE,"Topology of inner and outer shells seems different" ); int iMap; @@ -239,7 +231,7 @@ bool StdMeshers_RadialPrism_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& a } // Find matching nodes of in and out faces - TNodeNodeMap nodeIn2OutMap; + ProjectionUtils::TNodeNodeMap nodeIn2OutMap; if ( ! ProjectionUtils::FindMatchingNodesOnFaces( inFace, &aMesh, outFace, &aMesh, shape2ShapeMap, nodeIn2OutMap )) return error(COMPERR_BAD_INPUT_MESH,SMESH_Comment("Mesh on faces #") @@ -439,11 +431,7 @@ bool StdMeshers_RadialPrism_3D::Evaluate(SMESH_Mesh& aMesh, { // get 2 shells TopoDS_Solid solid = TopoDS::Solid( aShape ); -#if OCC_VERSION_LARGE > 0x06050400 TopoDS_Shell outerShell = BRepClass3d::OuterShell( solid ); -#else - TopoDS_Shell outerShell = BRepTools::OuterShell( solid ); -#endif TopoDS_Shape innerShell; int nbShells = 0; for ( TopoDS_Iterator It (solid); It.More(); It.Next(), ++nbShells ) @@ -598,3 +586,57 @@ bool StdMeshers_RadialPrism_3D::Evaluate(SMESH_Mesh& aMesh, return true; } + +//================================================================================ +/*! + * \brief Return true if the algorithm can mesh this shape + * \param [in] aShape - shape to check + * \param [in] toCheckAll - if true, this check returns OK if all shapes are OK, + * else, returns OK if at least one shape is OK + */ +//================================================================================ + +bool StdMeshers_RadialPrism_3D::IsApplicable( const TopoDS_Shape & aShape, bool toCheckAll ) +{ + bool isCurShellApp; + int nbFoundSolids = 0; + for (TopExp_Explorer exp( aShape, TopAbs_SOLID ); exp.More(); exp.Next(), ++nbFoundSolids ) + { + TopoDS_Shape shell[2]; + int nbShells = 0; + for ( TopoDS_Iterator It (exp.Current()); It.More(); It.Next() ) + { + nbShells++; + if ( nbShells > 2 ) { + if ( toCheckAll ) return false; + break; + } + shell[ nbShells-1 ] = It.Value(); + } + if ( nbShells != 2 ) { + if ( toCheckAll ) return false; + continue; + } + + int nbFaces1 = SMESH_MesherHelper:: Count( shell[0], TopAbs_FACE, 0 ); + int nbFaces2 = SMESH_MesherHelper:: Count( shell[1], TopAbs_FACE, 0 ); + if ( nbFaces1 != nbFaces2 ){ + if( toCheckAll ) return false; + continue; + } + int nbEdges1 = SMESH_MesherHelper:: Count( shell[0], TopAbs_EDGE, 0 ); + int nbEdges2 = SMESH_MesherHelper:: Count( shell[1], TopAbs_EDGE, 0 ); + if ( nbEdges1 != nbEdges2 ){ + if( toCheckAll ) return false; + continue; + } + int nbVertices1 = SMESH_MesherHelper:: Count( shell[0], TopAbs_VERTEX, 0 ); + int nbVertices2 = SMESH_MesherHelper:: Count( shell[1], TopAbs_VERTEX, 0 ); + if ( nbVertices1 != nbVertices2 ){ + if( toCheckAll ) return false; + continue; + } + if ( !toCheckAll ) return true; + } + return ( toCheckAll && nbFoundSolids != 0); +};