To adapt mesh in function of given solution. More...

#include <MeshAdapt.h>

Public Member Functions

 MeshAdapt ()
 Default constructor.
 
 MeshAdapt (Mesh &ms)
 Constructor using initial mesh.
 
 MeshAdapt (Domain &dom)
 Constructor using a reference to class Domain.
 
 ~MeshAdapt ()
 Destructor.
 
DomaingetDomain () const
 Get reference to Domain instance.
 
MeshgetMesh () const
 Get reference to current mesh.
 
void set (Domain &dom)
 Set reference to Domain instance.
 
void set (Mesh &ms)
 Set reference to Mesh instance.
 
void setSolution (const Vect< real_t > &u)
 Define label of node.
 
void setJacobi (int n)
 Set number of Jacobi iterations for smoothing.
 
void setSmooth (int n)
 Set number of smoothing iterations.
 
void AbsoluteError ()
 Metric is constructed with absolute error.
 
void RelativeError ()
 Metric is constructed with relative error.
 
void setError (real_t err)
 Set error threshold for adaption.
 
void setHMin (real_t h)
 Set minimal mesh size.
 
void setHMax (real_t h)
 Set maximal mesh size.
 
void setHMinAnisotropy (real_t h)
 Set minimal mesh size and set anisotropy.
 
void setRelaxation (real_t omega)
 Set relaxation parameter for smoothing.
 
void setAnisotropic ()
 Set that adapted mesh construction is anisotropic.
 
void MaxAnisotropy (real_t a)
 Set maximum ratio of anisotropy.
 
void setMaxSubdiv (real_t s)
 Change the metric such that the maximal subdivision of a background's edge is bounded by the given number (always limited by 10)
 
void setMaxNbVertices (size_t n)
 Set maximum number of vertices.
 
void setRatio (real_t r)
 Set ratio for a smoothing of the metric.
 
void setNoScaling ()
 Do not scale solution before metric computation.
 
void setNoKeep ()
 Do not keep old vertices.
 
void setHessian ()
 set computation of the Hessian
 
void setOutputMesh (string file)
 Create mesh output file.
 
void setGeoFile (string file)
 Set Geometry file.
 
void setGeoError (real_t e)
 Set error on geometry.
 
void setBackgroundMesh (string bgm)
 Set background mesh.
 
void SplitBoundaryEdges ()
 Split edges with two vertices on boundary.
 
void CreateMetricFile (string mf)
 Create a metric file.
 
void setMetricFile (string mf)
 Set Metric file.
 
void getSolutionMbb (string mbb)
 Set solution defined on background mesh for metric construction.
 
void getSolutionMBB (string mBB)
 Set solution defined on background mesh for metric construction.
 
void getSolutionbb (string rbb)
 Read solution defined on the background mesh in bb file.
 
void getSolutionBB (string rBB)
 Read solution defined on the background mesh in BB file.
 
void getSolution (Vect< real_t > &u, int is=1)
 Get the interpolated solution on the new mesh.
 
void getInterpolatedSolutionbb ()
 Write the file of interpolation of the solutions in bb file.
 
void getInterpolatedSolutionBB ()
 Write the file of interpolation of the solutions in BB file.
 
void setTheta (real_t theta)
 Set angular limit for a corner (in degrees)
 
void Split ()
 Split triangles into 4 triangles.
 
void saveMbb (string file, const Vect< real_t > &u)
 Save a solution in metric file.
 
int run ()
 Run adaptation process.
 
int run (const Vect< real_t > &u)
 Run adaptation process using a solution vector.
 
int run (const Vect< real_t > &u, Vect< real_t > &v)
 Run adaptation process using a solution vector and interpolates solution on the adapted mesh.
 

Detailed Description

To adapt mesh in function of given solution.

Class MeshAdapt enables modifying mesh according to a solution vector defining at nodes. It concerns 2-D triangular meshes only.

Remarks
Class MeshAdapt is mainly based on the software 'Bamg' developed by F. Hecht, Universite Pierre et Marie Curie, Paris. We warmly thank him for accepting incoporation of Bamg in the OFELI package
Author
Rachid Touzani

Constructor & Destructor Documentation

◆ MeshAdapt() [1/2]

MeshAdapt ( Mesh ms)

Constructor using initial mesh.

Parameters
[in]msReference to initial mesh

◆ MeshAdapt() [2/2]

MeshAdapt ( Domain dom)

Constructor using a reference to class Domain.

Parameters
[in]domReference to Domain class

Member Function Documentation

◆ getSolution()

void getSolution ( Vect< real_t > &  u,
int  is = 1 
)

Get the interpolated solution on the new mesh.

The solution must have been saved on an output bb file

Parameters
[out]uVector that contains on output the obtained solutions. This vector is resized before being initialized
[in]is[Default: 1]

◆ getSolutionbb()

void getSolutionbb ( string  rbb)

Read solution defined on the background mesh in bb file.

Solution is interpolated on created mesh

◆ getSolutionBB()

void getSolutionBB ( string  rBB)

Read solution defined on the background mesh in BB file.

Solution is interpolated on created mesh

◆ run() [1/3]

int run ( )

Run adaptation process.

Returns
Return code:
  • = 0: Adaptation has been normally completed
  • = 1: An error occured

◆ run() [2/3]

int run ( const Vect< real_t > &  u)

Run adaptation process using a solution vector.

Parameters
[in]uSolution vector defined on the input mesh
Returns
Return code:
  • = 0: Adaptation has been normally completed
  • = 1: An error occured

◆ run() [3/3]

int run ( const Vect< real_t > &  u,
Vect< real_t > &  v 
)

Run adaptation process using a solution vector and interpolates solution on the adapted mesh.

Parameters
[in]uSolution vector defined on the input mesh
[in]vSolution vector defined on the (adapted) output mesh
Returns
Return code:
  • = 0: Adaptation has been normally completed
  • = 1: An error occured

◆ saveMbb()

void saveMbb ( string  file,
const Vect< real_t > &  u 
)

Save a solution in metric file.

Parameters
[in]fileFile name where the metric is stored
[in]uSolution vector to store

◆ setMaxNbVertices()

void setMaxNbVertices ( size_t  n)

Set maximum number of vertices.

Default value is 500000

◆ setNoKeep()

void setNoKeep ( )

Do not keep old vertices.

By default, old vertices are kept

◆ setNoScaling()

void setNoScaling ( )

Do not scale solution before metric computation.

By default, solution is scaled (between 0 and 1)

◆ setRatio()

void setRatio ( real_t  r)

Set ratio for a smoothing of the metric.

Parameters
[in]rRatio value.
Note
If r is 0 then no smoothing is performed, if r lies in [1.1,10] then the smoothing changes the metric such that the largest geometrical progression (speed of mesh size variation in mesh is bounded by r) (by default no smoothing)

◆ setRelaxation()

void setRelaxation ( real_t  omega)

Set relaxation parameter for smoothing.

Default value for relaxation parameter is 1.8

◆ setTheta()

void setTheta ( real_t  theta)

Set angular limit for a corner (in degrees)

The angle is defined from 2 normals of 2 consecutive edges