X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FStdMeshers%2FStdMeshers_Projection_3D.cxx;h=040b2efc4bc8f13afb6f5e596022adbf8ac0f3ab;hp=e6a76eddc8eb5d9a7a248ccdccf8f87b5869f9d5;hb=ccb5e3c25bf204e839c0094f50f543eacedba5e6;hpb=6bac08c1a81f34d3f21c550bd92f83654b2546a5 diff --git a/src/StdMeshers/StdMeshers_Projection_3D.cxx b/src/StdMeshers/StdMeshers_Projection_3D.cxx index e6a76eddc..040b2efc4 100644 --- a/src/StdMeshers/StdMeshers_Projection_3D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_3D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 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 @@ -34,6 +34,7 @@ #include "SMDS_PolyhedralVolumeOfNodes.hxx" #include "SMDS_VolumeTool.hxx" #include "SMESHDS_Hypothesis.hxx" +#include "SMESHDS_Mesh.hxx" #include "SMESHDS_SubMesh.hxx" #include "SMESH_Block.hxx" #include "SMESH_Comment.hxx" @@ -52,13 +53,12 @@ #define RETURN_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); return false; } #define gpXYZ(n) gp_XYZ(n->X(),n->Y(),n->Z()) -#define SHOWYXZ(msg, xyz) // {\ -// gp_Pnt p (xyz); \ -// cout << msg << " ("<< p.X() << "; " < edgeIdVec; SMESH_Block::GetFaceEdgesIDs( fId, edgeIdVec ); - for ( int i = 0; i < edgeIdVec.size(); ++i ) { + for ( size_t i = 0; i < edgeIdVec.size(); ++i ) { int eID = edgeIdVec[ i ]; shape2ShapeMap.Bind( scrShapes( eID ), tgtShapes( eID )); if ( i < 2 ) { @@ -541,3 +541,39 @@ void StdMeshers_Projection_3D::SetEventListener(SMESH_subMesh* subMesh) _sourceHypo->GetSourceMesh() ); } +//================================================================================ +/*! + * \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_Projection_3D::IsApplicable(const TopoDS_Shape & aShape, bool toCheckAll) +{ + TopExp_Explorer exp0( aShape, TopAbs_SOLID ); + if ( !exp0.More() ) return false; + + TopTools_IndexedMapOfOrientedShape blockShapes; + TopoDS_Vertex v; + TopoDS_Shell shell; + for ( ; exp0.More(); exp0.Next() ) + { + int nbFoundShells = 0; + TopExp_Explorer exp1( exp0.Current(), TopAbs_SHELL ); + for ( ; exp1.More(); exp1.Next(), ++nbFoundShells ) + { + shell = TopoDS::Shell( exp1.Current() ); + if ( nbFoundShells == 2 ) break; + } + if ( nbFoundShells != 1 ) { + if ( toCheckAll ) return false; + continue; + } + bool isBlock = SMESH_Block::FindBlockShapes( shell, v, v, blockShapes ); + if ( toCheckAll && !isBlock ) return false; + if ( !toCheckAll && isBlock ) return true; + } + return toCheckAll; +}