Basic functions for point motion/relaxation.

This commit is contained in:
graham
2008-09-17 18:01:33 +01:00
parent affb31a010
commit cc632e6b91
10 changed files with 25586 additions and 25587 deletions

View File

@ -208,6 +208,27 @@ void Foam::CV3D::insertGrid()
} }
} }
void Foam::CV3D::relaxPoints(const scalar relaxation)
{
Info<< "Calculating new points: " << endl;
for
(
Triangulation::Finite_vertices_iterator vit = finite_vertices_begin();
vit != finite_vertices_end();
++vit
)
{
if (vit->internalPoint())
{
// movePoint(vit, newPoint);
}
}
}
void Foam::CV3D::insertSurfacePointPairs() void Foam::CV3D::insertSurfacePointPairs()
{ {
startOfSurfacePointPairs_ = number_of_vertices(); startOfSurfacePointPairs_ = number_of_vertices();
@ -236,6 +257,7 @@ void Foam::CV3D::boundaryConform()
{ {
} }
void Foam::CV3D::removeSurfacePointPairs() void Foam::CV3D::removeSurfacePointPairs()
{ {
for for
@ -252,6 +274,7 @@ void Foam::CV3D::removeSurfacePointPairs()
} }
} }
void Foam::CV3D::write() const void Foam::CV3D::write() const
{ {
if (controls_.writeFinalTriangulation) if (controls_.writeFinalTriangulation)

View File

@ -211,6 +211,8 @@ private:
const vector& n const vector& n
); );
inline void movePoint(const Vertex_handle& vh, const point& p);
//- Create the initial mesh from the bounding-box //- Create the initial mesh from the bounding-box
void insertBoundingBox(); void insertBoundingBox();
@ -330,6 +332,12 @@ public:
// Points outside the geometry are ignored. // Points outside the geometry are ignored.
void insertGrid(); void insertGrid();
// Point motion
//- Calculate the displacements to relax the points
void relaxPoints(const scalar relaxation);
//- Insert all surface point-pairs from //- Insert all surface point-pairs from
// insertSurfaceNearestPointPairs and // insertSurfaceNearestPointPairs and
// findIntersectionForOutsideCentroid // findIntersectionForOutsideCentroid

View File

@ -91,6 +91,16 @@ inline void Foam::CV3D::insertPointPair
insertPoint(surfPt + ppDistn, master); insertPoint(surfPt + ppDistn, master);
} }
void Foam::CV3D::movePoint(const Vertex_handle& vh, const point& p)
{
label nv = vh->index();
remove(vh);
insert(toPoint(p))->index() = nv;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
#ifdef CGAL_INEXACT #ifdef CGAL_INEXACT

View File

@ -90,12 +90,20 @@ int main(int argc, char *argv[])
mesh.boundaryConform(); mesh.boundaryConform();
} }
scalar relaxation = 1;
for (int iter=1; iter<=nIterations; iter++) for (int iter=1; iter<=nIterations; iter++)
{ {
Info<< nl Info<< nl
<< "Relaxation iteration " << iter << nl << "Relaxation iteration " << iter << nl
<< "~~~~~~~~~~~~~~~~~~~~~~~~" << endl; << "~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
relaxation -= 0.02;
Info<< "relaxation = " << relaxation << endl;
mesh.relaxPoints(relaxation);
mesh.removeSurfacePointPairs(); mesh.removeSurfacePointPairs();
mesh.insertSurfacePointPairs(); mesh.insertSurfacePointPairs();
mesh.boundaryConform(); mesh.boundaryConform();