jacobi_oo_STL
Public Member Functions | Protected Member Functions | List of all members
Mesh Class Referenceabstract

#include <geom.h>

Inheritance diagram for Mesh:
Mesh_2d_3_matlab Mesh_2d_3_square

Public Member Functions

 Mesh (int ndim, int nvert_e=0, int ndof_e=0)
 
virtual ~Mesh ()
 
int Nelems () const
 
int NverticesElements () const
 
int NdofsElement () const
 
int Nnodes () const
 
int Ndims () const
 
void Resize_Connectivity (int nelem, int nvert_e)
 
const std::vector< int > & GetConnectivity () const
 
std::vector< int > & GetConnectivity ()
 
void Resize_Coords (int nnodes, int ndim)
 
const std::vector< double > & GetCoords () const
 
std::vector< double > & GetCoords ()
 
void SetValues (std::vector< double > &v, const std::function< double(double, double)> &func) const
 
void Debug () const
 
virtual std::vector< int > Index_DirichletNodes () const =0
 
void Write_ascii_matlab (std::string const &fname, std::vector< double > const &v) const
 
void Visualize (std::vector< double > const &v) const
 

Protected Member Functions

void SetNelem (int nelem)
 
void SetNverticesElement (int nvert)
 
void SetNdofsElement (int ndof)
 
void SetNnode (int nnode)
 
void SetNdim (int ndim)
 

Detailed Description

Basis class for finite element meshes.

Definition at line 11 of file geom.h.

Constructor & Destructor Documentation

◆ Mesh()

Mesh::Mesh ( int  ndim,
int  nvert_e = 0,
int  ndof_e = 0 
)
explicit

Constructor initializing the members with default values.

Parameters
[in]ndimspace dimensions (dimension for coordinates)
[in]nvert_enumber of vertices per element (dimension for connectivity)
[in]ndof_edegrees of freedom per element (= nvert_e for linear elements)

Definition at line 13 of file geom.cpp.

◆ ~Mesh()

Mesh::~Mesh ( )
virtual

Destructor.

See clang warning on weak-vtables.

Definition at line 18 of file geom.cpp.

Member Function Documentation

◆ Debug()

void Mesh::Debug ( ) const

Prints the information for a finite element mesh

Definition at line 32 of file geom.cpp.

◆ GetConnectivity() [1/2]

std::vector<int>& Mesh::GetConnectivity ( )
inline

Access/Change connectivity information (g1,g2,g3)_i.

Returns
convectivity vector [nelems*ndofs].

Definition at line 102 of file geom.h.

◆ GetConnectivity() [2/2]

const std::vector<int>& Mesh::GetConnectivity ( ) const
inline

Read connectivity information (g1,g2,g3)_i.

Returns
convectivity vector [nelems*ndofs].

Definition at line 93 of file geom.h.

◆ GetCoords() [1/2]

std::vector<double>& Mesh::GetCoords ( )
inline

Access/Change coordinates of vertices (x,y)_i.

Returns
coordinates vector [nnodes*2].

Definition at line 133 of file geom.h.

◆ GetCoords() [2/2]

const std::vector<double>& Mesh::GetCoords ( ) const
inline

Read coordinates of vertices (x,y)_i.

Returns
coordinates vector [nnodes*2].

Definition at line 124 of file geom.h.

◆ Index_DirichletNodes()

virtual std::vector<int> Mesh::Index_DirichletNodes ( ) const
pure virtual

Determines the indices of those vertices with Dirichlet boundary conditions

Returns
index vector.

Implemented in Mesh_2d_3_matlab, and Mesh_2d_3_square.

◆ Ndims()

int Mesh::Ndims ( ) const
inline

Space dimension.

Returns
number of dimensions.

Definition at line 71 of file geom.h.

◆ NdofsElement()

int Mesh::NdofsElement ( ) const
inline

Global number of degrees of freedom (dof) for each finite element.

Returns
degrees of freedom per element.

Definition at line 53 of file geom.h.

◆ Nelems()

int Mesh::Nelems ( ) const
inline

Number of finite elements in (sub)domain.

Returns
number of elements.

Definition at line 35 of file geom.h.

◆ Nnodes()

int Mesh::Nnodes ( ) const
inline

Number of vertices in mesh.

Returns
number of vertices.

Definition at line 62 of file geom.h.

◆ NverticesElements()

int Mesh::NverticesElements ( ) const
inline

Global number of vertices for each finite element.

Returns
number of vertices per element.

Definition at line 44 of file geom.h.

◆ Resize_Connectivity()

void Mesh::Resize_Connectivity ( int  nelem,
int  nvert_e 
)
inline

(Re-)Allocates memory for the element connectivity and redefines the appropriate dimensions.

Parameters
[in]nelemnumber of elements
[in]nvert_enumber of vertices per element

Definition at line 82 of file geom.h.

◆ Resize_Coords()

void Mesh::Resize_Coords ( int  nnodes,
int  ndim 
)
inline

(Re-)Allocates memory for the element connectivity and redefines the appropriate dimensions.

Parameters
[in]nnodesnumber of nodes
[in]ndimspace dimension

Definition at line 113 of file geom.h.

◆ SetNdim()

void Mesh::SetNdim ( int  ndim)
inlineprotected

Definition at line 201 of file geom.h.

◆ SetNdofsElement()

void Mesh::SetNdofsElement ( int  ndof)
inlineprotected

Definition at line 191 of file geom.h.

◆ SetNelem()

void Mesh::SetNelem ( int  nelem)
inlineprotected

Definition at line 181 of file geom.h.

◆ SetNnode()

void Mesh::SetNnode ( int  nnode)
inlineprotected

Definition at line 196 of file geom.h.

◆ SetNverticesElement()

void Mesh::SetNverticesElement ( int  nvert)
inlineprotected

Definition at line 186 of file geom.h.

◆ SetValues()

void Mesh::SetValues ( std::vector< double > &  v,
const std::function< double(double, double)> &  func 
) const

Calculate values in vector v via function func(x,y)

Parameters
[in]vvector
[in]funcfunction of (x,y) returning a double value.

Definition at line 21 of file geom.cpp.

◆ Visualize()

void Mesh::Visualize ( std::vector< double > const &  v) const

Visualize v together with its mesh information via matlab or octave.

Comment/uncomment those code lines in method Mesh:Visualize (geom.cpp) that are supported on your system.

Parameters
[in]vvector
Warning
matlab files ascii_read_meshvector.m visualize_results.m must be in the executing directory.

Definition at line 106 of file geom.cpp.

◆ Write_ascii_matlab()

void Mesh::Write_ascii_matlab ( std::string const &  fname,
std::vector< double > const &  v 
) const

Write vector v toghether with its mesh information to an ASCii file fname.

The data are written in C-style.

Parameters
[in]fnamefile name
[in]vvector

Definition at line 56 of file geom.cpp.


The documentation for this class was generated from the following files: