#include <bulk_adapt.h>
Public Member Functions | |
Bulk_Adapt () | |
default constructor | |
Bulk_Adapt (FEM_Mesh *m, int d) | |
Initialize Bulk_Adapt_Algs with a partition of the mesh. | |
void | Bulk_Adapt_SetMesh (FEM_Mesh *m) |
Initialize FEM_Adapt with the FEM_Mesh object. | |
void | Bulk_Adapt_SetDim (int dimension) |
Initialize the coord_attr and boundary attr and number of dimensions for this mesh. | |
void | Bulk_Adapt_SetElemType (int et) |
~Bulk_Adapt () | |
default destructor | |
void | pup (PUP::er &p) |
pup for this object | |
void | Bulk_Adapt_Init (int mid, FEM_Mesh *mp, int d) |
void | ParFUM_Refine (int qm, int method, double factor, double *sizes) |
Perform refinements on a mesh. | |
void | ParFUM_Coarsen (int qm, int method, double factor, double *sizes) |
Perform coarsening on a mesh. | |
void | ParFUM_AdaptMesh (int qm, int method, double factor, double *sizes) |
Perform refinement/coarsening on a mesh. | |
void | ParFUM_Smooth (int qm, int method) |
Smooth the mesh using method according to some quality measure qm. | |
void | ParFUM_Repair (int qm) |
Repair the bad quality elements of a mesh. | |
void | ParFUM_Remesh (int qm, int method, double factor, double *sizes) |
Remesh entire mesh. | |
void | ParFUM_SetReferenceMesh () |
Set sizes on mesh elements based on their average edge length. | |
void | ParFUM_GradateMesh (double smoothness) |
Adjust sizes on mesh elements to avoid sharp discontinuities. | |
void | findEdgeLengths (int elemID, double *avgEdgeLength, double *maxEdgeLength, int *maxEdge, double *minEdgeLength, int *minEdge) |
Protected Attributes | |
FEM_Mesh * | theMesh |
cross-pointer to theMesh object on this chunk | |
int | theMeshID |
int | dim |
The number of dimensions of this mesh (adaptivity works only for 2D). | |
int | elemType |
Private Member Functions | |
int | Refine_h (int qm, int method, double factor, double *sizes) |
Performs refinement; returns number of modifications. | |
int | Coarsen_h (int qm, int method, double factor, double *sizes) |
Performs coarsening; returns number of modifications. | |
void | SetMeshSize (int method, double factor, double *sizes) |
Set sizes on elements throughout the mesh; note: size is edge length. | |
double | length (int n1, int n2) |
Returns the length of the edge formed by nodes n1, n2. | |
double | length3D (int n1, int n2) |
double | length (double *n1_coord, double *n2_coord) |
Returns the length between these two points. | |
double | length3D (double *n1_coord, double *n2_coord) |
double | getArea (int n1, int n2, int n3) |
Returns the area of the triangle formed by n1, n2 aand n3. | |
double | getArea (double *n1_coord, double *n2_coord, double *n3_coord) |
Returns the area between these three points. | |
double | getSignedArea (int n1, int n2, int n3) |
Returns the signed area of the triangle formed by the nodes in that order. | |
double | getSignedArea (double *n1_coord, double *n2_coord, double *n3_coord) |
Returns the signed area of the triangle formed by the point coordinates in that order. | |
int | getCoord (int n1, double *crds) |
Populates crds with the coordinates of the node n1. | |
int | getShortestEdge (int n1, int n2, int n3, int *shortestEdge) |
Retuns the shortest edge for the triangle formed by n1, n2, n3. | |
double | getAreaQuality (int elem) |
Returns the quality metric for this element. | |
void | ensureQuality (int n1, int n2, int n3) |
Ensure the quality of the triangle formed by these three nodes. | |
bool | controlQualityF (int n1, int n2, int n3, int n4) |
Verify if flip(n1,n2) will create bad quality elements. | |
bool | controlQualityR (int n1, int n2, int n3, int n4) |
Verify if bisect(n1,n2) will create bad quality elements. | |
bool | controlQualityR (double *n1_coord, double *n2_coord, double *n3_coord) |
Same as above; instead of node indices, it takes point coordinates as input. | |
bool | controlQualityC (int n1, int n2, int n3, double *n4_coord) |
Returns true if the quality will become bad if element (n1,n2,n3) changes to (n1,n2,n4). | |
bool | controlQualityC (double *n1_coord, double *n2_coord, double *n3_coord, double *n4_coord) |
same as above only takes in point coordinates instead of node indices | |
bool | flipOrBisect (int elId, int n1, int n2, int maxEdgeIdx, double maxlen) |
Used from FEM_Repair, when poor quality elements are encountered, depending on their maxEdgeLength, it could be better to flip it or bisect it to get better quality elements. | |
Friends | |
class | FEM_Interpolate |
This module implements high level mesh adaptivity algorithms that make use of the bulk mesh adaptivity operations provided by bulk_adapt_ops.
Definition at line 245 of file bulk_adapt.h.
Bulk_Adapt::Bulk_Adapt | ( | ) | [inline] |
Initialize Bulk_Adapt_Algs with a partition of the mesh.
Definition at line 257 of file bulk_adapt.h.
Bulk_Adapt::~Bulk_Adapt | ( | ) | [inline] |
void Bulk_Adapt::Bulk_Adapt_SetMesh | ( | FEM_Mesh * | m | ) | [inline] |
Initialize FEM_Adapt with the FEM_Mesh object.
Definition at line 259 of file bulk_adapt.h.
References theMesh.
void Bulk_Adapt::Bulk_Adapt_SetDim | ( | int | dimension | ) | [inline] |
Initialize the coord_attr and boundary attr and number of dimensions for this mesh.
Definition at line 261 of file bulk_adapt.h.
References dim.
void Bulk_Adapt::Bulk_Adapt_SetElemType | ( | int | et | ) | [inline] |
void Bulk_Adapt::pup | ( | PUP::er & | p | ) | [inline] |
Definition at line 270 of file bulk_adapt.h.
References CreateAdaptAdjacencies(), dim, FEM_Mesh_allocate_valid_attr(), MPI_Barrier, MPI_Comm_rank, ParFUM_SA_Init(), rank, theMesh, and theMeshID.
Perform refinements on a mesh.
Tries to maintain/improve element quality as specified by a quality measure qm; if method = 0, refine areas with size larger than factor down to factor if method = 1, refine elements down to sizes specified in sizes array Negative entries in size array indicate no refinement.
Definition at line 27 of file bulk_adapt.C.
References ParFUM_GradateMesh(), Refine_h(), and SetMeshSize().
Perform coarsening on a mesh.
Tries to maintain/improve element quality as specified by a quality measure qm; if method = 0, coarsen areas with size smaller than factor up to factor if method = 1, coarsen elements up to sizes specified in sizes array Negative entries in size array indicate no coarsening.
Definition at line 190 of file bulk_adapt.C.
References ParFUM_GradateMesh(), and SetMeshSize().
Perform refinement/coarsening on a mesh.
Performs a sequence of refinements or coarsening as is needed to achieve the target areas for elements.
Definition at line 338 of file bulk_adapt.C.
Smooth the mesh using method according to some quality measure qm.
Definition at line 376 of file bulk_adapt.C.
void Bulk_Adapt::ParFUM_Repair | ( | int | qm | ) |
Repair the bad quality elements of a mesh.
FEM_Mesh_smooth Inputs : meshP - a pointer to the FEM_Mesh object to smooth : nodes - an array of local node numbers to be smoothed.
Send NULL pointer to smooth all nodes. : nNodes - the size of the nodes array : attrNo - the attribute number where the coords are registered Shifts nodes around to improve mesh quality. FEM_BOUNDARY attribute and interpolator function must be registered by user to maintain boundary information. Elements with a bad quality metric are either flipped or coarsened to newer elements which are of better quality
Definition at line 447 of file bulk_adapt.C.
Remesh entire mesh.
Remesh entire mesh according to quality measure qm if method = 0, set entire mesh size to factor if method = 1, keep regional mesh sizes, and scale by factor if method = 2, uses sizes to size mesh by regions.
Definition at line 607 of file bulk_adapt.C.
void Bulk_Adapt::ParFUM_SetReferenceMesh | ( | ) |
Set sizes on mesh elements based on their average edge length.
For each element, set its size to its average edge length.
Definition at line 615 of file bulk_adapt.C.
References FEM_Mesh::e2n_getAll(), FEM_Mesh::elem, length(), FEM_Entity_Types< T >::size(), theMesh, and width().
void Bulk_Adapt::ParFUM_GradateMesh | ( | double | smoothness | ) |
Adjust sizes on mesh elements to avoid sharp discontinuities.
Resize mesh elements to avoid jumps in element size Algorithm based on h-shock correction, described in Mesh Gradation Control, Borouchaki et al IJNME43 1998 www.ann.jussieu.fr/~frey/publications/ijnme4398.pdf.
Definition at line 641 of file bulk_adapt.C.
References beta, e1, FEM_Mesh::elem, FEM_is_valid(), FEM_Mesh_data(), FEM_Mesh_default_read(), FEM_Mesh::get2ElementsOnEdge(), length(), FEM_Mesh::n2n_getAll(), nnodes, FEM_Mesh::node, FEM_Entity::size(), and theMesh.
Referenced by ParFUM_Coarsen(), and ParFUM_Refine().
void Bulk_Adapt::findEdgeLengths | ( | int | elemID, | |
double * | avgEdgeLength, | |||
double * | maxEdgeLength, | |||
int * | maxEdge, | |||
double * | minEdgeLength, | |||
int * | minEdge | |||
) |
Definition at line 864 of file bulk_adapt.C.
References conn, FEM_Mesh::elem, elem, elemType, FEM_Entity::getCoord(), length3D(), FEM_Mesh::node, and theMesh.
Referenced by Refine_h().
Performs refinement; returns number of modifications.
The actual refine in the previous operation.
Definition at line 35 of file bulk_adapt.C.
References Element_Bucket::Alloc(), ParFUMShadowArray::bulkAdapt, Element_Bucket::Clear(), count, CthYield(), dim, BulkAdapt::edge_bisect(), FEM_Mesh::elem, FEM_My_partition(), findEdgeLengths(), ParFUMShadowArray::holdingLock, Element_Bucket::Insert(), Element_Bucket::IsBucketEmpty(), len, BulkAdapt::lock_3D_region(), n1, n2, FEM_Mesh::node, FEM_Mesh::parfumSA, Element_Bucket::Remove(), FEM_Entity_Types< T >::size(), FEM_Entity::size(), theMesh, BulkAdapt::unlock_3D_region(), and BulkAdapt::unpend_3D_region().
Referenced by ParFUM_Refine().
Performs coarsening; returns number of modifications.
The actual coarsen in the previous operation.
Definition at line 200 of file bulk_adapt.C.
void Bulk_Adapt::SetMeshSize | ( | int | method, | |
double | factor, | |||
double * | sizes | |||
) | [private] |
Set sizes on elements throughout the mesh; note: size is edge length.
Definition at line 759 of file bulk_adapt.C.
References dim, FEM_Mesh::e2n_getAll(), FEM_Mesh::elem, length(), FEM_Mesh::node, FEM_Entity_Types< T >::size(), FEM_Entity::size(), theMesh, and width().
Referenced by ParFUM_Coarsen(), and ParFUM_Refine().
Returns the length of the edge formed by nodes n1, n2.
Definition at line 823 of file bulk_adapt.C.
References getCoord().
Referenced by controlQualityC(), controlQualityR(), ensureQuality(), flipOrBisect(), getAreaQuality(), getShortestEdge(), ParFUM_GradateMesh(), ParFUM_SetReferenceMesh(), and SetMeshSize().
Definition at line 833 of file bulk_adapt.C.
References getCoord().
Referenced by findEdgeLengths().
double Bulk_Adapt::length | ( | double * | n1_coord, | |
double * | n2_coord | |||
) | [private] |
double Bulk_Adapt::length3D | ( | double * | n1_coord, | |
double * | n2_coord | |||
) | [private] |
Returns the area of the triangle formed by n1, n2 aand n3.
Definition at line 908 of file bulk_adapt.C.
References getCoord().
Referenced by controlQualityR(), and getAreaQuality().
double Bulk_Adapt::getArea | ( | double * | n1_coord, | |
double * | n2_coord, | |||
double * | n3_coord | |||
) | [private] |
Returns the area between these three points.
Definition at line 919 of file bulk_adapt.C.
References PUP::d.
Returns the signed area of the triangle formed by the nodes in that order.
Definition at line 948 of file bulk_adapt.C.
References getCoord().
Referenced by controlQualityC(), and ensureQuality().
double Bulk_Adapt::getSignedArea | ( | double * | n1_coord, | |
double * | n2_coord, | |||
double * | n3_coord | |||
) | [private] |
Returns the signed area of the triangle formed by the point coordinates in that order.
Definition at line 958 of file bulk_adapt.C.
Populates crds with the coordinates of the node n1.
Definition at line 971 of file bulk_adapt.C.
References dim, FEM_Entity::getCoord(), FEM_Mesh::node, and theMesh.
Referenced by controlQualityC(), controlQualityF(), ensureQuality(), getArea(), getAreaQuality(), getShortestEdge(), getSignedArea(), length(), and length3D().
Retuns the shortest edge for the triangle formed by n1, n2, n3.
Definition at line 981 of file bulk_adapt.C.
References getCoord(), and length().
double Bulk_Adapt::getAreaQuality | ( | int | elem | ) | [private] |
Returns the quality metric for this element.
The quality metric is proportional to the area of the triangle upon the sum of squares of the lengths of each of the 3 sides.
Definition at line 1019 of file bulk_adapt.C.
References FEM_Mesh::e2n_getAll(), getArea(), getCoord(), len, length(), n, and theMesh.
Ensure the quality of the triangle formed by these three nodes.
The quality metric used is the maxEdgeLength / shortestAltitude of the triangle If this metric is less than 100 and the area is greater than sliverArea, the quality is supposed to be good.
Definition at line 1045 of file bulk_adapt.C.
References getCoord(), getSignedArea(), length(), max(), and min().
Verify if flip(n1,n2) will create bad quality elements.
Verify the quality of the two new elements that will be created by flip.
Definition at line 1068 of file bulk_adapt.C.
References controlQualityC(), flag, and getCoord().
Verify if bisect(n1,n2) will create bad quality elements.
bool Bulk_Adapt::controlQualityR | ( | double * | n1_coord, | |
double * | n2_coord, | |||
double * | n3_coord | |||
) | [private] |
Returns true if the quality will become bad if element (n1,n2,n3) changes to (n1,n2,n4).
Computes the longestLength, shotestLength, shortestAltitude, and other quality metrics for the new element (n1,n2,n4) If the new element forms a sliver or bad quality, return true.
Definition at line 1102 of file bulk_adapt.C.
References getCoord().
Referenced by controlQualityF().
bool Bulk_Adapt::controlQualityC | ( | double * | n1_coord, | |
double * | n2_coord, | |||
double * | n3_coord, | |||
double * | n4_coord | |||
) | [private] |
same as above only takes in point coordinates instead of node indices
Definition at line 1111 of file bulk_adapt.C.
References getSignedArea(), length(), max(), and min().
Used from FEM_Repair, when poor quality elements are encountered, depending on their maxEdgeLength, it could be better to flip it or bisect it to get better quality elements.
Returns true if it should flip.
Definition at line 1144 of file bulk_adapt.C.
References FEM_Mesh::e2e_getNbr(), FEM_Mesh::e2n_getAll(), length(), and theMesh.
friend class FEM_Interpolate [friend] |
Definition at line 246 of file bulk_adapt.h.
FEM_Mesh* Bulk_Adapt::theMesh [protected] |
cross-pointer to theMesh object on this chunk
Definition at line 249 of file bulk_adapt.h.
Referenced by Bulk_Adapt(), Bulk_Adapt_Init(), Bulk_Adapt_SetMesh(), findEdgeLengths(), flipOrBisect(), getAreaQuality(), getCoord(), ParFUM_GradateMesh(), ParFUM_SetReferenceMesh(), Refine_h(), and SetMeshSize().
int Bulk_Adapt::theMeshID [protected] |
int Bulk_Adapt::dim [protected] |
The number of dimensions of this mesh (adaptivity works only for 2D).
Definition at line 252 of file bulk_adapt.h.
Referenced by Bulk_Adapt(), Bulk_Adapt_Init(), Bulk_Adapt_SetDim(), getCoord(), length(), pup(), Refine_h(), and SetMeshSize().
int Bulk_Adapt::elemType [protected] |
Definition at line 252 of file bulk_adapt.h.
Referenced by Bulk_Adapt_SetElemType(), and findEdgeLengths().