-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2013 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
class gp_Vec;
class gp_Pnt;
class SMESH_MesherHelper;
-
-
-//=======================================================================
-/*!
- * \brief Searcher for the node closest to point
- */
-//=======================================================================
-struct SMESH_NodeSearcher
-{
- virtual const SMDS_MeshNode* FindClosestTo( const gp_Pnt& pnt ) = 0;
- virtual void MoveNode( const SMDS_MeshNode* node, const gp_Pnt& toPnt ) = 0;
-};
-
-//=======================================================================
-/*!
- * \brief Searcher for elements
- */
-//=======================================================================
-
-struct SMESH_ElementSearcher
-{
- /*!
- * \brief Find elements of given type where the given point is IN or ON.
- * Returns nb of found elements and elements them-selves.
- *
- * 'ALL' type means elements of any type excluding nodes and 0D elements
- */
- virtual int FindElementsByPoint(const gp_Pnt& point,
- SMDSAbs_ElementType type,
- std::vector< const SMDS_MeshElement* >& foundElems)=0;
- /*!
- * \brief Return an element most close to the given point
- */
- virtual const SMDS_MeshElement* FindClosestTo( const gp_Pnt& point,
- SMDSAbs_ElementType type) = 0;
- /*!
- * \brief Return elements possibly intersecting the line
- */
- virtual void GetElementsNearLine( const gp_Ax1& line,
- SMDSAbs_ElementType type,
- std::vector< const SMDS_MeshElement* >& foundElems)=0;
- /*!
- * \brief Find out if the given point is out of closed 2D mesh.
- */
- virtual TopAbs_State GetPointState(const gp_Pnt& point) = 0;
-
-};
+class SMESH_NodeSearcher;
// ============================================================
/*!
const SMESH_SequenceOfElemPtr& GetLastCreatedNodes() const { return myLastCreatedNodes; }
const SMESH_SequenceOfElemPtr& GetLastCreatedElems() const { return myLastCreatedElems; }
-
+ void CrearLastCreated();
SMESH_ComputeErrorPtr & GetError() { return myError; }
/*!
// Remove a node or an element.
// Modify a compute state of sub-meshes which become empty
+ void Create0DElementsOnAllNodes( const TIDSortedElemSet& elements,
+ TIDSortedElemSet& all0DElems);
+ // Create 0D elements on all nodes of the given object except those
+ // nodes on which a 0D element already exists. \a all0DElems returns
+ // all 0D elements found or created on nodes of \a elements
+
bool InverseDiag (const SMDS_MeshElement * theTria1,
const SMDS_MeshElement * theTria2 );
// Replace two neighbour triangles with ones built on the same 4 nodes
bool TriToQuad (TIDSortedElemSet & theElems,
SMESH::Controls::NumericalFunctorPtr theCriterion,
const double theMaxAngle);
-
/*!
* \brief Split quadrangles into triangles.
* \param theElems - The faces to be splitted.
*/
bool QuadToTri (TIDSortedElemSet & theElems,
SMESH::Controls::NumericalFunctorPtr theCriterion);
-
/*!
* \brief Split quadrangles into triangles.
* \param theElems - The faces to be splitted.
*/
bool QuadToTri (TIDSortedElemSet & theElems,
const bool the13Diag);
+ /*!
+ * \brief Split each of given quadrangles into 4 triangles.
+ * \param theElems - The faces to be splitted. If empty all faces are split.
+ */
+ void QuadTo4Tri (TIDSortedElemSet & theElems);
/*!
* \brief Find better diagonal for splitting.
SMESH_Mesh* theTargetMesh=0);
// Move or copy theElements applying theTrsf to their nodes
-
typedef std::list< std::list< const SMDS_MeshNode* > > TListOfListOfNodes;
void FindCoincidentNodes (TIDSortedNodeSet & theNodes,
// Return list of group of nodes close to each other within theTolerance.
// Search among theNodes or in the whole mesh if theNodes is empty.
- /*!
- * \brief Return SMESH_NodeSearcher. The caller is responsible for deleteing it
- */
- SMESH_NodeSearcher* GetNodeSearcher();
-
- /*!
- * \brief Return SMESH_ElementSearcher. The caller is responsible for deleting it
- */
- SMESH_ElementSearcher* GetElementSearcher();
- SMESH_ElementSearcher* GetElementSearcher( SMDS_ElemIteratorPtr elemIt );
- /*!
- * \brief Return true if the point is IN or ON of the element
- */
- static bool IsOut( const SMDS_MeshElement* element, const gp_Pnt& point, double tol );
-
- static double GetDistance( const SMDS_MeshFace* face, const gp_Pnt& point );
-
- int SimplifyFace (const std::vector<const SMDS_MeshNode *> faceNodes,
- std::vector<const SMDS_MeshNode *>& poly_nodes,
- std::vector<int>& quantities) const;
- // Split face, defined by <faceNodes>, into several faces by repeating nodes.
- // Is used by MergeNodes()
-
void MergeNodes (TListOfListOfNodes & theNodeGroups);
// In each group, the cdr of nodes are substituted by the first one
// in all elements.
typedef std::list< std::list< int > > TListOfListOfElementsID;
- void FindEqualElements(std::set<const SMDS_MeshElement*> & theElements,
- TListOfListOfElementsID & theGroupsOfElementsID);
+ void FindEqualElements(TIDSortedElemSet & theElements,
+ TListOfListOfElementsID & theGroupsOfElementsID);
// Return list of group of elements build on the same nodes.
// Search among theElements or in the whole mesh if theElements is empty.
// Remove all but one of elements built on the same nodes.
// Return nb of successfully merged groups.
+ int SimplifyFace (const std::vector<const SMDS_MeshNode *>& faceNodes,
+ std::vector<const SMDS_MeshNode *>& poly_nodes,
+ std::vector<int>& quantities) const;
+ // Split face, defined by <faceNodes>, into several faces by repeating nodes.
+ // Is used by MergeNodes()
+
static bool CheckFreeBorderNodes(const SMDS_MeshNode* theNode1,
const SMDS_MeshNode* theNode2,
const SMDS_MeshNode* theNode3 = 0);
// insert theNodesToInsert into all volumes, containing link
// theBetweenNode1 - theBetweenNode2, between theBetweenNode1 and theBetweenNode2.
- void ConvertToQuadratic(const bool theForce3d);
- void ConvertToQuadratic(const bool theForce3d, TIDSortedElemSet& theElements);
- // Converts all mesh to quadratic one, deletes old elements, replacing
- // them with quadratic ones with the same id.
+ void ConvertToQuadratic(const bool theForce3d, const bool theToBiQuad);
+ void ConvertToQuadratic(const bool theForce3d,
+ TIDSortedElemSet& theElements, const bool theToBiQuad);
+ // Converts all mesh to quadratic or bi-quadratic one, deletes old elements,
+ // replacing them with quadratic or bi-quadratic ones with the same id.
// If theForce3d = 1; this results in the medium node lying at the
- // middle of the line segments connecting start and end node of a mesh
- // element
+ // middle of the line segments connecting start and end node of a mesh element.
// If theForce3d = 0; this results in the medium node lying at the
- // geometrical edge from which the mesh element is built
+ // geometrical edge from which the mesh element is built.
bool ConvertFromQuadratic();
void ConvertFromQuadratic(TIDSortedElemSet& theElements);
TIDSortedElemSet & linkedNodes,
SMDSAbs_ElementType type = SMDSAbs_All );
- static 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
- // - not in avoidSet,
- // - in elemSet provided that !elemSet.empty()
- // i1 and i2 optionally returns indices of n1 and n2
-
/*!
* \brief Find corresponding nodes in two sets of faces
* \param theSide1 - first face set
// Return an index of the shape theElem is on
// or zero if a shape not found
+ void DoubleElements( const TIDSortedElemSet& theElements );
+
bool DoubleNodes( const std::list< int >& theListOfNodes,
const std::list< int >& theListOfModifiedElems );
bool toAddExistingBondary = false,
bool aroundElements = false);
-
private:
/*!
typedef std::map<const SMDS_MeshNode*, std::list<const SMDS_MeshNode*> > TNodeOfNodeListMap;
typedef TNodeOfNodeListMap::iterator TNodeOfNodeListMapItr;
typedef std::vector<TNodeOfNodeListMapItr> TVecOfNnlmiMap;
- typedef std::map<const SMDS_MeshElement*, TVecOfNnlmiMap > TElemOfVecOfNnlmiMap;
+ typedef std::map<const SMDS_MeshElement*, TVecOfNnlmiMap, TIDCompare > TElemOfVecOfNnlmiMap;
/*!
* \brief Create elements by sweeping an element