muMECH  1.0
Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | List of all members
mumech::Mesh Class Reference

Class Mesh contains and handles all mesh data. More...

#include <mesh.h>

Public Member Functions

 Mesh (long i, const Problems *p)
 Constructor. More...
 
 Mesh (long i, const Problems *p, const Mesh *src)
 Copy constructor. More...
 
virtual ~Mesh ()
 Destructor. More...
 
int add_problem (const Problems *p)
 
void set_coll (int val)
 
int give_nlc (void)
 
bool give_twodim (void) const
 
bool geom_is_readed (void)
 
bool equal_dimensions (int pid) const
 Returns true when mesh and problem dimensions are same. More...
 
bool is_unset (void)
 Returns true, if the receiver is unset, only constructor was called. More...
 
void scale (const double *s)
 Scale all nodes coordinates by vector s. More...
 
void local2global (const double *origin, const double *TInv)
 Local to global transformation of all nodes. More...
 
void shift_id (long snn, long sne)
 
void read_geometry_file_vtk (const char *vtkMeshFile, int pid, int lc, bool add)
 Read input file with mesh geometry from vtk file. More...
 
void generate_regular_mesh (const double *p1, const double *p2, const long *n)
 Generate regular mesh geometry of rectangular cuboid shape compound of rectangular cuboid shape elements. More...
 
void generate_regularSphereMesh_2d (int n, const double *a)
 Function generates uniform mesh on an unit circle. More...
 
void generate_regularSphereMesh_3d (int n, const double *a)
 Function generates uniform mesh on an unit sphere. More...
 
void compute_node_fields (char flag, bool displc_flag, bool strain_flag, bool stress_flag, int pid, int lc, int nLC, PFCmode pfcMode)
 
void compute_element_fields (char flag, bool displc_flag, bool strain_flag, bool stress_flag, int pid, int lc, int nLC, PFCmode pfcMode)
 predpokladame trojuhelnikove nebo tetrahedron prvky, tj. na elementu budeme drzet jednu hodnotu More...
 
void print_geometry_file_vtk (const char *rsltFileName, int pid, int lc, int nLC)
 Print output file with mesh geometry with results to vtk file. More...
 
double give_total_energy (int pid, int lc)
 
double give_homog_energy (int lc, int pid=0)
 
void integrate_energy_at_elems (int lc, int nLC)
 
double give_error (int pid1, int pid2, int lc)
 
double give_total_volume (void) const
 
double give_regular_element_volume (void) const
 

Public Attributes

long id
 identification number More...
 
int npa
 number of allocated pointers More...
 
int np
 number of pointers to problems More...
 
const Problems ** P
 set of pointers to solved problems More...
 
int coll
 
int md
 mesh dimension More...
 
MeshType mtA
 type of mesh, structured grid or unstructured More...
 
double point1 [3]
 
double point2 [3]
 
double delta [3]
 
long nsegs [3]
 
double volume
 Volume/Area. More...
 
long nNodes
 Number of nodes. More...
 
mNode ** Nodes
 1d array of pointers to Node. More...
 
long nElems
 Number of elements. More...
 
mElement ** Elems
 1d array of pointers to Element. More...
 
int nLC
 number of load cases More...
 
bool ** no_dspl_rf
 
bool ** no_strn_rf
 
bool ** no_strs_rf
 
bool ** el_dspl_rf
 pid x nlc More...
 
bool ** el_strn_rf
 
bool ** el_strs_rf
 

Protected Member Functions

void set_and_alloc_nNodes (long nn)
 Set nNodes and allocate array Nodes. More...
 
void set_and_alloc_nElems (long ne)
 Set nElems and allocate array Elems. More...
 

Private Member Functions

int file_type_s2e (const char *s)
 
void set_node_rslt_flags (bool displc_flag, bool strain_flag, bool stress_flag, int pid, int lc, int nLC)
 
void set_elem_rslt_flags (bool displc_flag, bool strain_flag, bool stress_flag, int pid, int lc, int nLC)
 
void average_fields (bool displc_flag, bool strain_flag, bool stress_flag, int lc, int nLC)
 

Detailed Description

Class Mesh contains and handles all mesh data.

Definition at line 52 of file mesh.h.

Constructor & Destructor Documentation

mumech::Mesh::Mesh ( long  i,
const Problems p 
)

Constructor.

Definition at line 49 of file mesh.cpp.

References add_problem(), coll, el_dspl_rf, el_strn_rf, el_strs_rf, Elems, md, mumech::MT_VOID, mtA, nElems, nLC, nNodes, no_dspl_rf, no_strn_rf, no_strs_rf, Nodes, np, npa, P, and volume.

mumech::Mesh::Mesh ( long  i,
const Problems p,
const Mesh src 
)

Copy constructor.

Definition at line 83 of file mesh.cpp.

References _errorr, add_problem(), coll, el_dspl_rf, el_strn_rf, el_strs_rf, Elems, errol, md, mumech::MT_GENERAL, mtA, nElems, nLC, nNodes, no_dspl_rf, no_strn_rf, no_strs_rf, Nodes, np, npa, P, and volume.

mumech::Mesh::~Mesh ( )
virtual

Destructor.

Definition at line 124 of file mesh.cpp.

References mumech::DeleteArray2D(), el_dspl_rf, el_strn_rf, el_strs_rf, Elems, nElems, nNodes, no_dspl_rf, no_strn_rf, no_strs_rf, Nodes, npa, and P.

Member Function Documentation

int mumech::Mesh::add_problem ( const Problems p)
void mumech::Mesh::average_fields ( bool  displc_flag,
bool  strain_flag,
bool  stress_flag,
int  lc,
int  nLC 
)
private

Referenced by geom_is_readed().

void mumech::Mesh::compute_element_fields ( char  flag,
bool  displc_flag,
bool  strain_flag,
bool  stress_flag,
int  pid,
int  lc,
int  nLC,
PFCmode  pfcMode 
)
void mumech::Mesh::compute_node_fields ( char  flag,
bool  displc_flag,
bool  strain_flag,
bool  stress_flag,
int  pid,
int  lc,
int  nLC,
PFCmode  pfcMode 
)
bool mumech::Mesh::equal_dimensions ( int  pid) const

Returns true when mesh and problem dimensions are same.

Definition at line 180 of file mesh.cpp.

References mumech::Problems::give_dimension(), md, and P.

Referenced by geom_is_readed(), mumech::mElement::give_strain(), and mumech::mElement::give_stress().

int mumech::Mesh::file_type_s2e ( const char *  s)
private

Definition at line 341 of file mesh.cpp.

References _errorr2, and _STRCMP.

Referenced by geom_is_readed(), and read_geometry_file_vtk().

void mumech::Mesh::generate_regular_mesh ( const double *  p1,
const double *  p2,
const long *  n 
)

Generate regular mesh geometry of rectangular cuboid shape compound of rectangular cuboid shape elements.

Generuje pravidelnou obdelnikovou 3d sit.

Parameters
p1Coordinates of the vertex of mesh cuboid with lowest component values.
p2Coordinates of the vertex of mesh cuboid with highest component values.
nNumber of elements in particular axes directions.

Pokud je n[i] == 0, tak to degraduje na 2d sit, zatim implementovano jen n[2]

Definition at line 260 of file mesh.cpp.

References _errorr, coll, mumech::mNode::coords, mumech::CopyVector(), delta, Elems, geom_is_readed(), mumech::MT_REGULAR, mtA, nElems, mumech::mElement::nodes, Nodes, nsegs, point1, point2, set_and_alloc_nElems(), set_and_alloc_nNodes(), and set_coll().

Referenced by clanek_homog_grid(), geom_is_readed(), mumech::Comparison::give_energy_MM(), mumech::RegGrid::giveHomogenizedStiffnessMatrix(), and mumech::Problem::printFieldsOnMeshGrid().

void mumech::Mesh::generate_regularSphereMesh_2d ( int  n,
const double *  a 
)

Function generates uniform mesh on an unit circle.

Parameters
MEmpty (only allocated) mesh object. Will be filled by uniform mesh.
nNumber of segments of a quater circle.

Definition at line 767 of file mesh.cpp.

References _errorr, _errorr1, mumech::mNode::coords, Elems, is_unset(), mumech::MT_GENERAL, mtA, nElems, nNodes, mumech::mElement::nodes, Nodes, PI, set_and_alloc_nElems(), set_and_alloc_nNodes(), set_coll(), mumech::mElement::set_type(), gelibspace::Elem3D::x, and gelibspace::Elem3D::y.

Referenced by geom_is_readed(), and mumech::Problem::print_visualization().

void mumech::Mesh::generate_regularSphereMesh_3d ( int  n,
const double *  a 
)

Function generates uniform mesh on an unit sphere.

Parameters
MEmpty (only allocated) mesh object. Will be filled by uniform mesh.
nNumber of segments of a quater circle.

Definition at line 808 of file mesh.cpp.

References _errorr, _errorr1, mumech::mNode::coords, Elems, mumech::give_curvature(), is_unset(), mumech::MT_GENERAL, mtA, nNodes, mumech::mElement::nodes, Nodes, PI, set_and_alloc_nElems(), set_and_alloc_nNodes(), set_coll(), mumech::mElement::set_type(), gelibspace::Elem3D::x, gelibspace::Elem3D::y, and gelibspace::Elem3D::z.

Referenced by geom_is_readed(), and mumech::Problem::print_visualization().

bool mumech::Mesh::geom_is_readed ( void  )
inline
double mumech::Mesh::give_error ( int  pid1,
int  pid2,
int  lc 
)
double mumech::Mesh::give_homog_energy ( int  lc,
int  pid = 0 
)
int mumech::Mesh::give_nlc ( void  )
inline

Definition at line 121 of file mesh.h.

References errol, and nLC.

double mumech::Mesh::give_regular_element_volume ( void  ) const
double mumech::Mesh::give_total_energy ( int  pid,
int  lc 
)

Definition at line 1269 of file mesh.cpp.

References _errorr2, el_strn_rf, el_strs_rf, Elems, and nElems.

Referenced by geom_is_readed(), and mumech::Comparison::give_energy_MM().

double mumech::Mesh::give_total_volume ( void  ) const
bool mumech::Mesh::give_twodim ( void  ) const
inline

Definition at line 123 of file mesh.h.

References errol.

Referenced by mumech::mElement::give_energy().

void mumech::Mesh::integrate_energy_at_elems ( int  lc,
int  nLC 
)

Referenced by geom_is_readed().

bool mumech::Mesh::is_unset ( void  )

Returns true, if the receiver is unset, only constructor was called.

Definition at line 187 of file mesh.cpp.

References coll, el_dspl_rf, el_strn_rf, el_strs_rf, Elems, mumech::MT_VOID, mtA, nElems, nNodes, no_dspl_rf, no_strn_rf, no_strs_rf, Nodes, and volume.

Referenced by generate_regularSphereMesh_2d(), generate_regularSphereMesh_3d(), and geom_is_readed().

void mumech::Mesh::local2global ( const double *  origin,
const double *  TInv 
)

Local to global transformation of all nodes.

Definition at line 212 of file mesh.cpp.

References gelibspace::Elem3D::add(), gelibspace::PoinT::beRotatedBy(), gelibspace::PoinT::beRotatedBy2d(), mumech::mNode::coords, md, nNodes, and Nodes.

Referenced by geom_is_readed(), and mumech::Problem::print_visualization().

void mumech::Mesh::print_geometry_file_vtk ( const char *  rsltFileName,
int  pid,
int  lc,
int  nLC 
)
void mumech::Mesh::read_geometry_file_vtk ( const char *  vtkMeshFile,
int  pid,
int  lc,
bool  add 
)

Read input file with mesh geometry from vtk file.

Parameters
filenameName of the input file.

Definition at line 355 of file mesh.cpp.

References _errorr, _errorr2, _STRCMP, mumech::mNode::allocate_fields(), mumech::mElement::allocate_fields(), tinyxml2::XMLElement::Attribute(), CASE, gelibspace::Stream::close(), coll, mumech::mNode::coords, tinyxml2::XMLNode::DeleteChild(), Elems, errol, gelibspace::Stream::file(), file_type_s2e(), tinyxml2::XMLNode::FirstChild(), FP_scan_expected_word_exit, gelibspace::FP_scan_word(), gelibspace::FP_skip_line(), geom_is_readed(), tinyxml2::XMLElement::GetText(), gelibspace::Stream::isFile(), mumech::MT_GENERAL, mtA, mumech::MTR_fem, mumech::MTR_femadd, mumech::MTR_geom, mumech::MTR_VOID, nElems, tinyxml2::XMLNode::NextSibling(), nNodes, mumech::mElement::nodes, Nodes, gelibspace::Stream::open(), P, tinyxml2::XMLElement::QueryLongAttribute(), mumech::mElement::region, gelibspace::Stream::relink_downF(), gelibspace::Stream::relink_next(), gelibspace::Stream::relink_up(), mumech::scan_DATA_field_head(), gelibspace::Elem3D::scan_xyz(), set_and_alloc_nElems(), set_and_alloc_nNodes(), set_coll(), set_elem_rslt_flags(), set_node_rslt_flags(), mumech::mElement::set_type(), SP_scan_expected_number_exit, SP_scan_expected_word2_exit, SP_scan_expected_word_exit, gelibspace::SP_scan_number(), gelibspace::SP_scan_word(), gelibspace::SP_skip_word(), gelibspace::ST_scan_array(), gelibspace::ST_scan_number(), mumech::mElement::strain, mumech::mElement::stress, gelibspace::STRM_void, gelibspace::Stream::tixel(), gelibspace::Stream::tixnod(), tinyxml2::XMLNode::ToComment(), tinyxml2::XMLNode::ToDeclaration(), tinyxml2::XMLNode::ToElement(), tinyxml2::XMLElement::ToElement(), tinyxml2::XMLNode::Value(), gelibspace::VTKR_cd, gelibspace::VTKR_cells, gelibspace::VTKR_data, gelibspace::VTKR_fields, gelibspace::VTKR_pd, gelibspace::VTKR_points, gelibspace::VTKR_void, gelibspace::XP_check_expected_attribute(), gelibspace::XP_give_unique_expected_elem(), and gelibspace::XP_giveDAtext().

Referenced by clanek_homog_grid(), mumech::Comparison::cmp_mm_ansys_total_energy(), geom_is_readed(), and mumech::Problem::printFieldsOnMeshVTK().

void mumech::Mesh::scale ( const double *  s)

Scale all nodes coordinates by vector s.

Definition at line 199 of file mesh.cpp.

References mumech::mNode::coords, md, nNodes, Nodes, gelibspace::Elem3D::x, gelibspace::Elem3D::y, and gelibspace::Elem3D::z.

Referenced by geom_is_readed(), and mumech::Problem::print_visualization().

void mumech::Mesh::set_and_alloc_nElems ( long  ne)
protected

Set nElems and allocate array Elems.

Definition at line 236 of file mesh.cpp.

References Elems, errol, and nElems.

Referenced by generate_regular_mesh(), generate_regularSphereMesh_2d(), generate_regularSphereMesh_3d(), geom_is_readed(), and read_geometry_file_vtk().

void mumech::Mesh::set_and_alloc_nNodes ( long  nn)
protected

Set nNodes and allocate array Nodes.

Definition at line 227 of file mesh.cpp.

References errol, nNodes, and Nodes.

Referenced by generate_regular_mesh(), generate_regularSphereMesh_2d(), generate_regularSphereMesh_3d(), geom_is_readed(), and read_geometry_file_vtk().

void mumech::Mesh::set_coll ( int  val)
void mumech::Mesh::set_elem_rslt_flags ( bool  displc_flag,
bool  strain_flag,
bool  stress_flag,
int  pid,
int  lc,
int  nLC 
)
private
void mumech::Mesh::set_node_rslt_flags ( bool  displc_flag,
bool  strain_flag,
bool  stress_flag,
int  pid,
int  lc,
int  nLC 
)
private
void mumech::Mesh::shift_id ( long  snn,
long  sne 
)

Member Data Documentation

int mumech::Mesh::coll
double mumech::Mesh::delta[3]

Definition at line 76 of file mesh.h.

Referenced by generate_regular_mesh().

bool** mumech::Mesh::el_dspl_rf
bool** mumech::Mesh::el_strn_rf
bool** mumech::Mesh::el_strs_rf
mElement** mumech::Mesh::Elems
long mumech::Mesh::id

identification number

Definition at line 56 of file mesh.h.

int mumech::Mesh::md

mesh dimension

Definition at line 70 of file mesh.h.

Referenced by equal_dimensions(), give_homog_energy(), local2global(), Mesh(), scale(), and set_coll().

MeshType mumech::Mesh::mtA
long mumech::Mesh::nElems
int mumech::Mesh::nLC
long mumech::Mesh::nNodes
bool** mumech::Mesh::no_dspl_rf
bool** mumech::Mesh::no_strn_rf
bool** mumech::Mesh::no_strs_rf
mNode** mumech::Mesh::Nodes
int mumech::Mesh::np

number of pointers to problems

Definition at line 58 of file mesh.h.

Referenced by add_problem(), and Mesh().

int mumech::Mesh::npa
long mumech::Mesh::nsegs[3]

Definition at line 77 of file mesh.h.

Referenced by generate_regular_mesh().

const Problems** mumech::Mesh::P
double mumech::Mesh::point1[3]

Definition at line 74 of file mesh.h.

Referenced by generate_regular_mesh(), and give_total_volume().

double mumech::Mesh::point2[3]

Definition at line 75 of file mesh.h.

Referenced by generate_regular_mesh(), and give_total_volume().

double mumech::Mesh::volume

Volume/Area.

Definition at line 79 of file mesh.h.

Referenced by give_total_volume(), is_unset(), and Mesh().


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