jacobi.template
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mesh_2d_3_square Class Reference

#include <geom.h>

Inheritance diagram for Mesh_2d_3_square:
Mesh

Public Member Functions

 Mesh_2d_3_square (int nx, int ny, int myid=0, int procx=1, int procy=1)
 
 ~Mesh_2d_3_square () override
 
void SetU (std::vector< double > &u) const
 
void SetF (std::vector< double > &f) const
 
std::vector< int > Index_DirichletNodes () const override
 
std::vector< int > Index_BoundaryNodes () const override
 
void SaveVectorP (std::string const &name, std::vector< double > const &u) const
 
- Public Member Functions inherited from Mesh
 Mesh (int ndim, int nvert_e=0, int ndof_e=0, int nedge_e=0)
 
 __attribute__ ((noinline)) Mesh(Mesh const &)=default
 
Meshoperator= (Mesh const &)=delete
 
virtual ~Mesh ()
 
 Mesh (std::string const &fname)
 
void ReadVertexBasedMesh (std::string const &fname)
 
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 SetBoundaryValues (std::vector< double > &v, const std::function< double(double, double)> &func) const
 
void SetDirchletValues (std::vector< double > &v, const std::function< double(double, double)> &func) const
 
void Debug () const
 
void DebugEdgeBased () const
 
void Write_ascii_matlab (std::string const &fname, std::vector< double > const &v) const
 
void Export_scicomp (std::string const &basename) const
 
virtual void Visualize (std::vector< double > const &v) const
 
int Nedges () const
 
int NedgesElements () const
 
const std::vector< int > & GetEdgeConnectivity () const
 
std::vector< int > & GetEdgeConnectivity ()
 
const std::vector< int > & GetEdges () const
 
std::vector< int > & GetEdges ()
 
std::vector< std::vector< int > > Node2NodeGraph () const
 
virtual const std::vector< int > & GetFathersOfVertices () const
 
void Del_EdgeConnectivity ()
 

Private Member Functions

void GetCoordsInRectangle (int nx, int ny, double xl, double xr, double yb, double yt, double xc[])
 
void GetConnectivityInRectangle (int nx, int ny, int ia[])
 

Private Attributes

int _myid
 my MPI rank More...
 
int _procx
 number of MPI ranks in x-direction More...
 
int _procy
 number of MPI ranks in y-direction More...
 
std::array< int, 4 > _neigh
 MPI ranks of neighbors (negative: no neighbor but b.c.) More...
 
int _color
 red/black coloring (checker board) of subdomains More...
 
double _xl
 x coordinate of lower left corner of square More...
 
double _xr
 x coordinate of lower right corner of square More...
 
double _yb
 y coordinate or lower left corner of square More...
 
double _yt
 y coordinate of upper right corner of square More...
 
int _nx
 number of intervals in x-direction More...
 
int _ny
 number of intervals in y-direction More...
 

Additional Inherited Members

- Protected Member Functions inherited from Mesh
void SetNelem (int nelem)
 
void SetNverticesElement (int nvert)
 
void SetNdofsElement (int ndof)
 
void SetNnode (int nnode)
 
void SetNdim (int ndim)
 
void SetNedge (int nedge)
 
void ReadVectexBasedMesh (std::string const &fname)
 
void DeriveEdgeFromVertexBased ()
 
void DeriveEdgeFromVertexBased_slow ()
 
void DeriveEdgeFromVertexBased_fast ()
 
void DeriveEdgeFromVertexBased_fast_2 ()
 
void DeriveVertexFromEdgeBased ()
 
int Nnbedges () const
 
virtual bool Check_array_dimensions () const
 
void PermuteVertices_EdgeBased (std::vector< int > const &old2new)
 
- Protected Attributes inherited from Mesh
int _nelem
 number elements More...
 
int _nvert_e
 number of vertices per element More...
 
int _ndof_e
 degrees of freedom (d.o.f.) per element More...
 
int _nnode
 number nodes/vertices More...
 
int _ndim
 space dimension of the problem (1, 2, or 3) More...
 
std::vector< int > _ia
 element connectivity More...
 
std::vector< double > _xc
 coordinates More...
 
std::vector< int > _bedges
 boundary edges [nbedges][2] storing start/end vertex More...
 
std::vector< int > _sdedges
 boundary edges [nbedges][2] with left/right subdomain number More...
 
int _nedge
 number of edges in mesh More...
 
int _nedge_e
 number of edges per element More...
 
std::vector< int > _edges
 edges of mesh (vertices ordered ascending) More...
 
std::vector< int > _ea
 edge based element connectivity More...
 
std::vector< int > _ebedges
 boundary edges [nbedges] More...
 

Detailed Description

2D finite element mesh of the square consisting of linear triangular elements.

Definition at line 609 of file geom.h.

Constructor & Destructor Documentation

◆ Mesh_2d_3_square()

Mesh_2d_3_square::Mesh_2d_3_square ( int  nx,
int  ny,
int  myid = 0,
int  procx = 1,
int  procy = 1 
)

Generates the f.e. mesh for the unit square.

Parameters
[in]nxnumber of discretization intervals in x-direction
[in]nynumber of discretization intervals in y-direction
[in]myidmy MPI-rank / subdomain
[in]procxnumber of ranks/subdomains in x-direction
[in]procynumber of processes in y-direction

Definition at line 1099 of file geom.cpp.

◆ ~Mesh_2d_3_square()

Mesh_2d_3_square::~Mesh_2d_3_square ( )
override

Destructor

Definition at line 1136 of file geom.cpp.

Member Function Documentation

◆ GetConnectivityInRectangle()

void Mesh_2d_3_square::GetConnectivityInRectangle ( int  nx,
int  ny,
int  ia[] 
)
private

Determines the element connectivity of linear triangular elements of a FEM discretization of a rectangle using nx x ny equidistant intervals for discretization.

Parameters
[in]nxnumber of discretization intervals in x-direction
[in]nynumber of discretization intervals in y-direction
[out]iaelement connectivity matrix with ia(3*s,3*s+1,3*s+2) as node numbers od element s

Definition at line 1254 of file geom.cpp.

◆ GetCoordsInRectangle()

void Mesh_2d_3_square::GetCoordsInRectangle ( int  nx,
int  ny,
double  xl,
double  xr,
double  yb,
double  yt,
double  xc[] 
)
private

Determines the coordinates of the discretization nodes of the domain [xl, xr] x [yb, yt] which is discretized into nx x ny intervals.

Parameters
[in]nxnumber of discretization intervals in x-direction
[in]nynumber of discretization intervals in y-direction
[in]xlx-coordinate of left boundary
[in]xrx-coordinate of right boundary
[in]yby-coordinate of lower boundary
[in]yty-coordinate of upper boundary
[out]xccoordinate vector of length 2n with x(2*k,2*k+1) as coordinates of node k

Definition at line 1233 of file geom.cpp.

◆ Index_BoundaryNodes()

vector< int > Mesh_2d_3_square::Index_BoundaryNodes ( ) const
overridevirtual

Reimplemented from Mesh.

Definition at line 1199 of file geom.cpp.

◆ Index_DirichletNodes()

std::vector< int > Mesh_2d_3_square::Index_DirichletNodes ( ) const
overridevirtual

Determines the indices of those vertices with Dirichlet boundary conditions

Returns
index vector.

Reimplemented from Mesh.

Definition at line 1169 of file geom.cpp.

◆ SaveVectorP()

void Mesh_2d_3_square::SaveVectorP ( std::string const &  name,
std::vector< double > const &  u 
) const

Stores the values of vector u of (sub)domain into a file name for further processing in gnuplot. The file stores rowise the x- and y- coordinates together with the value from u . The domain [xl, xr] x [yb, yt] is discretized into nx x ny intervals.

Parameters
[in]namebasename of file name (file name will be extended by the rank number)
[in]ulocal vector
Warning
Assumes tensor product grid in unit square; rowise numbered (as generated in class constructor). The output is provided for tensor product grid visualization ( similar to Matlab-surf() ).
See also
Mesh_2d_3_square

Definition at line 1208 of file geom.cpp.

◆ SetF()

void Mesh_2d_3_square::SetF ( std::vector< double > &  f) const

Set right hand side (rhs) vector on a tensor product grid in the rectangle.

Parameters
[in]frhs vector

Definition at line 1154 of file geom.cpp.

◆ SetU()

void Mesh_2d_3_square::SetU ( std::vector< double > &  u) const

Set solution vector based on a tensor product grid in the rectangle.

Parameters
[in]usolution vector

Definition at line 1140 of file geom.cpp.

Member Data Documentation

◆ _color

int Mesh_2d_3_square::_color
private

red/black coloring (checker board) of subdomains

Definition at line 697 of file geom.h.

◆ _myid

int Mesh_2d_3_square::_myid
private

my MPI rank

Definition at line 693 of file geom.h.

◆ _neigh

std::array<int, 4> Mesh_2d_3_square::_neigh
private

MPI ranks of neighbors (negative: no neighbor but b.c.)

Definition at line 696 of file geom.h.

◆ _nx

int Mesh_2d_3_square::_nx
private

number of intervals in x-direction

Definition at line 703 of file geom.h.

◆ _ny

int Mesh_2d_3_square::_ny
private

number of intervals in y-direction

Definition at line 704 of file geom.h.

◆ _procx

int Mesh_2d_3_square::_procx
private

number of MPI ranks in x-direction

Definition at line 694 of file geom.h.

◆ _procy

int Mesh_2d_3_square::_procy
private

number of MPI ranks in y-direction

Definition at line 695 of file geom.h.

◆ _xl

double Mesh_2d_3_square::_xl
private

x coordinate of lower left corner of square

Definition at line 699 of file geom.h.

◆ _xr

double Mesh_2d_3_square::_xr
private

x coordinate of lower right corner of square

Definition at line 700 of file geom.h.

◆ _yb

double Mesh_2d_3_square::_yb
private

y coordinate or lower left corner of square

Definition at line 701 of file geom.h.

◆ _yt

double Mesh_2d_3_square::_yt
private

y coordinate of upper right corner of square

Definition at line 702 of file geom.h.


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