2. Mapped Mesh Generation - MapMesh, ExtMesh
CEETRON Mesh supports the creation of finite element meshes using various mapped mesh generation techniques. The MapMesh module supports basic mapped mesh generation technology in which structured grids of nodes and elements are created within the parameter space of linear, parabolic or cubic hyperpatches. The ExtMesh module supports the generation of nodes and elements extruded from a given “cross section” represented by a general unstructured mesh.
2.1. Mapped Mesh Generation - MapMesh
The MapMesh module provides simple mapped mesh generation. The basic notion is to specify a parametrically defined parent domain or patch which represents the boundaries of a 1D, 2D or 3D region in space. The coordinate system in which the patch point coordinates are expressed can be changed so that generating finite element nodes in cylindrical or spherical coordinate systems or arbitrarily oriented and positioned coordinate systems is possible. Once defined, the parent patch is subdivided at regular intervals in parameter space to generate finite elements. The number of elements in each of the parametric directions of the parent patch may be specified. The patch basis functions are currently limited to linear, parabolic and cubic Serendipity and Lagrange polynomials on line, quadrilateral and hexahedral patch topologies. This technique can generate large numbers of elements very efficiently.
The functions associated with a MapMesh object are the following.
Begin and end an instance of an object, return object error flag
msh_MapMeshBegin()
- create an instance of a MapMesh objectmsh_MapMeshEnd()
- destroy an instance of a MapMesh objectmsh_MapMeshError()
- return MapMesh object error flag
Define input patches and generate mesh
msh_MapMeshDef()
- define number of points and patchesmsh_MapMeshInq()
- inquire number of points and patchesmsh_MapMeshGenerate()
- generate finite element meshmsh_MapMeshGetInteger()
- retrieve status valuesmsh_MapMeshSetCoordSys()
- define basic coordinate system.msh_MapMeshSetPatch()
- define a patch point connectivitymsh_MapMeshSetPatchAssoc()
- set a patch associationmsh_MapMeshSetPatchParami()
- set a patch parametermsh_MapMeshSetPoint()
- define a pointmsh_MapMeshSetPointAssoc()
- set a point parametermsh_MapMeshSetParami()
- set mesh generation parametersmsh_MapMeshGetParami()
- get mesh generation parameters
Instance a MapMesh object using msh_MapMeshBegin()
.
Once a MapMesh object is instanced,
define the number of points and patches to be input using msh_MapMeshDef()
.
Define point locations using msh_MapMeshSetPoint()
and patch connectivity
using msh_MapMeshSetPatch()
.
The point coordinates defined by msh_MapMeshSetPoint()
are assumed by default
to be expressed in the global Cartesian coordinate system. However this basic
coordinate system can be changed to a cylindrical or spherical system
by defining a CoordSys object and
specifying it using msh_MapMeshSetCoordSys()
.
Use msh_MapMeshSetParami()
to define
the overall order and topology (Serendipity or Lagrange) of the finite elements
to be generated.
Use msh_MapMeshSetPatchParami()
to set the shape and the number of elements
to generate in each direction of each patch.
The user is able to define integer associations at points and patch edges
and faces which will be assigned to the node or nodes generated on the
respective entity.
These associations are useful for identifying nodes and elements
for the application of boundary conditions.
The function msh_MapMeshSetPointAssoc()
is used to set associations at
nodes generated at defined points,
while the function msh_MapMeshSetPatchAssoc()
is used to
set associations for nodes generated along the edges and faces of the parent
patch.
Finally the function msh_MapMeshGenerate()
generates the
nodes and finite elements and enters them into a Connect object.
2.2. Function Descriptions
The currently available MapMesh functions are described in detail in this section.
-
msh_MapMesh *msh_MapMeshBegin(void)
create an instance of a MapMesh object
Create an instance of a MapMesh object. Memory is allocated for the object private data and the pointer to the data is returned. The default basic coordinate system is the global Cartesian coordinate system.
Destroy an instance of a MapMesh object using
void msh_MapMeshEnd (msh_MapMesh *mapmesh)
Return the current value of a MapMesh object error flag using
Vint msh_MapMeshError (msh_MapMesh *mapmesh)
- Returns:
The function returns a pointer to the newly created MapMesh object. If the object creation fails, NULL is returned.
-
void msh_MapMeshEnd(msh_MapMesh *p)
destroy an instance of a MapMesh object
-
Vint msh_MapMeshError(msh_MapMesh *p)
return the current value of a MapMesh object error flag
-
void msh_MapMeshDef(msh_MapMesh *p, Vint numpnts, Vint numpats)
define number of points and patches
Define the number of points and patches to be defined. Define point coordinates using
msh_MapMeshSetPoint()
and patch connectivities which reference the input points usingmsh_MapMeshSetPatch()
.Inquire of defined numpnts and numpats as output arguments using
void msh_MapMeshInq (msh_MapMesh *mapmesh, Vint *numpnts, Vint *numpats)
- Errors
VIS_ERROR_VALUE
is generated if an improper numpnts or numpats is less than or equal to zero.
- Parameters:
p – Pointer to MapMesh object.
numpnts – Number of points
numpats – Number of paths
-
void msh_MapMeshInq(msh_MapMesh *p, Vint *numpnts, Vint *numpats)
inquire of defined numpnts and numpats as output arguments
See
msh_MapMeshDef()
-
void msh_MapMeshSetParami(msh_MapMesh *p, Vint ptype, Vint iparam)
set mesh generation parameters
Specify mapped mesh generation parameters. These parameters specify the number and type of finite elements to generate.
The parameter
VIS_MESH_LAGRANGE
toggles the generation of finite elements with a Lagrange or Serendipity nodal pattern. By defaultVIS_MESH_LAGRANGE
is set toVIS_OFF
.The parameter
VIS_MESH_MAXI
sets the order of the generated finite elements by specifying the number of nodes to generate along an edge. Mapped mesh generation supports linear, parabolic and cubic elements. Mapped mesh generation will only generate elements of equal order in all directions. By defaultVIS_MESH_MAXI
is set to 2.Inquire of defined integer parameters as output arguments using
void msh_MapMeshSetParami (msh_MapMesh *mapmesh, Vint ptype, Vint *iparam)
- Errors
VIS_ERROR_ENUM
is generated if an improper ptype is specified.
- Parameters:
p – Pointer to MapMesh object.
ptype – Type of mesh parameter to set
x=VIS_MESH_LAGRANGE Nodal pattern of generated elements =VIS_MESH_MAXI Order of generated elements
iparam – Specifies the integer value that ptype will be set to.
x=VIS_OFF Turn parameter off =VIS_ON Turn parameter on
-
void msh_MapMeshGetParami(msh_MapMesh *p, Vint type, Vint *iparam)
get mesh generation parameters
-
void msh_MapMeshSetPoint(msh_MapMesh *p, Vint id, Vdouble x[3])
define a point
Set a point location. The point coordinates, x are assumed to be expressed in the basic coordinate system. The basic coordinate system is specified using
msh_MapMeshSetCoordSys()
.- Errors
VIS_ERROR_VALUE
is generated if an improper id is specified.
- Parameters:
p – Pointer to MapMesh object.
id – Point id
x – Point coordinate location
-
void msh_MapMeshSetPointAssoc(msh_MapMesh *p, Vint type, Vint id, Vint aid)
set a point association
Set a point association. The association is assigned to the node generated at the point. Only an association set at a corner point in a patch is assigned to the generated node. The type of associations allowed are those accepted by the Connect module function
vis_ConnectSetNodeAssoc()
.- Errors
VIS_ERROR_ENUM
is generated if an improper type is specified.VIS_ERROR_VALUE
is generated if an improper id is specified.
- Parameters:
p – Pointer to MapMesh object.
type – Type of association
id – Point id
aid – Association
-
void msh_MapMeshSetPatch(msh_MapMesh *p, Vint id, Vint shape, Vint maxi, Vint maxj, Vint maxk, Vint pix[])
define parent patch
Specify the topology of a patch and its point connectivity. Note that all patches must be entered sequentially.
- Errors
VIS_ERROR_ENUM
is generated if an improper shape is specified.VIS_ERROR_VALUE
is generated if an improper id, maxi, maxj or maxk is specified.VIS_ERROR_OPERATION
is generated if an id is entered out of order.
- Parameters:
p – Pointer to MapMesh object.
id – Patch id
shape – Patch shape parameter
x=VIS_SHAPELINE Line =VIS_SHAPEQUAD Quadrilateral =VIS_SHAPEHEX Hexahedron
maxi – The number of points along the i direction. If maxi = 0 then the linear element form of the specified shape is assumed.
maxj – The number of points along the j direction. If maxj = 0 and 2 <= maxi <= 4, then a Serendipity finite element is assumed. If 2 <= maxj and 2 <= maxi, then a Lagrange finite element is assumed. For triangle, tetrahedron and wedge shapes, set either maxj = 0 or maxj = maxi.
maxk – The number of points along the k direction. For tetrahedron shapes, set either maxk = 0 or maxk = maxi For hexahedron and wedge shapes, set either maxk = 2 or maxk = maxi
pix – Point connectivity of patch.
-
void msh_MapMeshSetPatchParami(msh_MapMesh *p, Vint id, Vint ptype, Vint iparam)
set a patch parameter
Specify patch parameters for patch id.
The parameter
VIS_MESH_SHAPE
specifies the shape of generated elements. By defaultVIS_MESH_SHAPE
is set toVIS_SHAPELINE
.The parameters
MAPMESH_NUMELEMI
,MAPMESH_NUMELEMJ
andMAPMESH_NUMELEMK
specify the number of elements to generate in the I, J and K directions. By defaultMAPMESH_NUMELEMI
,MAPMESH_NUMELEMJ
andMAPMESH_NUMELEMK
are set to 1.- Errors
VIS_ERROR_ENUM
is generated if an improper ptype is specified.VIS_ERROR_VALUE
is generated if an improper iparam is specified.
- Parameters:
p – Pointer to MapMesh object.
id – Patch id
ptype – Type of patch parameter to set
x=VIS_MESH_SHAPE Shape of generated elements =MAPMESH_NUMELEMI Number of elements in I direction =MAPMESH_NUMELEMJ Number of elements in J direction =MAPMESH_NUMELEMK Number of elements in K direction
iparam – Specifies the integer value that ptype will be set to.
x=VIS_SHAPELINE Line =VIS_SHAPETRI Triangle =VIS_SHAPEQUAD Quadrilateral =VIS_SHAPETET Tetrahedron =VIS_SHAPEPYR Pyramid =VIS_SHAPEWED Wedge =VIS_SHAPEHEX Hexahedron
-
void msh_MapMeshSetPatchAssoc(msh_MapMesh *p, Vint type, Vint id, Vint enttype, Vint no, Vint assoc)
set parent patch associations
Set a node association for nodes generated along a patch edge or on a patch face or an element association for elements generated within a patch. If enttype is
SYS_EDGE
then node associations are assigned to all nodes generated on the specified patch edge, no. If enttype isSYS_FACE
then node associations are assigned to all nodes generated on the specified patch face, no. If enttype isSYS_ELEM
then elements associations are assigned to all elements generated within the specified patch, id. The type of associations allowed are those accepted by the Connect module functionvis_ConnectSetNodeAssoc()
.- Errors
VIS_ERROR_ENUM
is generated if an improper type or enttype is specified.VIS_ERROR_VALUE
is generated if an improper id or no is specified.
- Parameters:
p – Pointer to MapMesh object.
type – Type of association
id – Patch id
enttype – Entity type to which association is applied
=SYS_EDGE Patch edge for node association =SYS_FACE Patch face for node association =SYS_ELEM Patch for element association
no – Patch edge or face number
assoc – Association
-
void msh_MapMeshGenerate(msh_MapMesh *p, vis_Connect *connect)
retrieve status information
Generate nodes and finite elements. The generated nodes and elements are appended to any existing nodes and elements in the input Connect object.
- Errors
VIS_ERROR_OPERATION
is generated if the patch shape does not allow the generation of the specified element topology.
-
void msh_MapMeshSetCoordSys(msh_MapMesh *p, vis_CoordSys *coordsys)
define basic coordinate system.
Specify the basic coordinate system as a CoordSys object. The point locations input using
msh_MapMeshSetPoint()
are assumed to be expressed in the basic coordinate system. All angular coordinates are in degrees. If CoordSys is input as NULL, then the global Cartesian coordinate system is used. By default the basic coordinate system is the global Cartesian coordinate system.
-
void msh_MapMeshGetInteger(msh_MapMesh *p, Vint type, Vint iparam[])
retrieve status information
Query for integer mesh generation information.
The query type
VIS_MESH_PROGRESS
returns information about the current state of the meshing process. This function is most useful when called from the monitor function. The following four integer values are returned.iparam[0] Meshing phase Phase 1 - Node generation Phase 2 - Element generation Phase 3 - Cleanup iparam[1] Current number of nodes iparam[2] Current number of elements iparam[3] Estimate percent completion
- Errors
VIS_ERROR_ENUM
is generated if type is invalid.
- Parameters:
p – Pointer to MapMesh object.
type – Type of parameter to be queried
x=VIS_MESH_PROGRESS Currently generated parameters
iparam – [out] Values(s) retrieved
2.3. Extruded Mesh Generation - ExtMesh
The ExtMesh module provides for the automatic generation of nodes and elements which are formed by extruding a given cross-section mesh along a given path. The specified cross section mesh can contain any combination of point, line, triangular or quadrilateral elements. These cross section elements are then extruded to form line, quadrilateral, wedge and hexahedral elements respectively. The input cross section elements may be linear or parabolic with Serendipity or Lagrange nodal patterns. The path along which the extrusion is directed may be a connected set of linear, parabolic or cubic lines. The coordinate system in which the path point coordinates are expressed can be changed so that generating finite element nodes extruded in cylindrical or spherical coordinate systems or arbitrarily oriented and positioned coordinate systems is possible. The number of layers of elements generated along each path segment may be specified. An option is also provided to extrude nodal planes along vectors specified at each node of the cross section mesh. This is useful for generating boundary layer meshes.
The functions associated with a ExtMesh object are the following.
Begin and end an instance of an object, return object error flag
msh_ExtMeshBegin()
- create an instance of a ExtMesh objectmsh_ExtMeshEnd()
- destroy an instance of a ExtMesh objectmsh_ExtMeshError()
- return ExtMesh object error flag
Define mesh parameters and generate mesh
msh_ExtMeshAbort()
- abort mesh generationmsh_ExtMeshDef()
- define number of section nodes, elementsmsh_ExtMeshInq()
- inquire number of section nodes, elementsmsh_ExtMeshGenerate()
- generate finite element meshmsh_ExtMeshGetInteger()
- retrieve status valuesmsh_ExtMeshSetOriginTriad()
- define basic coordinate system.msh_ExtMeshSetElem()
- set a cross section elementmsh_ExtMeshSetElemAssoc()
- set a cross section element associationmsh_ExtMeshSetFunction()
- set a monitoring functionmsh_ExtMeshSetNode()
- set a cross section nodemsh_ExtMeshSetNodeAssoc()
- set a cross section node associationmsh_ExtMeshSetNodeNormal()
- set a cross section node normalmsh_ExtMeshSetNormalPath()
- set layer parameter for normal extrusionmsh_ExtMeshSetParami()
- set mesh generation parametersmsh_ExtMeshGetParami()
- get mesh generation parametersmsh_ExtMeshSetParamd()
- set mesh generation parametersmsh_ExtMeshGetParamd()
- get mesh generation parametersmsh_ExtMeshSetPath()
- define a path point connectivitymsh_ExtMeshSetPathParami()
- define a path parametersmsh_ExtMeshSetPoint()
- define a path pointmsh_ExtMeshSetPointAssoc()
- set a point associationmsh_ExtMeshWrite()
- write mesh description to filemsh_ExtMeshRead()
- read mesh description from file
Instance an ExtMesh object using msh_ExtMeshBegin()
.
Once an ExtMesh object is instanced,
define the number of nodes and elements which define the cross section mesh
using msh_ExtMeshDef()
.
The cross section mesh is then input as
a set of nodes in 3D space and a set of element connectivities.
The nodes are defined using msh_ExtMeshSetNode()
,
the element connectivities are defined using msh_ExtMeshSetElem()
.
Optional node normals are defined using msh_ExtMeshSetNodeNormal()
. Node
normals must be defined if extrusion along node normals is enabled.
Extrusion path must otherwise be defined with msh_ExtMeshSetPath()
.
Normal extrusion may be done in multiple layers. Use
msh_ExtMeshSetNormalPath()
to specify, for each layer, thickness fraction,
number of elements through the thickness, and whether a layer of interface
elements is to be added.
The user is able to define integer associations at nodes, elements,
element edges, and points
which will be assigned to the nodes, edges, faces, and elements of the
generated entities.
These associations are useful for identifying nodes and elements
for the application of boundary conditions.
Note that the nodes entered using msh_ExtMeshSetNode()
appear unchanged
in the final mesh.
The function msh_ExtMeshSetNodeAssoc()
is used to set associations at
lines of nodes extruded from specified cross section nodes,
The function msh_ExtMeshSetPointAssoc()
is used to set associations at
nodes generated on nodal planes coincident to a specified point.
The node associations are assigned before the point associations at any
generated node.
The function msh_ExtMeshSetElemAssoc()
is used to set edge or element
associations at nodes, edges, and faces on the generated entities.
Additional associations may be set using the function msh_ExtMeshSetParami()
.
If the parameters EXTMESH_FACEMARK or EXTMESH_EDGEMARK are set, then
if EXTMESH_NORMAL is not enabled, the faces or edges on the original and
final cross-sections will have the
association defined by the parameters have values of 1 and 2, respectively.
If EXTMESH_NORMAL is enabled then the associations defined by the
parameters will have values of 1, 2, 3, etc. until one plus the number of paths
defined with msh_ExtMeshSetNormalPath()
.
As an option the cross section mesh may be extruded along normals
specified at the cross section nodes. Use the
function msh_ExtMeshSetParami()
to enable normal extrusion. If normal
extrusion is enabled, then extrusion defined by a path is disabled.
An important option for use with extrusion along node vectors is
a local check to avoid creating inverted elements in areas of high convex
curvature.
Use the parameter EXTMESH_LOCALRECEDE to enable this option.
If the node vectors create
inverted elements, the extrusion distance is receded until proper
elements result. The distances extruded along neighboring vectors
are also receded to create a smoother mesh. The growth rate used to
smooth the local recession is set using the function
msh_ExtMeshSetParamd()
with the parameter EXTMESH_RECEDEGROWTHRATE.
The number of layers of elements to be extruded along each path segment
is specified using msh_ExtMeshSetPathParami()
. If extrusion along nodal
normals is selected, the number of layers is defined by the parameter
EXTMESH_NORMAL_NUMLAYERS.
An option also exists when extruding an all quad mesh to generate an
all tetrahedral mesh rather than an all hexahedral mesh.
Set this option using msh_ExtMeshSetParami()
with the
parameter EXTMESH_GENTET.
The parameter VIS_MESH_GROWTHRATE can be used to specify a growth rate from one layer to the next. If a path is employed, the growth rate only applies to the first path.
Finally the function msh_ExtMeshGenerate()
generates the
nodes and finite elements and enters them into a Connect object. The
generation process can be monitored or aborted by using
msh_ExtMeshSetFunction()
to install a monitoring function. If the
monitoring function calls msh_ExtMeshAbort()
the mesh generation is
aborted.
The function msh_ExtMeshWrite()
is provided to write a complete description
of the defined meshing parameters to a file. The primary
use of this file is to encapsulate cases
in which the ExtMesh module fails
in some respect. This output file can then be
made available to Tech Soft 3D for failure diagnosis of ExtMesh meshing
algorithms.
The following code fragment illustrates the basic framework of using the ExtMesh module to generate linear wedge finite elements extruded along a straight line from a cross section defined by a set of linear triangular elements.
/* declare objects */
msh_ExtMesh *extmesh;
vis_Connect *connect;
/* input cross section elements */
Vint numnode, numelem;
Vdouble xnode[][3] = { ... };
Vint ixelem[][3] = { ... };
Vint numpnts, numpats;
Vdouble xpath[2][3] = { ... };
Vint ixpath[2] = { 1,2 };
Vint ierr;
numpnts = 2;
numpats = 1;
/* create extmesh object */
extmesh = msh_ExtMeshBegin ();
msh_ExtMeshDef (extmesh,numnode);
/* define cross section nodes and triangle elements */
for (i = 0; i < numnode; i++) {
msh_ExtMeshSetNode (extmesh,i+1,xnode[i]);
}
for (i = 0; i < numelem; i++) {
msh_ExtMeshSetElem (extmesh,i+1,VIS_SHAPETRI,maxi,maxj,ixelem[i]);
}
/* define path points and connectivity */
for (i = 0; i < numpnts; i++) {
msh_ExtMeshSetPoint (extmesh,i+1,xpath[i]);
}
msh_ExtMeshSetPath (extmesh,2,ixpath);
/* specify 3 layers of elements */
msh_ExtMeshSetPathParami (extmesh,1,VIS_MESH_NUMELEMENTS,3);
/* create empty connect object to hold generated mesh */
connect = vis_ConnectBegin ();
vis_ConnectDef (connect,0,0);
/* generate mesh */
msh_ExtMeshGenerate (extmesh,connect);
/* process any errors */
ierr = msh_ExtMeshError (extmesh);
if(ierr) {
...
}
/* access generated nodes and elements from Connect */
...
/* delete objects */
vis_ConnectEnd (connect);
msh_ExtMeshEnd (extmesh);
2.4. Function Descriptions
The currently available ExtMesh functions are described in detail in this section.
-
msh_ExtMesh *msh_ExtMeshBegin(void)
create an instance of an ExtMesh object
Create an instance of an ExtMesh object. Memory is allocated for the object private data and the pointer to the data is returned.
Destroy an instance of a ExtMesh object using
void msh_ExtMeshEnd (msh_ExtMesh *extmesh)
Return the current value of a ExtMesh object error flag using
Vint msh_ExtMeshError (msh_ExtMesh *extmesh)
- Returns:
The function returns a pointer to the newly created ExtMesh object. If the object creation fails, NULL is returned.
-
void msh_ExtMeshEnd(msh_ExtMesh *p)
destroy an instance of an ExtMesh object
-
Vint msh_ExtMeshError(msh_ExtMesh *p)
return the current value of an ExtMesh object error flag
-
void msh_ExtMeshDef(msh_ExtMesh *p, Vint numnode, Vint numelem)
define number of section nodes, elements
Define the number of nodes and elements which define the input cross section mesh. Define node coordinates using
msh_ExtMeshSetNode()
and optional node normals usingmsh_ExtMeshSetNodeNormal()
. Define element topology and connectivities usingmsh_ExtMeshSetElem()
.Define point coordinates using
msh_ExtMeshSetPoint()
and path connectivities which reference the input points usingmsh_ExtMeshSetPath()
.Inquire of defined numnode, numelem as output arguments using
void msh_ExtMeshInq (msh_ExtMesh *extmesh, Vint *numnode, Vint *numelem)
- Errors
VIS_ERROR_VALUE
is generated if numnode, or numelem is less than or equal to zero.
- Parameters:
p – Pointer to ExtMesh object.
numnode – Number of nodes on cross section mesh
numelem – Number of elements on cross section mesh
-
void msh_ExtMeshInq(msh_ExtMesh *p, Vint *numnode, Vint *numelem)
inquire of defined numnode, numelem as output arguments
See
msh_ExtMeshDef()
-
void msh_ExtMeshSetParami(msh_ExtMesh *p, Vint ptype, Vint iparam)
set mesh generation parameters
Specify mesh generation parameters.
The parameter
EXTMESH_NORMAL
enables the extrusion of the cross section mesh along node normals specified bymsh_ExtMeshSetNodeNormal()
. If this parameter is set toSYS_ON
extrusion through a path is disabled. The magnitude of these normal vectors indicate the distance each node is extruded. By defaultEXTMESH_NORMAL
is set toSYS_OFF
.The parameter
EXTMESH_ELEMMARK
specifies the association type that will be used to tag all elements belonging to a normal path. The association values on those elements will be 1 on the first path, 2 on the second path, and so on. These associations can be retrieved from the resulting Connect module withvis_ConnectElemAssoc()
. By default these associations are not set.The parameter
EXTMESH_FACEMARK
specifies the association type that will be used to tag the faces on the first and last extrusion planes. The association values on those faces will be 1 and 2 on the first and last extrusion planes, respectively. These associations can be retrieved from the resulting Connect module withvis_ConnectAllElemEntAssoc()
with entity type set toSYS_FACE
. By default these associations are not set.The parameter
EXTMESH_EDGEMARK
specifies the association type that will be used to tag the edges on the first and last extrusion planes. The association values on those edges will be 1 and 2 on the first and last extrusion planes, respectively. These associations can be retrieved from the resulting Connect module withvis_ConnectAllElemEntAssoc()
with entity type set toSYS_EDGE
. By default these associations are not set.The parameter
EXTMESH_GLOBALRECEDE
toggles the global checking of front intersection and enabling the recession of the extrusion distance. By defaultEXTMESH_GLOBALRECEDE
is set toSYS_OFF
.The parameter
EXTMESH_LOCALRECEDE
toggles the local checking of element inversion and enabling the recession of the extrusion distance. By defaultEXTMESH_LOCALRECEDE
is set toSYS_OFF
.The parameter
EXTMESH_GENTET
toggles the generation of tetrahedron elements for pentahedron elements when extruding all triangle surfaces. By defaultEXTMESH_GENTET
is set toSYS_OFF
.The parameter
EXTMESH_REVERSE
toggles the sense of the element connectivity generated during extrusion. This option is useful when generating boundary layer extrusions into the interior of a geometry defined by a surface mesh whose connectivty sense points to the exterior of the geometry. By defaultEXTMESH_REVERSE
is set toSYS_OFF
.The parameter
EXTMESH_SMOOTHMISIDE
toggles the interpolation of the normal vector at the midside nodes. By defaultEXTMESH_SMOOTHMIDSIDE
is set toSYS_ON
.Inquire of defined integer parameters as output arguments using
void msh_ExtMeshSetParami (msh_ExtMesh *extmesh, Vint ptype, Vint *iparam)
- Errors
VIS_ERROR_ENUM
is generated if an improper ptype is specified, or if its corresponding iparam value is invalid.
- Parameters:
p – Pointer to ExtMesh object.
ptype – Type of mesh parameter to set
x=EXTMESH_EDGEMARK Extrusion plane edge associations =EXTMESH_ELEMMARK Normal path element associations =EXTMESH_FACEMARK Extrusion plane face associations =EXTMESH_GENTET Create all tet elements =EXTMESH_GLOBALRECEDE Toggle front intersection check =EXTMESH_LOCALRECEDE Toggle local element inversion check =EXTMESH_NORMAL Enable extrusion along node normals =EXTMESH_REVERSE Toggle element connectivity sense =EXTMESH_SMOOTHMIDSIDE Toggle normal vector interpolation at midside nodes
iparam – Specifies the integer value that ptype will be set to.
-
void msh_ExtMeshGetParami(msh_ExtMesh *p, Vint type, Vint *iparam)
get mesh generation parameters
-
void msh_ExtMeshSetParamd(msh_ExtMesh *p, Vint ptype, Vdouble dparam)
set mesh generation parameters
Specify mesh generation parameters. These parameters are used to control the size of the generated elements.
The parameter
VIS_MESH_GROWTHRATE
specifies a growth rate for the extruded size of element layers. If path extrusion is selected, then the growth rate is only applied to the extrusion defined by the first path. For second and subsequent paths the growth rate is unity. By defaultVIS_MESH_GROWTHRATE
is set to unity.The parameter
VIS_MESH_RECEDEGROWTHRATE
specifies a growth rate for the smoothing of local distance recession which may optionally occur when extruding along node vectors. By defaultVIS_MESH_RECEDEGROWTHRATE
is set to 1.5.Inquire of defined double precision parameters as output arguments using
void msh_ExtMeshSetParamd (msh_ExtMesh *extmesh, Vint ptype, Vdouble *dparam)
- Errors
VIS_ERROR_ENUM
is generated if an improper ptype is specified.VIS_ERROR_VALUE
is generated if an improper growth rate is specified.
- Parameters:
p – Pointer to ExtMesh object.
ptype – Type of mesh parameter to set
x=VISMESH_GROWTHRATE Growth rate =EXTMESH_RECEDEGROWTHRATE Recession Growth rate
dparam – Specifies the value that ptype will be set to.
-
void msh_ExtMeshGetParamd(msh_ExtMesh *p, Vint type, Vdouble *dparam)
get mesh generation parameters
-
void msh_ExtMeshSetNode(msh_ExtMesh *p, Vint id, Vdouble x[3])
define a node
Set a node location. The node id must be in the interval 1 <= id <= numnode where numnode is defined by
msh_ExtMeshDef()
. The coordinates, x, are always in the global coordinate system. Element connectivity is defined usingmsh_ExtMeshSetElem()
.- Errors
VIS_ERROR_VALUE
is generated if an improper id is specified.
- Parameters:
p – Pointer to ExtMesh object.
id – Node id
x – Node coordinate location
-
void msh_ExtMeshSetNodeNormal(msh_ExtMesh *p, Vint id, Vdouble v[3])
define a node normal
Set a node normal v. The node id must be in the interval 1 <= id <= numnode where numnode is defined by
msh_ExtMeshDef()
. The node normal is used as an extrusion direction if theEXTMESH_NORMAL
option is enabled usingmsh_ExtMeshSetParami()
. The distance along the length of the normal vector is added to the extrusion for each path. Therefore the direction and length of the normal vector determine the extrusion distance.- Errors
VIS_ERROR_VALUE
is generated if an improper id is specified
- Parameters:
p – Pointer to ExtMesh object.
id – Node id
v – Node normal
-
void msh_ExtMeshSetNodeAssoc(msh_ExtMesh *p, Vint type, Vint id, Vint aid)
set a node association
Set a node association. The association is assigned to all nodes and edges generated along the line of nodes extruded from the corresponding node id. Node asssociations in the resulting Connect module can be retrieved with
vis_ConnectAllNodeAssoc()
, while edge associations can be retrieved withvis_ConnectAllElemEntAssoc()
, where the entity type isSYS_EDGE
. The type of associations allowed are those accepted by the Connect module functionvis_ConnectSetNodeAssoc()
. Usemsh_ExtMeshSetPointAssoc()
to set associations to be assigned at planes of nodes.- Errors
VIS_ERROR_ENUM
is generated if an improper type is specified.VIS_ERROR_VALUE
is generated if an improper id is specified.
- Parameters:
p – Pointer to ExtMesh object.
type – Type of association
id – Node id
aid – Node association
-
void msh_ExtMeshSetElem(msh_ExtMesh *p, Vint id, Vint shape, Vint maxi, Vint maxj, Vint ix[])
define an element connectivity
Set an element connectivity. The element id must be in the interval 1 <= id <= numelem where numelem is defined by
msh_ExtMeshDef()
. The element connectivity, ix, must contain the number of points corresponding to the specified shape, maxi, and maxj values used. Only linear and parabolic elements are supported. Note that all elements must be entered sequentially.- Errors
VIS_ERROR_VALUE
is generated if an improper id is specified.VIS_ERROR_ENUM
is generated if an improper shape is specified.VIS_ERROR_OPERATION
is generated if an id is entered out of order.
- Parameters:
p – Pointer to ExtMesh object.
id – Element id
shape – Element shape
x=VIS_SHAPEPOINT Point =VIS_SHAPELINE Line =VIS_SHAPETRI Triangle =VIS_SHAPEQUAD Quadrilateral
maxi – The number of points along the i direction. If maxi = 0 then the linear element form of the specified shape is assumed.
maxj – The number of points along the j direction. If maxj = 0 and 2 <= maxi <= 3, then a Serendipity finite element is assumed. If 2 <= maxj and 2 <= maxi, then a Lagrange finite element is assumed. For triangle set either maxj = 0 or maxj = maxi.
ix – Element connectivity
-
void msh_ExtMeshSetElemAssoc(msh_ExtMesh *p, Vint type, Vint id, Vint enttype, Vint no, Vint aid)
define an element association
Set an element association. The element id must be in the interval 1 <= id <= numelem where numelem is defined by
msh_ExtMeshDef()
. no must be a number between 1 and 4. If an invalid edge number within this range is specified for the specific element then this association will be be ignored inmsh_ExtMeshGenerate()
. The association value aid must be greater than zero.SYS_EDGE
associations are assigned to all faces extruded from an edge.SYS_ELEM
associations are assigned to all elements extruded from an element.- Errors
VIS_ERROR_VALUE
is generated if an improper id or no is specified.VIS_ERROR_ENUM
is generated if an improper type or enttype is specified.
- Parameters:
p – Pointer to ExtMesh object.
type – Type of element association
enttype – Type of element entity
x=SYS_EDGE Element edge =SYS_ELEM Element
id – Element id
no – Element edge number
aid – Element association value
-
void msh_ExtMeshSetPoint(msh_ExtMesh *p, Vint id, Vdouble x[3])
define a path point
Set a path point location. The point id must be in the interval 1 <= id <= numpnts where numpnts is defined by
msh_ExtMeshDef()
. Input paths are defined usingmsh_ExtMeshSetPath()
.- Errors
VIS_ERROR_VALUE
is generated if an improper id is specified.
- Parameters:
p – Pointer to ExtMesh object.
id – Point id
x – Point coordinate location
-
void msh_ExtMeshSetPointAssoc(msh_ExtMesh *p, Vint type, Vint id, Vint aid)
set a point association
Set a point association. The association is assigned to all nodes generated on a plane of nodes corresponding to the point. Only an association set at a start or end point of the path is assigned to the generated nodes. The type of associations allowed are those accepted by the Connect module function
vis_ConnectSetNodeAssoc()
.- Errors
VIS_ERROR_ENUM
is generated if an improper type is specified.VIS_ERROR_VALUE
is generated if an improper id is specified.
- Parameters:
p – Pointer to ExtMesh object.
type – Type of association
id – Point id
aid – Point association
-
void msh_ExtMeshSetNormalPath(msh_ExtMesh *p, Vint numlayers, Vdouble fraction, Vint interflag)
set layer parameter for normal extrusion
Multiple layers may be generated to cover the required thickness. This function should be called once for each laminar extrusion. fraction values need not add up to 1., all values of fraction will be scaled by a uniform factor such that their sum adds up to 1. Interface elements are added for each laminar extrusion for which interflag is set to
SYS_ON
. If either integer parametersEXTMESH_EDGEMARK
orEXTMESH_FACEMARK
are set then that association is set in incremental value starting at 1 for each normal path defined.- Errors
VIS_ERROR_VALUE
is generated if a improper values of numlayers or fraction are specified
- Parameters:
p – Pointer to ExtMesh object.
numlayers – Number of extruded layers for given fraction
fraction – Fraction of total thickness to be extruded
interflag – Toggle for generating a layer of interface elements
-
void msh_ExtMeshSetPath(msh_ExtMesh *p, Vint maxi, Vint pix[])
define a path connectivity
Set a path connectivity. The path connectivity, pix, must contain maxi points. The value of maxi determines the order of the Lagrange polynomial used to define the path. Use
msh_ExtMeshSetPathParami()
to specify the number of element layers to be generated along a given path.When called more than once, this function requires that the path be ordered, i.e., the first point defined on a new call to the function must equal the last point in the previous call.
An internal path id is assigned to each path as it is defined, starting from 1. This id is used in
msh_ExtMeshSetPathParami()
.- Errors
VIS_ERROR_VALUE
is generated if an improper maxi is specified.VIS_ERROR_OPERATION
is generated if the first point in a new path is not equal to the last node in the previous path.
- Parameters:
p – Pointer to ExtMesh object.
maxi – Number of points in path, 2 <= maxi <= 4
pix – Path connectivity
-
void msh_ExtMeshSetPathParami(msh_ExtMesh *p, Vint id, Vint ptype, Vint iparam)
define a path paramter
Specify path parameters for path id.
The parameter
VIS_MESH_NUMELEMENTS
specifies the number of layers of elements to be generated along path id. By defaultVIS_MESH_NUMELEMENTS
is set to 1.- Errors
VIS_ERROR_ENUM
is generated if an improper ptype is specified.VIS_ERROR_VALUE
is generated if an improper iparam is specified.
- Parameters:
p – Pointer to ExtMesh object.
id – Path id
ptype – Type of path parameter to set
x=VIS_MESH_NUMELEMENTS Number of element layers
iparam – Specifies the integer value that ptype will be set to.
-
void msh_ExtMeshSetOriginTriad(msh_ExtMesh *p, Vint type, Vdouble x[3], Vdouble tm[3][3])
define a basic coordinate system.
Specify the type, the coordinate system origin, x in global coordinates, and the system orientation, tm. The direction cosine matrix, tm, should be a proper orthonormal rotation matrix. No check is performed on the validity of the input tm. By default the basic coordinate system is the global Cartesian coordinate system. Use a cylindrical coordinate system, for example, to sweep cross section meshes as a body of revolution.
Node coordinates input using
msh_ExtMeshSetNode()
are always in the global coordinate system. All nodes generated bymsh_ExtMeshGenerate()
are also in the global coordinates system.- Errors
VIS_ERROR_ENUM
is generated if an improper type is specified.
- Parameters:
p – Pointer to ExtMesh object.
type – Coordinate system type.
x=SYS_CARTESIAN Cartesian system =SYS_CYLINDRICAL Cylindrical system =SYS_CYLINDRICAL_ALT Cylindrical alternate system =SYS_SPHERICAL Spherical system =SYS_SPHERICAL_ALT Spherical alternate system
x – Origin of coordinate system in global coordinates.
tm – Direction cosine matrix of system local axis.
-
void msh_ExtMeshGenerate(msh_ExtMesh *p, vis_Connect *connect)
generate finite element mesh
Generate extruded nodes and finite elements. The input Connect object is cleared of its contents and the generated nodes and elements are set in it. Upon completion, all generated nodes are in the global coordinate system.
- Errors
VIS_ERROR_OPERATION
is generated if mesh generation fails due to errors detected in the cross section mesh; or if a nodal normal extrusion is requested as a node has been detected with an undefined normal; or the default path extrusion is requested and no paths have been defined.
-
void msh_ExtMeshSetFunction(msh_ExtMesh *p, Vint functype, Vfunc *function, Vobject *object)
set a function pointer
Set a pointer to a function. By default, the monotir callback is NULL. A callback is not invoked if it is NULL.
The methods
msh_ExtMeshAbort()
and msh_ExtMeshGetInteger()` can be called from within the monitoring function if necessary. The first aborts the mesh generation, while the second provides information on its status.- Errors
VIS_ERROR_ENUM
is generated if an improper functype is specified.
- Parameters:
p – Pointer to ExtMesh object.
functype – The function type identifier
x=SYS_FUNCTION_MONITOR Monitoring function
function – Pointer to the function to be called
object – Pointer to a user object to be passed to the monitoring function
-
void msh_ExtMeshAbort(msh_ExtMesh *p)
abort the mesh generation
Aborts the mesh generation process initiated with
msh_ExtMeshGenerate()
. This function is usually called from within a user-defined monitoring function specified withmsh_ExtMeshSetFunction()
. The monitoring function is called at regular intervals during mesh generation, thereby allowing the user to issue the abort command if necessary.- Parameters:
p – Pointer to ExtMesh object.
-
void msh_ExtMeshWrite(msh_ExtMesh *p, Vint type, const Vchar *path)
write mesh description to file
Write a mesh description to a file which has been input to ExtMesh. The contents of the file is intended for internal use only. This function should be called after all input and meshing parameters have been set to ensure that an accurate mesh description including correct meshing parameters is written. The binary file format is preferred for accuracy and generally results in smaller file sizes. The primary use of this function is to create a file of the complete mesh description in the case that the ExtMesh module fails to properly generate a mesh. This file can then be transmitted to Visual Kinematics for debugging purposes. It is suggested that a file extension of .ext be used for ASCII files and .bext be used for BINARY files.
- Errors
SYS_ERROR_ENUM
is generated if an improper type is specified.SYS_ERROR_FILE
is generated if the file can not be opened.SYS_ERROR_OPERATION
is generated if the input mesh has not been defined.
- Parameters:
p – Pointer to ExtMesh object.
type – File type
x=SYS_ASCII ASCII format =SYS_BINARY Binary format
path – [out] File path
-
void msh_ExtMeshRead(msh_ExtMesh *p, Vint type, const Vchar *path)
read mesh description from file
Read a mesh description from a file which has been previously written by
msh_ExtMeshWrite()
. The format of the file is not published and is intended for internal use only.- Errors
SYS_ERROR_ENUM
is generated if an improper type is specified.SYS_ERROR_FILE
is generated if the file can not be opened.SYS_ERROR_FORMAT
is generated if the file contents are not correctly formatted or if a file written by a later version of ExtMesh is read.
- Parameters:
p – Pointer to ExtMesh object.
type – mesh description from file
x=SYS_ASCII ASCII format =SYS_BINARY Binary format
path – File path
-
void msh_ExtMeshGetInteger(msh_ExtMesh *p, Vint type, Vint iparam[])
retrieve status information
Query for integer mesh generation information.
The query type
EXTMESH_NUMINTERSECT
returns the number of input elements which intersect. The queryEXTMESH_INTERSECT
will return the list of intersecting elements.The query type
VIS_MESH_PROGRESS
returns information about the current state of the meshing process. This function is most useful when called from the monitor function. The following four integer values are returned.iparam[0] Meshing phase Phase 1 - Pre-processing boundary data Phase 2 - Generating interior points iparam[1] Current number of nodes iparam[2] Current number of elements iparam[3] Estimate percent completion
- Errors
VIS_ERROR_ENUM
is generated if type is invalid.
- Parameters:
p – Pointer to ExtMesh object.
type – Type of parameter to be queried
x=VIS_MESH_PROGRESS Currently generated parameters =EXTMESH_NUMINTERSECT Number of intersecting elements =EXTMESH_INTERSECT Intersecting elements
iparam – [out] Values(s) retrieved