-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021 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
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// SMESH SMESH : implementaion of SMESH idl descriptions
+// SMESH SMESH : implementation of SMESH idl descriptions
// File : StdMeshers_Projection_3D.cxx
// Module : SMESH
// Created : Fri Oct 20 11:37:07 2006
#include "StdMeshers_ProjectionUtils.hxx"
-#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"
#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() << "; " <<p.Y() << "; " <<p.Z() << ") " <<endl;\
-// }
+#define SHOWYXZ(msg, xyz) \
+ //{gp_Pnt p(xyz); cout<<msg<< " ("<< p.X() << "; " <<p.Y() << "; " <<p.Z() << ") " <<endl; }
namespace TAssocTool = StdMeshers_ProjectionUtils;
+using namespace std;
//=======================================================================
//function : StdMeshers_Projection_3D
//purpose :
//=======================================================================
-StdMeshers_Projection_3D::StdMeshers_Projection_3D(int hypId, int studyId, SMESH_Gen* gen)
- :SMESH_3D_Algo(hypId, studyId, gen)
+StdMeshers_Projection_3D::StdMeshers_Projection_3D(int hypId, SMESH_Gen* gen)
+ :SMESH_3D_Algo(hypId, gen)
{
_name = "Projection_3D";
_shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit per shape type
shape2ShapeMap.Clear();
vector< int > 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 ) {
nodes[6],
nodes[7], id, force3d); break;
default: // polyhedron
- const SMDS_VtkVolume * poly =
- dynamic_cast<const SMDS_VtkVolume*>( srcVol );
+ const SMDS_MeshVolume * poly = tgtMeshDS->DownCast<SMDS_MeshVolume>( srcVol );
if ( !poly )
RETURN_BAD_RESULT("Unexpected volume type");
if ( !poly->IsPoly())
return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed");
- std::vector<int> aVec(SMDSEntity_Last);
+ std::vector<smIdType> aVec(SMDSEntity_Last);
for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i] = 0;
aVec[SMDSEntity_Node] = srcSubMesh->GetSubMeshDS()->NbNodes();
_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;
+}