30#ifndef __SMESH_MeshAlgos_HXX__
31#define __SMESH_MeshAlgos_HXX__
39#include <TopAbs_State.hxx>
63 const double tolerance,
64 std::vector< const SMDS_MeshNode* >& foundNodes) = 0;
84 std::vector< const SMDS_MeshElement* >& foundElems) = 0;
95 std::vector< const SMDS_MeshElement* >& foundElems) = 0;
102 std::vector< const SMDS_MeshElement* >& foundElems) = 0;
108 std::vector< const SMDS_MeshElement* >& foundElems) = 0;
141 double tolerance=-1.);
145 double tolerance=-1. );
168 const gp_XY& t0,
const gp_XY& t1,
const gp_XY& t2,
169 double & bc0,
double & bc1);
176 double & tMin,
double & tMax,
177 int & iFacetMin,
int & iFacetMax);
214 std::vector< const SMDS_MeshNode*> * neibors =
nullptr );
243 template<
class ElemIter >
246 while ( it->more() ) it->next()->setIsMarked( isMarked );
251 template<
class ElemIter >
254 for ( ; it !=
end; ++it ) (*it)->setIsMarked( isMarked );
259 template<
class ElemIter >
260 void MarkElemNodes( ElemIter it,
const bool isMarked,
const bool markElem =
false )
263 while ( it->more() ) {
270 MarkElems( it->next()->nodesIterator(), isMarked );
275 template<
class ElemIter >
276 void MarkElemNodes( ElemIter it, ElemIter
end,
const bool isMarked,
const bool markElem =
false )
279 for ( ; it !=
end; ++it ) {
280 (*it)->setIsMarked( isMarked );
281 MarkElems( (*it)->nodesIterator(), isMarked );
284 for ( ; it !=
end; ++it )
285 MarkElems( (*it)->nodesIterator(), isMarked );
309 std::vector< std::vector< const SMDS_MeshElement* > >
348 const bool closedOnly,
349 bool* isManifold = 0,
350 bool* isGoodOri = 0);
359 std::vector<const SMDS_MeshElement*>& newFaces);
367 std::vector< const SMDS_MeshNode* >& newNodes,
368 std::vector< const SMDS_MeshNode* >& noMergeNodes);
386 const bool theFixIntersections,
410 const int nbCommonNodes = -1 );
427 const double theSign = 1.,
428 const bool theOptimize =
false );
430 typedef std::vector< SMESH_NodeXYZ >
TFace;
435 const std::vector< gp_Ax1 > & planes,
437 std::vector< TFace > & newFaceConnectivity );
461 std::vector< const SMDS_MeshNode*>& nodes);
464 bool triangulate( std::vector< const SMDS_MeshNode*>& nodes,
const size_t nbNodes );
516 std::vector<const SMDS_MeshElement*>& newEdges,
517 std::vector<const SMDS_MeshNode*>& newNodes,
531 std::vector< SMDS_MeshGroup* > & groupsToUpdate);
SMDSAbs_ElementType
Type (node, edge, face or volume) of elements.
Definition: SMDSAbs_ElementType.hxx:34
boost::shared_ptr< SMDS_Iterator< const SMDS_MeshElement * > > SMDS_ElemIteratorPtr
Definition: SMDS_ElemIterator.hxx:43
std::set< const SMDS_MeshElement *, TIDCompare > TIDSortedElemSet
Definition: SMESH_TypeDefs.hxx:58
#define SMESHUtils_EXPORT
Definition: SMESH_Utils.hxx:37
IMAP::const_iterator end(const IMAP &m)
Definition: StdMeshers_Projection_2D.cxx:106
Edge mesh element.
Definition: SMDS_MeshEdge.hxx:36
Base class for elements.
Definition: SMDS_MeshElement.hxx:56
virtual void setIsMarked(bool is) const
Mark this element.
Definition: SMDS_MeshElement.cxx:152
virtual SMDS_ElemIteratorPtr nodesIterator() const =0
Mesh face.
Definition: SMDS_MeshFace.hxx:41
Definition: SMDS_MeshGroup.hxx:37
Definition: SMDS_MeshNode.hxx:36
Mesh volume.
Definition: SMDS_MeshVolume.hxx:40
Definition: SMDS_Mesh.hxx:53
Cut faces of a triangular mesh.
Definition: SMESH_MeshAlgos.hxx:402
std::vector< SMESH_NodeXYZ > TFace
Definition: SMESH_MeshAlgos.hxx:430
Algo * myAlgo
Definition: SMESH_MeshAlgos.hxx:441
Divide a mesh face into triangles.
Definition: SMESH_MeshAlgos.hxx:452
Optimizer * _optimizer
Definition: SMESH_MeshAlgos.hxx:471
Data * _data
Definition: SMESH_MeshAlgos.hxx:470
Definition: SMESH_MeshAlgos.hxx:126
void DeMerge(const SMDS_MeshElement *elem, std::vector< const SMDS_MeshNode * > &newNodes, std::vector< const SMDS_MeshNode * > &noMergeNodes)
Find nodes whose merge makes the element invalid.
Definition: SMESH_DeMerge.cxx:163
std::vector< const SMDS_MeshNode * > TFreeBorder
Definition: SMESH_MeshAlgos.hxx:313
SMESH_ElementSearcher * GetElementSearcher(SMDS_Mesh &mesh, double tolerance=-1.)
Return SMESH_ElementSearcher.
Definition: SMESH_MeshAlgos.cxx:2559
SMDS_Mesh * MakeOffset(SMDS_ElemIteratorPtr faceIt, SMDS_Mesh &mesh, const double offset, const bool theFixIntersections, TElemIntPairVec &new2OldFaces, TNodeIntPairVec &new2OldNodes)
Create an offset mesh of given faces.
Definition: SMESH_Offset.cxx:3142
bool IsRightOrder(const SMDS_MeshElement *face, const SMDS_MeshNode *node0, const SMDS_MeshNode *node1)
Return true if node1 encounters first in the face and node2, after.
Definition: SMESH_MeshAlgos.cxx:2319
std::vector< Edge > FindSharpEdges(SMDS_Mesh *mesh, double angle, bool addExisting)
Return sharp edges of faces and non-manifold ones.
Definition: SMESH_MeshAlgos.cxx:1985
bool IntersectRayVolume(const gp_Ax1 &ray, const double rayLen, const SMDS_MeshElement *vol, double &tMin, double &tMax, int &iFacetMin, int &iFacetMax)
Intersect volume by a ray.
Definition: SMESH_MeshAlgos.cxx:2593
std::vector< PolySegment > TListOfPolySegments
Definition: SMESH_MeshAlgos.hxx:494
std::vector< std::vector< const SMDS_MeshElement * > > SeparateFacesByEdges(SMDS_Mesh *mesh, const std::vector< Edge > &edges)
Distribute all faces of the mesh between groups using given edges.
Definition: SMESH_MeshAlgos.cxx:2097
std::vector< TCoincidentGroup > TCoincidentGroupVec
Definition: SMESH_MeshAlgos.hxx:323
bool FaceNormal(const SMDS_MeshElement *F, gp_XYZ &normal, bool normalized=true)
Calculate normal of a mesh face.
Definition: SMESH_MeshAlgos.cxx:2207
void GetBarycentricCoords(const gp_XY &point, const gp_XY &t0, const gp_XY &t1, const gp_XY &t2, double &bc0, double &bc1)
Returns barycentric coordinates of a point within a triangle.
Definition: SMESH_MeshAlgos.cxx:1890
std::vector< const SMDS_MeshNode * > GetCommonNodes(const SMDS_MeshElement *e1, const SMDS_MeshElement *e2)
Return nodes common to two elements.
Definition: SMESH_MeshAlgos.cxx:2253
void FindFreeBorders(SMDS_Mesh &mesh, TFreeBorderVec &foundFreeBordes, const bool closedOnly, bool *isManifold=0, bool *isGoodOri=0)
Returns all or only closed TFreeBorder's.
Definition: SMESH_FreeBorders.cxx:834
void MarkElemNodes(ElemIter it, const bool isMarked, const bool markElem=false)
Mark nodes of elements given by SMDS_Iterator.
Definition: SMESH_MeshAlgos.hxx:260
void Get1DBranches(SMDS_ElemIteratorPtr edgeIt, TElemGroupVector &edgeGroups, TNodeGroupVector &nodeGroups, const SMDS_MeshNode *startNode=0)
Partition given 1D elements into groups of contiguous edges.
Definition: SMESH_MeshAlgos.cxx:2352
const SMDS_MeshElement * FindFaceInSet(const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const TIDSortedElemSet &elemSet, const TIDSortedElemSet &avoidSet, int *i1=0, int *i2=0)
Return a face having linked nodes n1 and n2 and which is.
Definition: SMESH_MeshAlgos.cxx:1924
bool IsOn2DBoundary(const SMDS_MeshNode *node, std::vector< const SMDS_MeshNode * > *neibors=nullptr)
Return true if a node is on a boundary of 2D mesh.
Definition: SMESH_MeshAlgos.cxx:2270
void MakePolyLine(SMDS_Mesh *mesh, TListOfPolySegments &segments, std::vector< const SMDS_MeshElement * > &newEdges, std::vector< const SMDS_MeshNode * > &newNodes, SMDS_MeshGroup *group=0, SMESH_ElementSearcher *searcher=0)
Create a polyline consisting of 1D mesh elements each lying on a 2D element of the initial mesh.
Definition: SMESH_PolyLine.cxx:618
std::vector< std::vector< const SMDS_MeshElement * > > TElemGroupVector
Definition: SMESH_MeshAlgos.hxx:224
double GetDistance(const SMDS_MeshElement *elem, const gp_Pnt &point, gp_XYZ *closestPnt=0)
Return minimal distance from a point to an element.
Definition: SMESH_MeshAlgos.cxx:1608
std::vector< std::pair< const SMDS_MeshNode *, int > > TNodeIntPairVec
Definition: SMESH_MeshAlgos.hxx:373
std::vector< std::vector< const SMDS_MeshNode * > > TNodeGroupVector
Definition: SMESH_MeshAlgos.hxx:225
void MarkElems(ElemIter it, const bool isMarked)
Mark elements given by SMDS_Iterator.
Definition: SMESH_MeshAlgos.hxx:244
SMESH_NodeSearcher * GetNodeSearcher(SMDS_Mesh &mesh)
Return SMESH_NodeSearcher.
Definition: SMESH_MeshAlgos.cxx:2537
int NbCommonNodes(const SMDS_MeshElement *e1, const SMDS_MeshElement *e2)
Return number of nodes common to two elements.
Definition: SMESH_MeshAlgos.cxx:2238
std::vector< std::pair< const SMDS_MeshElement *, int > > TElemIntPairVec
Definition: SMESH_MeshAlgos.hxx:372
void FindCoincidentFreeBorders(SMDS_Mesh &mesh, double tolerance, CoincidentFreeBorders &foundFreeBordes)
Returns TFreeBorder's coincident within the given tolerance.
Definition: SMESH_FreeBorders.cxx:442
bool IsOut(const SMDS_MeshElement *element, const gp_Pnt &point, double tol)
Return true if the point is IN or ON of the element.
Definition: SMESH_MeshAlgos.cxx:1367
std::vector< TFreeBorderPart > TCoincidentGroup
Definition: SMESH_MeshAlgos.hxx:322
void FillHole(const TFreeBorder &freeBorder, SMDS_Mesh &mesh, std::vector< const SMDS_MeshElement * > &newFaces)
Fill a hole defined by a TFreeBorder with 2D elements.
Definition: SMESH_FillHole.cxx:382
std::vector< Edge > MakeSlot(SMDS_ElemIteratorPtr segmentIt, double width, SMDS_Mesh *mesh, std::vector< SMDS_MeshGroup * > &groupsToUpdate)
Create a slot of given width around given 1D elements lying on a triangle mesh.
Definition: SMESH_Slot.cxx:532
std::vector< TFreeBorder > TFreeBorderVec
Definition: SMESH_MeshAlgos.hxx:314
Searcher for elements.
Definition: SMESH_MeshAlgos.hxx:75
virtual TopAbs_State GetPointState(const gp_Pnt &point)=0
Find out if the given point is out of closed 2D mesh.
virtual void GetElementsInBox(const Bnd_B3d &box, SMDSAbs_ElementType type, std::vector< const SMDS_MeshElement * > &foundElems)=0
Return elements whose bounding box intersects a given bounding box.
virtual gp_XYZ Project(const gp_Pnt &point, SMDSAbs_ElementType type, const SMDS_MeshElement **closestFace=0)=0
Return a projection of a given point to a 2D mesh.
virtual int FindElementsByPoint(const gp_Pnt &point, SMDSAbs_ElementType type, std::vector< const SMDS_MeshElement * > &foundElems)=0
Find elements of given type where the given point is IN or ON.
virtual const SMDS_MeshElement * FindClosestTo(const gp_Pnt &point, SMDSAbs_ElementType type)=0
Return an element most close to the given point.
virtual void GetElementsInSphere(const gp_XYZ ¢er, const double radius, SMDSAbs_ElementType type, std::vector< const SMDS_MeshElement * > &foundElems)=0
Return elements whose bounding box intersects a sphere.
virtual void GetElementsNearLine(const gp_Ax1 &line, SMDSAbs_ElementType type, std::vector< const SMDS_MeshElement * > &foundElems)=0
Return elements possibly intersecting the line.
Definition: SMESH_MeshAlgos.hxx:325
TFreeBorderVec _borders
Definition: SMESH_MeshAlgos.hxx:326
TCoincidentGroupVec _coincidentGroups
Definition: SMESH_MeshAlgos.hxx:327
Definition: SMESH_MeshAlgos.hxx:290
const SMDS_MeshNode * _node2
Definition: SMESH_MeshAlgos.hxx:292
const SMDS_MeshNode * _node1
Definition: SMESH_MeshAlgos.hxx:291
const SMDS_MeshNode * _medium
Definition: SMESH_MeshAlgos.hxx:293
Intersect faces of a mesh.
Definition: SMESH_Offset.cxx:805
Definition: SMESH_MeshAlgos.hxx:476
gp_XYZ myXYZ[2]
Definition: SMESH_MeshAlgos.hxx:483
const SMDS_MeshNode * myNode2[2]
Definition: SMESH_MeshAlgos.hxx:482
gp_Vec myVector
Definition: SMESH_MeshAlgos.hxx:489
const SMDS_MeshElement * myFace[2]
Definition: SMESH_MeshAlgos.hxx:486
const SMDS_MeshNode * myNode1[2]
Definition: SMESH_MeshAlgos.hxx:481
gp_Pnt myMidProjPoint
Definition: SMESH_MeshAlgos.hxx:492
Definition: SMESH_MeshAlgos.hxx:316
int _node2
Definition: SMESH_MeshAlgos.hxx:319
int _node1
Definition: SMESH_MeshAlgos.hxx:318
int _nodeLast
Definition: SMESH_MeshAlgos.hxx:320
int _border
Definition: SMESH_MeshAlgos.hxx:317
Searcher for the node closest to a point.
Definition: SMESH_MeshAlgos.hxx:59
virtual const SMDS_MeshNode * FindClosestTo(const gp_Pnt &pnt)=0
virtual int FindNearPoint(const gp_Pnt &point, const double tolerance, std::vector< const SMDS_MeshNode * > &foundNodes)=0
virtual ~SMESH_NodeSearcher()
Definition: SMESH_MeshAlgos.hxx:65
virtual void MoveNode(const SMDS_MeshNode *node, const gp_Pnt &toPnt)=0
SMDS_MeshNode -> gp_XYZ converter.
Definition: SMESH_TypeDefs.hxx:215
Definition: SMESH_Triangulate.cxx:93
Definition: SMESH_Triangulate.cxx:100
Vertex of a polygon.
Definition: SMESH_Triangulate.cxx:70