xmsmesh
1.0
|
Relaxes mesh points. Moves them around to form a better mesh. More...
Public Types | |
enum | RelaxFlagEnum { RELAX_RELAX = 1 } |
Point flags. | |
enum | RelaxTypeEnum { RELAXTYPE_AREA, RELAXTYPE_ANGLE, RELAXTYPE_SPRING } |
Types of relaxation, or the relaxation algorithms. | |
Public Member Functions | |
virtual void | Relax (const VecInt &a_fixedPoints, BSHP< TrTin > a_tin) override |
Moves interior mesh points to create a better mesh. More... | |
virtual bool | SetRelaxationMethod (const std::string &a_relaxMethod) override |
Sets the relaxation method. More... | |
virtual void | SetPointSizer (BSHP< MePolyRedistributePts > a_sizer) override |
Sets size function used by the spring relaxation method. More... | |
void | ComputeCentroids () |
Computes the centroids of each triangle. | |
void | RelaxMarkedPoints (RelaxTypeEnum a_relaxType, int a_iteration, int a_numiterations) |
Relaxes the points marked by m_flags. Compare to rlRelaxMarkedNodes. More... | |
void | AreaRelax (int a_point, Pt3d &a_newLocation) |
Relax a point using area of surrounding triangles. Trys to move point to the center of the area. Compare to rliAreaRelax. More... | |
void | AngleRelax (int a_point, Pt3d &a_newLocation) |
Relax a point using angles. Moves point to equalize the angles between the edges touching the point. Compare to rliAngleRelax. More... | |
void | SpringRelaxSinglePoint (int a_point, Pt3d &a_newLocation) |
Relax a point using spring method. More... | |
void | SetupNeighbors () |
Set up neighbor point information to be used by the spring relax algorithm. | |
void | SetupPointSizes () |
Set up point sizes to be used by the spring relax algorithm. | |
bool | NewLocationIsValid (size_t a_idx, Pt3d &a_newLocation) |
Checks if a new relaxed location results in valid triangle (area is positive) More... | |
bool | AllTrianglesHavePositiveArea (BSHP< TrTin > a_tin) |
Checks if all triangles have a positive area. More... | |
Public Attributes | |
BSHP< TrTin > | m_tin |
triangles connecting points (mesh elements) | |
const VecInt * | m_fixedPoints |
locations that may not be relaxed | |
VecPt3d | m_centroids |
The triangle centroids. | |
double | m_slideangle |
Used on boundary relaxation. Not sure how to document this one. | |
VecInt | m_flags |
Flags for points of type RelaxFlagEnum. | |
RelaxTypeEnum | m_relaxType |
the type of relaxation to perform. See RelaxTypeEnum | |
BSHP< MePolyRedistributePts > | m_sizer |
size function used by the spring relax method | |
VecDbl | m_pointSizes |
sizer size at each mesh point | |
VecInt2d | m_pointNeighbors |
neighbor points for spring relaxation | |
VecInt | m_pointsToDelete |
indexes of points that must be removed | |
Additional Inherited Members | |
Static Public Member Functions inherited from xms::MeRelaxer | |
static BSHP< MeRelaxer > | New () |
Creates a new instance of the class. More... | |
Protected Member Functions inherited from xms::MeRelaxer | |
MeRelaxer () | |
Constructor. | |
virtual | ~MeRelaxer () |
Destructor. | |
Relaxes mesh points. Moves them around to form a better mesh.
Definition at line 50 of file MeRelaxer.cpp.
Checks if all triangles have a positive area.
[in] | a_tin | the tin |
Definition at line 540 of file MeRelaxer.cpp.
Referenced by Relax(), and MeRelaxerUnitTests::testAllTrianglesHavePositiveArea().
void xms::MeRelaxerImpl::AngleRelax | ( | int | a_point, |
Pt3d & | a_newLocation | ||
) |
Relax a point using angles. Moves point to equalize the angles between the edges touching the point. Compare to rliAngleRelax.
[in] | a_point | The point index to be relaxed. |
[out] | a_newLocation | The location after point is relaxed (moved). |
Definition at line 340 of file MeRelaxer.cpp.
References m_tin, sqr(), trDecrementIndex(), trIncrementIndex(), xms::Pt2< T >::x, xms::Pt3< T >::x, XM_ASSERT, XM_PI, xms::Pt2< T >::y, and xms::Pt3< T >::y.
Referenced by RelaxMarkedPoints().
void xms::MeRelaxerImpl::AreaRelax | ( | int | a_point, |
Pt3d & | a_newLocation | ||
) |
Relax a point using area of surrounding triangles. Trys to move point to the center of the area. Compare to rliAreaRelax.
[in] | a_point | The point index to be relaxed. |
[out] | a_newLocation | The location after point is relaxed (moved). |
Definition at line 319 of file MeRelaxer.cpp.
References m_centroids, m_tin, xms::Pt3< T >::x, and xms::Pt3< T >::y.
Referenced by RelaxMarkedPoints().
bool xms::MeRelaxerImpl::NewLocationIsValid | ( | size_t | a_idx, |
Pt3d & | a_newLocation | ||
) |
Checks if a new relaxed location results in valid triangle (area is positive)
[in] | a_idx | the index to the point |
[in] | a_newLocation | x,y,z new coordinates |
Definition at line 518 of file MeRelaxer.cpp.
References GT_EPS(), and m_tin.
Referenced by RelaxMarkedPoints(), MeRelaxerUnitTests::testNewLocationIsValid(), MeRelaxerUnitTests::testSpringRelaxSinglePoint(), MeRelaxerUnitTests::testSpringRelaxSinglePoint2(), and MeRelaxerUnitTests::testSpringRelaxSinglePoint3().
|
overridevirtual |
Moves interior mesh points to create a better mesh.
Iteratively relaxes the interior nodes. Also swaps edges to maintain the Delauney criterion after each set of relaxations. Also merges triangles. Compare to myiRelaxSwapAndMerge.
a_tin | The tin with triangles. |
a_fixedPoints | Points that shouldn't be moved (boundaries, breaklines). 0-based point indices. |
Definition at line 134 of file MeRelaxer.cpp.
References AllTrianglesHavePositiveArea(), ComputeCentroids(), m_fixedPoints, m_flags, m_pointNeighbors, m_pointSizes, m_pointsToDelete, m_relaxType, m_sizer, m_tin, RelaxMarkedPoints(), SetupNeighbors(), SetupPointSizes(), xmlog::warning, XM_ASSERT, XM_ENSURE_TRUE_VOID, XM_ENSURE_TRUE_VOID_NO_ASSERT, and XM_LOG.
void xms::MeRelaxerImpl::RelaxMarkedPoints | ( | RelaxTypeEnum | a_relaxType, |
int | a_iteration, | ||
int | a_numiterations | ||
) |
Relaxes the points marked by m_flags. Compare to rlRelaxMarkedNodes.
a_relaxType | RelaxTypeEnum. |
a_iteration | Current iteration (for progress). |
a_numiterations | Total iterations we will do (for progress). |
Definition at line 259 of file MeRelaxer.cpp.
References AngleRelax(), AreaRelax(), m_flags, m_pointSizes, m_pointsToDelete, m_sizer, m_tin, NewLocationIsValid(), SpringRelaxSinglePoint(), XM_ASSERT, and xms::Pt3< T >::z.
Referenced by Relax().
|
inlineoverridevirtual |
Sets size function used by the spring relaxation method.
a_sizer | The size function class |
Definition at line 74 of file MeRelaxer.cpp.
References m_sizer.
|
overridevirtual |
Sets the relaxation method.
[in] | a_relaxType | Case insensitive string that identifies the type of relaxation. Acceptable values include: "spring_relax" |
Definition at line 230 of file MeRelaxer.cpp.
References m_relaxType, and stToLowerCopy().
void xms::MeRelaxerImpl::SpringRelaxSinglePoint | ( | int | a_point, |
Pt3d & | a_newLocation | ||
) |
Relax a point using spring method.
[in] | a_point | The point index to be relaxed. |
[out] | a_newLocation | The location after point is relaxed (moved). |
Definition at line 423 of file MeRelaxer.cpp.
References gmCreateVector(), m_pointNeighbors, m_pointSizes, m_tin, Mdist(), xms::Pt3< T >::x, and xms::Pt3< T >::y.
Referenced by RelaxMarkedPoints(), MeRelaxerUnitTests::testSpringRelaxSinglePoint(), MeRelaxerUnitTests::testSpringRelaxSinglePoint2(), and MeRelaxerUnitTests::testSpringRelaxSinglePoint3().