H2Lib
3.0
|
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 surface3d * | psurface3d |
Abbreviation for a pointer to a surface3d object. | |
typedef const surface3d * | pcsurface3d |
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 . 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... | |
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 .
uint check_surface3d | ( | pcsurface3d | gr | ) |
Check if the geometrical information of a surface are consistent.
gr | Surface3d object to be checked. |
void del_surface3d | ( | psurface3d | gr | ) |
void getproperties_surface3d | ( | pcsurface3d | gr, |
preal | hmin, | ||
preal | hmax, | ||
preal | anglemin, | ||
preal | angleedge | ||
) |
Compute geometrical properties of a surface grid.
gr | Grid |
hmin | Will be filled with minimal edge length. |
hmax | Will be filled with maximal edge length. |
anglemin | Will be filled with minimal interior angle. |
angleedge | Will be will with maximal angle across edges between triangles. |
bool isclosed_surface3d | ( | pcsurface3d | gr | ) |
Check if the surface mesh is closed.
gr | Surface3d object to be checked. |
true
, if surface is closed, false otherwise. bool isoriented_surface3d | ( | pcsurface3d | gr | ) |
Check if the surface is oriented correctly.
gr | Surface3d object to be checked. |
true
, if surface is oriented, false otherwise. psurface3d merge_surface3d | ( | pcsurface3d | gr1, |
pcsurface3d | gr2 | ||
) |
Merge to meshes into a single mesh.
gr1 | First mesh to be merged. |
gr2 | Second mesh to be merged. |
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.
vertices | Number of vertices for the new mesh. |
edges | Number of edges for the new mesh. |
triangles | Number of triangles for the new mesh. |
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.
gr | Surface3d object to be initialized. |
void print_surface3d | ( | pcsurface3d | gr | ) |
print geometrical information to stdout.
gr | Surface3d 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.
n
and the gram determinants g
are not yet initialized. Consider calling prepare_surface3d before using the geometry read by this function.filename | Filename for the geometry. |
psurface3d read_nc_surface3d | ( | const char * | filename | ) |
Read geometrical information of a surface mesh from a given file using NetCDF.
n
and the gram determinants g
are not yet initialized. Consider calling prepare_surface3d before using the geometry read by this function.filename | Filename for the geometry. |
psurface3d read_netgen_surface3d | ( | const char * | filename | ) |
Read geometrical information of a surface mesh from a given file using the netgen format.
n
and the gram determinants g
are not yet initialized. Consider calling prepare_surface3d before using the geometry read by this function.filename | Filename for the geometry. |
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]}
n
and the gram determinants g
are not yet initialized. Consider calling prepare_surface3d before using the geometry read by this function.filename | Filename for the geometry. |
psurface3d read_unv_surface3d | ( | char * | filename | ) |
Read geometrical information of a surface mesh from a given file using the unv format.
n
and the gram determinants g
are not yet initialized. Consider calling prepare_surface3d before using the geometry read by this function.filename | Filename for the geometry. |
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.
in | Surface to be refined. |
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 .
gr | Surface3d object to be scaled. |
a | Minimal coordinates of scaling cube. |
b | Maximal coordinates of scaling cube. |
void translate_surface3d | ( | psurface3d | gr, |
real * | t | ||
) |
Translate a geometry gr
by a vector .
gr | Geometry that should be translated. |
t | Translation vector . |
void write_nc_surface3d | ( | pcsurface3d | gr, |
const char * | filename | ||
) |
Write geometrical information of a surface mesh into a given file using NetCDF.
gr | Geometry to be written to a file. |
filename | Filename 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 .
gr | Geometry to be written to a file. |
filename | Filename for the geometry. |