H2Lib  3.0
Data Structures | Typedefs | Functions
surface3d

Representation of a 3D-surface by using a triangle mesh. More...

Data Structures

struct  _surface3d
 Representation of a triangle surface mesh. More...
 

Typedefs

typedef struct _surface3d surface3d
 Abbreviation for the struct _surface3d .
 
typedef surface3dpsurface3d
 Abbreviation for a pointer to a surface3d object.
 
typedef const surface3dpcsurface3d
 Abbreviation for a pointer to a constant surface3d object.
 

Functions

psurface3d new_surface3d (uint vertices, uint edges, uint triangles)
 create a new surface3d object with a certain number of vertices, edges and triangles. More...
 
void prepare_surface3d (psurface3d gr)
 This function computes the normal vectors n , the gram determinants g and the minimal and maximal mesh size hmin, hmax from the geometrical information. More...
 
void del_surface3d (psurface3d gr)
 Free Storage allocated for a surface3d object. More...
 
void getproperties_surface3d (pcsurface3d gr, preal hmin, preal hmax, preal anglemin, preal angleedge)
 Compute geometrical properties of a surface grid. More...
 
void print_surface3d (pcsurface3d gr)
 print geometrical information to stdout. More...
 
uint check_surface3d (pcsurface3d gr)
 Check if the geometrical information of a surface are consistent. More...
 
bool isclosed_surface3d (pcsurface3d gr)
 Check if the surface mesh is closed. More...
 
bool isoriented_surface3d (pcsurface3d gr)
 Check if the surface is oriented correctly. More...
 
void scale_surface3d (psurface3d gr, real *a, real *b)
 Scale the geometry to a cube of given size. More...
 
void translate_surface3d (psurface3d gr, real *t)
 Translate a geometry gr by a vector $t \in \mathbb R^3$. More...
 
psurface3d merge_surface3d (pcsurface3d gr1, pcsurface3d gr2)
 Merge to meshes into a single mesh. More...
 
void write_surface3d (pcsurface3d gr, const char *filename)
 Write geometrical information of a surface mesh into a given file using the H2Lib ascii representation. More...
 
psurface3d read_surface3d (const char *filename)
 Read geometrical information of a surface mesh from a given file using the H2Lib ascii representation. More...
 
void write_nc_surface3d (pcsurface3d gr, const char *filename)
 Write geometrical information of a surface mesh into a given file using NetCDF. More...
 
psurface3d read_nc_surface3d (const char *filename)
 Read geometrical information of a surface mesh from a given file using NetCDF. More...
 
psurface3d read_netgen_surface3d (const char *filename)
 Read geometrical information of a surface mesh from a given file using the netgen format. More...
 
psurface3d read_gmsh_surface3d (const char *filename)
 Read geometrical information of a surface mesh from a given file using the gmsh format. More...
 
psurface3d read_unv_surface3d (char *filename)
 Read geometrical information of a surface mesh from a given file using the unv format. More...
 
psurface3d refine_red_surface3d (psurface3d in)
 Apply a red refinement to a surface mesh. More...
 

Detailed Description

Representation of a 3D-surface by using a triangle mesh.

This module offers basic functions to create, load and save triangular surface meshes. Also a simple red refinement is implemented via refine_red_surface3d .

Function Documentation

uint check_surface3d ( pcsurface3d  gr)

Check if the geometrical information of a surface are consistent.

Parameters
grSurface3d object to be checked.
Returns
The total number of problems found is returned.
void del_surface3d ( psurface3d  gr)

Free Storage allocated for a surface3d object.

Parameters
grSurface3d object to be deleted.
void getproperties_surface3d ( pcsurface3d  gr,
preal  hmin,
preal  hmax,
preal  anglemin,
preal  angleedge 
)

Compute geometrical properties of a surface grid.

Parameters
grGrid
hminWill be filled with minimal edge length.
hmaxWill be filled with maximal edge length.
angleminWill be filled with minimal interior angle.
angleedgeWill be will with maximal angle across edges between triangles.
bool isclosed_surface3d ( pcsurface3d  gr)

Check if the surface mesh is closed.

Parameters
grSurface3d object to be checked.
Returns
Return value is true, if surface is closed, false otherwise.
bool isoriented_surface3d ( pcsurface3d  gr)

Check if the surface is oriented correctly.

Parameters
grSurface3d object to be checked.
Returns
Return value is true, if surface is oriented, false otherwise.
psurface3d merge_surface3d ( pcsurface3d  gr1,
pcsurface3d  gr2 
)

Merge to meshes into a single mesh.

Parameters
gr1First mesh to be merged.
gr2Second mesh to be merged.
Returns
New surface mesh containing all elements form gr1 and gr2.
psurface3d new_surface3d ( uint  vertices,
uint  edges,
uint  triangles 
)

create a new surface3d object with a certain number of vertices, edges and triangles.

This function will allocated storage for the members x, e, t, s, n and g of the struct surface3d.

Parameters
verticesNumber of vertices for the new mesh.
edgesNumber of edges for the new mesh.
trianglesNumber of triangles for the new mesh.
Returns
A new, uninitialized surface3d object.
void prepare_surface3d ( psurface3d  gr)

This function computes the normal vectors n , the gram determinants g and the minimal and maximal mesh size hmin, hmax from the geometrical information.

Parameters
grSurface3d object to be initialized.
void print_surface3d ( pcsurface3d  gr)

print geometrical information to stdout.

Parameters
grSurface3d object to be printed out.
psurface3d read_gmsh_surface3d ( const char *  filename)

Read geometrical information of a surface mesh from a given file using the gmsh format.

Attention
The normal vectors n and the gram determinants g are not yet initialized. Consider calling prepare_surface3d before using the geometry read by this function.
Parameters
filenameFilename for the geometry.
Returns
A new surface3d object with the geometrical information read from the file is returned.
psurface3d read_nc_surface3d ( const char *  filename)

Read geometrical information of a surface mesh from a given file using NetCDF.

Attention
The normal vectors n and the gram determinants g are not yet initialized. Consider calling prepare_surface3d before using the geometry read by this function.
Parameters
filenameFilename for the geometry.
Returns
A new surface3d object with the geometrical information read from the file is returned.
psurface3d read_netgen_surface3d ( const char *  filename)

Read geometrical information of a surface mesh from a given file using the netgen format.

Attention
The normal vectors n and the gram determinants g are not yet initialized. Consider calling prepare_surface3d before using the geometry read by this function.
Parameters
filenameFilename for the geometry.
Returns
A new surface3d object with the geometrical information read from the file is returned.
psurface3d read_surface3d ( const char *  filename)

Read geometrical information of a surface mesh from a given file using the H2Lib ascii representation.

The file format is the following:

{vertices} {edges} {triangles}
{x[0][0]} {x[0][1]} {x[0][2]}
...
{x[{vertices}-1][0]} {x[{vertices}-1][1]} {x[{vertices}-1][2]}
{e[0][0]} {e[0][1]}
...
{e[{edges}-1][0]} {e[{edges}-1][1]}
{t[0][0]} {t[0][1]} {t[0][2]} {s[0][0]} {s[0][1]} {s[0][2]}
...
{t[{triangles}-1][0]} {t[{triangles}-1][1]} {t[{triangles}-1][2]} {s[{triangles}-1][0]} {s[{triangles}-1][1]} {s[{triangles}-1][2]}

Attention
The normal vectors n and the gram determinants g are not yet initialized. Consider calling prepare_surface3d before using the geometry read by this function.
Parameters
filenameFilename for the geometry.
Returns
A new surface3d object with the geometrical information read from the file is returned.
psurface3d read_unv_surface3d ( char *  filename)

Read geometrical information of a surface mesh from a given file using the unv format.

Attention
The normal vectors n and the gram determinants g are not yet initialized. Consider calling prepare_surface3d before using the geometry read by this function.
Parameters
filenameFilename for the geometry.
Returns
A new surface3d object with the geometrical information read from the file is returned.
psurface3d refine_red_surface3d ( psurface3d  in)

Apply a red refinement to a surface mesh.

The surface mesh is globally refined with a red refinement resulting in a mesh having four times as much triangles as the input mesh.

Parameters
inSurface to be refined.
Returns
A new surface3d object is returned which is a red refinement from the input surface mesh.
void scale_surface3d ( psurface3d  gr,
real a,
real b 
)

Scale the geometry to a cube of given size.

The coordinates of the geometry are scaled in a way to fit into the cube defined by $ [a_1, b_1] \times [a_2, b_2] \times [a_3, b_3]$.

Parameters
grSurface3d object to be scaled.
aMinimal coordinates of scaling cube.
bMaximal coordinates of scaling cube.
void translate_surface3d ( psurface3d  gr,
real t 
)

Translate a geometry gr by a vector $t \in \mathbb R^3$.

Parameters
grGeometry that should be translated.
tTranslation vector $t$.
void write_nc_surface3d ( pcsurface3d  gr,
const char *  filename 
)

Write geometrical information of a surface mesh into a given file using NetCDF.

Parameters
grGeometry to be written to a file.
filenameFilename for the geometry.
void write_surface3d ( pcsurface3d  gr,
const char *  filename 
)

Write geometrical information of a surface mesh into a given file using the H2Lib ascii representation.

For the format description please refer to read_surface3d .

See also
read_surface3d for the used file format.
Parameters
grGeometry to be written to a file.
filenameFilename for the geometry.