Imports 3D mesh with tetrahedra and hexahedra. More...

#include <meshImport3D.hh>

Inheritance diagram for concepts::Import3dMesh:
concepts::Mesh3 concepts::Mesh concepts::OutputOperator

Classes

class  NodeCell
 Stores the nodes and edges of a cell to be created. More...
 
class  NodeHexahedron
 Stores the nodes and faces of a hexahedral cell to be created. More...
 
class  NodeTetrahedron
 Stores the nodes and faces of a tetrahedral cell to be created. More...
 
class  S
 Scanner class for Import3dMesh. More...
 

Public Member Functions

 Import3dMesh (const std::string coord, const std::string elms, const std::string boundary, const uint idxStart=1, const bool leftHand=false, const uint elmtyp=0)
 Constructor. More...
 
virtual uint ncell () const
 Returns the number of cells in the mesh. More...
 
virtual Scan3scan ()
 Returns a scanner over the cells of the mesh. More...
 
virtual ~Import3dMesh ()
 

Protected Member Functions

virtual std::ostream & info (std::ostream &os) const
 Returns information in an output stream. More...
 

Private Member Functions

void clear_ (std::vector< NodeCell * > &cells) const
 Deletes the content of cells. More...
 
void createEdge_ (uint ix, uint iy, std::map< uint, std::map< uint, Edge * > > &edges, Attribute attr=0, Edge **e=0)
 Creates the edge with vertices ix and iy using edges as repository. More...
 
QuadcreateQuad_ (const Index &I, std::map< uint, std::map< uint, Edge * > > &edges, Attribute attr=0)
 Creates a quad. More...
 
TrianglecreateTriangle_ (const Index &I, std::map< uint, std::map< uint, Edge * > > &edges, Attribute attr=0)
 Creates a triangle. More...
 
uint readInts_ (const std::string &i, std::vector< int > &v) const
 Reads integers from the string. More...
 

Private Attributes

std::vector< Cell3 * > cell_
 List of cells. More...
 
std::vector< Edge * > edg_
 List of edges. More...
 
std::unordered_map< Index, Quad *, std::hash< Index >, std::IndexEqualquad_
 List of quads. More...
 
std::unordered_map< Index, Triangle *, std::hash< Index >, std::IndexEqualtri_
 List of triangles. More...
 
std::vector< Vertex * > vtx_
 List of vertices. More...
 

Detailed Description

Imports 3D mesh with tetrahedra and hexahedra.

They can be mixed in the mesh—the only problem is, that tetrahedra and hexahedra cannot connect to each other, but this importer can be enhanced to support prisms or pyramids as well.

The notation for the meshes is used in [1] for instance.

Author
Philipp Frauenfelder, 2002
Test:

test::DeadLock1

test::DeadLock3

See also
[1] Alberty, Carstensen, Funken, Remarks Around 50 Lines of MATLAB: Finite Element Implementation, 1998
Examples
hpFEM3d-EV.cc.

Definition at line 94 of file meshImport3D.hh.

Constructor & Destructor Documentation

◆ Import3dMesh()

concepts::Import3dMesh::Import3dMesh ( const std::string  coord,
const std::string  elms,
const std::string  boundary,
const uint  idxStart = 1,
const bool  leftHand = false,
const uint  elmtyp = 0 
)

Constructor.

Reads the data from three files and creates a mesh from it. The vertices, faces and cells should be number in striclty increasing order, ie. 1, 2, 3 etc.

Parameters
coordFile with coordinates of vertices. Format:
<node> <x> <y> <z>
For instance:
1 1.0 1.0 2.0
2 0.0 0.5 1.0
3 0.0 0.0 0.0
4 -1.0 2.0 3.0
elmsFile with node numbers of tetrahedra or hexahedra. Format:
<tetrahedron> <node0> <node1> <node2> <node3>
or
<hexahedron> <node0> <node1> <node2> <node3> <node4> <node5> <node6> <node7>
For instance:
1 1 2 3 4
or
1 1 2 3 4 5 6 7 8
boundaryFile with node numbers of edges with boundary conditions and attribute number. Format for a triangle:
<face> <node0> <node1> <node2> <attr>
Format for a quad:
<face> <node0> <node1> <node2> <node3> <attr>
Format for an edge:
<edge> <node0> <node1> <attr>
Format for a vertex:
<vtx> <node> <attr>
For instance:
1 2 33
2 1 2 66
3 1 2 3 44
4 1 2 3 4 55
Vertices should come first in the list of boundary attributes, then edges and triangle or quads last.
idxStartStarting point of indices in the files (1 or 0)
leftHandIndicates if the order of the points in a tet follow the left hand rule
elmtyponly for hexahedras (0: Hexahedron3d is used, 1: Parallelepiped3d is used)

◆ ~Import3dMesh()

virtual concepts::Import3dMesh::~Import3dMesh ( )
virtual

Member Function Documentation

◆ clear_()

void concepts::Import3dMesh::clear_ ( std::vector< NodeCell * > &  cells) const
private

Deletes the content of cells.

◆ createEdge_()

void concepts::Import3dMesh::createEdge_ ( uint  ix,
uint  iy,
std::map< uint, std::map< uint, Edge * > > &  edges,
Attribute  attr = 0,
Edge **  e = 0 
)
private

Creates the edge with vertices ix and iy using edges as repository.

If e is different from 0, the found or created edge is stored there.

Parameters
ixIndex of first vertex
iyIndex of second vertex
edgesStores the edges index by smaller and greater index
attrAttribute for the edge
eReturn value: the new (or found) edge
Precondition
ix and iy are vertices which are mentioned in vtx_

◆ createQuad_()

Quad* concepts::Import3dMesh::createQuad_ ( const Index I,
std::map< uint, std::map< uint, Edge * > > &  edges,
Attribute  attr = 0 
)
private

Creates a quad.

The edges are taken from edges or created and stored there by calling createEdge_.

Parameters
IIndices of the vertices to create the quad from
edgesStorage area for the edges
attrAttribute for the triangle
Returns
the new or found quad

◆ createTriangle_()

Triangle* concepts::Import3dMesh::createTriangle_ ( const Index I,
std::map< uint, std::map< uint, Edge * > > &  edges,
Attribute  attr = 0 
)
private

Creates a triangle.

The edges are taken from edges or created and stored there by calling createEdge_.

Parameters
IIndices of the vertices to create the triangle from
edgesStorage area for the edges
attrAttribute for the triangle
Returns
the new or found triangle

◆ info()

virtual std::ostream& concepts::Import3dMesh::info ( std::ostream &  os) const
protectedvirtual

Returns information in an output stream.

Reimplemented from concepts::Mesh.

◆ ncell()

virtual uint concepts::Import3dMesh::ncell ( ) const
inlinevirtual

Returns the number of cells in the mesh.

Implements concepts::Mesh.

Definition at line 140 of file meshImport3D.hh.

◆ readInts_()

uint concepts::Import3dMesh::readInts_ ( const std::string &  i,
std::vector< int > &  v 
) const
private

Reads integers from the string.

Returns
Number of integers read

◆ scan()

virtual Scan3* concepts::Import3dMesh::scan ( )
inlinevirtual

Returns a scanner over the cells of the mesh.

Postcondition
The scanner must be deleted after usage. This has to be done by the user.

Implements concepts::Mesh3.

Definition at line 141 of file meshImport3D.hh.

Member Data Documentation

◆ cell_

std::vector<Cell3*> concepts::Import3dMesh::cell_
private

List of cells.

Definition at line 173 of file meshImport3D.hh.

◆ edg_

std::vector<Edge*> concepts::Import3dMesh::edg_
private

List of edges.

Definition at line 165 of file meshImport3D.hh.

◆ quad_

std::unordered_map<Index, Quad*, std::hash<Index>, std::IndexEqual> concepts::Import3dMesh::quad_
private

List of quads.

Definition at line 171 of file meshImport3D.hh.

◆ tri_

std::unordered_map<Index, Triangle*, std::hash<Index>, std::IndexEqual> concepts::Import3dMesh::tri_
private

List of triangles.

Definition at line 168 of file meshImport3D.hh.

◆ vtx_

std::vector<Vertex*> concepts::Import3dMesh::vtx_
private

List of vertices.

Definition at line 163 of file meshImport3D.hh.


The documentation for this class was generated from the following file:
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich