From 8baf98a9740d86cd06cb78bc16f1e649488983d0 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 12 Mar 2010 08:30:20 +0000 Subject: [PATCH] +//======================================================================= +/*! + * \brief SMESH_TLink knowing its orientation + */ +//======================================================================= + +struct SMESH_OrientedLink: public SMESH_TLink +{ + bool _reversed; + SMESH_OrientedLink(const SMDS_MeshNode* n1, const SMDS_MeshNode* n2 ) + : SMESH_TLink( n1, n2 ), _reversed( n1 != node1() ) {} +}; --- src/SMESH/SMESH_MeshEditor.hxx | 17 +++++++++++++++++ src/SMESH/SMESH_MesherHelper.cxx | 21 +++++++++++++++++++++ src/SMESH/SMESH_MesherHelper.hxx | 6 ++++++ 3 files changed, 44 insertions(+) diff --git a/src/SMESH/SMESH_MeshEditor.hxx b/src/SMESH/SMESH_MeshEditor.hxx index 45666d05d..f5f0981a4 100644 --- a/src/SMESH/SMESH_MeshEditor.hxx +++ b/src/SMESH/SMESH_MeshEditor.hxx @@ -109,6 +109,18 @@ struct SMESH_TLink: public NLink const SMDS_MeshNode* node2() const { return second; } }; +//======================================================================= +/*! + * \brief SMESH_TLink knowing its orientation + */ +//======================================================================= + +struct SMESH_OrientedLink: public SMESH_TLink +{ + bool _reversed; + SMESH_OrientedLink(const SMDS_MeshNode* n1, const SMDS_MeshNode* n2 ) + : SMESH_TLink( n1, n2 ), _reversed( n1 != node1() ) {} +}; // ============================================================ /*! @@ -540,6 +552,11 @@ public: SMESHDS_Mesh * aMesh); // replace elemToRm by elemToAdd in the all groups +// static void ReplaceElemInGroups (const SMDS_MeshElement* elemToRm, +// const std::vector& elemToAdd, +// SMESHDS_Mesh * aMesh); + // replace elemToRm by elemToAdd in the all groups + /*! * \brief Return nodes linked to the given one in elements of the type */ diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index 39d34fd75..4e4b40979 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -1366,6 +1366,27 @@ int SMESH_MesherHelper::NbAncestors(const TopoDS_Shape& shape, return ancestors.Extent(); } +//======================================================================= +//function : GetSubShapeOri +//purpose : Return orientation of sub-shape in the main shape +//======================================================================= + +TopAbs_Orientation SMESH_MesherHelper::GetSubShapeOri(const TopoDS_Shape& shape, + const TopoDS_Shape& subShape) +{ + TopAbs_Orientation ori = TopAbs_Orientation(-1); + if ( !shape.IsNull() && !subShape.IsNull() ) + { + TopExp_Explorer e( shape, subShape.ShapeType() ); + for ( ; e.More(); e.Next()) + if ( subShape.IsSame( e.Current() )) + break; + if ( e.More() ) + ori = e.Current().Orientation(); + } + return ori; +} + //======================================================================= //function : IsQuadraticMesh //purpose : Check mesh without geometry for: if all elements on this shape are quadratic, diff --git a/src/SMESH/SMESH_MesherHelper.hxx b/src/SMESH/SMESH_MesherHelper.hxx index 930b7ecc0..84b703530 100644 --- a/src/SMESH/SMESH_MesherHelper.hxx +++ b/src/SMESH/SMESH_MesherHelper.hxx @@ -113,6 +113,12 @@ public: const SMESH_Mesh& mesh, TopAbs_ShapeEnum ancestorType=TopAbs_SHAPE); + /*! + * \brief Return orientation of sub-shape in the main shape + */ + static TopAbs_Orientation GetSubShapeOri(const TopoDS_Shape& shape, + const TopoDS_Shape& subShape); + public: // ---------- PUBLIC INSTANCE METHODS ---------- -- 2.39.2