CMLTriAdvance Class Reference

The tri-advance mesher fills a surface with triangles using an advancing-front algorithm. More...

#include <CMLTriAdvance.hpp>

Inheritance diagram for CMLTriAdvance:

CMLMesher List of all members.

Public Member Functions

Constructor/Destructor
 CMLTriAdvance (CMLSurfEval *geom_eval, CMLSizeEval *size_eval=NULL, CML::OutputMsg msg_level=CML::STANDARD)
 A class constructor.
virtual ~CMLTriAdvance ()
 A virtual destructor for the class.
Mesh input
bool set_boundary_mesh (int num_points_in, double *const points, int num_loops, int *const loop_size, int *const loops, int num_hard_points=0, int *const point_ids=NULL)
 Supply the surface mesh describing the surface boundary.
bool set_free_edges (int num_edges, int *const edges)
 Supply interior edges that will be included in the triangle mesh.
Core mesher
bool generate_mesh (int &num_points_out, int &num_tris)
 Generate a triangle mesh for the surface.
Mesh output
bool get_mesh (int num_points_out, double *const points, int num_tris, int *const tris)
 Retrieve the generated triangle mesh.
int get_points_buf (int buf_size, double *const points, int start_index=0)
 Retrieve the generated points one buffer at a time.
int get_tris_buf (int buf_size, int *const tris, int start_index=0)
 Retrieve the generated triangles one buffer at a time.
Meshing properties
void set_sizing_function (CML::SizingType type, double size1=-1.0, double size2=-1.0)
 Set a sizing function for the Tri-Advance mesher.
void set_force_to_surf (bool force)
 Set the flag that forces points to the surface.
int get_force_to_surf () const
 Get the value of the force-to-surface flag.
Message output control
virtual CML::OutputMsg get_msg_level () const
 Get the value of the message level flag.
virtual void set_msg_level (CML::OutputMsg level)
 Set the value of the message level flag.
virtual void open_log_file (const char *filename, bool append=false)
 Open a log file to record algorithm output.
virtual void close_log_file ()
 Close an open log file.
virtual void set_message_handler (CubitMessageHandler *h)
 Use an alternate output message handler.
virtual void set_progress_handler (CMLProgress *h)
 Use an alternate progress handler.
CAMAL version
virtual int get_major_version () const
 Returns the major version number.
virtual int get_minor_version () const
 Returns the minor version number.
virtual int get_subminor_version () const
 Returns the subminor version (patch) number.
virtual int get_allint_version () const
 Returns version number as one integer.
virtual const char * get_version_string ()
 Returns version number as a string.

Detailed Description

The tri-advance mesher fills a surface with triangles using an advancing-front algorithm.

The surface is defined by a loops of points that are the surface's boundary. The tri-mesher uses sizing information provided by a CMLSizeEval object to control element size and to produce an anisotropic mesh. It also uses a CMLSurfEval object to move nodes to the surface and maintain proper element orientation.


Constructor & Destructor Documentation

CMLTriAdvance::CMLTriAdvance ( CMLSurfEval geom_eval,
CMLSizeEval size_eval = NULL,
CML::OutputMsg  msg_level = CML::STANDARD 
)

A class constructor.

Parameters:
geom_eval A pointer to the geometry evaluator object that performs move-to-surface, normal-at-point, etc. computations.
size_eval A pointer to the size evaluator object the determines element size at a point. It may be NULL if no external sizing function is used.
msg_level An enumerated constant that controls the amount of output. The default value is CML::STANDARD. A value of CML::NONE causes the tri-advance mesher to suppress all output.
See also:
set_msg_level()


Member Function Documentation

virtual void CMLTriAdvance::close_log_file (  )  [virtual]

Close an open log file.

See also:
open_log_file()

Implements CMLMesher.

bool CMLTriAdvance::generate_mesh ( int &  num_points_out,
int &  num_tris 
)

Generate a triangle mesh for the surface.

Parameters:
num_points_out The total number of points generated including the input points
num_tris The number of triangles generated
Returns:
true if successful, false otherwise
Note:
These two output values are useful for dynamically allocating the memory necessary to retrieve the triangle mesh with get_mesh().

bool CMLTriAdvance::get_mesh ( int  num_points_out,
double *const   points,
int  num_tris,
int *const   tris 
)

Retrieve the generated triangle mesh.

Parameters:
num_points_out The number of points to retrieve. This should be the same number returned by generate_mesh().
points An array of points in the generated mesh (array size = 3 * num_points_out.)
The first three array values are the x, y and z coordinates of the first point. The next three are for the second point, then the third, etc.
num_tris The number of triangles to retrieve. This should be the same number returned by generate_mesh().
tris An array defining the connectivity of the generated mesh (array size = 3 * num_tris.)
The first three array values are the indices to the points array of the first triangle's corner points. The second three describes the second triangle, then the third, etc. The three indices of a triangle are entered in a counter-clockwise direction around the face when viewed from a positive distance along the triangle's normal. Indices range from 0 to num_points_out - 1 since the points array is zero-based.
Returns:
true if successful, false otherwise

virtual CML::OutputMsg CMLTriAdvance::get_msg_level (  )  const [virtual]

Get the value of the message level flag.

Returns:
The current message level flag.
See also:
set_msg_level()

Implements CMLMesher.

int CMLTriAdvance::get_points_buf ( int  buf_size,
double *const   points,
int  start_index = 0 
)

Retrieve the generated points one buffer at a time.

Parameters:
buf_size The length of the points array.
points The output buffer for points. A maximum of length/3 points will be copied to this buffer.
start_index The index of the first output point.
Returns:
The number of points returned in points buffer. Returns zero if start_index is greater than the number of points in the array.
Note:
To return all points, begin with start_index = 0 and increment it by the return value until the return value is zero.

int CMLTriAdvance::get_tris_buf ( int  buf_size,
int *const   tris,
int  start_index = 0 
)

Retrieve the generated triangles one buffer at a time.

Parameters:
buf_size The length of the tris buffer array
tris The output buffer for triangles. A maximum of length/3 triangles will be copied to this buffer.
start_index The index of the first out triangle.
Returns:
The number of triangles returned in tris buffer. Returns zero if start_index is greater than the number of triangles in the array.
Note:
To return all triangles, begin with start_index = 0 and increment it by the return value until the return value is zero.

virtual void CMLTriAdvance::open_log_file ( const char *  filename,
bool  append = false 
) [virtual]

Open a log file to record algorithm output.

Parameters:
filename The log file name
append Appends to the file filename if it exists
See also:
close_log_file()

Implements CMLMesher.

bool CMLTriAdvance::set_boundary_mesh ( int  num_points_in,
double *const   points,
int  num_loops,
int *const   loop_size,
int *const   loops,
int  num_hard_points = 0,
int *const   point_ids = NULL 
)

Supply the surface mesh describing the surface boundary.

Parameters:
num_points_in The number of points in the boundary mesh plus any optional free interior (hard) points.
points An array of points (array size = 3 * num_points_in.)
The first three array values are the x, y and z coordinates of the first point. The next three are for the second point, then the third, etc. Free interior points, if any, will appear in the final triangle mesh.
num_loops The number of loops that describe the boundary of the surface.
loop_size The number of point ids in each loop in loops. (array size = num_loops)
loops connectivity of boundary mesh (array size = sum of values in loop_sizes)
num_hard_points The number of optional free interior points on the surface.
point_ids An optional array whose values are the user's identifiers for the points (array size = num_points_in.)
Messages generated by the tri-mesher use this array to translate from internal point identifiers to user identifiers.
Returns:
true if successful, false otherwise.

void CMLTriAdvance::set_force_to_surf ( bool  force  ) 

Set the flag that forces points to the surface.

Some geometry evaluators report that a surface is planar when it is so only within tolerance. This may cause points to be projected that are not on the surface and for the algorithm to not detect intersections producing a mesh breakout.

Parameters:
force true to force points to the surface and false to rely on the geometry evaluator to use planarity to determine if points are projected to the surface.

bool CMLTriAdvance::set_free_edges ( int  num_edges,
int *const   edges 
)

Supply interior edges that will be included in the triangle mesh.

Parameters:
num_edges The number of edges interior to the surface.
edges An array defining the end points of the free edges (array size = 2 * num_edges.)
The first two array values are the indices of the points at each end of the first edge. The next two are the indices of the second edge's end-points, then the third, etc. Indices range from 0 to num_points_in - 1 since the points array is zero-based.
Returns:
true if successful, false otherwise
Note:
One or both end-points must be free points interior to the surface.

virtual void CMLTriAdvance::set_message_handler ( CubitMessageHandler *  h  )  [virtual]

Use an alternate output message handler.

Parameters:
h A pointer to a message handler derived from CubitMessageHandler.

Implements CMLMesher.

virtual void CMLTriAdvance::set_msg_level ( CML::OutputMsg  level  )  [virtual]

Set the value of the message level flag.

Parameters:
level The value of the message level is an enumerated constant. The default value is CML::STANDARD and generates minimal output. A value of CML::VERBOSE generates more output, and a value of CML::DEBUG generates output helpful to developers. A value of CML::NONE causes the mesher to suppress all output.
See also:
get_msg_level()

Implements CMLMesher.

virtual void CMLTriAdvance::set_progress_handler ( CMLProgress *  h  )  [virtual]

Use an alternate progress handler.

Parameters:
h A pointer to a progress hander derived from CMLProgress.

Implements CMLMesher.

void CMLTriAdvance::set_sizing_function ( CML::SizingType  type,
double  size1 = -1.0,
double  size2 = -1.0 
) [virtual]

Set a sizing function for the Tri-Advance mesher.

Parameters:
type An enumerated sizing type, e.g., CML::LINEAR_SIZING.
size1 This is the element size for CML::CONSTANT_SIZING. It is the minimum element size for other sizing functions.
size2 This is the maximum element size for all sizing functions except CML::CONSTANT_SIZING. It is ignored by constant sizing.
Note:
The last two parameters are optional. If omitted, size information is computed from the boundary loops. The average edge length is used by constant sizing. Minimum and maximum edge lengths are used by all other sizing functions.

Implements CMLMesher.


The documentation for this class was generated from the following file:

CAMAL 5.2-0 documentation created on 1 Jun 2010
Comments to csimsoft.com