From d772319aabe614a2a722f2be5cbaed45529199be Mon Sep 17 00:00:00 2001 From: AON <> Date: Thu, 28 Apr 2011 14:49:04 +0000 Subject: [PATCH] OCC22138 Remove *.gxx files from Mesh algorithm Removing MeshAlgo and MeshDS packages --- src/MeshAlgo/FILES | 2 - src/MeshAlgo/MeshAlgo.cdl | 54 - src/MeshAlgo/MeshAlgo_CellFilter.hxx | 12 - src/MeshAlgo/MeshAlgo_Circ.cdl | 45 - src/MeshAlgo/MeshAlgo_Circ.cxx | 23 - src/MeshAlgo/MeshAlgo_Circ.lxx | 10 - src/MeshAlgo/MeshAlgo_CircleInspector.hxx | 84 - src/MeshAlgo/MeshAlgo_CircleTool.cdl | 93 - src/MeshAlgo/MeshAlgo_CircleTool.cxx | 268 --- src/MeshAlgo/MeshAlgo_Delaunay.cdl | 241 --- src/MeshAlgo/MeshAlgo_Delaunay.gxx | 1594 ----------------- src/MeshAlgo/MeshAlgo_Delaunay.lxx | 27 - src/MeshAlgo/MeshAlgo_Edge.cdl | 54 - src/MeshAlgo/MeshAlgo_Edge.cxx | 6 - .../MeshAlgo_IndexedPntComparator.cdl | 40 - .../MeshAlgo_IndexedPntComparator.gxx | 56 - src/MeshAlgo/MeshAlgo_PntComparator.cdl | 36 - src/MeshAlgo/MeshAlgo_PntComparator.gxx | 50 - src/MeshAlgo/MeshAlgo_Triangle.cdl | 52 - src/MeshAlgo/MeshAlgo_Triangle.cxx | 6 - src/MeshAlgo/MeshAlgo_Vertex.cdl | 48 - src/MeshAlgo/MeshAlgo_Vertex.cxx | 6 - src/MeshDS/FILES | 5 - src/MeshDS/MeshDS.cdl | 53 - src/MeshDS/MeshDS_BaseAllocator.hxx | 3 - src/MeshDS/MeshDS_Element2d.cdl | 49 - src/MeshDS/MeshDS_Element2d.gxx | 0 src/MeshDS/MeshDS_Link.cdl | 56 - src/MeshDS/MeshDS_Link.gxx | 0 src/MeshDS/MeshDS_ListOfInteger.hxx | 3 - src/MeshDS/MeshDS_MapOfInteger.hxx | 3 - src/MeshDS/MeshDS_MapOfIntegerInteger.hxx | 12 - src/MeshDS/MeshDS_Mesh2d.cdl | 368 ---- src/MeshDS/MeshDS_Mesh2d.gxx | 686 ------- src/MeshDS/MeshDS_Node.cdl | 40 - src/MeshDS/MeshDS_Node.gxx | 0 src/MeshDS/MeshDS_PairOfIndex.hxx | 105 -- src/MeshDS/MeshDS_Selector.gxx | 155 -- 38 files changed, 4345 deletions(-) delete mode 100755 src/MeshAlgo/FILES delete mode 100755 src/MeshAlgo/MeshAlgo.cdl delete mode 100755 src/MeshAlgo/MeshAlgo_CellFilter.hxx delete mode 100755 src/MeshAlgo/MeshAlgo_Circ.cdl delete mode 100755 src/MeshAlgo/MeshAlgo_Circ.cxx delete mode 100755 src/MeshAlgo/MeshAlgo_Circ.lxx delete mode 100755 src/MeshAlgo/MeshAlgo_CircleInspector.hxx delete mode 100755 src/MeshAlgo/MeshAlgo_CircleTool.cdl delete mode 100755 src/MeshAlgo/MeshAlgo_CircleTool.cxx delete mode 100755 src/MeshAlgo/MeshAlgo_Delaunay.cdl delete mode 100755 src/MeshAlgo/MeshAlgo_Delaunay.gxx delete mode 100755 src/MeshAlgo/MeshAlgo_Delaunay.lxx delete mode 100755 src/MeshAlgo/MeshAlgo_Edge.cdl delete mode 100755 src/MeshAlgo/MeshAlgo_Edge.cxx delete mode 100755 src/MeshAlgo/MeshAlgo_IndexedPntComparator.cdl delete mode 100755 src/MeshAlgo/MeshAlgo_IndexedPntComparator.gxx delete mode 100755 src/MeshAlgo/MeshAlgo_PntComparator.cdl delete mode 100755 src/MeshAlgo/MeshAlgo_PntComparator.gxx delete mode 100755 src/MeshAlgo/MeshAlgo_Triangle.cdl delete mode 100755 src/MeshAlgo/MeshAlgo_Triangle.cxx delete mode 100755 src/MeshAlgo/MeshAlgo_Vertex.cdl delete mode 100755 src/MeshAlgo/MeshAlgo_Vertex.cxx delete mode 100755 src/MeshDS/FILES delete mode 100755 src/MeshDS/MeshDS.cdl delete mode 100755 src/MeshDS/MeshDS_BaseAllocator.hxx delete mode 100755 src/MeshDS/MeshDS_Element2d.cdl delete mode 100755 src/MeshDS/MeshDS_Element2d.gxx delete mode 100755 src/MeshDS/MeshDS_Link.cdl delete mode 100755 src/MeshDS/MeshDS_Link.gxx delete mode 100755 src/MeshDS/MeshDS_ListOfInteger.hxx delete mode 100755 src/MeshDS/MeshDS_MapOfInteger.hxx delete mode 100755 src/MeshDS/MeshDS_MapOfIntegerInteger.hxx delete mode 100755 src/MeshDS/MeshDS_Mesh2d.cdl delete mode 100755 src/MeshDS/MeshDS_Mesh2d.gxx delete mode 100755 src/MeshDS/MeshDS_Node.cdl delete mode 100755 src/MeshDS/MeshDS_Node.gxx delete mode 100755 src/MeshDS/MeshDS_PairOfIndex.hxx delete mode 100755 src/MeshDS/MeshDS_Selector.gxx diff --git a/src/MeshAlgo/FILES b/src/MeshAlgo/FILES deleted file mode 100755 index a5175768b1..0000000000 --- a/src/MeshAlgo/FILES +++ /dev/null @@ -1,2 +0,0 @@ -MeshAlgo_CellFilter.hxx -MeshAlgo_CircleInspector.hxx diff --git a/src/MeshAlgo/MeshAlgo.cdl b/src/MeshAlgo/MeshAlgo.cdl deleted file mode 100755 index af429cc92d..0000000000 --- a/src/MeshAlgo/MeshAlgo.cdl +++ /dev/null @@ -1,54 +0,0 @@ --- File: MeshAlgo.cdl --- Created: Tue May 11 16:03:43 1993 --- Author: Didier PIFFAULT --- ----Copyright: Matra Datavision 1993, 1994 - - -package MeshAlgo - - ---Purpose: Manages different algorithms for triangulation. - -- (like Delaunay) - - - ---Level : Advanced. - -- All methods of all classes will be advanced. - - -uses Standard, - gp, - TCollection, - SortTools, - TColStd, - Bnd, - MeshDS - - -is - imported CellFilter from MeshAlgo; - - imported CircleInspector from MeshAlgo; - - deferred class Vertex from MeshAlgo; -- signature - - deferred class Edge from MeshAlgo; -- signature - - deferred class Triangle from MeshAlgo; -- signature - - class Circ from MeshAlgo; - - class CircleTool from MeshAlgo; - - - generic class PntComparator from MeshAlgo; - - - generic class IndexedPntComparator from MeshAlgo; - - - generic class Delaunay from MeshAlgo, DataStructure, - ComparatorOfVertex, ComparatorOfIndexedVertex, - Array1OfVertex, HArray1OfVertex, - HeapSortVertex, HeapSortIndexedVertex; - -end MeshAlgo; diff --git a/src/MeshAlgo/MeshAlgo_CellFilter.hxx b/src/MeshAlgo/MeshAlgo_CellFilter.hxx deleted file mode 100755 index 0c9a8fbb3e..0000000000 --- a/src/MeshAlgo/MeshAlgo_CellFilter.hxx +++ /dev/null @@ -1,12 +0,0 @@ -// File: MeshAlgo_CellFilter.hxx -// Created: May 26 16:40:53 2008 -// Author: Ekaterina SMIRNOVA -// Copyright: Open CASCADE SAS 2008 - - -#include -#include -#include -#include - -typedef NCollection_CellFilter MeshAlgo_CellFilter; diff --git a/src/MeshAlgo/MeshAlgo_Circ.cdl b/src/MeshAlgo/MeshAlgo_Circ.cdl deleted file mode 100755 index aa4f28152a..0000000000 --- a/src/MeshAlgo/MeshAlgo_Circ.cdl +++ /dev/null @@ -1,45 +0,0 @@ --- File: MeshAlgo_Circ.cdl --- Created: Mon Aug 9 16:31:05 1993 --- Author: Didier PIFFAULT --- ----Copyright: Matra Datavision 1993 - - -class Circ from MeshAlgo - - ---Purpose: Describes a 2d circle with a size of only 3 - -- Standard Real numbers instead of gp who needs 7 - -- Standard Real numbers. - -uses Real from Standard, - XY from gp - - -is Create returns Circ from MeshAlgo; - - Create (loc : XY from gp; rad : Real from Standard) - returns Circ from MeshAlgo; - - SetLocation(me : in out; loc : XY from gp) - is static; - - SetRadius (me : in out; rad : Real from Standard) - is static; - - Location (me) - ---C++: return const & - ---C++: inline - returns XY from gp - is static; - - Radius (me) - ---C++: return const & - ---C++: inline - returns Real from Standard - is static; - - -fields location : XY from gp; - radius : Real from Standard; - -end Circ; diff --git a/src/MeshAlgo/MeshAlgo_Circ.cxx b/src/MeshAlgo/MeshAlgo_Circ.cxx deleted file mode 100755 index 5d175939cb..0000000000 --- a/src/MeshAlgo/MeshAlgo_Circ.cxx +++ /dev/null @@ -1,23 +0,0 @@ -// File: MeshAlgo_Circ.cxx -// Created: Mon Aug 9 17:48:36 1993 -// Author: Didier PIFFAULT -// - -#include - -MeshAlgo_Circ::MeshAlgo_Circ() -{} - -MeshAlgo_Circ::MeshAlgo_Circ(const gp_XY& loc, const Standard_Real rad) - : location(loc), radius(rad) -{} - -void MeshAlgo_Circ::SetLocation(const gp_XY& loc) -{ - location=loc; -} - -void MeshAlgo_Circ::SetRadius(const Standard_Real rad) -{ - radius=rad; -} diff --git a/src/MeshAlgo/MeshAlgo_Circ.lxx b/src/MeshAlgo/MeshAlgo_Circ.lxx deleted file mode 100755 index dd34e31c76..0000000000 --- a/src/MeshAlgo/MeshAlgo_Circ.lxx +++ /dev/null @@ -1,10 +0,0 @@ -// File: MeshAlgo_Circ.lxx -// Created: Mon Aug 9 17:46:36 1993 -// Author: Didier PIFFAULT -// - -inline const gp_XY& MeshAlgo_Circ::Location() const -{ return location;} - -inline const Standard_Real& MeshAlgo_Circ::Radius() const -{ return radius;} diff --git a/src/MeshAlgo/MeshAlgo_CircleInspector.hxx b/src/MeshAlgo/MeshAlgo_CircleInspector.hxx deleted file mode 100755 index a4d315c3da..0000000000 --- a/src/MeshAlgo/MeshAlgo_CircleInspector.hxx +++ /dev/null @@ -1,84 +0,0 @@ -// File: MeshAlgo_CircleInspector.hxx -// Created: May 26 16:40:53 2008 -// Author: Ekaterina SMIRNOVA -// Copyright: Open CASCADE SAS 2008 - - -#ifndef MeshAlgo_CircleInspector_Header -#define MeshAlgo_CircleInspector_Header - -#include - -#include -#include -#include -#include - -#include -#include - -typedef NCollection_Vector CircVector; - -//======================================================================= -//! The class to find in the coincidence points -//======================================================================= - -class MeshAlgo_CircleInspector : public NCollection_CellFilter_InspectorXY -{ -public: - typedef Standard_Integer Target; - //! Constructor; remembers tolerance and collector data structure. - //! All the found points are put in the map and excluded from further - //! consideration. - MeshAlgo_CircleInspector (Standard_Real theTol, - Standard_Integer nbComp, - const MeshDS_BaseAllocator& theAlloc); - - void Add(Standard_Integer theInd,const MeshAlgo_Circ& theCircle) - { - myInitCircle.SetValue(theInd, theCircle); - } - - void ClerResList() - { - myResInd.Clear(); - } - - CircVector& MapOfCirc() - { - return myInitCircle; - } - - MeshAlgo_Circ& GetCirc(Standard_Integer theInd) - { - return myInitCircle(theInd); - } - - //! Set current node to be checked - void SetCurrent (const gp_XY& theCurCircle) - { - myCurrent = theCurCircle; - } - - //!Get result index of node - MeshDS_ListOfInteger& GetCoincidentInd() - { - return myResInd; - } - - //! Implementation of inspection method - NCollection_CellFilter_Action Inspect (const Standard_Integer theTarget); - - static Standard_Boolean IsEqual (Standard_Integer theIdx, const Standard_Integer theTarget) - { - return (theIdx == theTarget); - } - -private: - Standard_Real myTol; - MeshDS_ListOfInteger myResInd; - CircVector myInitCircle; - gp_XY myCurrent; -}; - -#endif diff --git a/src/MeshAlgo/MeshAlgo_CircleTool.cdl b/src/MeshAlgo/MeshAlgo_CircleTool.cdl deleted file mode 100755 index bcf4f5380c..0000000000 --- a/src/MeshAlgo/MeshAlgo_CircleTool.cdl +++ /dev/null @@ -1,93 +0,0 @@ --- File: MeshAlgo_CircleTool.cdl --- Created: Wed May 12 09:30:49 1993 --- Author: Didier PIFFAULT --- ----Copyright: Matra Datavision 1993 - - -class CircleTool from MeshAlgo - - ---Purpose: Create sort and destroy the circles used in - -- triangulation. - -uses Boolean from Standard, - Integer from Standard, - Real from Standard, - XY from gp, - Circ2d from gp, - ListOfInteger from MeshDS, - CellFilter from MeshAlgo, - CircleInspector from MeshAlgo, - BaseAllocator from MeshDS - -is Create (theAlloc : in BaseAllocator from MeshDS) - returns CircleTool from MeshAlgo; - - - Create (numberOfComponents : in Integer from Standard; - theAlloc : in BaseAllocator from MeshDS) - ---Purpose: Constructs a CircleTool with the maximal dimension - -- of the occuped space and an evaluation of the - -- number of circles. - returns CircleTool from MeshAlgo; - - Initialize (me : in out; - numberOfComponents : in Integer from Standard) - ---Purpose: Constructs a CircleTool with the maximal dimension - -- of the occuped space and an evaluation of the - -- number of circles. - is static; - - SetCellSize(me : in out; - theSize : in Real from Standard) - ---Purpose: Sets new size for cellfilter - is static; - - SetCellSize(me : in out; - theXSize : in Real from Standard; - theYSize : in Real from Standard) - ---Purpose: Sets new size for cellfilter - is static; - - SetMinMaxSize(me : in out; - theMin : in XY from gp; - theMax : in XY from gp) - ---Purpose: Sets min and max size for circle - is static; - - Add (me : in out; - theCirc : in Circ2d from gp; - theIndex : in Integer from Standard) - ---Purpose: Adds and binds circle to the tool. - is static; - - - Add (me : in out; - p1, p2, p3 : in XY from gp; - theIndex : in Integer from Standard) - ---Purpose: Computes adds and binds circle to the tool. - returns Boolean from Standard is static; - - MocAdd (me : in out; - theIndex : in Integer from Standard); - ---Purpose: Adds implicit zero circle - - - Delete (me : in out; theIndex : Integer from Standard) - ---Purpose: Deletes a circle from the tool. - is static; - - - Select (me : in out; thePnt : XY from gp) - ---Purpose: Select the circles which contains thePnt. - ---C++: return & - returns ListOfInteger from MeshDS is static; - -fields Tolerance : Real from Standard; - Allocator : BaseAllocator from MeshDS; - CellFilter : CellFilter from MeshAlgo; - Selector : CircleInspector from MeshAlgo; - FaceMax : XY from gp; - FaceMin : XY from gp; - -end CircleTool; diff --git a/src/MeshAlgo/MeshAlgo_CircleTool.cxx b/src/MeshAlgo/MeshAlgo_CircleTool.cxx deleted file mode 100755 index 40b9723944..0000000000 --- a/src/MeshAlgo/MeshAlgo_CircleTool.cxx +++ /dev/null @@ -1,268 +0,0 @@ -// File: MeshAlgo_CircleTool.cxx -// Created: Tue Jun 15 19:10:25 1993 -// Author: Didier PIFFAULT -// - -#include -#include -#include -#include -#include - - -//======================================================================= -//function : MeshAlgo_CircleInspector -//purpose : Constructor -// -//======================================================================= - -MeshAlgo_CircleInspector::MeshAlgo_CircleInspector (Standard_Real theTol, - Standard_Integer nbComp, - const MeshDS_BaseAllocator& theAlloc) - : myTol(theTol*theTol), - myResInd(theAlloc), - myInitCircle(nbComp) -{ -// myTol = theTol*theTol; -} - -//======================================================================= -//function : Inspect -//purpose : -// -//======================================================================= -NCollection_CellFilter_Action MeshAlgo_CircleInspector::Inspect (const Standard_Integer theTarget) -{ - const MeshAlgo_Circ& Circ = myInitCircle(theTarget); - Standard_Real R = Circ.Radius(); - if(R < 0) - return CellFilter_Purge; - Standard_Real dx,dy; - const gp_XY& aLoc=Circ.Location(); - dx=myCurrent.X()-aLoc.X(); - dy=myCurrent.Y()-aLoc.Y(); - if ((dx*dx+dy*dy)-(R*R) <= myTol) - myResInd.Append(theTarget); - return CellFilter_Keep; -} - - -//======================================================================= -//function : MeshAlgo_CircleTool -//purpose : -//======================================================================= -MeshAlgo_CircleTool::MeshAlgo_CircleTool(const MeshDS_BaseAllocator& theAlloc) - : Tolerance(Precision::PConfusion()), - Allocator(theAlloc), - CellFilter(10, theAlloc), - Selector(Tolerance,64,theAlloc) -{ - Tolerance=Tolerance*Tolerance; -} - -//======================================================================= -//function : MeshAlgo_CircleTool -//purpose : -//======================================================================= -MeshAlgo_CircleTool::MeshAlgo_CircleTool(const Standard_Integer nbComp, - const MeshDS_BaseAllocator& theAlloc) - : Tolerance(Precision::PConfusion()), - Allocator(theAlloc), - CellFilter(10, theAlloc), - Selector(Tolerance,Max(nbComp,64),theAlloc) -{ - Tolerance=Tolerance*Tolerance; -} - - -//======================================================================= -//function : Initialize -//purpose : -//======================================================================= -void MeshAlgo_CircleTool::Initialize(const Standard_Integer /*nbComp*/) -{ - Tolerance=Precision::PConfusion(); - Tolerance=Tolerance*Tolerance; -} - -void MeshAlgo_CircleTool::SetCellSize(const Standard_Real theSize) -{ - CellFilter.Reset(theSize, Allocator); -} - -void MeshAlgo_CircleTool::SetCellSize(const Standard_Real theXSize, - const Standard_Real theYSize) -{ - Standard_Real aCellSize[2]; - aCellSize[0] = theXSize; - aCellSize[1] = theYSize; - - CellFilter.Reset(aCellSize, Allocator); -} - - -void MeshAlgo_CircleTool::SetMinMaxSize(const gp_XY& theMin, - const gp_XY& theMax) -{ - FaceMin = theMin; - FaceMax = theMax; -} - -//======================================================================= -//function : Add -//purpose : -//======================================================================= -void MeshAlgo_CircleTool::Add(const gp_Circ2d& theCirc, - const Standard_Integer theIndex) -{ - gp_XY aCoord(theCirc.Location().Coord()); - Standard_Real R = theCirc.Radius(); - MeshAlgo_Circ aCir(aCoord, R); - - //compute coords - Standard_Real xMax=Min(aCoord.X()+R,FaceMax.X()); - Standard_Real xMin=Max(aCoord.X()-R,FaceMin.X()); - Standard_Real yMax=Min(aCoord.Y()+R,FaceMax.Y()); - Standard_Real yMin=Max(aCoord.Y()-R,FaceMin.Y()); - - gp_XY MinPnt(xMin,yMin); - gp_XY MaxPnt(xMax,yMax); - - CellFilter.Add(theIndex, MinPnt, MaxPnt); - Selector.Add(theIndex, aCir); -} - -//======================================================================= -//function : Add -//purpose : -//======================================================================= -Standard_Boolean MeshAlgo_CircleTool::Add(const gp_XY& p1, - const gp_XY& p2, - const gp_XY& p3, - const Standard_Integer theIndex) -{ - gp_XY m1((p1.X()+p2.X())/2., (p1.Y()+p2.Y())/2.); - gp_XY m2((p2.X()+p3.X())/2., (p2.Y()+p3.Y())/2.); - gp_XY m3((p3.X()+p1.X())/2., (p3.Y()+p1.Y())/2.); - Standard_Real dx=m1.X()-m2.X(); - Standard_Real dy=m1.Y()-m2.Y(); - Standard_Real d12=(dx*dx)+(dy*dy); - dx=m2.X()-m3.X(); - dy=m2.Y()-m3.Y(); - Standard_Real d23=(dx*dx)+(dy*dy); - dx=m3.X()-m1.X(); - dy=m3.Y()-m1.Y(); - Standard_Real d31=(dx*dx)+(dy*dy); - gp_XY pl11, pl12, pl21, pl22; - - if (d12>d23 && d12>d31) { - dy=p2.Y()-p1.Y(); - dx=p1.X()-p2.X(); - if (dy!=0. || dx!=0.) { - pl11 = m1; - pl12 = gp_XY(dy, dx); - } - else return Standard_False; - - dy=p3.Y()-p2.Y(); - dx=p2.X()-p3.X(); - if (dy!=0. || dx!=0.) { - pl21 = m2; - pl22 = gp_XY(dy, dx); - } - else return Standard_False; - } - else { - if (d23>d31) { - dy=p3.Y()-p2.Y(); - dx=p2.X()-p3.X(); - if (dy!=0. || dx!=0.) { - pl11 = m2; - pl12 = gp_XY(dy, dx); - } - else return Standard_False; - - dy=p1.Y()-p3.Y(); - dx=p3.X()-p1.X(); - if (dy!=0. || dx!=0.) { - pl21 = m3; - pl22 = gp_XY(dy, dx); - } - else return Standard_False; - } - else { - dy=p1.Y()-p3.Y(); - dx=p3.X()-p1.X(); - if (dy!=0. || dx!=0.) { - pl11 = m3; - pl12 = gp_XY(dy, dx); - } - else return Standard_False; - - dy=p2.Y()-p1.Y(); - dx=p1.X()-p2.X(); - if (dy!=0. || dx!=0.) { - pl21 = m1; - pl22 = gp_XY(dy, dx); - } - else return Standard_False; - } - } - - gp_XY aVecO1O2 = pl21 - pl11; - Standard_Real aCrossD1D2 = pl12 ^ pl22; - Standard_Real theSinAngle = Abs(aCrossD1D2); - if (theSinAngle < gp::Resolution()) - return Standard_False; - Standard_Real theParam1 = (aVecO1O2 ^ pl22) / aCrossD1D2; - gp_XY pInt = pl11+pl12*theParam1; - dx=p1.X()-pInt.X(); - dy=p1.Y()-pInt.Y(); - Standard_Real R = Sqrt(dx*dx+dy*dy); - MeshAlgo_Circ aCir(pInt, R); - - //compute coords - Standard_Real xMax=Min(pInt.X()+R,FaceMax.X()); - Standard_Real xMin=Max(pInt.X()-R,FaceMin.X()); - Standard_Real yMax=Min(pInt.Y()+R,FaceMax.Y()); - Standard_Real yMin=Max(pInt.Y()-R,FaceMin.Y()); - - gp_XY MinPnt(xMin,yMin); - gp_XY MaxPnt(xMax,yMax); - - CellFilter.Add(theIndex, MinPnt, MaxPnt); - - Selector.Add(theIndex, aCir); - return Standard_True; -} - -//======================================================================= -//function : Delete -//purpose : -//======================================================================= -void MeshAlgo_CircleTool::Delete(const Standard_Integer theIndex) -{ - MeshAlgo_Circ& Circ = Selector.GetCirc(theIndex); - if(Circ.Radius() > 0.) { - Circ.SetRadius(-1); - } -} - -//======================================================================= -//function : Select -//purpose : -//======================================================================= -MeshDS_ListOfInteger& MeshAlgo_CircleTool::Select(const gp_XY& thePnt) -{ - Selector.ClerResList(); - Selector.SetCurrent(thePnt); - CellFilter.Inspect (thePnt, Selector); - return Selector.GetCoincidentInd(); -} - -void MeshAlgo_CircleTool::MocAdd(const Standard_Integer theIndex) -{ - gp_XY nullPnt(0.,0.); - MeshAlgo_Circ theNullCir(nullPnt, -1.); - Selector.Add(theIndex, theNullCir); -} diff --git a/src/MeshAlgo/MeshAlgo_Delaunay.cdl b/src/MeshAlgo/MeshAlgo_Delaunay.cdl deleted file mode 100755 index 4fe0406dbc..0000000000 --- a/src/MeshAlgo/MeshAlgo_Delaunay.cdl +++ /dev/null @@ -1,241 +0,0 @@ --- File: MeshAlgo_Delaunay.cdl --- Created: Tue May 11 17:19:19 1993 --- Author: Didier PIFFAULT --- ----Copyright: Matra Datavision 1993, 1994 - - -generic class Delaunay from MeshAlgo (Vertex as any; - Edge as any; - Triangle as any) - - ---Purpose: Compute the Delaunay's triangulation with the - -- algorithm of Watson. - - -uses Integer from Standard, - SequenceOfInteger from TColStd, - Array1OfInteger from TColStd, - XY from gp, - Box2d from Bnd, - CircleTool from MeshAlgo, - MapOfInteger from MeshDS, - MapOfIntegerInteger from MeshDS - - - class DataStructure instantiates Mesh2d from MeshDS - (Vertex, Edge, Triangle); - - class ComparatorOfVertex instantiates PntComparator(Vertex,XY from gp); - - class ComparatorOfIndexedVertex instantiates IndexedPntComparator - (DataStructure from MeshAlgo, XY from gp); - - class Array1OfVertex instantiates Array1 from TCollection(Vertex); - - class HArray1OfVertex instantiates HArray1 from TCollection - (Vertex, Array1OfVertex); - - class HeapSortVertex instantiates HeapSort from SortTools - (Vertex, Array1OfVertex, ComparatorOfVertex); - - class HeapSortIndexedVertex instantiates HeapSort from SortTools - (Integer, Array1OfInteger from TColStd, ComparatorOfIndexedVertex); - - -is - --- Interface : - - Create (Vertices : in out Array1OfVertex from MeshAlgo; - ZPositive : in Boolean from Standard=Standard_True) - ---Purpose: Creates the triangulation with an empty Mesh - -- data structure. - returns Delaunay from MeshAlgo; - - - Create (OldMesh : mutable DataStructure from MeshAlgo; - Vertices : in out Array1OfVertex from MeshAlgo; - ZPositive : in Boolean from Standard=Standard_True) - ---Purpose: Creates the triangulation with and existant - -- Mesh data structure. - returns Delaunay from MeshAlgo; - - - Create (OldMesh : mutable DataStructure from MeshAlgo; - VertexIndices : in out Array1OfInteger from TColStd; - ZPositive : in Boolean from Standard=Standard_True) - ---Purpose: Creates the triangulation with and existant - -- Mesh data structure. - returns Delaunay from MeshAlgo; - - - AddVertex (me : in out; - theVertex : in Vertex); - ---Purpose: Adds a new vertex in the triangulation. - - - RemoveVertex (me : in out; - theVertex : in Vertex); - ---Purpose: Removes a vertex in the triangulation. - - - AddVertices (me : in out; - Vertices : in out Array1OfVertex from MeshAlgo); - ---Purpose: Adds some vertices in the triangulation. - - - RevertDiagonal (me : in out; - theEdge : in Integer from Standard) - ---Purpose: Substitutes the Edge beetween to triangles by the - -- other diagonal of the quadrilatere if it is - -- possible (convex polygon). Return True if done. - returns Boolean from Standard; - - - UseEdge (me : in out; - theEdge : in Integer from Standard) - ---Purpose: Modify mesh to use the edge. Return True if done. - returns Boolean from Standard; - - - SmoothMesh (me : in out; - Epsilon : in Real from Standard); - ---Purpose: Smooths the mesh in 2d space. The method is to - -- move the free and OnSurface vertices at the - -- barycentre of their polygon. - - - Result (me) - ---C++: return const & - ---Purpose: Gives the Mesh data structure. - returns DataStructure from MeshAlgo; - - - Frontier (me : in out) - ---Purpose: Gives the list of frontier edges - ---C++: return const & - returns MapOfInteger from MeshDS; - - - InternalEdges (me : in out) - ---Purpose: Gives the list of internal edges - ---C++: return const & - returns MapOfInteger from MeshDS; - - - FreeEdges (me : in out) - ---Purpose: Gives the list of free edges used only one time - ---C++: return const & - returns MapOfInteger from MeshDS; - - - GetVertex (me; - vIndex : in Integer from Standard) - ---C++: return const & - ---C++: inline - returns Vertex; - - - GetEdge (me; - eIndex : in Integer from Standard) - ---C++: return const & - ---C++: inline - returns Edge; - - - GetTriangle (me; - tIndex : in Integer from Standard) - ---C++: return const & - ---C++: inline - returns Triangle; - - --- Implementation : - - Init (me : in out; - Vertices : in out Array1OfVertex from MeshAlgo); - ---Purpose: Initializes the triangulation with an Array of - -- Vertex. - - Compute (me : in out; - VertexIndices : in out Array1OfInteger from TColStd); - ---Purpose: Computes the triangulation and add the vertices - -- edges and triangles to the Mesh data structure. - - ReCompute (me : in out; - VertexIndices : in out Array1OfInteger from TColStd); - ---Purpose: Clear the existing triangles and recomputes - -- the triangulation . - - SuperMesh (me : in out; - theBox : Box2d from Bnd); - ---Purpose: Build the super mesh . - - - FrontierAdjust (me : in out) - ---Purpose: Adjust the mesh on the frontier. - is private; - - - MeshLeftPolygonOf (me : in out; - EdgeIndex : Integer from Standard; - EdgeSens : Boolean from Standard) - ---Purpose: Find left polygon of the edge and call MeshPolygon. - is private; - - - MeshPolygon (me : in out; - Polygon : in out SequenceOfInteger from TColStd) - ---Purpose: Mesh closed polygon. - is private; - - - CreateTriangles(me : in out; - vertexIndex : Integer from Standard; - --vertex : in Vertex; - freeEdges: out MapOfIntegerInteger from MeshDS) - ---Purpose: Creates the triangles beetween the node - -- and the polyline . - is private; - - - DeleteTriangle (me : in out; - TrianIndex : Integer from Standard; - freeEdges : out MapOfIntegerInteger from MeshDS) - ---Purpose: Deletes the triangle of index and - -- add the free edges to the map. - -- When an edge is suppressed more than one time - -- it is destroyed. - is private; - - - Contains (me; - TrianIndex : Integer from Standard; - theVertex : in Vertex; - edgeOn : out Integer from Standard) - ---Purpose: Test if triangle of index - -- contains geometricaly . If - -- is != 0 then theVertex is on Edge of index - -- . - returns Boolean from Standard; - - TriangleContaining - (me : in out; - theVertex : in Vertex) - ---Purpose: Gives the index of triangle containing - -- geometricaly . - returns Integer from Standard; - - -fields MeshData : DataStructure from MeshAlgo; - PositiveOrientation : Boolean from Standard; - tCircles : CircleTool from MeshAlgo; - supVert1 : Integer from Standard; - supVert2 : Integer from Standard; - supVert3 : Integer from Standard; - supTrian : Triangle; - mapEdges : MapOfInteger from MeshDS; - - -end Delaunay; diff --git a/src/MeshAlgo/MeshAlgo_Delaunay.gxx b/src/MeshAlgo/MeshAlgo_Delaunay.gxx deleted file mode 100755 index 4e4d69bf0e..0000000000 --- a/src/MeshAlgo/MeshAlgo_Delaunay.gxx +++ /dev/null @@ -1,1594 +0,0 @@ -// File: MeshAlgo_Delaunay.gxx -// Created: Wed May 12 08:58:20 1993 -// Author: Didier PIFFAULT -// - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -typedef TColStd_ListIteratorOfListOfInteger IteratorOnListOfInteger; -typedef TColStd_ListOfInteger ListOfInteger; - -#define EPSEPS Precision::PConfusion()*Precision::PConfusion() - -const gp_XY SortingDirection(M_SQRT1_2, M_SQRT1_2); - -//#define TRIANGULATION_MESURE - -#ifdef TRIANGULATION_MESURE -#include -#include -static OSD_Chronometer ChroTrigu; -static OSD_Chronometer ChroSearch; -static OSD_Chronometer ChroDelete; -static OSD_Chronometer ChroDelTri; -static OSD_Chronometer ChroDelCir; -static OSD_Chronometer ChroCreate; -static OSD_Chronometer ChroFront; -Standard_EXPORT Standard_Boolean Triangulation_Chrono; -#endif - -//#define TRIANGULATION_DEBUG - -#ifdef TRIANGULATION_DEBUG -Standard_IMPORT Standard_Integer Triangulation_Trace; -#endif - - -//======================================================================= -//function : MeshAlgo_Delaunay -//purpose : -//======================================================================= -MeshAlgo_Delaunay::MeshAlgo_Delaunay - (MeshAlgo_Array1OfVertex& Vertices, const Standard_Boolean ZPositive) -: PositiveOrientation(ZPositive), tCircles(Vertices.Length(),new NCollection_IncAllocator()) -{ - if (Vertices.Length()>2) { - MeshData=new MeshAlgo_DataStructure(new NCollection_IncAllocator(),Vertices.Length()); - Init(Vertices); - } -} - -//======================================================================= -//function : MeshAlgo_Delaunay -//purpose : -//======================================================================= -MeshAlgo_Delaunay::MeshAlgo_Delaunay - (const Handle(MeshAlgo_DataStructure)& OldMesh, - MeshAlgo_Array1OfVertex& Vertices, - const Standard_Boolean ZPositive) -: PositiveOrientation(ZPositive), tCircles(Vertices.Length(),OldMesh->Allocator()) -{ - MeshData=OldMesh; - if (Vertices.Length()>2) - Init(Vertices); -} - - -//======================================================================= -//function : Init -//purpose : -//======================================================================= -void MeshAlgo_Delaunay::Init(MeshAlgo_Array1OfVertex& Vertices) -{ - Bnd_Box2d theBox; - TColStd_Array1OfInteger vertexIndices(Vertices.Lower(), Vertices.Upper()); - Standard_Integer niver; - - for (niver=Vertices.Lower(); niver<=Vertices.Upper(); niver++) { - theBox.Add(gp_Pnt2d(Vertices(niver).Coord())); - vertexIndices(niver)=MeshData->AddNode(Vertices(niver)); - } - - theBox.Enlarge(Precision::PConfusion()); - SuperMesh(theBox); - - MeshAlgo_HeapSortIndexedVertex::Sort - (vertexIndices, - MeshAlgo_ComparatorOfIndexedVertex(SortingDirection, - Precision::PConfusion(), - MeshData)); - - Compute(vertexIndices); -} - - -//======================================================================= -//function : MeshAlgo_Delaunay -//purpose : -//======================================================================= -MeshAlgo_Delaunay::MeshAlgo_Delaunay - (const Handle(MeshAlgo_DataStructure)& OldMesh, - TColStd_Array1OfInteger& VertexIndices, - const Standard_Boolean ZPositive) -: PositiveOrientation(ZPositive), tCircles(VertexIndices.Length(),OldMesh->Allocator()) -{ - MeshData=OldMesh; - if (VertexIndices.Length()>2) { - Bnd_Box2d theBox; - Standard_Integer niver; - for (niver=VertexIndices.Lower(); niver<=VertexIndices.Upper(); niver++) { - theBox.Add(gp_Pnt2d(GetVertex(VertexIndices(niver)).Coord())); - } - - theBox.Enlarge(Precision::PConfusion()); - SuperMesh(theBox); - - MeshAlgo_HeapSortIndexedVertex::Sort - (VertexIndices, - MeshAlgo_ComparatorOfIndexedVertex(SortingDirection, - Precision::PConfusion(), - MeshData)); - - Compute(VertexIndices); - } -} - -//======================================================================= -//function : Compute -//purpose : -//======================================================================= -void MeshAlgo_Delaunay::Compute (TColStd_Array1OfInteger& VertexIndices) -{ - // Insertion of edges of super triangles in the list of free edges: - MeshDS_MapOfIntegerInteger loopEdges(10,MeshData->Allocator()); - Standard_Integer e1, e2, e3; - Standard_Boolean o1, o2, o3; - supTrian.Edges(e1, e2, e3, o1, o2, o3); - loopEdges.Bind(e1, Standard_True); - loopEdges.Bind(e2, Standard_True); - loopEdges.Bind(e3, Standard_True); - - if (VertexIndices.Length()>0) { - - // Creation of 3 triangles with the node and the edges of the super triangle: - Standard_Integer iVert=VertexIndices.Lower(); - CreateTriangles(VertexIndices(iVert), loopEdges); - - // Insertion of nodes : - Standard_Boolean modif=Standard_True; - Standard_Integer edgeOn, triPerce; - - Standard_Integer aVertIdx; - for (iVert++; iVert<=VertexIndices.Upper(); iVert++) { - aVertIdx = VertexIndices(iVert); - const Vertex& refToVert=GetVertex(aVertIdx); - loopEdges.Clear(); - - // List of indices of circles containing the node : - MeshDS_ListOfInteger& cirL=tCircles.Select(refToVert.Coord()); - MeshDS_ListOfInteger::Iterator itT(cirL); - - edgeOn=0; - triPerce=0; - - for (; itT.More(); itT.Next()) { - - // To add a node in the mesh it is necessary to check to conditions - // - the node should be located on the border of the mesh and in an existing triangle - // - all adjacent triangles should belong to a component connected with this triangle - if (Contains(itT.Value(), refToVert, edgeOn)) { - triPerce=itT.Value(); - cirL.Remove(itT); - break; - } - } - - if (triPerce>0) { - DeleteTriangle(triPerce, loopEdges); - - modif=Standard_True; - while (modif && !cirL.IsEmpty()) { - modif=Standard_False; - MeshDS_ListOfInteger::Iterator itT1(cirL); - for (; itT1.More(); itT1.Next()) { - GetTriangle(itT1.Value()).Edges(e1,e2,e3,o1,o2,o3); - if (loopEdges.IsBound(e1) || - loopEdges.IsBound(e2) || - loopEdges.IsBound(e3)) { - modif=Standard_True; - DeleteTriangle(itT1.Value(), loopEdges); - cirL.Remove(itT1); - break; - } - } - } - -#ifdef TRIANGULATION_DEBUG - if (Triangulation_Trace>0) { - cout << " creation of a triangle with the vertex: "; - cout << refToVert.Coord().X() << " " << refToVert.Coord().Y() << endl; - } -#endif - // Creation of triangles with the current node - // and free edges and removal of these edges from the list of free edges - CreateTriangles(aVertIdx, loopEdges); - - } - } - - // check that internal edges are not crossed by triangles - MeshDS_MapOfInteger::Iterator itFr(InternalEdges()); - - // destruction of triancles intersecting internal edges - // and their replacement by makeshift triangles - Standard_Integer nbc; - - itFr.Reset(); - for (; itFr.More(); itFr.Next()) { - nbc = MeshData->ElemConnectedTo(itFr.Key()).Extent(); - if (nbc == 0) { - MeshLeftPolygonOf(itFr.Key(), Standard_True); - MeshLeftPolygonOf(itFr.Key(), Standard_False); - } - } - - // adjustment of meshes to boundary edges - FrontierAdjust(); - - } - - // destruction of triangles containing a top of the super triangle - MeshAlgo_SelectorOfDataStructure select(MeshData); - select.NeighboursOfNode(supVert1); - select.NeighboursOfNode(supVert2); - select.NeighboursOfNode(supVert3); - MeshDS_MapOfInteger::Iterator trs(select.Elements()); - loopEdges.Clear(); - for (;trs.More(); trs.Next()) { - DeleteTriangle(trs.Key(), loopEdges); - } - - // all edges that remain free are removed from loopEdges; - // only the boundary edges of the triangulation remain in loopEdges - MeshDS_MapOfIntegerInteger::Iterator itLEd(loopEdges); - for (; itLEd.More(); itLEd.Next()) { - if (MeshData->ElemConnectedTo(itLEd.Key()).IsEmpty()) - MeshData->RemoveLink(itLEd.Key()); - } - - //the tops of the super triangle are destroyed - MeshData->RemoveNode(supVert1); - MeshData->RemoveNode(supVert2); - MeshData->RemoveNode(supVert3); - -} - -//======================================================================= -//function : ReCompute -//purpose : -//======================================================================= -void MeshAlgo_Delaunay::ReCompute (TColStd_Array1OfInteger& VertexIndices) -{ - MeshData->ClearDomain(); - - // Initialization of CircleTool : - tCircles.Initialize(VertexIndices.Length()); - - if (VertexIndices.Length()>2) - Compute(VertexIndices); -} - - -//======================================================================= -//function : FrontierAdjust -//purpose : -//======================================================================= -void MeshAlgo_Delaunay::FrontierAdjust() -{ - Standard_Integer e1, e2, e3; - Standard_Boolean o1, o2, o3; - MeshDS_MapOfIntegerInteger loopEdges(10,MeshData->Allocator()); - MeshDS_ListOfInteger::Iterator itconx; - ListOfInteger tril; - - // find external triangles on boundary edges - MeshDS_MapOfInteger::Iterator itFr(Frontier()); - for (; itFr.More(); itFr.Next()) { - const MeshDS_PairOfIndex& aPair = MeshData->ElemConnectedTo(itFr.Key()); - for(Standard_Integer j = 1, jn = aPair.Extent(); j <= jn; j++) { - const Triangle& trc=GetTriangle(aPair.Index(j)); - trc.Edges(e1,e2,e3,o1,o2,o3); - if ((itFr.Key()==e1 && !o1) || - (itFr.Key()==e2 && !o2) || - (itFr.Key()==e3 && !o3)) { -#ifdef TRIANGULATION_DEBUG - if (Triangulation_Trace>0) { - cout << "---> destruction of the triangle " << aPair.Index(j) << endl; - } -#endif - tril.Append(aPair.Index(j)); - } - } - } - - // destruction of external triangles on boundary edges - for (; !tril.IsEmpty(); tril.RemoveFirst()) { - DeleteTriangle(tril.First(), loopEdges); - } - - // destrucrion of remaining hanging edges : - MeshDS_MapOfIntegerInteger::Iterator itFE(loopEdges); - - for (; itFE.More(); itFE.Next()) { - if (MeshData->ElemConnectedTo(itFE.Key()).IsEmpty()) - MeshData->RemoveLink(itFE.Key()); - } - - // destruction of triangles crossing the boundary edges and - // their replacement by makeshift triangles - itFr.Reset(); - for (; itFr.More(); itFr.Next()) { - if (MeshData->ElemConnectedTo(itFr.Key()).IsEmpty()) { - MeshLeftPolygonOf(itFr.Key(), Standard_True); - } - } - - // After this processing there sometimes remain triangles outside boundaries. - // Destruction of these triangles : - Standard_Integer nbFront; - - // For each edge with only one connection - // If one of its tops already passes two boundary edges, - // the connected triangle is outside of the contour - Standard_Boolean again = Standard_True; - - while (again) { - tril.Clear(); - loopEdges.Clear(); - - for (itFr.Initialize(FreeEdges()); itFr.More(); itFr.Next()) { - const Edge& edg=GetEdge(itFr.Key()); - if (edg.Movability()!=MeshDS_Frontier) { - nbFront=0; - if (MeshData->ElemConnectedTo(itFr.Key()).IsEmpty()) - loopEdges.Bind(itFr.Key(), Standard_True); - else { - for (itconx.Init(MeshData->LinkNeighboursOf(edg.FirstNode())); - itconx.More(); itconx.Next()) { - if (GetEdge(itconx.Value()).Movability()==MeshDS_Frontier) { - nbFront++; - if (nbFront>1) break; - } - } - if (nbFront==2) { - const MeshDS_PairOfIndex& aPair = MeshData->ElemConnectedTo(itFr.Key()); - for(Standard_Integer j = 1, jn = aPair.Extent(); j <= jn; j++) { - const Standard_Integer elemId = aPair.Index(j); - GetTriangle(elemId).Edges(e1, e2, e3, o1, o2, o3); - if (GetEdge(e1).Movability()==MeshDS_Free && - GetEdge(e2).Movability()==MeshDS_Free && - GetEdge(e3).Movability()==MeshDS_Free) { -#ifdef TRIANGULATION_DEBUG - if (Triangulation_Trace>0) { - cout << " ----> destruction of the triangle" << elemId <ElemConnectedTo(itFE.Key()).IsEmpty()) - MeshData->RemoveLink(itFE.Key()); - } - - if (kk == 0) break; - } - - // find external triangles on boundary edges - // because in comlex curved boundaries external triangles can appear - // after "mesh left polygon" - for (itFr.Initialize(Frontier()); itFr.More(); itFr.Next()) { - const MeshDS_PairOfIndex& aPair = MeshData->ElemConnectedTo(itFr.Key()); - for(Standard_Integer j = 1, jn = aPair.Extent(); j <= jn; j++) { - const Triangle& trc=GetTriangle(aPair.Index(j)); - trc.Edges(e1,e2,e3,o1,o2,o3); - if ((itFr.Key()==e1 && !o1) || - (itFr.Key()==e2 && !o2) || - (itFr.Key()==e3 && !o3)) { -#ifdef TRIANGULATION_DEBUG - if (Triangulation_Trace>0) { - cout << "---> destruction du triangle " << aPair.Index(j) << endl; - } -#endif - tril.Append(aPair.Index(j)); - } - } - } - - // destruction of external triangles on boundary edges - for (; !tril.IsEmpty(); tril.RemoveFirst()) { - DeleteTriangle(tril.First(), loopEdges); - } - - for (itFE.Initialize(loopEdges); itFE.More(); itFE.Next()) { - if (MeshData->ElemConnectedTo(itFE.Key()).IsEmpty()) - MeshData->RemoveLink(itFE.Key()); - } - - - // in some cases there remain unused boundaries check - for (itFr.Initialize(Frontier()); itFr.More(); itFr.Next()) { - if (MeshData->ElemConnectedTo(itFr.Key()).IsEmpty()) { - MeshLeftPolygonOf(itFr.Key(), Standard_True); - } - } -} - - -//======================================================================= -//function : MeshLeftPolygonOf -//purpose : Triangulation of the polygon to the left of .(material side) -//======================================================================= -void MeshAlgo_Delaunay::MeshLeftPolygonOf(const Standard_Integer indexEdg, - const Standard_Boolean forwdEdg) -{ - const Edge& edg=GetEdge(indexEdg); - TColStd_SequenceOfInteger polyg; - MeshDS_MapOfIntegerInteger loopEdges(10,MeshData->Allocator()); - TColStd_MapOfInteger usedEdges; - - // Find the polygon - usedEdges.Add(indexEdg); - Standard_Integer debut, prem, pivo; -#ifndef DEB - Standard_Integer ders =0, oth =0; -#else - Standard_Integer ders, oth; -#endif - if (forwdEdg) { - polyg.Append(indexEdg); - prem=edg.FirstNode(); - pivo=edg.LastNode(); - } - else { - polyg.Append(-indexEdg); - prem=edg.LastNode(); - pivo=edg.FirstNode(); - } - debut=prem; - const Vertex& debEd=GetVertex(debut); - const Vertex& finEd=GetVertex(pivo); - - // Check the presence of the previous edge : - MeshDS_ListOfInteger::Iterator itLiVer(MeshData->LinkNeighboursOf(prem)); - for (; itLiVer.More(); itLiVer.Next()) { - oth=0; - if (itLiVer.Value()!=indexEdg) { - const Edge& nedg=GetEdge(itLiVer.Value()); - oth=nedg.LastNode(); - if (oth==prem) oth=nedg.FirstNode(); - break; - } - } - if (oth==0) { -#ifdef TRIANGULATION_DEBUG - if (Triangulation_Trace>0) - cout << " MeshLeftPolygonOf : No path to the previous Edge!" << endl; -#endif - return; - } - - - gp_XY vedge(finEd.Coord()); - vedge.Subtract(debEd.Coord()); - gp_XY ved1(vedge); - gp_XY ved2; - Standard_Integer curEdg=indexEdg, e1, e2, e3; - Standard_Boolean o1, o2, o3; - - // Find the nearest to closed polygon : - Standard_Boolean InMesh, notInters; - Standard_Integer nextedge; - Standard_Real ang, angref; - gp_XY vpivo, vedcur, voth; - - while (pivo!=debut) { - nextedge=0; - if (PositiveOrientation) angref=RealFirst(); - else angref=RealLast(); - const Vertex& vertPivo=GetVertex(pivo); - vpivo=vertPivo.Coord(); - vpivo.Subtract(debEd.Coord()); - - itLiVer.Init(MeshData->LinkNeighboursOf(pivo)); - - // Find the next edge with the greatest angle with - // and non intersecting : - - for (; itLiVer.More(); itLiVer.Next()) { - if (itLiVer.Value()!=curEdg) { - notInters=Standard_True; - const Edge& nedg=GetEdge(itLiVer.Value()); - - InMesh=Standard_True; - if (nedg.Movability()==MeshDS_Free) { - if (MeshData->ElemConnectedTo(itLiVer.Value()).IsEmpty()) - InMesh=Standard_False; - } - - if (InMesh) { - oth=nedg.FirstNode(); - if (oth==pivo) oth=nedg.LastNode(); - - vedcur=GetVertex(oth).Coord(); - vedcur.Subtract(vertPivo.Coord()); - if (vedcur.Modulus() >= gp::Resolution() && - ved1.Modulus() >= gp::Resolution()) { - if (prem!=debut && oth!=debut) { - voth=GetVertex(oth).Coord(); - voth.Subtract(debEd.Coord()); - if ((vedge^vpivo)*(vedge^voth)<0.) { - voth=vertPivo.Coord(); - voth.Subtract(finEd.Coord()); - if ((vedcur^vpivo)*(vedcur^voth)<0.) - notInters=Standard_False; - } - } - - if (notInters) { - ang=gp_Vec2d(ved1).Angle(gp_Vec2d(vedcur)); - - if ((PositiveOrientation && ang>angref) || - (!PositiveOrientation && ang0) - cout << " MeshLeftPolygonOf : polygone is not closed!" - << endl; -#endif - - // all edges of the boundary contour are removed from the polygon - curEdg=Abs(polyg(polyg.Length())); - while (GetEdge(curEdg).Movability()==MeshDS_Frontier){ - polyg.Remove(polyg.Length()); - if (polyg.Length()<=0) break; - curEdg=Abs(polyg(polyg.Length())); - } - return; - } - - polyg.Append(nextedge); - - Standard_Boolean forw=nextedge>0; - const MeshDS_PairOfIndex& aPair = MeshData->ElemConnectedTo(curEdg); - for(Standard_Integer j = 1, jn = aPair.Extent(); j <= jn; j++) { - const Standard_Integer elemId = aPair.Index(j); - GetTriangle(elemId).Edges(e1,e2,e3,o1,o2,o3); - if ((e1==curEdg && o1==forw) || - (e2==curEdg && o2==forw) || - (e3==curEdg && o3==forw)) { - DeleteTriangle(elemId, loopEdges); - break; - } - } - } - } - else { -#ifdef TRIANGULATION_DEBUG - if (Triangulation_Trace>0) - cout << " MeshLeftPolygonOf : No next!" << endl; -#endif - return; - } - prem=pivo; - pivo=ders; - ved1=ved2; - } - - - // Destruction of unused free edges : - MeshDS_MapOfIntegerInteger::Iterator itFE(loopEdges); - - for (; itFE.More(); itFE.Next()) { - if (MeshData->ElemConnectedTo(itFE.Key()).IsEmpty()) - MeshData->RemoveLink(itFE.Key()); - } - - MeshPolygon(polyg); -} - - -//======================================================================= -//function : MeshPolygon -//purpose : Triangulatiion of a closed polygon described by the list of indexes of -// its edges in the structure. (negative index == reversed) -//======================================================================= -void MeshAlgo_Delaunay::MeshPolygon (TColStd_SequenceOfInteger& poly) -{ - Standard_Integer vert, vert1, vert2, vert3 =0, tri; - - if (poly.Length()==3) { - tri=MeshData->AddElement(Triangle(Abs(poly(1)),Abs(poly(2)),Abs(poly(3)), - poly(1)>0, poly(2)>0, poly(3)>0, - MeshDS_Free)); - tCircles.MocAdd(tri); - const Edge& edg1=GetEdge(Abs(poly(1))); - const Edge& edg2=GetEdge(Abs(poly(2))); - if (poly(1)>0) { - vert1=edg1.FirstNode(); - vert2=edg1.LastNode(); - } - else { - vert1=edg1.LastNode(); - vert2=edg1.FirstNode(); - } - if (poly(2)>0) - vert3=edg2.LastNode(); - else - vert3=edg2.FirstNode(); - - if (!tCircles.Add(GetVertex(vert1).Coord(), - GetVertex(vert2).Coord(), - GetVertex(vert3).Coord(), - tri)) { - MeshData->RemoveElement(tri); - } - } - - else if (poly.Length()>3) { - const Edge& edg=GetEdge(Abs(poly(1))); - Standard_Real distmin=RealLast(); - Standard_Integer ip, used =0; - - if (poly(1)>0) { - vert1=edg.FirstNode(); - vert2=edg.LastNode(); - } - else { - vert1=edg.LastNode(); - vert2=edg.FirstNode(); - } - gp_XY vedg(GetVertex(vert2).Coord()- - GetVertex(vert1).Coord()); - Standard_Real modul=vedg.Modulus(); - if (modul>0.) { - vedg.SetCoord(vedg.X()/modul, vedg.Y()/modul); - - for (ip=3; ip<=poly.Length(); ip++) { - const Edge& nedg=GetEdge(Abs(poly(ip))); - if (poly(ip)>0) vert=nedg.FirstNode(); - else vert=nedg.LastNode(); - gp_XY vep(GetVertex(vert).Coord()-GetVertex(vert2).Coord()); - - Standard_Real dist=vedg^vep; - if (Abs(dist)>Precision::PConfusion()) { - if ((dist>0. && PositiveOrientation) || - (dist<0. && !PositiveOrientation)) { - if (Abs(dist)AddLink(Edge(vert2, vert3, MeshDS_Free)); - ne3=MeshData->AddLink(Edge(vert3, vert1, MeshDS_Free)); - tri=MeshData->AddElement(Triangle(Abs(poly(1)), Abs(ne2), Abs(ne3), - (poly(1)>0), (ne2>0), (ne3>0), - MeshDS_Free)); - - if (!tCircles.Add(GetVertex(vert1).Coord(), - GetVertex(vert2).Coord(), - GetVertex(vert3).Coord(), - tri)) { - MeshData->RemoveElement(tri); - } - - if (used3) { - poly.SetValue(1, -ne2); - MeshPolygon(poly); - } - } - else { -#ifdef TRIANGULATION_DEBUG - if (Triangulation_Trace>0) { - cout << " MeshPolygon : impossible !" << endl; - if (Triangulation_Trace==5) { - cout << " MeshPolygon : "; - for (vert=1; vert<=poly.Length(); vert++) - cout << poly(vert) << " "; - cout<NbNodes()>100) - koeff = 5; - else if(MeshData->NbNodes()>1000) - koeff = 7; - - tCircles.SetCellSize(deltax/koeff, deltay/koeff); - - supVert1=MeshData->AddNode(Vertex((xMin+xMax)/2, yMax+deltaMax, MeshDS_Free)); - supVert2=MeshData->AddNode(Vertex(xMin-delta, yMin-deltaMin, MeshDS_Free)); - supVert3=MeshData->AddNode(Vertex(xMax+delta, yMin-deltaMin, MeshDS_Free)); - - Standard_Integer niver; - if (!PositiveOrientation) { - niver=supVert2; - supVert2=supVert3; - supVert3=niver; - } - - Standard_Integer - ed1=MeshData->AddLink(Edge(supVert1,supVert2,MeshDS_Free)); - Standard_Integer - ed2=MeshData->AddLink(Edge(supVert2,supVert3,MeshDS_Free)); - Standard_Integer - ed3=MeshData->AddLink(Edge(supVert3,supVert1,MeshDS_Free)); - supTrian=Triangle(Abs(ed1), Abs(ed2), Abs(ed3), - (ed1>0), (ed2>0), (ed3>0), MeshDS_Free); -} - - -//======================================================================= -//function : CreateTriangles -//purpose : Creation of triangles from the current node and free edges -// and deletion of these edges in the list : -//======================================================================= -void MeshAlgo_Delaunay::CreateTriangles (const Standard_Integer theVertexIndex, - MeshDS_MapOfIntegerInteger& theEdges) -{ - MeshDS_MapOfIntegerInteger::Iterator itFE(theEdges); - Standard_Real z12, z23, modul; - Standard_Integer ne1, ne3, nt; - gp_XY vl1, vl2, vl3; - ListOfInteger EdgLoop, EdgOK, EdgExter; - - const gp_XY& VertexCoord = MeshData->GetNode(theVertexIndex).Coord(); - for (; itFE.More(); itFE.Next()) { - const Edge& edg=GetEdge(itFE.Key()); - Standard_Integer deb=edg.FirstNode(); - Standard_Integer fin=edg.LastNode(); - Standard_Boolean sens=(Standard_Boolean)theEdges(itFE.Key()); - if (!sens) { - nt=deb; - deb=fin; - fin=nt; - } - - const Vertex& debVert=GetVertex(deb); - const Vertex& finVert=GetVertex(fin); - - vl1=debVert.Coord(); - vl1.Subtract(VertexCoord); - vl2=finVert.Coord(); - vl2.Subtract(debVert.Coord()); -// vl3=theVertex.Coord(); - vl3=VertexCoord; - vl3.Subtract(finVert.Coord()); - - z12=z23=0.; - modul=vl2.Modulus(); - if (modul>Precision::PConfusion()) { - vl2.SetCoord(vl2.X()/modul, vl2.Y()/modul); - z12=vl1^vl2; - z23=vl2^vl3; - } - - if (Abs(z12)>=Precision::PConfusion() && - Abs(z23)>=Precision::PConfusion()) { - Standard_Boolean sensOK; - if (PositiveOrientation) sensOK=(z12>0. && z23>0.); - else sensOK=(z12<0. && z23<0.); - if (sensOK) { - ne1=MeshData->AddLink(Edge(theVertexIndex, deb, MeshDS_Free)); - ne3=MeshData->AddLink(Edge(fin, theVertexIndex, MeshDS_Free)); - nt=MeshData->AddElement(Triangle(Abs(ne1), itFE.Key(), Abs(ne3), - (ne1>0), sens, (ne3>0), - MeshDS_Free)); - - if (!tCircles.Add(VertexCoord, - debVert.Coord(), - finVert.Coord(), nt)) - MeshData->RemoveElement(nt); - } - else { - - if (sens) EdgLoop.Append(itFE.Key()); - else EdgLoop.Append(-itFE.Key()); - if (vl1.SquareModulus()>vl3.SquareModulus()) { - ne1=MeshData->AddLink(Edge(theVertexIndex, deb, MeshDS_Free)); - EdgExter.Append(Abs(ne1)); - } - else{ - ne3=MeshData->AddLink(Edge(fin, theVertexIndex, MeshDS_Free)); - EdgExter.Append(Abs(ne3)); - } - } - } -#ifdef TRIANGULATION_DEBUG - else { - if (Triangulation_Trace>0) - cout << " CreateTriangles : too small vector product !" << endl; - } -#endif - } - theEdges.Clear(); - while (!EdgExter.IsEmpty()) { - const MeshDS_PairOfIndex& conx = MeshData->ElemConnectedTo(Abs(EdgExter.First())); - if (!conx.IsEmpty()) - DeleteTriangle(conx.FirstIndex(), theEdges); - EdgExter.RemoveFirst(); - } - - for (itFE.Initialize(theEdges); itFE.More(); itFE.Next()) { - if (MeshData->ElemConnectedTo(itFE.Key()).IsEmpty()) - MeshData->RemoveLink(itFE.Key()); - } - - while (!EdgLoop.IsEmpty()) { - if (GetEdge(Abs(EdgLoop.First())).Movability()!=MeshDS_Deleted) { - MeshLeftPolygonOf(Abs(EdgLoop.First()), (EdgLoop.First()>0)); - } - EdgLoop.RemoveFirst(); - } -} - -//======================================================================= -//function : DeleteTriangle -//purpose : The concerned triangles are deleted and the freed edges are added in -// . If an edge is added twice, it does not exist and -// it is necessary to destroy it. This corresponds to the destruction of two -// connected triangles. -//======================================================================= - -void MeshAlgo_Delaunay::DeleteTriangle (const Standard_Integer tIndex, - MeshDS_MapOfIntegerInteger& fEdges) -{ - tCircles.Delete(tIndex); - - Standard_Integer fe1, fe2, fe3; - Standard_Boolean or1, or2, or3; - GetTriangle(tIndex).Edges(fe1, fe2, fe3, or1, or2, or3); - MeshData->RemoveElement(tIndex); - - if (!fEdges.Bind(fe1, or1)) { - fEdges.UnBind(fe1); - MeshData->RemoveLink(fe1); - } - if (!fEdges.Bind(fe2, or2)) { - fEdges.UnBind(fe2); - MeshData->RemoveLink(fe2); - } - if (!fEdges.Bind(fe3, or3)) { - fEdges.UnBind(fe3); - MeshData->RemoveLink(fe3); - } - -} - - -//======================================================================= -//function : AddVertex -//purpose : -//======================================================================= -void MeshAlgo_Delaunay::AddVertex(const Vertex& theVert) -{ - Standard_Integer nv = MeshData->AddNode(theVert); - - // Iterator in the list of indexes of circles containing the node : - MeshDS_ListOfInteger& cirL=tCircles.Select(theVert.Coord()); - - Standard_Integer edgon=0; - Standard_Integer triPer=0; - Standard_Integer e1, e2, e3; - Standard_Boolean o1, o2, o3; - - MeshDS_ListOfInteger::Iterator itT(cirL); - for (; itT.More(); itT.Next()) { - - // To add a node in the mesh it is necessary to check conditions: - // - the node should be within the boundaries of the mesh and so in an existing triangle - // - all adjacent triangles should belong to a component connected with this triangle - if (Contains(itT.Value(), theVert, edgon)) { - if (edgon==0) { - triPer=itT.Value(); - cirL.Remove(itT); - break; - } - else if (GetEdge(edgon).Movability()==MeshDS_Free) { - triPer=itT.Value(); - cirL.Remove(itT); - break; - } - } - } - - if (triPer>0) { - - MeshDS_MapOfIntegerInteger loopEdges(10,MeshData->Allocator()); - DeleteTriangle(triPer, loopEdges); - - Standard_Boolean modif=Standard_True; - while (modif && !cirL.IsEmpty()) { - modif=Standard_False; - MeshDS_ListOfInteger::Iterator itT1(cirL); - for (; itT1.More(); itT1.Next()) { - GetTriangle(itT.Value()).Edges(e1,e2,e3,o1,o2,o3); - if (loopEdges.IsBound(e1) || - loopEdges.IsBound(e2) || - loopEdges.IsBound(e3)) { - modif=Standard_True; - DeleteTriangle(itT1.Value(), loopEdges); - cirL.Remove(itT1); - break; - } - } - } - - // Creation of triangles with the current node and free edges - // and removal of these edges from the list of free edges - CreateTriangles(nv, loopEdges); - - // Check that internal edges are not crossed by the triangles - MeshDS_MapOfInteger::Iterator itFr(InternalEdges()); - - // Destruction of triangles crossing internal edges and - // their replacement by makeshift triangles - Standard_Integer nbc; - itFr.Reset(); - for (; itFr.More(); itFr.Next()) { - nbc = MeshData->ElemConnectedTo(itFr.Key()).Extent(); - if (nbc == 0) { - MeshLeftPolygonOf(itFr.Key(), Standard_True); - MeshLeftPolygonOf(itFr.Key(), Standard_False); - } - } - - FrontierAdjust(); - - } - -} - -//======================================================================= -//function : RemoveVertex -//purpose : -//======================================================================= -void MeshAlgo_Delaunay::RemoveVertex(const Vertex& theVert) -{ - MeshAlgo_SelectorOfDataStructure select(MeshData); - select.NeighboursOf(theVert); - - MeshDS_MapOfIntegerInteger loopEdges(10,MeshData->Allocator()); - - // Loop on triangles to be destroyed : - MeshDS_MapOfInteger::Iterator trs(select.Elements()); - for (;trs.More(); trs.Next()) { - DeleteTriangle(trs.Key(), loopEdges); - } - - TColStd_SequenceOfInteger polyg; - Standard_Integer iv; - Standard_Integer nbLi=loopEdges.Extent(); - MeshDS_MapOfIntegerInteger::Iterator itFE(loopEdges); - - if (itFE.More()) { - const Edge& edg=GetEdge(itFE.Key()); - Standard_Integer deb=edg.FirstNode(); - Standard_Integer fin; - Standard_Integer pivo=edg.LastNode(); - Standard_Integer iseg=itFE.Key(); - Standard_Boolean sens=(Standard_Boolean)loopEdges(iseg); - if (!sens) { - iv=deb; - deb=pivo; - pivo=iv; - polyg.Append(-iseg); - } - else { - polyg.Append(iseg); - } - loopEdges.UnBind(iseg); - fin=deb; - MeshDS_ListOfInteger::Iterator itLiV; - Standard_Integer vcur; - while (pivo!=fin) { - itLiV.Init(MeshData->LinkNeighboursOf(pivo)); - for (; itLiV.More(); itLiV.Next()) { - if (itLiV.Value()!=iseg && loopEdges.IsBound(itLiV.Value())) { - iseg=itLiV.Value(); - const Edge& edg1=GetEdge(iseg); - vcur=edg1.LastNode(); - if (vcur!=pivo) { - vcur=edg1.FirstNode(); - polyg.Append(-iseg); - } - else - polyg.Append(iseg); - pivo=vcur; - loopEdges.UnBind(iseg); - break; - } - } - if (nbLi<=0) break; - nbLi--; - } - MeshPolygon(polyg); - } -} - - -//======================================================================= -//function : AddVertices -//purpose : -//======================================================================= -void MeshAlgo_Delaunay::AddVertices(MeshAlgo_Array1OfVertex& vertices) -{ - MeshAlgo_HeapSortVertex::Sort - (vertices, - MeshAlgo_ComparatorOfVertex(SortingDirection, Precision::PConfusion())); - - MeshDS_MapOfIntegerInteger loopEdges(10,MeshData->Allocator()); - Standard_Boolean modif=Standard_True; - Standard_Integer edgon, triPer; - Standard_Integer e1, e2, e3; - Standard_Boolean o1, o2, o3; - - Standard_Integer niver; - Standard_Integer aIdxVert; - for (niver=vertices.Lower(); niver<=vertices.Upper(); niver++) { - aIdxVert = MeshData->AddNode(vertices(niver)); - - // Iterator in the list of indexes of circles containing the node - MeshDS_ListOfInteger& cirL=tCircles.Select(vertices(niver).Coord()); - - edgon=0; - triPer=0; - - MeshDS_ListOfInteger::Iterator itT(cirL); - for (; itT.More(); itT.Next()) { - - // To add a node in the mesh it is necessary to check conditions: - // the node should be within the boundaries of the mesh and so in an existing triangle - // all adjacent triangles should belong to a component connected with this triangle - if (Contains(itT.Value(), vertices(niver), edgon)) { - if (edgon==0) { - triPer=itT.Value(); - cirL.Remove(itT); - break; - } - else if (GetEdge(edgon).Movability()==MeshDS_Free) { - triPer=itT.Value(); - cirL.Remove(itT); - break; - } - } - } - - if (triPer>0) { - DeleteTriangle(triPer, loopEdges); - - modif=Standard_True; - while (modif && !cirL.IsEmpty()) { - modif=Standard_False; - MeshDS_ListOfInteger::Iterator itT1(cirL); - for (; itT1.More(); itT1.Next()) { - GetTriangle(itT1.Value()).Edges(e1,e2,e3,o1,o2,o3); - if (loopEdges.IsBound(e1) || - loopEdges.IsBound(e2) || - loopEdges.IsBound(e3)) { - modif=Standard_True; - DeleteTriangle(itT1.Value(), loopEdges); - cirL.Remove(itT1); - break; - } - } - } - - // Creation of triangles with the current node and free edges - // and removal of these edges from the list of free edges - CreateTriangles(aIdxVert, loopEdges); - } - } - - // Check that internal edges are not crossed by triangles - MeshDS_MapOfInteger::Iterator itFr(InternalEdges()); - - // Destruction of triangles crossing internal edges - //and their replacement by makeshift triangles - Standard_Integer nbc; - itFr.Reset(); - for (; itFr.More(); itFr.Next()) { - nbc = MeshData->ElemConnectedTo(itFr.Key()).Extent(); - if (nbc == 0) { - MeshLeftPolygonOf(itFr.Key(), Standard_True); - MeshLeftPolygonOf(itFr.Key(), Standard_False); - } - } - - // Adjustment of meshes to boundary edges - FrontierAdjust(); -} - - -//======================================================================= -//function : RevertDiagonal -//purpose : -//======================================================================= -Standard_Boolean MeshAlgo_Delaunay::RevertDiagonal(const Standard_Integer ind) -{ - const MeshDS_PairOfIndex& elConx = MeshData->ElemConnectedTo(ind); - const Edge& lEdge = GetEdge(ind); - if (elConx.Extent()==2 && lEdge.Movability()==MeshDS_Free) { - Standard_Integer t1(elConx.FirstIndex()); - Standard_Integer t2(elConx.LastIndex()); - - Standard_Integer e1t1, e2t1, e3t1, e1t2, e2t2, e3t2 ; - Standard_Boolean o1t1, o2t1, o3t1, o1t2, o2t2, o3t2; -#ifndef DEB - Standard_Integer ed13=0, ed23=0, ed14=0, ed24=0, v1, v2, v3=0, v4=0, vc1; - Standard_Boolean oindt1=Standard_False, or13=Standard_False, - or23=Standard_False, or14=Standard_False, or24=Standard_False, orien; -#else - Standard_Integer ed13, ed23, ed14, ed24, v1, v2, v3, v4, vc1; - Standard_Boolean oindt1, or13, or23, or14, or24, orien; -#endif - GetTriangle(t1).Edges(e1t1, e2t1, e3t1, o1t1, o2t1, o3t1); - GetTriangle(t2).Edges(e1t2, e2t2, e3t2, o1t2, o2t2, o3t2); - - v1=lEdge.FirstNode(); v2=lEdge.LastNode(); - if (e1t1==ind) { - if (o2t1) v3 =GetEdge(e2t1).LastNode(); - else v3 =GetEdge(e2t1).FirstNode(); - ed13=e3t1; ed23=e2t1; - or13=o3t1; or23=o2t1; - oindt1=o1t1; - } - else if (e2t1==ind) { - if (o3t1) v3 =GetEdge(e3t1).LastNode(); - else v3 =GetEdge(e3t1).FirstNode(); - ed13=e1t1; ed23=e3t1; - or13=o1t1; or23=o3t1; - oindt1=o2t1; - } - else if (e3t1==ind) { - if (o1t1) v3 =GetEdge(e1t1).LastNode(); - else v3 =GetEdge(e1t1).FirstNode(); - ed13=e2t1; ed23=e1t1; - or13=o2t1; or23=o1t1; - oindt1=o3t1; - } - if (e1t2==ind) { - if (o2t2) v4 =GetEdge(e2t2).LastNode(); - else v4 =GetEdge(e2t2).FirstNode(); - ed14=e2t2; ed24=e3t2; - or14=o2t2; or24=o3t2; - } - else if (e2t2==ind) { - if (o3t2) v4 =GetEdge(e3t2).LastNode(); - else v4 =GetEdge(e3t2).FirstNode(); - ed14=e3t2; ed24=e1t2; - or14=o3t2; or24=o1t2; - } - else if (e3t2==ind) { - if (o1t2) v4 =GetEdge(e1t2).LastNode(); - else v4 =GetEdge(e1t2).FirstNode(); - ed14=e1t2; ed24=e2t2; - or14=o1t2; or24=o2t2; - } - if (!oindt1) { - vc1=v3; v3=v4; v4=vc1; - vc1=ed13; ed13=ed24; ed24=vc1; - orien =or13; or13=or24; or24=orien ; - vc1=ed14; ed14=ed23; ed23=vc1; - orien =or14; or14=or23; or23=orien ; - } - const Vertex& vert1 = GetVertex(v1); - const Vertex& vert2 = GetVertex(v2); - const Vertex& vert3 = GetVertex(v3); - const Vertex& vert4 = GetVertex(v4); - - gp_XY ved13(vert1.Coord()); ved13.Subtract(vert3.Coord()); - gp_XY ved14(vert4.Coord()); ved14.Subtract(vert1.Coord()); - gp_XY ved23(vert3.Coord()); ved23.Subtract(vert2.Coord()); - gp_XY ved24(vert2.Coord()); ved24.Subtract(vert4.Coord()); - - Standard_Real z13, z24, modul; - z13=z24=0.; - modul=ved13.Modulus(); - if (modul>Precision::PConfusion()) { - ved13.SetCoord(ved13.X()/modul, ved13.Y()/modul); - z13=ved13^ved14; - } - modul=ved24.Modulus(); - if (modul>Precision::PConfusion()) { - ved24.SetCoord(ved24.X()/modul, ved24.Y()/modul); - z24=ved24^ved23; - } - - if (Abs(z13)>=Precision::PConfusion()&&Abs(z24)>=Precision::PConfusion()) { - if ((z13>0. && z24>0.) || (z13<0. && z24<0.)) { - tCircles.Delete(t1); - tCircles.Delete(t2); - if (!tCircles.Add(vert4.Coord(), vert2.Coord(), vert3.Coord(), t1) && - !tCircles.Add(vert3.Coord(), vert1.Coord(), vert4.Coord(), t2)) { - Standard_Integer newd=ind; - Edge newEdg=Edge(v3, v4, MeshDS_Free); - if (!MeshData->SubstituteLink(newd, newEdg)) { - newd=MeshData->IndexOf(newEdg); - MeshData->RemoveLink(ind); - } - MeshData->SubstituteElement(t1, Triangle(ed24, ed23, newd, - or24, or23, Standard_True, - MeshDS_Free)); - MeshData->SubstituteElement(t2, Triangle(ed13, ed14, newd, - or13, or14, Standard_False, - MeshDS_Free)); - return Standard_True; - } - else { - if (oindt1) { - tCircles.Add(vert1.Coord(), vert2.Coord(), vert3.Coord(), t1); - tCircles.Add(vert2.Coord(), vert1.Coord(), vert4.Coord(), t2); - } - else { - tCircles.Add(vert1.Coord(), vert2.Coord(), vert3.Coord(), t2); - tCircles.Add(vert2.Coord(), vert1.Coord(), vert4.Coord(), t1); - } - } - } - } - } - return Standard_False; -} - -//======================================================================= -//function : UseEdge -//purpose : -//======================================================================= -Standard_Boolean MeshAlgo_Delaunay::UseEdge(const Standard_Integer ind) -{ - const MeshDS_PairOfIndex& elConx=MeshData->ElemConnectedTo(ind); - if (elConx.Extent()==0) { - const Edge& lEdge = GetEdge(ind); - Standard_Integer vdeb, pivo, othV, leftEdge, rightEdge; - vdeb=lEdge.FirstNode(); - pivo=lEdge.LastNode(); - const MeshDS_ListOfInteger& neigVDeb = MeshData->LinkNeighboursOf(vdeb); - const MeshDS_ListOfInteger& neigPivo = MeshData->LinkNeighboursOf(pivo); - if (neigVDeb.Extent()>0 && neigPivo.Extent()>0) { - const Vertex& vertDeb=GetVertex(vdeb); - const Vertex& vertPivo=GetVertex(pivo); - - gp_XY vedcur; - gp_XY vedge(vertPivo.Coord()); - vedge.Subtract(vertDeb.Coord()); - - MeshDS_ListOfInteger::Iterator itNeig(neigPivo); -#ifndef DEB - Standard_Real ang =0.; -#else - Standard_Real ang; -#endif - Standard_Real angMin=RealLast(); - Standard_Real angMax=RealFirst(); - Standard_Boolean InMesh; - leftEdge=rightEdge=0; - - for (; itNeig.More(); itNeig.Next()) { - if (itNeig.Value()!=ind) { - const Edge& nedg=GetEdge(itNeig.Value()); - - InMesh=Standard_True; - if (nedg.Movability()==MeshDS_Free) { - if (MeshData->ElemConnectedTo(itNeig.Value()).IsEmpty()) - InMesh=Standard_False; - } - - if (InMesh) { - othV=nedg.FirstNode(); - if (othV==pivo) othV=nedg.LastNode(); - - vedcur=GetVertex(othV).Coord(); - vedcur.Subtract(vertPivo.Coord()); - - ang=gp_Vec2d(vedge).Angle(gp_Vec2d(vedcur)); - } - if (ang>angMax) { - angMax=ang; - leftEdge=itNeig.Value(); - } - if (ang0) { - if (leftEdge==rightEdge) { - } - else { - } - } - } - } - return Standard_False; -} - -//======================================================================= -//function : SmoothMesh -//purpose : -//======================================================================= -void MeshAlgo_Delaunay::SmoothMesh(const Standard_Real Epsilon) -{ - Standard_Integer baryVert, polyVert, nbPolyVert; - Standard_Real uSom, vSom, newU, newV; - Standard_Integer nbVert=MeshData->NbNodes(); - MeshDS_ListOfInteger::Iterator itNeig; - - uSom=vSom=0; - for (baryVert=1; baryVert<=nbVert; baryVert++) { - const Vertex& curVert=GetVertex(baryVert); - if (curVert.Movability()==MeshDS_Free) { - const MeshDS_ListOfInteger& neighEdg=MeshData->LinkNeighboursOf(baryVert); - if (neighEdg.Extent()>2) { - nbPolyVert=0; - for (itNeig.Init(neighEdg); itNeig.More(); itNeig.Next()) { - const Edge& nedg=GetEdge(itNeig.Value()); - polyVert=nedg.FirstNode(); - if (polyVert==baryVert) polyVert=nedg.LastNode(); - nbPolyVert++; - const gp_XY& pVal = GetVertex(polyVert).Coord(); - uSom+=pVal.X(); - vSom+=pVal.Y(); - } - if (nbPolyVert>2) { - newU=uSom/(Standard_Real)nbPolyVert; - newV=vSom/(Standard_Real)nbPolyVert; - if (!curVert.Coord().IsEqual(gp_XY(newU, newV), Epsilon)) { - Vertex newVert(newU, newV, curVert.Movability()); - MeshData->MoveNode(baryVert, newVert); - } - } - } - } - } -} - -//======================================================================= -//function : Result -//purpose : -//======================================================================= -const Handle(MeshAlgo_DataStructure)& MeshAlgo_Delaunay::Result()const -{ - return MeshData; -} - -//======================================================================= -//function : Frontier -//purpose : -//======================================================================= -const MeshDS_MapOfInteger& MeshAlgo_Delaunay::Frontier () -{ - MeshDS_MapOfInteger::Iterator triDom(MeshData->LinkOfDomain()); - - mapEdges.Clear(); - for (; triDom.More(); triDom.Next()) { - if (GetEdge(triDom.Key()).Movability()==MeshDS_Frontier) { - mapEdges.Add(triDom.Key()); - } - } - return mapEdges; -} - -//======================================================================= -//function : InternalEdges -//purpose : -//======================================================================= -const MeshDS_MapOfInteger& MeshAlgo_Delaunay::InternalEdges () -{ - MeshDS_MapOfInteger::Iterator triDom(MeshData->LinkOfDomain()); - - mapEdges.Clear(); - for (; triDom.More(); triDom.Next()) { - if (GetEdge(triDom.Key()).Movability()==MeshDS_Fixed) { - mapEdges.Add(triDom.Key()); - } - } - return mapEdges; -} - -//======================================================================= -//function : FreeEdges -//purpose : -//======================================================================= -const MeshDS_MapOfInteger& MeshAlgo_Delaunay::FreeEdges () -{ - MeshDS_MapOfInteger::Iterator triDom(MeshData->LinkOfDomain()); - - mapEdges.Clear(); - for (; triDom.More(); triDom.Next()) { - if (MeshData->ElemConnectedTo(triDom.Key()).Extent()<=1) { - mapEdges.Add(triDom.Key()); - } - } - return mapEdges; -} - - -//======================================================================= -//function : Contains -//purpose : -//======================================================================= -Standard_Boolean MeshAlgo_Delaunay::Contains(const Standard_Integer tri, - const Vertex& vert, - Standard_Integer& edgOn)const -{ - edgOn=0; - Standard_Integer e1, e2, e3, p1, p2, p3; - Standard_Boolean o1, o2, o3; - GetTriangle(tri).Edges(e1, e2, e3, o1, o2, o3); - const Edge& edg1=GetEdge(e1); - const Edge& edg2=GetEdge(e2); - const Edge& edg3=GetEdge(e3); - if (o1) { - p1=edg1.FirstNode(); - p2=edg1.LastNode(); - } - else { - p2=edg1.FirstNode(); - p1=edg1.LastNode(); - } - if (o3) p3=edg3.FirstNode(); - else p3=edg3.LastNode(); - - const gp_XY& P1=GetVertex(p1).Coord(); - const gp_XY& P2=GetVertex(p2).Coord(); - const gp_XY& P3=GetVertex(p3).Coord(); - gp_XY E1(P2); E1.Subtract(P1); - gp_XY E2(P3); E2.Subtract(P2); - gp_XY E3(P1); E3.Subtract(P3); - - Standard_Real mode1=E1.SquareModulus(); - //Standard_Real dist=Sqrt(mode1); - if (mode1<=EPSEPS) return Standard_False; - Standard_Real v1=E1^(vert.Coord()-P1); - Standard_Real distMin=(v1*v1)/mode1; - edgOn=e1; - - Standard_Real mode2=E2.SquareModulus(); - Standard_Real dist; - //dist=Sqrt(mode2); - if (mode2<=EPSEPS) return Standard_False; - Standard_Real v2=E2^(vert.Coord()-P2); - dist=(v2*v2)/mode2; - if (distEPSEPS) { - Standard_Integer edf=edgOn; - edgOn=0; - if (edf==e1 && edg1.Movability()!=MeshDS_Free) { - if (v1<(mode1/5.)) edgOn=e1; - } - else if (edf==e2 && edg2.Movability()!=MeshDS_Free) { - if (v2<(mode2/5.)) edgOn=e2; - } - else if (edf==e3 && edg3.Movability()!=MeshDS_Free) { - if (v3<(mode3/5.)) edgOn=e3; - } - } - - return (v1+v2+v3!=0. &&((v1>=0. && v2>=0. && v3>=0.) || - (v1<=0. && v2<=0. && v3<=0.))); -} - -//======================================================================= -//function : TriangleContaining -//purpose : -//======================================================================= -Standard_Integer MeshAlgo_Delaunay::TriangleContaining(const Vertex& vert) -{ - const MeshDS_ListOfInteger& cirL=tCircles.Select(vert.Coord()); - - MeshDS_ListOfInteger::Iterator itT(cirL); - Standard_Integer triPer=0; - Standard_Integer edgon=0; - for (; itT.More(); itT.Next()) { - if (Contains(itT.Value(), vert, edgon)) { - if (edgon==0) { - triPer=itT.Value(); - break; - } - else if (GetEdge(edgon).Movability()==MeshDS_Free) { - triPer=itT.Value(); - break; - } - } - } - return triPer; -} diff --git a/src/MeshAlgo/MeshAlgo_Delaunay.lxx b/src/MeshAlgo/MeshAlgo_Delaunay.lxx deleted file mode 100755 index 2a18da2918..0000000000 --- a/src/MeshAlgo/MeshAlgo_Delaunay.lxx +++ /dev/null @@ -1,27 +0,0 @@ -// File: MeshAlgo_Delaunay.lxx -// Created: Thu Aug 19 10:52:01 1993 -// Author: Didier PIFFAULT -// - - -#include MeshAlgo_DataStructure_hxx - -inline const Vertex& MeshAlgo_Delaunay::GetVertex - (const Standard_Integer vIndex) const -{ - return MeshData->GetNode(vIndex); -} - - -inline const Edge& MeshAlgo_Delaunay::GetEdge - (const Standard_Integer eIndex) const -{ - return MeshData->GetLink(eIndex); -} - - -inline const Triangle& MeshAlgo_Delaunay::GetTriangle - (const Standard_Integer tIndex) const -{ - return MeshData->GetElement(tIndex); -} diff --git a/src/MeshAlgo/MeshAlgo_Edge.cdl b/src/MeshAlgo/MeshAlgo_Edge.cdl deleted file mode 100755 index 823d62944f..0000000000 --- a/src/MeshAlgo/MeshAlgo_Edge.cdl +++ /dev/null @@ -1,54 +0,0 @@ --- File: MeshAlgo_Edge.cdl --- Created: Tue May 11 16:38:19 1993 --- Author: Didier PIFFAULT --- ----Copyright: Matra Datavision 1993 - --- signature -deferred class Edge from MeshAlgo - - ---Purpose: Describes the data structure of a Edge. - - -uses Integer from Standard, - Boolean from Standard, - DegreeOfFreedom from MeshDS - - -is Initialize (node1, node2 : Integer from Standard; - canMove : DegreeOfFreedom from MeshDS); - ---Purpose: Contructs an Edge beetween to vertices. - - - FirstNode (me) - ---Purpose: Give the index of first node of the Edge. - returns Integer from Standard; - - LastNode (me) - ---Purpose: Give the index of Last node of the Edge. - returns Integer from Standard; - - Movability (me) - returns DegreeOfFreedom from MeshDS; - - SetMovability (me : in out; - canMove : DegreeOfFreedom from MeshDS); - - SameOrientation(me; Other : Edge from MeshAlgo) - returns Boolean from Standard; - - ----Purpose: For maping the Edges. --- Same Edge -> Same HashCode --- Different Edges -> Not IsEqual but can have same HashCode - - HashCode (me; - Upper : Integer from Standard) - ---C++: function call - returns Integer from Standard; - - IsEqual (me; Other: Edge from MeshAlgo) - ---C++: alias operator == - returns Boolean from Standard; - -end Edge; diff --git a/src/MeshAlgo/MeshAlgo_Edge.cxx b/src/MeshAlgo/MeshAlgo_Edge.cxx deleted file mode 100755 index b104a7985b..0000000000 --- a/src/MeshAlgo/MeshAlgo_Edge.cxx +++ /dev/null @@ -1,6 +0,0 @@ -// File: MeshAlgo_Edge.cxx -// Created: Fri Jul 2 11:33:41 1993 -// Author: Didier PIFFAULT -// - -#include diff --git a/src/MeshAlgo/MeshAlgo_IndexedPntComparator.cdl b/src/MeshAlgo/MeshAlgo_IndexedPntComparator.cdl deleted file mode 100755 index 811284b629..0000000000 --- a/src/MeshAlgo/MeshAlgo_IndexedPntComparator.cdl +++ /dev/null @@ -1,40 +0,0 @@ --- File: MeshAlgo_IndexedPntComparator.cdl --- Created: Tue Apr 5 11:45:18 1994 --- Author: Didier PIFFAULT --- ----Copyright: Matra Datavision 1994 - - -generic class IndexedPntComparator from MeshAlgo - (HandledStructureOfPnt as any; Direction as any) - - ---Purpose: Sort two point in a given direction. - - -uses Boolean from Standard - - -is Create (theDir : Direction; - TheTol : Real from Standard; - HDS : HandledStructureOfPnt) - returns IndexedPntComparator; - - - IsLower (me; Left, Right: Integer) - ---Purpose: returns True if is lower than - returns Boolean from Standard; - - IsGreater (me; Left, Right: Integer) - ---Purpose: returns True if is greater than - returns Boolean from Standard; - - IsEqual(me; Left, Right: Integer) - ---Purpose: returns True when and are equal. - returns Boolean from Standard; - - -fields IndexedStructure : HandledStructureOfPnt; - DirectionOfSort : Direction; - Tolerance : Real from Standard; - -end IndexedPntComparator; diff --git a/src/MeshAlgo/MeshAlgo_IndexedPntComparator.gxx b/src/MeshAlgo/MeshAlgo_IndexedPntComparator.gxx deleted file mode 100755 index 0c409be2cd..0000000000 --- a/src/MeshAlgo/MeshAlgo_IndexedPntComparator.gxx +++ /dev/null @@ -1,56 +0,0 @@ -// File: MeshAlgo_IndexedPntComparator.gxx -// Created: Tue Apr 5 11:50:40 1994 -// Author: Didier PIFFAULT -// - -//======================================================================= -//function : MeshAlgo_IndexedPntComparator -//purpose : -//======================================================================= - -#include - - -MeshAlgo_IndexedPntComparator::MeshAlgo_IndexedPntComparator - (const Direction& theDir, - const Standard_Real theTol, - const HandledStructureOfPnt& HDS) -: IndexedStructure(HDS),DirectionOfSort(theDir), Tolerance(theTol) -{} - -//======================================================================= -//function : IsLower -//purpose : -//======================================================================= - -Standard_Boolean MeshAlgo_IndexedPntComparator::IsLower - (const Standard_Integer Left, const Standard_Integer Right) const -{ - return ((IndexedStructure->GetNode(Left).Coord()*DirectionOfSort) < - (IndexedStructure->GetNode(Right).Coord()*DirectionOfSort)); -} - -//======================================================================= -//function : IsGreater -//purpose : -//======================================================================= - -Standard_Boolean MeshAlgo_IndexedPntComparator::IsGreater - (const Standard_Integer Left, const Standard_Integer Right) const -{ - return ((IndexedStructure->GetNode(Left).Coord()*DirectionOfSort) > - (IndexedStructure->GetNode(Right).Coord()*DirectionOfSort)); -} - -//======================================================================= -//function : IsEqual -//purpose : -//======================================================================= - -Standard_Boolean MeshAlgo_IndexedPntComparator::IsEqual - (const Standard_Integer Left, const Standard_Integer Right) const -{ - return (IndexedStructure->GetNode(Left).Coord().IsEqual - (IndexedStructure->GetNode(Right).Coord(), Tolerance)); -} - diff --git a/src/MeshAlgo/MeshAlgo_PntComparator.cdl b/src/MeshAlgo/MeshAlgo_PntComparator.cdl deleted file mode 100755 index 0f632900c2..0000000000 --- a/src/MeshAlgo/MeshAlgo_PntComparator.cdl +++ /dev/null @@ -1,36 +0,0 @@ --- File: MeshAlgo_PntComparator.cdl --- Created: Fri Jun 18 13:46:14 1993 --- Author: Didier PIFFAULT --- ----Copyright: Matra Datavision 1993 - - -generic class PntComparator from MeshAlgo (Point as any; Direction as any) - - ---Purpose: Sort two point in a given direction. - - -uses Boolean from Standard - - -is Create (theDir : Direction; TheTol: Real from Standard) - returns PntComparator; - - - IsLower (me; Left, Right: Point) - ---Purpose: returns True if is lower than - returns Boolean from Standard; - - IsGreater (me; Left, Right: Point) - ---Purpose: returns True if is greater than - returns Boolean from Standard; - - IsEqual(me; Left, Right: Point) - ---Purpose: returns True when and are equal. - returns Boolean from Standard; - - -fields DirectionOfSort : Direction; - Tolerance : Real from Standard; - -end PntComparator; diff --git a/src/MeshAlgo/MeshAlgo_PntComparator.gxx b/src/MeshAlgo/MeshAlgo_PntComparator.gxx deleted file mode 100755 index a5dd3937b6..0000000000 --- a/src/MeshAlgo/MeshAlgo_PntComparator.gxx +++ /dev/null @@ -1,50 +0,0 @@ -// File: MeshAlgo_PntComparator.gxx -// Created: Fri Jun 18 17:04:44 1993 -// Author: Didier PIFFAULT -// - -//======================================================================= -//function : MeshAlgo_PntComparator -//purpose : -//======================================================================= - -MeshAlgo_PntComparator::MeshAlgo_PntComparator(const Direction& theDir, - const Standard_Real theTol) - : DirectionOfSort(theDir), Tolerance(theTol) -{} - -//======================================================================= -//function : IsLower -//purpose : -//======================================================================= - -Standard_Boolean MeshAlgo_PntComparator::IsLower(const Point& Left, - const Point& Right) const -{ - return (Left.Coord()*DirectionOfSort) < - (Right.Coord()*DirectionOfSort); -} - -//======================================================================= -//function : IsGreater -//purpose : -//======================================================================= - -Standard_Boolean MeshAlgo_PntComparator::IsGreater(const Point& Left, - const Point& Right) const -{ - return (Left.Coord()*DirectionOfSort) > - (Right.Coord()*DirectionOfSort); -} - -//======================================================================= -//function : IsEqual -//purpose : -//======================================================================= - -Standard_Boolean MeshAlgo_PntComparator::IsEqual(const Point& Left, - const Point& Right) const -{ - return Left.IsEqual(Right); -} - diff --git a/src/MeshAlgo/MeshAlgo_Triangle.cdl b/src/MeshAlgo/MeshAlgo_Triangle.cdl deleted file mode 100755 index aecbeed732..0000000000 --- a/src/MeshAlgo/MeshAlgo_Triangle.cdl +++ /dev/null @@ -1,52 +0,0 @@ --- File: MeshAlgo_Triangle.cdl --- Created: Tue May 11 16:43:27 1993 --- Author: Didier PIFFAULT --- ----Copyright: Matra Datavision 1993 - --- signature -deferred class Triangle from MeshAlgo - - ---Purpose: Describes the data structure of a Triangle for - -- Deleaunay triangulation. - - -uses Boolean from Standard, - Integer from Standard, - ListOfInteger from TColStd, - DegreeOfFreedom from MeshDS - - -is Initialize (e1, e2, e3 : Integer from Standard; - o1, o2, o3 : Boolean from Standard; - canMove : DegreeOfFreedom from MeshDS); - - - Edges (me; - e1, e2, e3 : out Integer from Standard; - o1, o2, o3 : out Boolean from Standard); - - - Movability (me) - returns DegreeOfFreedom from MeshDS; - - - SetMovability (me : in out; - canMove : DegreeOfFreedom from MeshDS); - - ----Purpose: For maping the Triangles. --- Same Triangle -> Same HashCode --- Different Triangles -> Not IsEqual but can have same HashCode - - HashCode (me; - Upper : Integer from Standard) - ---C++: function call - returns Integer from Standard; - - - IsEqual (me; Other : Triangle from MeshAlgo) - ---C++: alias operator == - returns Boolean from Standard; - -end Triangle; diff --git a/src/MeshAlgo/MeshAlgo_Triangle.cxx b/src/MeshAlgo/MeshAlgo_Triangle.cxx deleted file mode 100755 index f22dc244b9..0000000000 --- a/src/MeshAlgo/MeshAlgo_Triangle.cxx +++ /dev/null @@ -1,6 +0,0 @@ -// File: MeshAlgo_Triangle.cxx -// Created: Fri Jul 2 11:33:22 1993 -// Author: Didier PIFFAULT -// - -#include diff --git a/src/MeshAlgo/MeshAlgo_Vertex.cdl b/src/MeshAlgo/MeshAlgo_Vertex.cdl deleted file mode 100755 index a3c4a63778..0000000000 --- a/src/MeshAlgo/MeshAlgo_Vertex.cdl +++ /dev/null @@ -1,48 +0,0 @@ --- File: MeshAlgo_Vertex.cdl --- Created: Tue May 11 16:17:57 1993 --- Author: Didier PIFFAULT --- ----Copyright: Matra Datavision 1993 - --- signature -deferred class Vertex from MeshAlgo - - ---Purpose: Describes the data structure for a vertex in a - -- Delaunay triangulation. - -uses Boolean from Standard, - Integer from Standard, - Real from Standard, - XY from gp, - DegreeOfFreedom from MeshDS - - -is Initialize (x, y : Real from Standard; - theMov : DegreeOfFreedom from MeshDS) ; - - Coord (me) - ---C++: return const & - returns XY from gp; - - Movability (me) - returns DegreeOfFreedom from MeshDS; - - SetMovability (me : in out; mov : DegreeOfFreedom from MeshDS); - - ----Purpose: For maping the Vertices. --- Same Vertex -> Same HashCode --- Different Vertices -> Not IsEqual but can have same HashCode - - HashCode (me; - Upper : Integer from Standard) - ---C++: function call - returns Integer from Standard; - - - IsEqual (me; Other : Vertex from MeshAlgo) - ---C++: alias operator == - returns Boolean from Standard; - - -end Vertex; diff --git a/src/MeshAlgo/MeshAlgo_Vertex.cxx b/src/MeshAlgo/MeshAlgo_Vertex.cxx deleted file mode 100755 index 1c7fbc2c65..0000000000 --- a/src/MeshAlgo/MeshAlgo_Vertex.cxx +++ /dev/null @@ -1,6 +0,0 @@ -// File: MeshAlgo_Vertex.cxx -// Created: Fri Jul 2 11:32:53 1993 -// Author: Didier PIFFAULT -// - -#include diff --git a/src/MeshDS/FILES b/src/MeshDS/FILES deleted file mode 100755 index e3de6db330..0000000000 --- a/src/MeshDS/FILES +++ /dev/null @@ -1,5 +0,0 @@ -MeshDS_MapOfIntegerInteger.hxx -MeshDS_MapOfInteger.hxx -MeshDS_ListOfInteger.hxx -MeshDS_BaseAllocator.hxx -MeshDS_PairOfIndex.hxx diff --git a/src/MeshDS/MeshDS.cdl b/src/MeshDS/MeshDS.cdl deleted file mode 100755 index b98ad508d8..0000000000 --- a/src/MeshDS/MeshDS.cdl +++ /dev/null @@ -1,53 +0,0 @@ --- File: MeshDS.cdl --- Created: Mon Mar 15 17:47:36 1993 --- Author: Didier PIFFAULT --- ----Copyright: Matra Datavision 1993 - - -package MeshDS - - ---Purpose: This package describes the common data structure for - -- the differents MESH algorithms. - -- Level : Advanced. - -- All methods of all classes will be advanced. - -uses Standard, - MMgt, - TCollection, - gp, - Bnd - - -is enumeration DegreeOfFreedom is - Free, - InVolume, - OnSurface, - OnCurve, - Fixed, - Frontier, - Deleted; - - imported DataMapOfInteger from MeshDS; - imported MapOfIntegerInteger from MeshDS; - imported MapOfInteger from MeshDS; - imported ListOfInteger from MeshDS; - imported BaseAllocator from MeshDS; - imported PairOfIndex from MeshDS; - - deferred generic class Node; -- Signature - - deferred generic class Link; -- Signature - - deferred generic class Element2d; -- Signature - - generic class Mesh2d, NodeHasher, - LinkHasher, - ElemHasher, - IDMapOfNode, - IDMapOfLink, - IMapOfElement, - Selector; - - -end MeshDS; diff --git a/src/MeshDS/MeshDS_BaseAllocator.hxx b/src/MeshDS/MeshDS_BaseAllocator.hxx deleted file mode 100755 index 284cddcba7..0000000000 --- a/src/MeshDS/MeshDS_BaseAllocator.hxx +++ /dev/null @@ -1,3 +0,0 @@ -#include - -typedef Handle_NCollection_IncAllocator MeshDS_BaseAllocator; diff --git a/src/MeshDS/MeshDS_Element2d.cdl b/src/MeshDS/MeshDS_Element2d.cdl deleted file mode 100755 index a4219aa2d9..0000000000 --- a/src/MeshDS/MeshDS_Element2d.cdl +++ /dev/null @@ -1,49 +0,0 @@ --- File: MeshDS_Element2d.cdl --- Created: Tue Mar 16 15:28:35 1993 --- Author: Didier PIFFAULT --- ----Copyright: Matra Datavision 1993 - - -deferred generic class Element2d from MeshDS (dummyarg as any) - - ---Purpose: Describes the necessary services of an Element2d - -- for a mesh data structure. - - -uses Integer from Standard, - Boolean from Standard, - DegreeOfFreedom from MeshDS - - -is Edges (me; e1, e2, e3 : out Integer from Standard; - o1, o2, o3 : out Boolean from Standard); - ---Purpose: Gives the indices of the edges and the - -- orientation of each one. - - - Movability (me) - returns DegreeOfFreedom from MeshDS; - ---Purpose: The movability of the triangle. - - - SetMovability (me : in out; - canMove : DegreeOfFreedom from MeshDS); - - ----Purpose: For maping the Elements. --- Same Element -> Same HashCode --- Different Elements -> Not IsEqual but can have same HashCode - - HashCode (me; - Upper : Integer from Standard) - ---C++: function call - returns Integer from Standard; - - - IsEqual (me; Other: Element2d from MeshDS) - ---C++: alias operator == - returns Boolean from Standard; - - -end Element2d; diff --git a/src/MeshDS/MeshDS_Element2d.gxx b/src/MeshDS/MeshDS_Element2d.gxx deleted file mode 100755 index e69de29bb2..0000000000 diff --git a/src/MeshDS/MeshDS_Link.cdl b/src/MeshDS/MeshDS_Link.cdl deleted file mode 100755 index df3be25b49..0000000000 --- a/src/MeshDS/MeshDS_Link.cdl +++ /dev/null @@ -1,56 +0,0 @@ --- File: MeshDS_Link.cdl --- Created: Thu Apr 29 11:23:38 1993 --- Author: Didier PIFFAULT --- ----Copyright: Matra Datavision 1993 - - -deferred generic class Link from MeshDS (dummyarg as any) - - ---Purpose: Describes the necessary services of a Link for a - -- mesh data structure. - - -uses Integer from Standard, - Boolean from Standard, - DegreeOfFreedom from MeshDS - - -is Initialize (node1, node2 : Integer from Standard; - canMove : DegreeOfFreedom from MeshDS); - ---Purpose: Contructs a Link beetween to vertices. - - - - FirstNode (me) - ---Purpose: Give the index of first node of the Link. - returns Integer from Standard; - - LastNode (me) - ---Purpose: Give the index of Last node of the Link. - returns Integer from Standard; - - Movability (me) - returns DegreeOfFreedom from MeshDS; - - SetMovability (me : in out; - canMove : DegreeOfFreedom from MeshDS); - - SameOrientation(me; Other : Link from MeshDS) - returns Boolean from Standard; - - ----Purpose: For maping the Links. --- Same Link -> Same HashCode --- Different Links -> Not IsEqual but can have same HashCode - - HashCode (me; - Upper : Integer from Standard) - ---C++: function call - returns Integer from Standard; - - IsEqual (me; Other: Link from MeshDS) - ---C++: alias operator == - returns Boolean from Standard; - -end Link; diff --git a/src/MeshDS/MeshDS_Link.gxx b/src/MeshDS/MeshDS_Link.gxx deleted file mode 100755 index e69de29bb2..0000000000 diff --git a/src/MeshDS/MeshDS_ListOfInteger.hxx b/src/MeshDS/MeshDS_ListOfInteger.hxx deleted file mode 100755 index 36c4768c2a..0000000000 --- a/src/MeshDS/MeshDS_ListOfInteger.hxx +++ /dev/null @@ -1,3 +0,0 @@ -#include - -typedef NCollection_List MeshDS_ListOfInteger; diff --git a/src/MeshDS/MeshDS_MapOfInteger.hxx b/src/MeshDS/MeshDS_MapOfInteger.hxx deleted file mode 100755 index af5a0fa121..0000000000 --- a/src/MeshDS/MeshDS_MapOfInteger.hxx +++ /dev/null @@ -1,3 +0,0 @@ -#include - -typedef NCollection_Map MeshDS_MapOfInteger; diff --git a/src/MeshDS/MeshDS_MapOfIntegerInteger.hxx b/src/MeshDS/MeshDS_MapOfIntegerInteger.hxx deleted file mode 100755 index 4fdbaf5006..0000000000 --- a/src/MeshDS/MeshDS_MapOfIntegerInteger.hxx +++ /dev/null @@ -1,12 +0,0 @@ -// File: MeshDS_MapOfIntegerInteger.hxx -// Created: Fri Jan 30 15:15:17 2009 -// Author: Pavel DURANDIN (pdn) -// Copyright: Open CASCADE 2009 - -#ifndef MeshDS_MapOfIntegerInteger_HeaderFile -#define MeshDS_MapOfIntegerInteger_HeaderFile - -#include -typedef NCollection_DataMap MeshDS_MapOfIntegerInteger; - -#endif diff --git a/src/MeshDS/MeshDS_Mesh2d.cdl b/src/MeshDS/MeshDS_Mesh2d.cdl deleted file mode 100755 index 5640a844b4..0000000000 --- a/src/MeshDS/MeshDS_Mesh2d.cdl +++ /dev/null @@ -1,368 +0,0 @@ --- File: MeshDS_Mesh2d.cdl --- Created: Wed Mar 17 11:20:52 1993 --- Author: Didier PIFFAULT --- ----Copyright: Matra Datavision 1993 - - -generic class Mesh2d from MeshDS - (Node as any; -- Signature of Node from MeshDS - Link as any; -- Signature of Link from MeshDS - Element as any) -- Signature of Element2d from MeshDS - inherits TShared from MMgt - - ---Purpose: Describes the data structure necessary for the - -- mesh algorithms in two dimensions plane or on - -- surface by meshing in UV space. - - -uses Integer from Standard, - ListOfInteger from MeshDS, - MapOfInteger from MeshDS, - PairOfIndex from MeshDS, - Box from Bnd, - BoundSortBox from Bnd, - BaseAllocator from MeshDS - - class NodeHasher instantiates MapHasher(Node); - class LinkHasher instantiates MapHasher(Link); - class ElemHasher instantiates MapHasher(Element); - - class IDMapOfNode instantiates IndexedDataMap from TCollection - (Node, - ListOfInteger from MeshDS, - NodeHasher); - - - class IDMapOfLink instantiates IndexedDataMap from TCollection - (Link, - PairOfIndex from MeshDS, - LinkHasher); - - - class IMapOfElement instantiates IndexedMap from TCollection - (Element, - ElemHasher); - - - class Selector from MeshDS - - ---Purpose: Describes a selector and an Iterator on a - -- selector of components of a Mesh. - - uses Integer from Standard, - Box from Bnd, - MapOfInteger from MeshDS - - is Create returns Selector from MeshDS; - - Create (theMesh : Mesh2d from MeshDS) - returns Selector from MeshDS; - - Initialize (me : in out; - theMesh : Mesh2d from MeshDS) - is static; - - - NeighboursOf(me : in out; - theNode : in Node) - is static; - - NeighboursOfNode(me : in out; - indexNode : in Integer from Standard) - is static; - - - NeighboursOf(me : in out; - theLink : in Link) - is static; - - NeighboursOfLink(me : in out; - indexLink : in Integer from Standard) - is static; - - - NeighboursOf(me : in out; - theElem : in Element) - is static; - - NeighboursOfElement(me : in out; - indexElem : in Integer from Standard) - ---Purpose: All Neighbours Of the Element. By - -- edge or by vertices. - is static; - - - NeighboursByEdgeOf (me : in out; - theElem : in Element) - ---Purpose: Neighbours by edge Of the Element. - is static; - - - NeighboursOf(me : in out; - theSelector : in Selector from MeshDS) - ---Purpose: Adds a level of Neighbours by edge - -- to the selector . - is static; - - - AddNeighbours(me : in out) - ---Purpose: Adds a level of Neighbours by edge - -- to the selector . - is static; - - - Nodes (me) - ---C++: return const & - returns MapOfInteger from MeshDS is static; - - Links (me) - ---C++: return const & - returns MapOfInteger from MeshDS is static; - - Elements (me) - ---C++: return const & - returns MapOfInteger from MeshDS is static; - - FrontierLinks(me) - ---Purpose: Gives the list of links incices - -- frontier of the selector . - ---C++: return const & - returns MapOfInteger from MeshDS is static; - - - fields myMesh : Mesh2d from MeshDS; - myNodes : MapOfInteger from MeshDS; - myLinks : MapOfInteger from MeshDS; - myElements : MapOfInteger from MeshDS; - myFrontier : MapOfInteger from MeshDS; - - end Selector; - - - -is Create (theAllocator: BaseAllocator from MeshDS; - NodeNumber : Integer from Standard = 100) - ---Purpose: is just an evaluation of the - -- presumed number of nodes in this mesh. The - -- Mesh data structure will be automatically - -- redimensioned if necessary. - returns mutable Mesh2d from MeshDS; - - AddNode (me : mutable ; - theNode : Node) - returns Integer from Standard - ---Purpose: Adds a node to the mesh if the node is not - -- already in the Mesh. Returns the index of the - -- node in the structure. - is static; - - GetNode (me : mutable; - Index : Integer from Standard) - returns any Node - ---Purpose: Get the value of node . - ---C++: return const & - ---C++: alias operator () - is static; - - GetNodeList (me : mutable; - Index : Integer from Standard) - returns ListOfInteger from MeshDS - ---Purpose: Get the list of node . - ---C++: return const & - is static; - - ForceRemoveNode (me : mutable; - Index : Integer from Standard) - ---Purpose: Removes the node of index from the mesh. - is static; - - ForceRemoveLink (me : mutable; - Index : Integer from Standard) - ---Purpose: Removes the link of index from the mesh. - is static; - - ReplaceNodes (me : mutable; - NewNodes : IDMapOfNode from MeshDS) - ---Purpose: Removes the all nodes and sets new map of - -- nodes from the mesh. - -- For internal use only. - is static; - - RemoveNode (me : mutable; - Index : Integer from Standard) - ---Purpose: Removes the node of index from the mesh. - is static; - - MoveNode (me : mutable ; - Index : Integer from Standard; - newNode : Node) - ---Purpose: Changes the UV value of node of index by - -- . Returns false if is already in - -- the structure. - returns Boolean from Standard is static; - - NbNodes (me) - returns Integer from Standard - ---Purpose: Gives the number of nodes in this mesh. - is static; - - - AddLink (me : mutable; - theLink : Link) - returns Integer from Standard - ---Purpose: Adds a Link to the mesh if the Link is not - -- already in the structure. Returns the index of - -- the link in the structure. - is static; - - GetLink (me : mutable; - Index : Integer from Standard) - returns any Link - ---Purpose: Get the value of Link . - ---C++: return const & - is static; - - RemoveLink (me : mutable; - Index : Integer from Standard) - ---Purpose: Removes the Link of index from the - -- mesh. - is static; - - SubstituteLink (me : mutable ; - Index : Integer from Standard; - newLink : Link) - ---Purpose: Substitutes the Link of index by - -- clear the connectivity. - returns Boolean from Standard is static; - - NbLinks (me) - returns Integer from Standard - ---Purpose: Gives the number of elements in this mesh. - is static; - - - AddElement (me : mutable; - theElement : Element) - returns Integer from Standard - ---Purpose: Adds an element to the mesh if it is not - -- already in the Mesh. Returns the index of the - -- element in the structure. - is static; - - GetElement (me : mutable; - Index : Integer from Standard) - returns any Element - ---Purpose: Get the value of Element . - ---C++: return const & - is static; - - RemoveElement (me : mutable; - Index : Integer from Standard) - ---Purpose: Removes the element of index in the mesh. - is static; - - SubstituteElement (me : mutable ; - Index : Integer from Standard; - newElement : Element) - ---Purpose: Substitutes the element of index by - -- . The links connectivity is updated. - returns Boolean from Standard is static; - - NbElements (me) - returns Integer from Standard - ---Purpose: Gives the number of elements in this mesh. - is static; - - - ClearDomain (me : mutable) - ---Purpose: Removes all elements - is static; - - - IndexOf (me; - aNode : Node) - ---Purpose: Finds the index of the node. Returns 0 if the - -- node is not in the mesh. - returns Integer from Standard; - - IndexOf (me; - aLink : Link) - ---Purpose: Finds the index of the Link. Returns 0 if the - -- Link is not in the mesh. - returns Integer from Standard; - - IndexOf (me; - anElement : Element) - ---Purpose: Finds the index of the Element. Returns 0 if - -- the Element is not in the mesh. - returns Integer from Standard; - - - LinkNeighboursOf (me; - theNode : in Integer from Standard) - returns ListOfInteger from MeshDS - ---C++: return const & - ---Purpose: Gives the list of Link's indices handling the - -- node . - is static; - - - ElemConnectedTo (me; - theLink : in Integer from Standard) - returns PairOfIndex from MeshDS - ---C++: return const & - ---Purpose: Gives the element's indices conected - -- to . - is static; - - ElemOfDomain (me) - returns MapOfInteger from MeshDS - ---C++: return const & - ---Purpose: Gives the list of element's indices - is static; - - - LinkOfDomain (me) - returns MapOfInteger from MeshDS - ---C++: return const & - ---Purpose: Gives the list of link's indices - is static; - - - ClearDeleted (me : mutable) - ---Purpose: This method substitute the deleted items by - -- the last in Indexed Data Maps to have only - -- non-deleted elements, links or nodes in the - -- structure. - is static; - - --- Internal methods : - - ClearElement (me : mutable; - Index : Integer from Standard; - theElem : Element) - ---Purpose: Deletes the element of index in - -- the mesh. Used by RemoveElement. - is static private; - - Statistics (me; - flot : in out OStream from Standard) - ---Purpose: Give informations on map. - is static; - - Allocator (me) returns BaseAllocator from MeshDS; - ---C++: return const& - - -fields myNodes : IDMapOfNode from MeshDS; - myDelNodes : ListOfInteger from MeshDS; - myLinks : IDMapOfLink from MeshDS; - myDelLinks : ListOfInteger from MeshDS; - myElements : IMapOfElement from MeshDS; - --myDelElements : ListOfInteger from MeshDS; - myElemOfDomain : MapOfInteger from MeshDS; - myLinkOfDomain : MapOfInteger from MeshDS; - myAllocator : BaseAllocator from MeshDS; -end Mesh2d; diff --git a/src/MeshDS/MeshDS_Mesh2d.gxx b/src/MeshDS/MeshDS_Mesh2d.gxx deleted file mode 100755 index ba4ddf31c0..0000000000 --- a/src/MeshDS/MeshDS_Mesh2d.gxx +++ /dev/null @@ -1,686 +0,0 @@ -// File: MeshDS_Mesh2d.gxx -// Created: Tue May 11 16:01:57 1993 -// Author: Didier PIFFAULT -// - - -//======================================================================= -//function : MeshDS_Mesh2d -//purpose : -//======================================================================= -MeshDS_Mesh2d::MeshDS_Mesh2d(const MeshDS_BaseAllocator& theAlloc, - const Standard_Integer NodeNumber) - : myNodes(NodeNumber+3), - myDelNodes(theAlloc), - myLinks(NodeNumber*3), - myDelLinks(theAlloc), - myElements(NodeNumber*2), - // Not_Debuged_Yet myDelElements(theAlloc), - myElemOfDomain(NodeNumber*2,theAlloc), - myLinkOfDomain(NodeNumber*2,theAlloc) -{ - myAllocator = theAlloc; -} - -//======================================================================= -//function : AddNode -//purpose : -//======================================================================= -Standard_Integer MeshDS_Mesh2d::AddNode(const Node& theNode) -{ - Standard_Integer NodeIndex=myNodes.FindIndex(theNode); - if (NodeIndex>0 && !myDelNodes.IsEmpty()) { - if (myNodes.FindKey(NodeIndex).Movability()==MeshDS_Deleted) - NodeIndex=0; - } - if (NodeIndex<=0) { - MeshDS_ListOfInteger thelist(myAllocator); - if (!myDelNodes.IsEmpty()) { - NodeIndex=myDelNodes.First(); - myNodes.Substitute(NodeIndex, theNode, thelist); - myDelNodes.RemoveFirst(); - } - else { - NodeIndex=myNodes.Add(theNode, thelist); - } - } - return NodeIndex; -} - -//======================================================================= -//function : GetNode -//purpose : -//======================================================================= -const Node& MeshDS_Mesh2d::GetNode(const Standard_Integer Index) -{ - return myNodes.FindKey(Index); -} - -//======================================================================= -//function : GetNodeList -//purpose : -//======================================================================= -const MeshDS_ListOfInteger& MeshDS_Mesh2d::GetNodeList(const Standard_Integer Index) -{ - return myNodes.FindFromIndex(Index); -} - -//======================================================================= -//function : ForceRemoveNode -//purpose : -//======================================================================= -void MeshDS_Mesh2d::ForceRemoveNode(const Standard_Integer Index) -{ - //Warning, the static cast from const& to & is called for - //performance reasons. This is applicable only in case if later - //modification of element (field movability) does not influent on - //has calculation. - Node& vref=(Node&)myNodes.FindKey(Index); - if ( myNodes.FindFromIndex(Index).Extent()==0) { - vref.SetMovability(MeshDS_Deleted); - myDelNodes.Append(Index); - } -} - -//======================================================================= -//function : ReplaceNodes -//purpose : -//======================================================================= -void MeshDS_Mesh2d::ReplaceNodes(const MeshDS_IDMapOfNode& NewNodes) -{ - if (NewNodes.IsEmpty() || NewNodes.Extent() != myNodes.Extent()) - return; - /*for (Standard_Integer i = 1; i <= myNodes.Extent(); i++) - ForceRemoveNode(i);*/ - - myNodes.Assign(NewNodes); -} - -//======================================================================= -//function : ForceRemoveLink -//purpose : -//======================================================================= -void MeshDS_Mesh2d::ForceRemoveLink(const Standard_Integer Index) -{ - //Warning, the static cast from const& to & is called for - //performance reasons. This is applicable only in case if later - //modification of element (field movability) does not influent on - //has calculation. - Link& lref=(Link&)myLinks.FindKey(Index); - if (lref.Movability()!=MeshDS_Deleted) { - if (myLinks.FindFromIndex(Index).Extent()==0) { - MeshDS_ListOfInteger::Iterator tit; - MeshDS_ListOfInteger& aList1 = myNodes(lref.FirstNode()); - for(tit.Init(aList1); tit.More(); tit.Next()){ - if (tit.Value()==Index) { - aList1.Remove(tit); - break; - } - } - - MeshDS_ListOfInteger& aList2 = myNodes(lref.LastNode()); - for(tit.Init(aList2); tit.More(); tit.Next()){ - if (tit.Value()==Index) { - aList2.Remove(tit); - break; - } - } - myLinkOfDomain.Remove(Index); - lref.SetMovability(MeshDS_Deleted); - myDelLinks.Append(Index); - } - } -} - -//======================================================================= -//function : RemoveNode -//purpose : -//======================================================================= -void MeshDS_Mesh2d::RemoveNode(const Standard_Integer Index) -{ - //Warning, the static cast from const& to & is called for - //performance reasons. This is applicable only in case if later - //modification of element (field movability) does not influent on - //has calculation. - Node& vref=(Node&)myNodes.FindKey(Index); - if (vref.Movability()==MeshDS_Free && - myNodes.FindFromIndex(Index).Extent()==0) { - vref.SetMovability(MeshDS_Deleted); - myDelNodes.Append(Index); - } -} - -//======================================================================= -//function : MoveNode -//purpose : -//======================================================================= -Standard_Boolean MeshDS_Mesh2d::MoveNode(const Standard_Integer Index, - const Node& newNode) -{ - if (myNodes.FindIndex(newNode)==0) { - Node vref(myNodes.FindKey(Index)); - const MeshDS_ListOfInteger& refLink=myNodes(Index); - vref.SetMovability(MeshDS_Deleted); - myNodes.Substitute(Index, vref, refLink); - myNodes.Substitute(Index, newNode, refLink); - return Standard_True; - } - return Standard_False; -} - -//======================================================================= -//function : NbNodes -//purpose : -//======================================================================= -Standard_Integer MeshDS_Mesh2d::NbNodes()const -{ - return myNodes.Extent(); -} - -//======================================================================= -//function : AddLink -//purpose : -//======================================================================= -Standard_Integer MeshDS_Mesh2d::AddLink(const Link& theLink) -{ - Standard_Integer LinkIndex=myLinks.FindIndex(theLink); - if (LinkIndex<=0) { - MeshDS_PairOfIndex aPair; - if (!myDelLinks.IsEmpty()) { - LinkIndex=myDelLinks.First(); - myLinks.Substitute(LinkIndex, theLink, aPair); - myDelLinks.RemoveFirst(); - } - else { - LinkIndex=myLinks.Add(theLink, aPair); - } - myNodes(theLink.FirstNode()).Append(Abs(LinkIndex)); - myNodes(theLink.LastNode()).Append(Abs(LinkIndex)); - myLinkOfDomain.Add(LinkIndex); - } - else if (!theLink.SameOrientation(myLinks.FindKey(LinkIndex))) - LinkIndex=-LinkIndex; - - return LinkIndex; -} - -//======================================================================= -//function : GetLink -//purpose : -//======================================================================= -const Link& MeshDS_Mesh2d::GetLink(const Standard_Integer Index) -{ - return myLinks.FindKey(Index); -} - -//======================================================================= -//function : RemoveLink -//purpose : -//======================================================================= -void MeshDS_Mesh2d::RemoveLink(const Standard_Integer Index) -{ - //Warning, the static cast from const& to & is called for - //performance reasons. This is applicable only in case if later - //modification of element (field movability) does not influent on - //has calculation. - Link& lref=(Link&)myLinks.FindKey(Index); - if (lref.Movability()!=MeshDS_Deleted) { - if (lref.Movability()==MeshDS_Free && - myLinks.FindFromIndex(Index).Extent()==0) { - MeshDS_ListOfInteger::Iterator tit; - MeshDS_ListOfInteger& aList1 = myNodes(lref.FirstNode()); - for(tit.Init(aList1); tit.More(); tit.Next()){ - if (tit.Value()==Index) { - aList1.Remove(tit); - break; - } - } - MeshDS_ListOfInteger& aList2 = myNodes(lref.LastNode()); - for(tit.Init(aList2); tit.More(); tit.Next()){ - if (tit.Value()==Index) { - aList2.Remove(tit); - break; - } - } - myLinkOfDomain.Remove(Index); - lref.SetMovability(MeshDS_Deleted); - myDelLinks.Append(Index); - } - } -} - -//======================================================================= -//function : SubstituteLink -//purpose : -//======================================================================= -Standard_Boolean MeshDS_Mesh2d::SubstituteLink(const Standard_Integer Index, - const Link& newLink) -{ - //MeshDS_ListOfInteger thelist(myAllocator); - MeshDS_PairOfIndex aPair; - Link lref=myLinks.FindKey(Index); - if (lref.Movability()==MeshDS_Deleted) - myLinks.Substitute(Index, newLink, aPair); - else { - if (myLinks.FindIndex(newLink)!=0) - return Standard_False; - - lref.SetMovability(MeshDS_Deleted); - myLinks.Substitute(Index, lref, aPair); - - MeshDS_ListOfInteger::Iterator tit; - for(tit.Init(myNodes(lref.FirstNode())); tit.More(); tit.Next()){ - if (tit.Value()==Index) { - myNodes(lref.FirstNode()).Remove(tit); - break; - } - } - for(tit.Init(myNodes(lref.LastNode())); tit.More(); tit.Next()){ - if (tit.Value()==Index) { - myNodes(lref.LastNode()).Remove(tit); - break; - } - } - myLinks.Substitute(Index, newLink, aPair); - myNodes(newLink.FirstNode()).Append(Abs(Index)); - myNodes(newLink.LastNode()).Append(Abs(Index)); - } - return Standard_True; -} - -//======================================================================= -//function : NbLinks -//purpose : -//======================================================================= -Standard_Integer MeshDS_Mesh2d::NbLinks()const -{ - return myLinks.Extent(); -} - -//======================================================================= -//function : AddElement -//purpose : -//======================================================================= -Standard_Integer MeshDS_Mesh2d::AddElement(const Element& theElement) -{ - Standard_Integer ElemIndex=myElements.FindIndex(theElement); - - if (ElemIndex<=0) { - /* Not_Debuged_Yet - if (!myDelElements.IsEmpty()) { - ElemIndex=myDelElements.First(); - myElements.Substitute(ElemIndex, theElement); - myDelElements.RemoveFirst(); - } - else */ - ElemIndex=myElements.Add(theElement); - - myElemOfDomain.Add(ElemIndex); - - Standard_Integer ed1, ed2, ed3; - Standard_Boolean or1, or2, or3; - theElement.Edges(ed1, ed2, ed3, or1, or2, or3); - myLinks(ed1).Append(ElemIndex); - myLinks(ed2).Append(ElemIndex); - myLinks(ed3).Append(ElemIndex); - } - - return ElemIndex; -} - -//======================================================================= -//function : GetElement -//purpose : -//======================================================================= -const Element& MeshDS_Mesh2d::GetElement(const Standard_Integer Index) -{ - return myElements.FindKey(Index); -} - -//======================================================================= -//function : RemoveElement -//purpose : -//======================================================================= -void MeshDS_Mesh2d::RemoveElement(const Standard_Integer Index) -{ - //Warning, the static cast from const& to & is called for - //performance reasons. This is applicable only in case if later - //modification of element (field movability) does not influent on - //has calculation. - Element& lelem=(Element&)myElements.FindKey(Index); - if (lelem.Movability()!=MeshDS_Deleted) { - ClearElement(Index, lelem); - lelem.SetMovability(MeshDS_Deleted); - // Not_Debuged_Yet myDelElements.Append(Index); - myElemOfDomain.Remove(Index); - } -} - -static void removeElementIndex(MeshDS_PairOfIndex& thePair, - const Standard_Integer Index) -{ - for(Standard_Integer i = 1, n = thePair.Extent(); i <= n; i++) { - if (thePair.Index(i)==Index) { - thePair.RemoveIndex(i); - break; - } - } -} - -void MeshDS_Mesh2d::ClearElement(const Standard_Integer Index, - const Element& theElem) -{ - if (theElem.Movability()==MeshDS_Free) { - Standard_Integer ed1, ed2, ed3; - Standard_Boolean or1, or2, or3; - theElem.Edges(ed1, ed2, ed3, or1, or2, or3); - removeElementIndex(myLinks(ed1),Index); - removeElementIndex(myLinks(ed2),Index); - removeElementIndex(myLinks(ed3),Index); - } -} - -//======================================================================= -//function : SubstituteElement -//purpose : -//======================================================================= -Standard_Boolean MeshDS_Mesh2d::SubstituteElement - (const Standard_Integer Index, const Element& newElement) -{ - const Element& lelem=myElements.FindKey(Index); - if (lelem.Movability()==MeshDS_Deleted) - myElements.Substitute(Index, newElement); - else { - if (myElements.FindIndex(newElement)==0) { - ClearElement(Index, lelem); - // Warning: here new element and old element should have different Hash code - myElements.Substitute(Index, newElement); - - Standard_Integer ed1, ed2, ed3; - Standard_Boolean or1, or2, or3; - newElement.Edges(ed1, ed2, ed3, or1, or2, or3); - myLinks(ed1).Append(Index); - myLinks(ed2).Append(Index); - myLinks(ed3).Append(Index); - } - else return Standard_False; - } - return Standard_True; -} - -//======================================================================= -//function : ClearDomain -//purpose : -//======================================================================= -void MeshDS_Mesh2d::ClearDomain() -{ - MeshDS_MapOfInteger freeEdges; - Standard_Integer ed1, ed2, ed3; - Standard_Boolean or1, or2, or3; - MeshDS_MapOfInteger::Iterator itDom(myElemOfDomain); - //Warning, the static cast from const& to & is called for - //performance reasons. This is applicable only in case if later - //modification of element (field movability) does not influent on - //has calculation. - for (;itDom.More(); itDom.Next()) { - Element& lelem=(Element&)myElements.FindKey(itDom.Key()); - lelem.Edges(ed1, ed2, ed3, or1, or2, or3); - freeEdges.Add(ed1); - freeEdges.Add(ed2); - freeEdges.Add(ed3); - ClearElement(itDom.Key(), lelem); - lelem.SetMovability(MeshDS_Deleted); - // Not_Debuged_Yet myDelElements.Append(itDom.Key()); - } - myElemOfDomain.Clear(); - MeshDS_MapOfInteger::Iterator edgeIt(freeEdges); - for (; edgeIt.More(); edgeIt.Next()) - RemoveLink(edgeIt.Key()); -} - -//======================================================================= -//function : NbElements -//purpose : -//======================================================================= -Standard_Integer MeshDS_Mesh2d::NbElements()const -{ - return myElements.Extent(); -} - -//======================================================================= -//function : IndexOf -//purpose : -//======================================================================= -Standard_Integer MeshDS_Mesh2d::IndexOf(const Node& aNode)const -{ - return myNodes.FindIndex(aNode); -} - -//======================================================================= -//function : IndexOf -//purpose : -//======================================================================= -Standard_Integer MeshDS_Mesh2d::IndexOf(const Link& aLink)const -{ - return myLinks.FindIndex(aLink); -} - -//======================================================================= -//function : IndexOf -//purpose : -//======================================================================= -Standard_Integer MeshDS_Mesh2d::IndexOf(const Element& anElement)const -{ - return myElements.FindIndex(anElement); -} - -//======================================================================= -//function : LinkNeighboursOf -//purpose : -//======================================================================= -const MeshDS_ListOfInteger& MeshDS_Mesh2d::LinkNeighboursOf - (const Standard_Integer theNode)const -{ - return myNodes.FindFromIndex(theNode); -} - -//======================================================================= -//function : ElemConnectedTo -//purpose : -//======================================================================= -const MeshDS_PairOfIndex& MeshDS_Mesh2d::ElemConnectedTo - (const Standard_Integer theLink)const -{ - return myLinks.FindFromIndex(theLink); -} - -//======================================================================= -//function : ElemOfDomain -//purpose : -//======================================================================= -const MeshDS_MapOfInteger& MeshDS_Mesh2d::ElemOfDomain () const -{ - return myElemOfDomain; -} - -//======================================================================= -//function : LinkOfDomain -//purpose : -//======================================================================= -const MeshDS_MapOfInteger& MeshDS_Mesh2d::LinkOfDomain () const -{ - return myLinkOfDomain; -} - -//======================================================================= -//function : ClearDeleted -//purpose : -//======================================================================= -void MeshDS_Mesh2d::ClearDeleted() -{ - - // Traitement des Elements - - Standard_Integer IndexDelItem; - - Standard_Integer lastNonDelItem=myElements.Extent(); - /* // Not_Debuged_Yet - while (!myDelElements.IsEmpty()) { - while (lastNonDelItem>0) { - if (myElements.FindKey(lastNonDelItem).Movability()!=MeshDS_Deleted) - break; - myElements.RemoveLast(); - lastNonDelItem--; - } - - IndexDelItem=myDelElements.First(); - myDelElements.RemoveFirst(); - - if (IndexDelItem0) { - if (myLinks.FindKey(lastNonDelItem).Movability()!=MeshDS_Deleted) - break; - myLinks.RemoveLast(); - lastNonDelItem--; - } - - IndexDelItem=myDelLinks.First(); - myDelLinks.RemoveFirst(); - - if (IndexDelItem0) { - if (myNodes.FindKey(lastNonDelItem).Movability()!=MeshDS_Deleted) - break; - myNodes.RemoveLast(); - lastNonDelItem--; - } - IndexDelItem=myDelNodes.First(); - myDelNodes.RemoveFirst(); - - if (IndexDelItem ----Copyright: Matra Datavision 1993 - - -deferred generic class Node from MeshDS (dummyarg as any) - - ---Purpose: Describes the necessary services of a node to use - --- it in a Mesh data structure. - -uses DegreeOfFreedom from MeshDS - -is Movability (me) - returns DegreeOfFreedom from MeshDS; - - - SetMovability (me: in out; canMove : DegreeOfFreedom from MeshDS); - - - Domain (me) - returns Integer from Standard; - - ----Purpose: For maping the Nodes. --- Same Node -> Same HashCode --- Different Nodes -> Not IsEqual but can have same HashCode - - HashCode (me; - Upper : Integer from Standard) - ---C++: function call - returns Integer from Standard; - - - IsEqual (me; Other : Node from MeshDS) - ---C++: alias operator == - returns Boolean from Standard; - -end Node; diff --git a/src/MeshDS/MeshDS_Node.gxx b/src/MeshDS/MeshDS_Node.gxx deleted file mode 100755 index e69de29bb2..0000000000 diff --git a/src/MeshDS/MeshDS_PairOfIndex.hxx b/src/MeshDS/MeshDS_PairOfIndex.hxx deleted file mode 100755 index be5f2a2f2c..0000000000 --- a/src/MeshDS/MeshDS_PairOfIndex.hxx +++ /dev/null @@ -1,105 +0,0 @@ -// File: MeshDS_PairOfIndex.hxx -// Created: 29.01.09 15:55:25 -// Author: Pavel TELKOV -// Copyright: Open CASCADE 2009 - -/* -* Purpose: This class represent pair of integer indices -* It is restricted to store more than two indices in it -* This pair uses to store element indices connected to link -*/ - -#ifndef MeshDS_PairOfIndex_HeaderFile -#define MeshDS_PairOfIndex_HeaderFile - -#include - -class MeshDS_PairOfIndex -{ - public: - MeshDS_PairOfIndex() - { myIndx1 = myIndx2 = -1; } - - MeshDS_PairOfIndex(const MeshDS_PairOfIndex& theOther) - { - myIndx1 = theOther.myIndx1; - myIndx1 = theOther.myIndx2; - } - - //! Clear indices - void Clear() - { - myIndx1 = myIndx2 = -1; - } - - //! append index (store first of last index of pair) - void Append(const Standard_Integer theIndx) - { - if ( myIndx1 < 0 ) - myIndx1 = theIndx; - else - { - if ( myIndx2 >= 0 ) - Standard_OutOfRange::Raise ("MeshDS_PairOfIndex::Append, more than two index to store"); - myIndx2 = theIndx; - } - } - - //! prepend index (store first index) - void Prepend(const Standard_Integer theIndx) - { - if ( myIndx2 >= 0 ) - Standard_OutOfRange::Raise ("MeshDS_PairOfIndex::Append, more than two index to store"); - myIndx2 = myIndx1; - myIndx1 = theIndx; - } - - //! returns is pair not initialized by index - Standard_Boolean IsEmpty() const - { - return (myIndx1 < 0 /*optimisation && myIndx2 < 0*/); - } - - //! returns numner of initialized indeces - Standard_Integer Extent() const - { - return (myIndx1 < 0 ? 0 : (myIndx2 < 0 ? 1 : 2)); - } - - //! returns first index from pair - Standard_Integer FirstIndex() const - { - return myIndx1; - } - - //! returns last index - Standard_Integer LastIndex() const - { - return (myIndx2 < 0 ? myIndx1 : myIndx2); - } - - Standard_Integer Index(const Standard_Integer theNum) const - { - return (theNum == 1 ? myIndx1 : myIndx2 /*(theNum == 2 ? myIndx2 : -1 )*/); - } - - void SetIndex(const Standard_Integer theNum, - const Standard_Integer theIndex) - { - theNum == 1 ? myIndx1 = theIndex : myIndx2 = theIndex; - } - - //! remove indicated - void RemoveIndex (const Standard_Integer theNum) - { - if ( theNum == 1 ) - myIndx1 = myIndx2; - myIndx2 = -1; - } - //! fields - private: - Standard_Integer myIndx1; - Standard_Integer myIndx2; -}; - -#endif diff --git a/src/MeshDS/MeshDS_Selector.gxx b/src/MeshDS/MeshDS_Selector.gxx deleted file mode 100755 index e543474d20..0000000000 --- a/src/MeshDS/MeshDS_Selector.gxx +++ /dev/null @@ -1,155 +0,0 @@ -// File: MeshDS_Selector.gxx -// Created: Tue Jun 1 11:20:51 1993 -// Author: Didier PIFFAULT -// - -#include - -//======================================================================= -//function : MeshDS_Selector -//purpose : -//======================================================================= -MeshDS_Selector::MeshDS_Selector() - : myNodes(10, new NCollection_IncAllocator), - myLinks(10, new NCollection_IncAllocator), - myElements(10, new NCollection_IncAllocator), - myFrontier(10, new NCollection_IncAllocator) - -{} - -MeshDS_Selector::MeshDS_Selector(const Handle(MeshDS_Mesh2d)& theMesh) - : myMesh(theMesh), - myNodes(10, myMesh->Allocator()), - myLinks(10, myMesh->Allocator()), - myElements(10, myMesh->Allocator()), - myFrontier(10, myMesh->Allocator()) -{} - -void MeshDS_Selector::Initialize(const Handle(MeshDS_Mesh2d)& theMesh) -{ - myMesh=theMesh; - myNodes.Clear(); - myLinks.Clear(); - myElements.Clear(); - myFrontier.Clear(); -} - -//======================================================================= -//function : NeighboursOfNode -//purpose : -//======================================================================= -void MeshDS_Selector::NeighboursOf(const Node& theNode) -{ - NeighboursOfNode(myMesh->IndexOf(theNode)); -} - -void MeshDS_Selector::NeighboursOfNode(const Standard_Integer indexNode) -{ - MeshDS_ListOfInteger::Iterator itL(myMesh->LinkNeighboursOf(indexNode)); - - for (; itL.More(); itL.Next()) { - const MeshDS_PairOfIndex& aPair = myMesh->ElemConnectedTo(itL.Value()); - for(Standard_Integer j = 1, jn = aPair.Extent(); j <= jn; j++) - myElements.Add(aPair.Index(j)); - } -} - -//======================================================================= -//function : NeighboursOfLink -//purpose : -//======================================================================= -void MeshDS_Selector::NeighboursOf(const Link& theLink) -{ - NeighboursOfNode(theLink.FirstNode()); - NeighboursOfNode(theLink.LastNode()); -} - -void MeshDS_Selector::NeighboursOfLink(const Standard_Integer indexLink) -{ - NeighboursOf(myMesh->GetLink(indexLink)); -} - -//======================================================================= -//function : NeighboursOfElement -//purpose : by edge and by vertices -//======================================================================= -void MeshDS_Selector::NeighboursOf(const Element& theElem) -{ - Standard_Integer v1, v2, v3, ev; - Standard_Boolean o1, o2, o3; - theElem.Edges(v1, v3, ev, o1, o2, o3); - v2=myMesh->GetLink(v1).LastNode(); - v1=myMesh->GetLink(v1).FirstNode(); - ev=myMesh->GetLink(v3).LastNode(); - if (v1!=ev && v2!=ev) v3=ev; - else v3=myMesh->GetLink(v3).FirstNode(); - NeighboursOfNode(v1); - NeighboursOfNode(v2); - NeighboursOfNode(v3); -} - -void MeshDS_Selector::NeighboursOfElement(const Standard_Integer indexElem) -{ - NeighboursOf(myMesh->GetElement(indexElem)); -} - -//======================================================================= -//function : NeighboursByEdgeOf -//purpose : Neighbours Of an element only by edge -//======================================================================= -void MeshDS_Selector::NeighboursByEdgeOf(const Element& theElem) -{ - Standard_Integer e[3], iEd; - Standard_Boolean o1, o2, o3; - theElem.Edges(e[0], e[1], e[2], o1, o2, o3); - - for (iEd=0; iEd<3; iEd++) { - const MeshDS_PairOfIndex& aPair = myMesh->ElemConnectedTo(e[iEd]); - for(Standard_Integer j = 1, jn = aPair.Extent(); j <= jn; j++) - myElements.Add(aPair.Index(j)); - } -} - - -//======================================================================= -//function : NeighboursOfSelector -//purpose : -//======================================================================= -void MeshDS_Selector::NeighboursOf(const MeshDS_Selector& /*theSelector*/) -{} - -//======================================================================= -//function : AddNeighbours -//purpose : -//======================================================================= -void MeshDS_Selector::AddNeighbours() -{} - -//======================================================================= -//function : Nodes -//purpose : -//======================================================================= -const MeshDS_MapOfInteger& MeshDS_Selector::Nodes()const -{return myNodes;} - -//======================================================================= -//function : Links -//purpose : -//======================================================================= -const MeshDS_MapOfInteger& MeshDS_Selector::Links()const -{return myLinks;} - -//======================================================================= -//function : Elements -//purpose : -//======================================================================= -const MeshDS_MapOfInteger& MeshDS_Selector::Elements()const -{return myElements;} - -//======================================================================= -//function : FrontierLinks -//purpose : -//======================================================================= -const MeshDS_MapOfInteger& MeshDS_Selector::FrontierLinks()const -{return myFrontier;} - -- 2.20.1