Professional Documents
Culture Documents
API Manual
MeshGems-Tetra HPC Version: 2.10
Documentation Revision: 1
October 2019
Pantone Pantone
Process Blue 294 C
Gems 04
Customer Service
Should you encounter any problem with MeshGems-Tetra HPC or the MeshGems
R
Suite, please contact
01
Pantone Pantone Pantone
the customer service by:
306 C Process Blue 294 C
/04/2011
0401 Logo Mesh Gems 04
Telephone: +33(0)970-650-219
Fax: +33(0)169-269-033
Electronic mail: support@distene.com
MeshGems
R
: a brand of DISTENE
Copyright
c Distene SAS 2019
Reproduction of this document is permitted except for resale and on condition its origin is specified. It may
not be changed in any way without the prior agreement of the authors.
1st edition edition, October 2019
TH-2
MG-TETRA HPC API Manual
Release 2.10
10401
Pantone Pantone Pantone
306 C Process Blue 294 C
Date : 14/04/2011
Name : 10401 Logo Mesh Gems 04
Information
This document is the api manual of the MeshGems-Tetra HPC software. It applies to all platforms running
the software.
The MeshGems-Tetra HPC software is the multithread or distributed tetrahedral mesh generator of the
MeshGems
R
suite.
Important notice: In order to use MeshGems-Tetra HPC, you must first install the
tool and, if necessary, the license server. Please refer to the installation guide in the
delivered CD-ROM or in the installed distribution.
TH-3
API Manual MG-TETRA HPC
Release 2.10
Document History
Version Date Comment
01
Pantone
306 C
Pantone
Process Blue
Pantone
294 C 2.10-1 October 2019 1st edition
/04/2011
0401 Logo Mesh Gems 04
TH-4
MG-TETRA HPC API Manual
Release 2.10
10401
Pantone Pantone Pantone
306 C Process Blue 294 C
Date : 14/04/2011
Name : 10401 Logo Mesh Gems 04
Foreword
The MeshGems
R
Suite is a comprehensive set of meshing components, which aim at providing CAD/CAE
application developers with reliable, fast and high quality meshing technologies. These components ad-
dress all aspects of automatic meshing for real life industrial 3D numerical simulations, using very efficient
algorithms:
• surface meshing from analytical CAD, discrete CAD (tessellation) or hybrid CAD (mix of analytical
and discrete CAD definition),
• correction of data, whether geometrical or triangulated,
The MeshGems
R
Suite is designed to make integration and maintenance easy by third party developers.
R
The MeshGems Suite today includes:
All these components can be used independently or as a compatible whole thanks to the common core module
(MeshGems-Core) included in all the MeshGems
R
Suite components.
See section 2.4 for more information about coupling MeshGems-Tetra HPC with the other MeshGems
R
Suite components.
TH-5
API Manual MG-TETRA HPC
Release 2.10
01
Pantone Pantone Pantone
306 C Process Blue 294 C
/04/2011
0401 Logo Mesh Gems 04
TH-6
MG-TETRA HPC API Manual
CONTENTS Release 2.10
10401
Pantone Pantone Pantone
306 C Process Blue 294 C
Date : 14/04/2011
Name : 10401 Logo Mesh Gems 04
Contents
Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1 Introduction 11
2 Getting started 13
2.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.1.1 Content of the distribution directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.1.2 Dynamic libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.1.3 Include files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.1.4 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2.1 Supported platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2.2 Disk Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2.3 CPU time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2.4 Memory usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.3 Errors and diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.4 Coupling with other Distene tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.5 Integration within third party products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
TH-7
API Manual MG-TETRA HPC
Release 2.10 CONTENTS
/04/2011
Pantone
Process Blue
Pantone
294 C
3.1.5 Stub system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
0401 Logo Mesh Gems 04
Appendices 41
TH-8
MG-TETRA HPC API Manual
CONTENTS Release 2.10
TH-9
API Manual MG-TETRA HPC
Release 2.10 CONTENTS
01
Pantone Pantone Pantone
306 C Process Blue 294 C
/04/2011
0401 Logo Mesh Gems 04
TH-10
MG-TETRA HPC API Manual
Release 2.10
10401
Pantone Pantone Pantone
306 C Process Blue 294 C
Date : 14/04/2011
Name : 10401 Logo Mesh Gems 04
Chapter 1
Tél. : 01 48 51 05 78 - Fax : 01 48 51 10 35 - www.ckube.fr
Introduction
This user manual describes the main features of the API of MeshGems-Tetra HPC1 2.10 version.
TH-11
API Manual MG-TETRA HPC
Release 2.10 CHAPTER 1. INTRODUCTION
01
Pantone Pantone Pantone
306 C Process Blue 294 C
/04/2011
0401 Logo Mesh Gems 04
TH-12
MG-TETRA HPC API Manual
Release 2.10
10401
Pantone Pantone Pantone
306 C Process Blue 294 C
Date : 14/04/2011
Name : 10401 Logo Mesh Gems 04
Chapter 2
Tél. : 01 48 51 05 78 - Fax : 01 48 51 10 35 - www.ckube.fr
Getting started
2.1 Installation
Docs: mg-tetra hpc user manual.pdf the MeshGems-Tetra HPC user manual and mg-tetra hpc api manual.pdf
the API MeshGems-Tetra HPC user manual.
bin : the executable versions of MeshGems-Tetra HPC. They are organized by architecture in sub-directories.
See the MeshGems-Tetra HPC user manual for more information.
include : the include files (C headers) associated to the dynamic libraries contained in the lib directory.
lib : the dynamic libraries of MeshGems-Tetra HPC. They are organized by architecture in sub-directories.
stubs : the source file of the stub system provided by the MeshGems
R
Suite API (see 3.1.5).
templates : templates that show how to use and integrate the component.
Dynamic libraries are provided for various systems. Each sub-directory of the lib directory is dedicated to
a target architecture and contains :
• the files for the dynamic library (*.so or *.dll for example),
• a short text file readme.txt that describes the compiling environment or special options we used to
generate the dynamic library.
The dynamic libraries needed to use MeshGems-Tetra HPC are mg-tetra hpc.*, meshgems.* and meshgems stubs.*.
The name of a target architecture is self-explanatory. By default the target is a 32bit architecture while the
64 bit versions have the 64 suffix. For example Linux is the 32 bit target while Linux 64 is the 64 bit one.
TH-13
API Manual MG-TETRA HPC
Release 2.10 CHAPTER 2. GETTING STARTED
The include files are gathered in the include/meshgems directory. This whole directory should be kept as
is.
01
Pantone
306 C
Pantone
Process Blue
Pantone
294 C
To compile a code with MeshGems-Tetra HPC you have to make sure that your compiler is able to find the
/04/2011
0401 Logo Mesh Gems 04
extern "C" {
#include <meshgems/meshgems.h>
#include <meshgems/tetra hpc.h>
}
2.1.4 Examples
Each example is provided under source form and may require some data. They produce a .mesh file.
2.2 Requirements
MeshGems-Tetra HPC multithread version is currently available on Windows 7 and Linux architectures,
both 32 and 64 bits. MeshGems-Tetra HPC distributed version is on the other hand only available on Linux
architectures, both 32 and 64 bits.
The disk space requirement for this tool installation is about 15 MB per platform.
The CPU time much depends on the input mesh. It can vary from less than a second to several minutes.
TH-14
MG-TETRA HPC API Manual
2.5. INTEGRATION WITHIN THIRD PARTY PRODUCTS Release 2.10
• CADSurf for the generation of the surface meshes needed by Tetra HPC
• Cleaner for the correction of the input surface meshes, if they contain errors preventing Tetra HPC
from getting a correct input mesh
10401
Date : 14/04/2011
Name : 10401 Logo Mesh Gems 04
• Adapt for the local control and remeshing of meshes produced by Tetra HPC 11, rue des Grandes Cultures - 93100 MONTREUIL
Tél. : 01 48 51 05 78 - Fax : 01 48 51 10 35 - www.ckube.fr
TH-15
API Manual MG-TETRA HPC
Release 2.10 CHAPTER 2. GETTING STARTED
01
Pantone Pantone Pantone
306 C Process Blue 294 C
/04/2011
0401 Logo Mesh Gems 04
TH-16
MG-TETRA HPC API Manual
Release 2.10
10401
Pantone Pantone Pantone
306 C Process Blue 294 C
Date : 14/04/2011
Name : 10401 Logo Mesh Gems 04
Chapter 3
Tél. : 01 48 51 05 78 - Fax : 01 48 51 10 35 - www.ckube.fr
To communicate with the user environment, MeshGems-Tetra HPC uses the general MeshGems
R
API.
The meshing and processing functions can then be accessed through a MeshGems-Tetra HPC session object
(see 3.1.2) that was associated to these inputs.
As output, a MeshGems-Tetra HPC session generates a mesh which is stored in an abstract structure de-
scribed in section 3.7.
The API is fully written in C language, following an object oriented approach. For the sake of compatibility
and code safety, the only way to manipulate an API object is through its given functions. Every object
provides at least a constructor and a destructor (with respectively a new and delete suffix).
Each function, except constructors and destructors, returns a status code of type status t. In case of
success, the returned value is STATUS OK.
Every object is attached to a parent one at construction time. The root object being the global context of
type context t.
All the MeshGems
R
functions, types, macros and constants are prefixed with meshgems . The equivalent
short names (i.e. without the meshgems prefix) are also automatically defined in the MeshGems
R
headers
using #define macros.
We will either use the long or the short names in this documentation.
All the symbols exported by the MeshGems
R
dynamic libraries are prefixed with meshgems .
3.1.2.1 Construction/Destruction
TH-17
API Manual MG-TETRA HPC
Release 2.10 CHAPTER 3. MESHGEMS-TETRA HPC’S INTEGRATION
context_t *context_new(void)
void context_delete(context_t *ctx)
/04/2011
0401 Logo Mesh Gems 04
where
A message object (of type message t) is an abstract object representing a message from MeshGems-
Tetra HPC to the user. It contains :
• a number: an integer which is negative for an error, positive for a warning/information and null for
an unstructured text message.
• a description: a char* string containing the text describing the message.
Such an object is always constructed and destructed by MeshGems-Tetra HPC itself. The user is provided
with functions to interrogate it. The following functions extract respectively the number (codenumber) and
the description (desc) of a given message :
Note : The char * set by message get description shall not be freed by the user.
where
TH-18
MG-TETRA HPC API Manual
3.1. SHORT DESCRIPTION OF THE APPLICATION PROGRAMMING INTERFACE Release 2.10
it sends it to the user through a message callback function of type message callback t (see 3.1.3.2). By
Date : 14/04/2011
Name : 10401 Logo Mesh Gems 04
default this message callback prints the message to standard output but one can override this behaviour by
11, rue des Grandes Cultures - 93100 MONTREUIL
Tél. : 01 48 51 05 78 - Fax : 01 48 51 10 35 - www.ckube.fr
providing the context a new message callback, with the following function:
We provide here is an example of message callback to parse the warning/error messages generated by
MeshGems-Tetra HPC :
return STATUS_OK;
}
TH-19
API Manual MG-TETRA HPC
Release 2.10 CHAPTER 3. MESHGEMS-TETRA HPC’S INTEGRATION
01
3.1.5 Stub system
Pantone Pantone Pantone
306 C Process Blue 294 C
/04/2011
0401 Logo Mesh Gems 04
The file stubs/meshgems stubs.c defines the implementation of the functions that can be replaced.
The integrator can modify this meshgems stubs.c file for his needs. This file has then to be recompiled into
a dynamic stubs implementation library 1 .
This dynamic library shall replace the existing one provided with MeshGems
R
dynamic libraries.
The MeshGems-Tetra HPC library is thread safe and can be called in a multi-threaded environment. However
some limitations still exist in the MeshGems
R
Suite for the moment :
• The context t object is not fully thread safe. It is thus recommended to create one context t object
per calling thread.
• The DLIM license management system (using .key files or a license server) is not thread safe. If you
want to work in a multi-threaded calling environment, please use the OEM license management system.
• The routines mesh write mesh() and mesh new read mesh() designed to handle the .mesh[b] files
are not thread safe and should only be used sequentially.
A MeshGems-Tetra HPC session object (of type meshgems tetra hpc session t) is an object describing a
MeshGems-Tetra HPC run. It makes the link between the input mesh and parameters, the meshing process
and the resulting mesh recovery.
1 see the Readme stubs.txt in the stubs directory
TH-20
MG-TETRA HPC API Manual
3.2. MESHGEMS-TETRA HPC’S SESSION Release 2.10
3.2.1 Construction/Destruction
The following constructor creates a new meshgems tetra hpc session t object associated to the given
context:
10401
Pantone Pantone Pantone
306 C Process Blue 294 C
A meshgems tetra hpc session t object shall be destructed by a call to its destructor:
status_t meshgems tetra hpc_set_param(meshgems tetra hpc_session_t *ts, const char *option_name,
const char *option_value)
where
In a session, the message callback provided by the associated context (see 3.1.2.2) can be overridden through
the following call :
where
While the MeshGems-Tetra HPC session is generating a mesh or doing a complex operation, the user might
want to stop the computation. For this purpose MeshGems-Tetra HPC regularly interrogates a user provided
interrupt callback.
The prototype of an interrupt callback is given by the type :
TH-21
API Manual MG-TETRA HPC
Release 2.10 CHAPTER 3. MESHGEMS-TETRA HPC’S INTEGRATION
where
• interrupt status (input/output) is a pointer to an integer the user has to set to either INTERRUPT STOP
01
(stop the current computation) or INTERRUPT CONTINUE (continue the current computation).
Pantone Pantone Pantone
306 C Process Blue 294 C
/04/2011
0401 Logo Mesh Gems 04
• user data (input) is the generic user pointer associated to the working interrupt callback.
11, rue des Grandes Cultures - 93100 MONTREUIL
Tél. : 01 48 51 05 78 - Fax : 01 48 51 10 35 - www.ckube.fr
By default, an interrupt callback that never asks to stop the computation is provided, but one can override
it with the following call :
where
• user data (input) is a user pointer the callback function will be given as last parameter when called.
The input mesh of a session can be set with the following function:
where
• m (input) is the given input mesh (see 3.7 for the mesh t structure). It can be a surface mesh (made
of vertices, edges and triangles) or a volume mesh (made of vertices, edges, triangles and tetrahedra).
An optional continous size specification callback can be given to a session with the following function:
where
• s (input) is the given sizemap (see 3.4 for information on the sizemap t structure).
Please note that this functionality may require an optional license feature.
TH-22
MG-TETRA HPC API Manual
3.2. MESHGEMS-TETRA HPC’S SESSION Release 2.10
An optional tetrahedron quality callback can be given to a session with the following function:
10401
Date : 14/04/2011
where
/**
* Type for a user callback function for computing the quality of a
* tetrahedron, given the coordinates of its vertices and a metric.
*
* For an oriented tetrahedron given by the coordinates of its
* vertices xyz1, xyz2, xyz3 and xyz4, this function returns
* its quality in the metric given by metric. The resulting quality is
* a real number between 0. (worst quality) and 1. (perfect quality)
*
* @param[in] xyz1 : a real[3] array with the coordinates of the 1st tetrahedron vertex
* @param[in] xyz2 : a real[3] array with the coordinates of the 2nd tetrahedron vertex
* @param[in] xyz3 : a real[3] array with the coordinates of the 3rd tetrahedron vertex
* @param[in] xyz4 : a real[3] array with the coordinates of the 4th tetrahedron vertex
* @param[in] metric : a real[6] array with the metric to be considered. If NULL,
* there is no metric to consider (we are in an isotropic situation).
* @param[in] volume : a real containing the (already known) volume of the tetrahedron
* in the metric
* @param[in] user_data : a user pointer.
*
* @retval the computed quality between 0. (worst quality) and 1. (perfect quality).
*/
typedef real (tetra_hpc_tetrahedron_quality_callback_t)(real xyz1[3], real xyz2[3],
real xyz3[3], real xyz4[3],
real metric[6], real volume,
void *user_data);
TH-23
API Manual MG-TETRA HPC
Release 2.10 CHAPTER 3. MESHGEMS-TETRA HPC’S INTEGRATION
return q;
}
It is guaranteed that the quality (as defined by the user provided tetrahedron quality callback) of the
generated volume mesh will be equal or better than the one which would have been generated if the callback
had not been provided.
3.2.8 Meshing
When all the input parameters are set in the session, the mesh can be generated by calling the following
function:
where
The mesh structure resulting from the previous meshing step can be recovered with :
where
TH-24
MG-TETRA HPC API Manual
3.3. MESHGEMS-TETRA HPC’S PARAMETERS Release 2.10
The section 3.7 explains how to extract the mesh elements from this abstract structure. It shall be released
by the user and given back to the session afterward with :
Date : 14/04/2011
Name : 10401 Logo Mesh Gems 04
3.3 MeshGems-Tetra HPC’s parameters 11, rue des Grandes Cultures - 93100 MONTREUIL
Tél. : 01 48 51 05 78 - Fax : 01 48 51 10 35 - www.ckube.fr
The array 3.1 gives a list of all MeshGems-Tetra HPC parameters, with their name, type, default value and
where they are described in this document. The most significant and important ones are indicated by a
diamond-shaped sign (♦).
In this array, diag is the length of the diagonal of the box bounding the object.
• components: Sets the desired set of components to be meshed. Possible values are:
– all: all the volume components will be meshed.
– outside components: only the outermost components will be meshed.
Default value is all.
• gradation: Sets the desired maximum ratio between 2 adjacent tetrahedra edges. The closer it is to
”1”, the more uniform the mesh will be. Default value is ”1.05”
• internal points: Sets whether to insert internal vertices inside the volume or not. Default value is
yes.
TH-25
API Manual MG-TETRA HPC
Release 2.10 CHAPTER 3. MESHGEMS-TETRA HPC’S INTEGRATION
• max number of threads: Sets the maximum number of computing threads to launch for the meshing
process. Default value is ”4”.
• max edge length: Sets the maximum edge length for the generated volume mesh. Default value is
01 ”0”, meaning that there is no maximum edge length.
Pantone Pantone Pantone
306 C Process Blue 294 C
/04/2011
0401 Logo Mesh Gems 04
• metric: Sets the type of metric governing the mesh generation. Possible values are :
• min edge length: Sets the minimum edge length for the generated volume mesh. Default value is ”0”,
meaning that there is no minimum edge length.
item min size: Sets the desired minimum cell size for the generated volume mesh. This will drive the
minimum edge length but does imply that all volume edges will respect this minimum size (see also
3.3.2). Default value is ”0”, meaning that there is no minimum size.
• number of subdomains: Sets the desired number of parallel subdomains. This parameter only exists
for the shared memory version. Default value is ”0”, meaning that this value will be automatically
determined.
• optimisation: Sets whether to optimise mesh quality or not. Default value is ”yes”, meaning that
some time will be spent to optimise the resulting volume mesh quality.
• optimisation level: Sets the desired optimisation level regarding mesh quality. Possible values are,
in increasing order of quality versus speed ratio :
– light
– standard
– strong
The default value is standard. The optimisation levels are strictly incremental. It means that for a
given input mesh, increasing the optimisation level can only lead to equal or better quality for the
generated output mesh.
• parallel strategy: Sets the desired parallel strategy, influencing the level of reproducibility of the
result and the potential performances. Possible values for strategy are (in decreasing order for
reproducibility and increasing order for performances):
• split overconstrained edges: Sets whether to split over-constrained edges or not. An edge is
considered as overconstrained when it connects two surface vertices but does not belong to the surface.
Default value is no.
TH-26
MG-TETRA HPC API Manual
3.4. SIZEMAP STRUCTURE Release 2.10
• split overconstrained elements: Sets whether to split over-constrained elements or not. An ele-
ment is considered as overconstrained when at least two of its faces belong to the surface or when
at least one of its edges connects two surface vertices but does not belong to the surface. Default
value is no. Activating this option is equivalent to activating both split overconstrained edges
10401
and split overconstrained tetrahedra. Pantone
306 C
Pantone
Process Blue
Pantone
294 C
Date : 14/04/2011
tetrahedra is considered as overconstrained when at least two of its faces belong to the surface. Default
value is no.
• verbose: This parameter changes the verbosity level of MeshGems-Tetra HPC, between 0 and 10.
The higher it is, the more messages MeshGems-Tetra HPC will send through the message callback.
Default is 3.
• volume proximity layers: This parameter sets the desired minimum number of tetrahedra layers
inside the volume. Default is 0 (no minimum).
• sizemap iso 3d t,
• sizemap aniso 3d t
a structured sizemap object on the XYZ space can be created using the following constructor:
where :
• user data is a user pointer the corresponding size function will be given as last parameter when called.
a structured sizemap object on mesh vertices can be created using the following constructor:
TH-27
API Manual MG-TETRA HPC
Release 2.10 CHAPTER 3. MESHGEMS-TETRA HPC’S INTEGRATION
where :
/04/2011
0401 Logo Mesh Gems 04
• user data is a user pointer the corresponding size function will be given as last parameter when called.
For instance, an isotropic continuous sizemap object for MeshGems-Tetra HPC can be created with the
following call:
status t sizemap iso fun(real *xyz, real *size, void *user data){
your user data type your user data = (your user data type) user_data;
if(xyz[1] <= 50 )
*size = 5;
else
*size = 40;
where:
• xyz (input) is a real[3] array containing the coordinates of the point for which the size is being requested.
• size (output) is a real representing the size we request for the given xyz.
• user data (input) is the pointer you choose to provide as last paramter in the sizemap new() call.
One can also request an anisotropic mesh by setting the “metric” parameter to “anisotropic” and using a
sizemap aniso 3d t callback function.
An anisotropic metric at a point P is defined by a matrix (M ) 3x3 symmetric and positive-definite. The six
reals array metric to be filled in the sizemap aniso 3d t is defined by :
• metric[0] = M11
• metric[1] = M12
• metric[2] = M22
• metric[3] = M13
• metric[4] = M23
TH-28
MG-TETRA HPC API Manual
3.5. SIZEMAP CREATOR STRUCTURE Release 2.10
• metric[5] = M33
This anisotropic metric is used to determine the desired element size in all directions. MeshGems-Tetra HPC
(and all the components of the MeshGems Suite) assumes that the eigen values of this matrix give the square
10401
inverse of the desired lengths and the eigen vectors give the directions. Pantone
306 C
Pantone
Process Blue
Pantone
294 C
Date : 14/04/2011
Name : 10401 Logo Mesh Gems 04
For example if one wants the edges around a node to be : 11, rue des Grandes Cultures - 93100 MONTREUIL
Tél. : 01 48 51 05 78 - Fax : 01 48 51 10 35 - www.ckube.fr
then the user should write the following data for the desired point P in the callback of the anisotropic sizemap
1 1 1
: 2×2 , 0, 10×10 , 0, 0, 10×10 .
3.5.1 Construction/Destruction
Where:
• parent (input) is the associated parent object the sizemap creator is made for : only a context t for
now.
– meshgems sizemap creator type iso 3d to create an isotropic 3d sizemap using the sizemap
creator.
– meshgems sizemap creator type aniso 3d to create an anisotropic 3d sizemap using the sizemap
creator.
• xyz min[3] (input) are the coordinates of the minimum point of the bounding box of the geometry.
• xyz max[3] (input) are the coordinates of the maximum point of the bounding box of the geometry.
TH-29
API Manual MG-TETRA HPC
Release 2.10 CHAPTER 3. MESHGEMS-TETRA HPC’S INTEGRATION
Once created, one can add some constraints in the sizemap creator. We list below all the constraints currently
available in the sizemap creator object.
01
Pantone
306 C
Pantone
Process Blue
Pantone
294 C
The first constraint is related to the default size to be used. This size will be used for each point which does
/04/2011
0401 Logo Mesh Gems 04
Where:
The second constraint can be used to specify a gradation in the resulting 3d sizemap. We give here its
prototype :
Where:
A size at a given point coordinates can be specified using the following constraint function :
Where:
It is also possible to specify a size inside a sphere using the following constraint function :
TH-30
MG-TETRA HPC API Manual
3.5. SIZEMAP CREATOR STRUCTURE Release 2.10
Where:
10401
Pantone Pantone Pantone
306 C Process Blue 294 C
Date : 14/04/2011
• sc (input) is the working sizemap creator object Name : 10401 Logo Mesh Gems 04
It is also possible to specify a size inside a non twisted hexahedron. This can be done by calling the following
function :
Where:
Last, one can specify a size inside a cylinder using the following function :
Where:
TH-31
API Manual MG-TETRA HPC
Release 2.10 CHAPTER 3. MESHGEMS-TETRA HPC’S INTEGRATION
01
• p2[3] (input) are the coordinates of the second point of the cylinder axis
Pantone Pantone Pantone
306 C Process Blue 294 C
/04/2011
0401 Logo Mesh Gems 04
• radius (input) is the radius of the cylinder
11, rue des Grandes Cultures - 93100 MONTREUIL
Tél. : 01 48 51 05 78 - Fax : 01 48 51 10 35 - www.ckube.fr
All these constraints (expect the default size setting) can be added several times.
Once all the constraints specified, the associated 3d sizemap t can be created using the following function :
Where:
The type of the created sizemap will be meshgems sizemap type iso 3d.
The resulting sizemap respects the following properties :
• For each point outside of each constraint, the returned size is the default one.
• If a point belongs to several constraints, the associated size is defined by the minimum size on each of
these constraints.
• It’s destruction is on the responsibility of the user, using the function sizemap delete.
status t mesh get tetrahedron extra vertices(mesh t *msh, integer itetra, integer *type,
integer *evtetra);
where
TH-32
MG-TETRA HPC API Manual
3.7. MESH STRUCTURE Release 2.10
Date : 14/04/2011
Name : 10401 Logo Mesh Gems 04
status t mesh get triangle extra vertices(mesh t *msh, integer itri, integer *typetri,
integer *evtri);
The user can leave to the API the responsibility to allocate and free a buffer that will be able to hold the
extra nodes for any kind of element generated by MeshGems-Tetra HPC:
The order used by MeshGems-Tetra HPC to enumerate the extra vertices for a triangle or a tetrahedra is
presented on the figure 3.2.
• a file reader; or
• a memory repository.
Depending on the case at hand (see above), a mesh t object simply keeps track of which method implemen-
tation should be called for each of the available mesh methods.
TH-33
API Manual MG-TETRA HPC
Release 2.10 CHAPTER 3. MESHGEMS-TETRA HPC’S INTEGRATION
A mesh is described by an object of type mesh t. The basic functions to manipulate this object are:
01
Pantone
306 C
Pantone
Process Blue
Pantone
294 C • mesh t *mesh new(context t *ctx) : constructs a mesh object and associates it to the given context
/04/2011
0401 Logo Mesh Gems 04
mesh_t *msh;
One can access the mesh vertices, edges, triangles and tetrahedra through the following functions:
If the generated mesh has high order elements, one can access them through the following functions:
The subdomain definition for the generated tetrahedra can be accessed through the following functions (more
details on this topic can be found in 3.8):
TH-34
MG-TETRA HPC API Manual
3.7. MESH STRUCTURE Release 2.10
mesh_get_vertex_count(msh, &nv);
cout << "There are "<< nv << " vertices in the mesh" << endl;
for (i=1;i<=nv;i++){
mesh_get_vertex_coordinates(msh, i, x);
mesh_get_vertex_tag(msh, i, &tag);
TH-35
API Manual MG-TETRA HPC
Release 2.10 CHAPTER 3. MESHGEMS-TETRA HPC’S INTEGRATION
mesh_get_subdomain_count(msh, &nsub);
cout << "There are "<< nsub << " subdomains in the mesh" << endl;
for (i=1;i<=nsub;i++) {
mesh_get_subdomain_description(msh, i, &subdomain_tag, &seed_type,
&seed_idx, &seed_orientation);
cout << "Subdomain "<< i << " tag is : " << subdomain_tag << endl;
cout << "Subdomain "<< i << " seed type is : " << seed_type << endl;
cout << "Subdomain "<< i << " seed index is : " << seed_idx << endl;
cout << "Subdomain "<< i << " seed orientation is : " << seed_orientation << endl;
}
The mesh object can contain a description of the volume subdomains. This description links for each
subdomain a tag of volume elements to a volume subdomain defined by a seed face.
For exemple, in a mesh m generated by MeshGems-Tetra HPC, the subdomain description will provide the
information that the tetrahedra with a tag equal to t fill the volume defined by the i-th triangle of the mesh
(which can be accessed through the mesh get triangle vertices(m,i,...) function) considered either in
TH-36
MG-TETRA HPC API Manual
3.8. THE SUBDOMAIN DESCRIPTION Release 2.10
10401
Date : 14/04/2011
Name : 10401 Logo Mesh Gems 04
The number of subdomains in a mesh can be retrieved with the following function :
where
After retrieving the number of subdomains in the mesh, it is possible to retrieve the description of each
subdomain with the following function :
where
• seed type (output) is the subdomain seed element type : MESH ELEMENT TYPE TRIA3 for a
triangle.
• seed idx (output) is the index of the seed element for the subdomain in the table of the elements of
type seed type.
• seed orientation (output) is the orientation of the subdomain seed : the normal is assumed to
point toward the outside of the subdomain. Value can be MESH ORIENTATION FORWARD or
MESH ORIENTATION REVERSE.
TH-37
API Manual MG-TETRA HPC
Release 2.10 CHAPTER 3. MESHGEMS-TETRA HPC’S INTEGRATION
01
Pantone Pantone Pantone
306 C Process Blue 294 C
/04/2011
0401 Logo Mesh Gems 04
TH-38
MG-TETRA HPC API Manual
3.8. THE SUBDOMAIN DESCRIPTION Release 2.10
10401
Pantone Pantone Pantone
306 C Process Blue 294 C
Date : 14/04/2011
Name : 10401 Logo Mesh Gems 04
Appendices
TH-39
MG-TETRA HPC API Manual
Release 2.10
10401
Pantone Pantone Pantone
306 C Process Blue 294 C
Date : 14/04/2011
Name : 10401 Logo Mesh Gems 04
Appendix A
Tél. : 01 48 51 05 78 - Fax : 01 48 51 10 35 - www.ckube.fr
TH-41
API Manual MG-TETRA HPC
Release 2.10 APPENDIX A. MESHGEMS-TETRA HPC’S INTEGRATION TEMPLATE
/04/2011
51
0401 Logo Mesh Gems 04
TH-42
MG-TETRA HPC API Manual
Release 2.10
112 int j ;
113 y o u r _ i n t e r n a l _ d a t a _ t * mm = ( y o u r _ i n t e r n a l _ d a t a _ t *) user_data ;
114
115 for ( j = 0; j < 3; j ++)
116 vtri [ j ] = 0; /* the j ’ th vertex index of the itri ’ th triangle */
10401
117 Pantone Pantone Pantone
306 C Process Blue 294 C
120
121 /**
122 * Implementation of how the required status of a mesh vertex is obtained .
123 * @param [ in ] ivtx : index of the desired vertex from 1 to nbvtx
124 * @param [ out ] rvtx : integer [1] containing the required status (0 or 1) of the
vertex
125 * @param [ in ] user_data : a user pointer .
126 * @return error code
127 */
128 status_t m g t m _ g e t _ v e r t e x _ r e q u i r e d _ p r o p e r t y ( integer ivtx , integer * rvtx ,
129 void * user_data ) {
130 y o u r _ i n t e r n a l _ d a t a _ t * mm = ( y o u r _ i n t e r n a l _ d a t a _ t *) user_data ;
131
132 * rvtx = 0; /* the ivtx ’ th vertex required property : 1 if the vertex is required or
0 if it is not */
133
134 return STATUS_OK ;
135 }
136
137 /**
138 * This is the message callback function that Tetra_HPC will call when
139 * it wants to send a message to the caller
140 * see meshgems / message . h for more details .
141 *
142 * @param [ in ] msg : the message
143 * @param [ in ] user_data : a user pointer .
144 * @return an error code
145 */
146 status_t my_message_cb ( message_t * msg , void * user_data ) {
147 char * desc ;
148 integer e , ibuff [6];
149 real rbuff [3];
150
151 m e s s a g e _ g e t _ d e s c r i p t i o n ( msg , & desc ) ;
152 m e s s a g e _g e t _ n u m b e r ( msg , & e ) ;
153
154 if ( e == M E S H G E M S _ T E T R A _ H P C _ C O D E ( -8411) ) {
155 /* This is the error 8411 related to unrecovered
156 * required vertex .
157 * Get the associated integer data
158 */
159 m e s s a g e _ g e t _ i n t e g e r _ d a t a ( msg , 1 , 1 , ibuff ) ;
160 printf (" Missing required vertex : % i \ n " , ibuff [0]) ;
161 } else if ( e == M E S H G E M S _ T E T R A _ H P C _ C O D E ( -8441) ) {
162 /* This is the error 8441 related to unrecovered edges .
163 * Get the associated integer data [1..2]
164 */
165 m e s s a g e _ g e t _ i n t e g e r _ d a t a ( msg , 1 , 2 , ibuff ) ;
166 printf (" Missing required edge : % i % i \ n " , ibuff [0] , ibuff [1]) ;
167 } else if ( e == M E S H G E M S _ T E T R A _ H P C _ C O D E ( -8423) ) {
168 /* This is the error 8423 related to unrecovered faces .
169 * Get the associated integer data [1..3]
170 */
171 m e s s a g e _ g e t _ i n t e g e r _ d a t a ( msg , 1 , 3 , ibuff ) ;
172 printf (" Missing required face : % i % i % i \ n " , ibuff [0] , ibuff [1] , ibuff [2]) ;
173 } else {
174 /* No specific handler for this message . Just print its description */
175 printf (" Message (% i ) : % s " , e , desc ) ;
176 }
TH-43
API Manual MG-TETRA HPC
Release 2.10 APPENDIX A. MESHGEMS-TETRA HPC’S INTEGRATION TEMPLATE
177
178 return STATUS_OK ;
179 }
180
181 status_t s e t _ t e t r a _ h p c _ p a r a m e t e r s ( t e t r a _ h p c _ s e s s i o n _ t * ts ) {
01
Pantone Pantone Pantone
182 status_t ret ;
306 C Process Blue 294 C
/04/2011
183
0401 Logo Mesh Gems 04
TH-44
MG-TETRA HPC API Manual
Release 2.10
251 R E T U R N _ W I T H _ M E S S A G E ( ret , " internal error ") ; Name : 10401 Logo Mesh Gems 04
252
253 /*
254 * Create the mesh_t structure holding the callbacks giving acces to your mesh data
in
255 * y ou r _ i n t e r n a l _ d at a
256 */
257 input_mesh = mesh_new ( ctx ) ;
258 if (! input_mesh )
259 R E T U R N _ W I T H _ M E S S A G E ( STATUS_NOMEM , " unable to create a new mesh ") ;
260
261 /*
262 * Set the mesh_t callback functions that will query y o u r _ i n t e r n a l _ d a t a structure :
263 * see meshgems / mesh . h for detailed function prototypes .
264 */
265
266 ret = m e s h _ s e t _ g e t _ v e r t e x _ c o u n t ( input_mesh , mgtm_get_vertex_count ,
267 your_internal_data );
268 if ( ret != STATUS_OK )
269 R E T U R N _ W I T H _ M E S S A G E ( ret , " internal error ") ;
270
271 ret = m e s h _ s e t _ g e t _ v e r t e x _ c o o r d i n a t e s ( input_mesh , m gtm_ge t_ver tex_c oordi nates ,
272 your_internal_data );
273 if ( ret != STATUS_OK )
274 R E T U R N _ W I T H _ M E S S A G E ( ret , " internal error ") ;
275
276 ret = m e s h _ s e t _ g e t _ v e r t e x _ r e q u i r e d _ p r o p e r t y ( input_mesh ,
277 mgtm_get_vertex_required_property ,
278 your_internal_data );
279 if ( ret != STATUS_OK )
280 R E T U R N _ W I T H _ M E S S A G E ( ret , " internal error ") ;
281
282 ret = m e s h _ s e t _ g e t _ e d g e _ c o u n t ( input_mesh , mgtm_get_edge_count ,
283 your_internal_data );
284 if ( ret != STATUS_OK )
285 R E T U R N _ W I T H _ M E S S A G E ( ret , " internal error ") ;
286
287 ret = m e s h _ s e t _ g e t _ e d g e _ v e r t i c e s ( input_mesh , mgtm_get_edge_vertices ,
288 your_internal_data );
289 if ( ret != STATUS_OK )
290 R E T U R N _ W I T H _ M E S S A G E ( ret , " internal error ") ;
291
292 ret = m e s h _ s e t _ g e t _ t r i a n g l e _ c o u n t ( input_mesh , mgtm_get_triangle_count ,
293 your_internal_data );
294 if ( ret != STATUS_OK )
295 R E T U R N _ W I T H _ M E S S A G E ( ret , " internal error ") ;
296
297 ret = m e s h _ s e t _ g e t _ t r i a n g l e _ v e r t i c e s ( input_mesh , mgtm_get_triangle_vertices ,
298 your_internal_data );
299 if ( ret != STATUS_OK )
300 R E T U R N _ W I T H _ M E S S A G E ( ret , " internal error ") ;
301
302 if (0) {
303 /*
304 * Display some statistics about the surface mesh .
305 * The data is sent formated to the context message callback
306 * For debugging purposes
307 */
308 m e s h _ c o m p u t e _ s t a t i s t i c s ( input_mesh ) ;
309 }
TH-45
API Manual MG-TETRA HPC
Release 2.10 APPENDIX A. MESHGEMS-TETRA HPC’S INTEGRATION TEMPLATE
310 # ifdef _ _ M E S H G E M S _ P R I V K E Y _ H _ _
311 /* If you are an OEM customer for Tetra_HPC , this will sign the mesh object with
312 * your private key ( else Tetra_HPC would reject it ) */
313 ret = sign_mesh ( input_mesh ) ;
314 if ( ret != STATUS_OK )
01
Pantone Pantone Pantone
315 R E T U R N _ W I T H _ M E S S A G E ( ret , " unable to sign input mesh ") ;
306 C Process Blue 294 C
/04/2011
316 # endif
0401 Logo Mesh Gems 04
TH-46
MG-TETRA HPC API Manual
Release 2.10
377 }
378
379 /* Then get all the tetrahedra and compute some statistics on their aspect ratio */
380
381 qmin = REAL_INFINITY ;
10401
382 qmax = - REAL_INFINITY ; Pantone Pantone Pantone
306 C Process Blue 294 C
384 for ( i = 1; i <= ntm ; i ++) { Name : 10401 Logo Mesh Gems 04
TH-47
API Manual MG-TETRA HPC
Release 2.10 APPENDIX A. MESHGEMS-TETRA HPC’S INTEGRATION TEMPLATE
444 /*
445 * We can also directly write a . mesh formated file and a . sol formated file for the
sizemap :
446 */
447
01
Pantone Pantone Pantone
448 fprintf ( stdout , " Writing volume mesh in tetra_hpc . mesh file \ n ") ;
306 C Process Blue 294 C
/04/2011
449 ret = mesh_write_mesh ( output_mesh , " tetra_hpc . mesh ") ;
0401 Logo Mesh Gems 04
TH-48
MG-TETRA HPC API Manual
Release 2.10
10401
Pantone Pantone Pantone
306 C Process Blue 294 C
Date : 14/04/2011
Name : 10401 Logo Mesh Gems 04
Appendix B
Tél. : 01 48 51 05 78 - Fax : 01 48 51 10 35 - www.ckube.fr
• there are wrong data (for example the surface mesh contains elements other than edge and triangle),
• the surface is self-intersecting (at least, a surface edge intersects a surface face, an edge intersects
another edge or a face intersects another face),
• the surface mesh contains hole(s) so that the domain is not watertight and therefore the volume is not
properly defined,
• two given points at least are identical or considered as being too close to one another,
• the boundary regeneration was not performed (most of the time because the surface quality is too poor
or because incompatible face sizes occur for two faces that are very close to one another).
Remark: Most of the failures of the mesh generation algorithm are due to very poor quality surface meshes
(in terms of element aspect ratios). To prevent this type of failure, it is advised to input good quality surface
meshes to MeshGems-Tetra HPC.
TH-49
API Manual MG-TETRA HPC
Release 2.10 APPENDIX B. MESHGEMS-TETRA HPC’S DIAGNOSTICS
A non null message code number can be written as follows : code = ±(1000000 × q + r),
where 0 ≤ r < 1000000
Where q identifies the module and r identifies the diagnostic independently of the module and defines the
01
base number of the message. For a diagnostic comming from MeshGems-Tetra HPC q is equal to 9.
Pantone Pantone Pantone
306 C Process Blue 294 C
/04/2011
0401 Logo Mesh Gems 04
For example, let’s consider a message with a code number equal to -9005100. This is an error message (the
11, rue des Grandes Cultures - 93100 MONTREUIL
Tél. : 01 48 51 05 78 - Fax : 01 48 51 10 35 - www.ckube.fr
code is negative). It comes from MeshGems-Tetra HPC (q is 1), and the base number is 5100.
TH-50
MG-TETRA HPC API Manual
LIST OF FIGURES Release 2.10
10401
Pantone Pantone Pantone
306 C Process Blue 294 C
Date : 14/04/2011
Name : 10401 Logo Mesh Gems 04
TH-51
API Manual MG-TETRA HPC
Release 2.10 LIST OF FIGURES
01
Pantone Pantone Pantone
306 C Process Blue 294 C
/04/2011
0401 Logo Mesh Gems 04
TH-52