1-D meshes

    

We detail the class Mesh<Dimension1> and Edge<Dimension1>.

Methods of Mesh<Dimension1>

Vertex access to the vertex i of the mesh
Element access to the element i of the mesh
GetVerticesElement retrieves the vertices of the element i
GetXmin returns the left extremity of the 1-D interval
GetXmax returns the right extremity of the 1-D interval
GetNumberDof returns the dof number of local dof j of element i
GetOrder returns the order of approximation associated with the mesh
GetNbDof returns the total number of degrees of freedom in the mesh
GetNbElt returns the number of elements in the mesh
GetNbVertices returns the number of vertices in the mesh
SetOrder sets the order of approximation associated with the mesh
SetPeriodicExtremity sets a periodic mesh (for dof numbering)
GetOrderElement returns the order associated with the element i
GetMeshSize returns the mesh size (average length of elements)
Read reads the mesh from an input file
Write writes the mesh in an output file
GetMemorySize returns the memory used to store the object in bytes
ConstructMesh constructs a mesh from a line of the data file
CreateRegularMesh creates a regular subdivision of an interval
CreateNonRegularMesh creates a non-regular subdivision of an interval
CreateLayeredMesh creates a regular subdivision of different layers
AddLayersInput specifies layers to add when ConstructMesh is called
ClearLayersInput clears layers to add when ConstructMesh is called
AddRefinementVertex specifies a local refinement to apply when ConstructMesh is called
ClearRefinementVertex clears local refinements to apply when ConstructMesh is called
NumberMesh adds or updates degrees of freedoms of the mesh
SubdivideMesh creates a finer mesh by splitting each edge into several edges
CreateSubmesh extracts some element of the mesh to create another one
Clear clears the mesh
GetThicknessPML returns the thickness of the PML zone
SetThicknessPML sets the thickness of the PML zone
GetTypeAdditionPML returns the type of PML to add
GetNbLayersPML returns the number of cells in each PML zone
SetAdditionPML sets which PML zones must be added or not
AddPMLElements adds PML to the mesh

Methods of Edge<Dimension1>

Init sets the two extremities of the edge and its reference.
GetReference returns the reference associated with the edge
SetReference sets the reference associated with the edge.
numVertex returns the vertex number of an extremity of the edge
GetMemorySize returns the memory used by the object in bytes
SetPML marks the edge as an element inside a PML
UnsetPML unmarks the edge as an element inside a PML
IsPML returns true if the edge belongs to a PML

Vertex

Syntax

Real_wp& Vertex(int i)

This method can be used to obtain the coordinate of the vertex i of the mesh or to obtain all the coordinates.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// you can obtain a single point
int i = 10;
Real_wp x = mesh.Vertex(i);

// Vertex can be used to modify a coordinate of a point
mesh.Vertex(i) = x+1.0;

// you can also retrieve all the coordinates
VectReal_wp all_pts = mesh.Vertex();

Location :

Mesh1DInline.cxx

Element

Syntax

Edge<Dimension1>& Element(int i)

This method can be used to access to the element i (1-D edge).

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// you can obtain a single element
int i = 10;
Edge<Dimension1> elt = mesh.Element(i);

// it is used to have vertices number and reference
int n0 = mesh.Element(i).numVertex(0);
int n1 = mesh.Element(i).numVertex(1);
int ref = mesh.Element(i).GetReference();

// you can modify also the element
mesh.Element(i).SetReference(3);

Location :

Mesh1DInline.cxx

GetVerticesElement

Syntax

void GetVerticesElement(int ne, R2& points) const

This method retrieves the coordinates of the two extremities of the element.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

//  for element i, you want to know the interval [x_i, x_{i+1}]
R2 points; int i = 10;
mesh.GetVerticesElement(i, points);

// x_i is in points(0) and x_{i+1} in points(1)

Location :

Mesh1DInline.cxx

GetXmin, GetXmax

Syntax

Real_wp GetXmin() const
Real_wp GetXmax() const

These methods returns the left or right extremity of the interval discretized by the mesh.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// the mesh discretizes the interval [a, b]
Real_wp a = mesh.GetXmin();
Real_wp b = mesh.GetXmax();

Location :

Mesh1DInline.cxx

GetNumberDof

Syntax

int GetNumberDof(int i, int j) const

This method returns the global dof (degree of freedom) number of local dof j of element i.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// you prescribe the order of discretization
int r = 3;
mesh.SetOrder(r);

// then you can number the mesh
mesh.NumberMesh();

// loop over elements
for (int i = 0; i < mesh.GetNbElt(); i++)
  {
    // loop over dofs of element i
    for (int j = 0; j ≤ r; j++)
      {
        // global dof number
        int num_dof = mesh.GetNumberDof(i, j);
      }
  }

Location :

Mesh1DInline.cxx

GetOrder

Syntax

int GetOrder() const

This method returns the order of discretization associated with the mesh.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// you prescribe the order of discretization
int r = 3;
mesh.SetOrder(r);

// then you can number the mesh
mesh.NumberMesh();

// if you need to retrieve the order r
r = mesh.GetOrder();

Location :

Mesh1DInline.cxx

GetNbDof

Syntax

int GetNbDof() const

This method returns the number of degrees of freedom associated with the mesh.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// you prescribe the order of discretization
int r = 3;
mesh.SetOrder(r);

// then you can number the mesh
mesh.NumberMesh();

// if you need to retrieve the number of degrees of freedom
// contained in the mesh
int nb_dof = mesh.GetNbDof();

Location :

Mesh1DInline.cxx

GetNbElt

Syntax

int GetNbElt() const

This method returns the number of elements contained in the mesh.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// how many elements belong to the mesh
int nb_elt = mesh.GetNbElt();

Location :

Mesh1DInline.cxx

GetNbVertices

Syntax

int GetNbVertices() const

This method returns the number of vertices contained in the mesh.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// how many vertices are present in the mesh
int nb_vertices = mesh.GetNbVertices();

Location :

Mesh1DInline.cxx

SetOrder

Syntax

void SetOrder(int r)

This method sets the order of approximation to use when the mesh will be numbered.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// you prescribe the order of discretization
int r = 3;
mesh.SetOrder(r);

// then you can number the mesh
mesh.NumberMesh();

// if you need to retrieve the number of degrees of freedom
// contained in the mesh
int nb_dof = mesh.GetNbDof();

Location :

Mesh1DInline.cxx

SetPeriodicExtremity

Syntax

void SetPeriodicExtremity()
void SetPeriodicExtremity(bool per)

This method allows the user to set a periodic mesh. When the mesh is numbered and periodic, the last degree of freedom has the same number as the first one.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// you prescribe the order of discretization
int r = 3;
mesh.SetOrder(r);

// you can inform that you want periodic mesh
mesh.SetPeriodicExtremity();

// then you can number the mesh
mesh.NumberMesh();

// if you need to retrieve the number of degrees of freedom
// contained in the mesh
int nb_dof = mesh.GetNbDof();

// you can get back to a non-periodic mesh
mesh.SetPeriodicExtremity(false);

// you need to renumber the mesh in this case
mesh.NumberMesh();

Location :

Mesh1DInline.cxx

GetOrderElement

Syntax

void GetOrderElement(int i) const

This method returns the order of approximation for the element i.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// you prescribe the order of discretization
int r = 3;
mesh.SetOrder(r);

// then you can number the mesh
mesh.NumberMesh();

// order for element i ? (should be r)
int i = 2;
int ri = mesh.GetOrderElement(i);

Location :

Mesh1DInline.cxx

GetMeshSize

Syntax

Real_wp GetMeshSize() const

This method returns the mesh size, i.e. the average length for elements of the mesh.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// you want to know the average length of all sub-intervals of the mesh
Real_wp h = mesh.GetMeshSize();

Location :

Mesh1D.cxx

Read

Syntax

void Read(string file_name)

This method initializes a mesh from a file containing coordinates. The method sets the reference of all elements to 1.

Example :

Mesh<Dimension1> mesh;

// the file points.dat is a file containing a list of coordinates (in text format)
mesh.Read("points.dat");

// you want to know the average length of all sub-intervals of the mesh
Real_wp h = mesh.GetMeshSize();

Location :

Mesh1D.cxx

Write

Syntax

void Write(string file_name) const

This method writes a mesh in a file. Only coordinates of the points are written, references of elements are not written.

Example :

Mesh<Dimension1> mesh;

// a regular mesh is created
mesh.CreateRegularMesh(Real_wp(-2), Real_wp(3), 100, 1);

// then the mesh can be written in a file
mesh.Write("points.dat");

Location :

Mesh1D.cxx

GetMemorySize

Syntax

size_t GetMemorySize() const

This method returns the size used to store the mesh in bytes.

Example :

Mesh<Dimension1> mesh;

//  we read a mesh
mesh.Read("points.dat");

// we number it
mesh.SetOrder(8);
mesh.NumberMesh();

// what is the memory used to store the object mesh ?
int nb_bytes = mesh.GetMemorySize();

Location :

Mesh1D.cxx

ConstructMesh

Syntax

void ConstructMesh(const VectString& parameters, Real_wp& xmin, Real_wp& xmax)

This method constructs the mesh with parameters (that correspond to the line FileMesh of the data file) amd global attributes stored in the class. xmin and xmax are extremities of the physical domain (PML layers are excluded).

Example :

Mesh<Dimension1> mesh;

// for the interval [a, b] = [-2.5, 2.5]
// for a regular mesh the line is FileMesh = REGULAR N a b
VectString parameters(4);
parameters(0) = string("REGULAR");
parameters(1) = string("101");
parameters(2) = string("-2.5");
parameters(3) = string("2.5");

// for a layered mesh, the line is FileMesh = LAYERED -2.5 -0.8 2.5 AUTO 0.1
// AUTO means that each layer will be meshed by trying to impose a mesh size of 0.1 (the next argument)
// if not AUTO, the user gives the number of cells in each layer
// e.g. FileMesh = LAYERED -2.5 -0.8 2.5 AUTO 11 15

// you can ask to refine globally the mesh
// by adding REFINED r to the list of parameters
parameters.PushBack(string("REFINED"));
parameters.PushBack(string("3"));

// if you want to refine locally on vertices of the mesh
// a natural ratio is 2.0 : each edge close to the vertex is divided in two
// the level is the number of iterations of this process
// for a ratio greater than 2.0, there is a small edge close to the vertex,
// and the ratio is the length of the big edge over the length of the small edge
mesh.AddRefinementVertex(-0.5, 4, 3.0);

// if you want to add layers with different references
mesh.AddLayersInput(3.0, 21, 2);

// if you want to add PML layers
mesh.SetThicknessPML(0.3);
mesh.SetAdditionPML(mesh.PML_BOTH_SIDES, 10);

//  then we construct the mesh from all these datas
Real_wp xmin, xmax; 
mesh.ConstructMesh(parameters, xmin, xmax); // xmin and xmax are computed 

// the physical domain is [xmin, xmax], PML layers if present are outside this interval

// then we can number it
mesh.SetOrder(8);
mesh.NumberMesh();

Location :

Mesh1D.cxx

CreateRegularMesh

Syntax

void CreateRegularMesh(Real_wp a, Real_wp b, int N, int ref)

This method creates a regular mesh of the interval [a, b] with N points. ref is the reference affected to all the elements of the mesh.

Example :

Mesh<Dimension1> mesh;

// we create a regular mesh of interval [-3, 2]
// and 101 points (100 subdivisions)
mesh.CreateRegularMesh(Real_wp(-3), Real_wp(2), 101, 1);

Location :

Mesh1D.cxx

CreateNonRegularMesh

Syntax

void CreateNonRegularMesh(const VectReal_wp& Points, const IVect& ref)

This method creates a non-regular mesh of the interval [a, b]. The user provides directly a sorted list of all the points of the mesh, and the references of the associated elements.

Example :

Mesh<Dimension1> mesh;

int N = 101;
VectReal_wp Points(N);

// random points between 0 and 1
Points.FillRand(); Points *= Real_wp(1)/RAND_MAX;
Sort(Points);

// references of elements
IVect ref(N-1);
ref.Fill(1);

// the mesh is initialized with these datas
mesh.CreateNonRegularMesh(Points, ref);

Location :

Mesh1D.cxx

CreateLayeredMesh

Syntax

void CreateLayeredMesh(const VectReal_wp& pos, const IVect& nb_cells, const IVect& ref)

This method creates a layered mesh. The user provides the positions of each layer in the array pos, the number of cells for each layer in nb_cells and the references for each layer in ref. Then each layer is subdivided regularly with nb_cells(i) sub-intervals.

Example :

Mesh<Dimension1> mesh;

// we want to have two regions [-0.3, 1.2] and [1.2, 2.7]
// the positions are then (-0.3, 1.2, 2.7)
VectReal_wp pos(3);
pos(0) = -0.3; pos(1) = 1.2; pos(2) = 2.7;

// number of cells for each region
IVect nb_cells(2);
nb_cells(0) = 11; nb_cells(1) = 16;

// reference for each region
IVect ref(2);
ref(0) = 3; ref(1) = 2;

// the mesh is initialized with these datas
mesh.CreateLayeredMesh(pos, nb_cells, ref);

Location :

Mesh1D.cxx

AddLayersInput

Syntax

void AddLayersInput(Real_wp pos, int N, int ref)

This method adds a new layer at the right of the mesh. The first argument pos is the position of the right extremity of this new layer. The second argument N is the number of elements and ref is the reference. This layer will be added when the method ConstructMesh is called.

Example :

Mesh<Dimension1> mesh;

// you can start from a regular mesh with only one reference (=1)
// for the interval [a, b] = [-2.5, 2.5]
// for a regular mesh the line is FileMesh = REGULAR N a b
VectString parameters(4);
parameters(0) = string("REGULAR");
parameters(1) = string("101");
parameters(2) = string("-2.5");
parameters(3) = string("2.5");

// if you want to add layers with different references
// here we add a layer [2.5, 3.0] with 21 elements between these two points
// and a reference of 2 for these new elements
mesh.AddLayersInput(3.0, 21, 2);

// you can add another layer (here in the interval [3.0, 4.0]
mesh.AddLayersInput(4.0, 11, 3);

//  then we construct the mesh from all these datas
Real_wp xmin, xmax;
mesh.ConstructMesh(parameters, xmin, xmax);

Location :

Mesh1D.cxx

AddRefinementVertex

Syntax

void AddRefinementVertex(Real_wp pos, int level, Real_wp ratio)

This method specifies that the vertex located at x=pos needs to be refined. The second argument is the level of refinement (how many layers are created?). The last argument is the ratio. The refinement is performed when the method ConstructMesh is called.

Example :

Mesh<Dimension1> mesh;

// you can start from a regular mesh with only one reference (=1)
// for the interval [a, b] = [-2.5, 2.5]
// for a regular mesh the line is FileMesh = REGULAR N a b
VectString parameters(4);
parameters(0) = string("REGULAR");
parameters(1) = string("101");
parameters(2) = string("-2.5");
parameters(3) = string("2.5");

// if you want to refine locally on vertices of the mesh
// a natural ratio is 2.0 : each edge close to the vertex is divided in two
// the level is the number of iterations of this process
// for a ratio greater than 2.0, there is a small edge close to the vertex,
// and the ratio is the length of the big edge over the length of the small edge
mesh.AddRefinementVertex(-0.5, 4, 3.0);

// you can add a refinement close to another vertex
mesh.AddRefinementVertex(1.0, 2, 2.5);

//  then we construct the mesh from all these datas
Real_wp xmin, xmax;
mesh.ConstructMesh(parameters, xmin, xmax);

Location :

Mesh1D.cxx

ClearRefinementVertex

Syntax

void ClearRefinementVertex()

This method clears the datas about local refinements to apply to the mesh.

Related topics :

AddRefinementVertex

Location :

Mesh1D.cxx

ClearLayersInput

Syntax

void ClearLayersInput()

This method clears the datas about layers to add to the mesh.

Related topics :

AddLayersInput

Location :

Mesh1D.cxx

NumberMesh

Syntax

void NumberMesh()
void NumberMesh(true)

This method constructs degrees of freedom associated with the mesh. Each edge contains r+1 degrees of freedom where r is the order of approximation. The second argument is optional and equal to false by default. If not given (or set to false), the degrees of freedom are continuous, i.e. two adjacent edges share a degree of freedom. If set to true, the degrees of freedom are discontinuous.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// you prescribe the order of discretization
int r = 3;
mesh.SetOrder(r);

// then you can number the mesh
mesh.NumberMesh();

// loop over elements
for (int i = 0; i < mesh.GetNbElt(); i++)
  {
    // loop over dofs of element i
    for (int j = 0; j ≤ r; j++)
      {
        // global dof number
        int num_dof = mesh.GetNumberDof(i, j);
      }
  }

// if you modify the mesh
mesh.AddPMLElements(3);

// you have to update numbering
mesh.NumberMesh();

// for discontinuous Galerkin, ask for discontinuous degrees of freedom
mesh.NumberMesh(true);

Location :

Mesh1D.cxx

SubdivideMesh

Syntax

void SubdivideMesh(Mesh<Dimension1> & fine_mesh, const IVect& raff)

This method constructs a finer mesh (in the object fine_mesh) of the current mesh. This mesh is generated by dividing each element into several elements. The number of elements is given through the array raff. raff(i) is the refinement factor for elements whose reference is i.

Example :

Mesh<Dimension1> mesh, fine_mesh;
mesh.Read("points.dat");

// if you want to split each edge into four sub-edges
IVect raff(10);
raff.Fill(4);

mesh.SubdivideMesh(fine_mesh, raff);

fine_mesh.Write("raff_points.dat");

Location :

Mesh1D.cxx

CreateSubmesh

Syntax

void CreateSubmesh(Mesh<Dimension1> & sub_mesh, int n0, int n1)

This method extracts a sub-mesh (in the object sub_mesh) from the current mesh. This mesh is generated by keeping elements whose number is comprised betwee n0 and n1 (n1 being excluded).

Example :

Mesh<Dimension1> mesh, sub_mesh;
mesh.Read("points.dat");

// if you want to extract elements 10-49 (49 included)
mesh.CreateSubmesh(sub_mesh, 10, 50);

sub_mesh.Write("sub_points.dat");

Location :

Mesh1D.cxx

Clear

Syntax

void Clear()

This method clears arrays used to store the mesh.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// you no longer need mesh, you can release memory used to store it
mesh.Clear();

Location :

Mesh1D.cxx

GetThicknessPML, SetThicknessPML

Syntax

Real_wp GetThicknessPML() const
void SetThicknessPML(Real_wp delta)

This method allows the user to retrieve or modify the thickness of the PML layers.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// if you want to add PML
// you set the thickness of PMLs
mesh.SetThicknessPML(Real_wp(0.5));
// then if you want to add them at the right or left side (or both sides)
mesh.SetAdditionPML(mesh.PML_BOTH_SIDES, 4);
// then you ask to PML with these informations
mesh.AddPMLElements(4);

// you can retrieve PML thickness
Real_wp delta = mesh.GetThicknessPML();

Location :

Mesh1D.cxx

GetTypeAdditionPML

Syntax

int GetTypeAdditionPML(int n) const

This method returns the type of added PML. The argument n is an integer that is not used (present for compatibility with 2-D and 3-D meshes).

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// if you want to add PML
// you set the thickness of PMLs
mesh.SetThicknessPML(Real_wp(0.5));
// then if you want to add them at the right or left side (or both sides)
mesh.SetAdditionPML(mesh.PML_BOTH_SIDES, 4);
// then you ask to PML with these informations
mesh.AddPMLElements(4);

// you can retrieve PML thickness
Real_wp delta = mesh.GetThicknessPML();
// and where PML have been added (right, left or both sides)
int type_add = mesh.GetTypeAdditionPML(0);

Location :

Mesh1D.cxx

GetNbLayersPML

Syntax

int GetNbLayersPML() const

This method returns the number of layers in the PML region.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// if you want to add PML
// you set the thickness of PMLs
mesh.SetThicknessPML(Real_wp(0.5));
// then if you want to add them at the right or left side (or both sides)
mesh.SetAdditionPML(mesh.PML_BOTH_SIDES, 4);
// then you ask to PML with these informations
mesh.AddPMLElements(4);

// you can retrieve PML thickness
Real_wp delta = mesh.GetThicknessPML();
// and number of layers
int nb_layers = mesh.GetNbLayersPML();

Location :

Mesh1D.cxx

SetAdditionPML

Syntax

void SetAdditionPML(int type_add, int nb_layers)
void SetAdditionPML(int type_add, int nb_layers, int ref)

This method sets how PML layers must be added to the mesh. By default, elements in the PML will be affected with the same reference as neighbor elements. If a third argument is provided, the reference given to PML elements is equal to ref.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// if you want to add PML
// you set the thickness of PMLs
mesh.SetThicknessPML(Real_wp(0.5));
// then if you want to add them at the right or left side (or both sides)
// left : PML_NEGATIVE_SIDE, right : PML_POSITIVE_SIDE, both : PML_BOTH_SIDES, no pml : PML_NO
// the second argument is the number of layers inside the PML
mesh.SetAdditionPML(mesh.PML_BOTH_SIDES, 4);

// then you ask to PML with these informations
// an alternative solution is to call ConstructMesh that will reconstruct all the mesh
// and call AddPMLElements
mesh.AddPMLElements(4);

Location :

Mesh1D.cxx

AddPMLElements

Syntax

void AddPMLElements(int n)

This method adds PML layers to the mesh. n is the number of cells for each PML zone.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// if you want to add PML
// you set the thickness of PMLs
mesh.SetThicknessPML(Real_wp(0.5));
// then if you want to add them at the right or left side (or both sides)
// left : PML_NEGATIVE_SIDE, right : PML_POSITIVE_SIDE, both : PML_BOTH_SIDES, no pml : PML_NO
// the second argument is the number of layers inside the PML
mesh.SetAdditionPML(mesh.PML_BOTH_SIDES, 4);

// then you ask to PML with these informations
// an alternative solution is to call ConstructMesh that will reconstruct all the mesh
// and call AddPMLElements with the number of layers given in SetAdditionPML
// If you call directly AddPMLElements, you can specify another number, and this number will be used
mesh.AddPMLElements(6); // here we have 6 cells in each PML zone (left and right)

Location :

Mesh1D.cxx

Init

Syntax

void Init(int n1, int n2)
void Init(int n1, int n2, int ref)

This method initializes an edge of the mesh, n1 and n2 are the two extremities of the edge, ref the reference. If ref is not provided, the reference of the edge is not modified.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// you can retrieve an edge of the mesh
Edge<Dimension1>& edge = mesh.Element(2);

// and modify it
int n1 = 4, n2 = 6, ref = 1;
edge.Init(n1, n2, ref);

Location :

MeshElementInline.cxx

GetReference

Syntax

int GetReference() const

This method returns the reference of an edge.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// you can retrieve an edge of the mesh
const Edge<Dimension1>& edge = mesh.Element(2);

// and its reference
int ref = edge.GetReference();

Location :

MeshElementInline.cxx

SetReference

Syntax

void SetReference(int ref)

This method modifies the reference of an edge.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// you can retrieve an edge of the mesh
Edge<Dimension1>& edge = mesh.Element(2);

// and modify its reference
int ref = 3;
edge.SetReference(ref);

Location :

MeshElementInline.cxx

numVertex

Syntax

int numVertex(int j) const

This method returns the number of the vertex j of the edge.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// you can retrieve an edge of the mesh
const Edge<Dimension1>& edge = mesh.Element(2);

// and retrieve the two extremities
int n1 = edge.numVertex(0);
int n2 = edge.numVertex(1);

Location :

MeshElementInline.cxx

GetMemorySize

Syntax

size_t GetMemorySize() const

This method returns the memory used by the object in bytes.

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// you can retrieve an edge of the mesh
const Edge<Dimension1>& edge = mesh.Element(2);

// and know how many bytes it takes to store it
size_t taille = edge.GetMemorySize();

Location :

MeshElementInline.cxx

SetPML

Syntax

void SetPML()

This method marks the edge as an edge belonging to a PML (Perfectly Matched Layer).

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// you can retrieve an edge of the mesh
Edge<Dimension1>& edge = mesh.Element(2);

// and mark it as PML
edge.SetPML();

Location :

MeshElementInline.cxx

UnsetPML

Syntax

void UnsetPML()

This method unmarks the edge as an edge belonging to a PML (Perfectly Matched Layer).

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// you can retrieve an edge of the mesh
Edge<Dimension1>& edge = mesh.Element(2);

// and mark it as non-PML
edge.UnsetPML();

Location :

MeshElementInline.cxx

IsPML

Syntax

bool IsPML() const

This method returns true if the edge belongs to a PML (Perfectly Matched Layer).

Example :

Mesh<Dimension1> mesh;
mesh.Read("points.dat");

// you can retrieve an edge of the mesh
const Edge<Dimension1>& edge = mesh.Element(2);

// and do an action if you are inside the PML
if (edge.IsPML())
  {
    cout << "Edge in the PML" << endl;
  }

Location :

MeshElementInline.cxx