MOAB: Mesh Oriented datABase  (version 5.4.1)
MBMesquite::BoundedCylinderDomain Class Reference

#include <BoundedCylinderDomain.hpp>

+ Inheritance diagram for MBMesquite::BoundedCylinderDomain:
+ Collaboration diagram for MBMesquite::BoundedCylinderDomain:

Classes

struct  Curve

Public Member Functions

 BoundedCylinderDomain (double pradius, Vector3D axis_direction=Vector3D(0, 0, 1), Vector3D axis_point=Vector3D(0, 0, 0))
virtual void domain_DoF (const Mesh::VertexHandle *handle_array, unsigned short *dof_array, size_t count, MsqError &err) const
void create_curve (double distance, const std::vector< Mesh::VertexHandle > &handles)
 define a circular curve bounding the cylinder
void create_curve (double distance, Mesh *mesh, double tolerance, MsqError &err)
 define a circular curve bounding the cylinder

Protected Member Functions

void evaluate (double t, const Vector3D &point, Vector3D &closest, Vector3D &normal) const
virtual void evaluate (Mesh::VertexHandle handle, const Vector3D &point, Vector3D &closest, Vector3D &normal) const
bool find_curve (Mesh::VertexHandle handle, double &t) const

Private Attributes

std::list< CurvecurveList

Detailed Description

Definition at line 38 of file BoundedCylinderDomain.hpp.


Constructor & Destructor Documentation

MBMesquite::BoundedCylinderDomain::BoundedCylinderDomain ( double  pradius,
Vector3D  axis_direction = Vector3D( 0, 0, 1 ),
Vector3D  axis_point = Vector3D( 0, 0, 0 ) 
) [inline]
Parameters:
radius- Radius of the cylinder
axis_direction- Vector defining the direction of the axis
axis_point- A point through which the axis passes.

Definition at line 46 of file BoundedCylinderDomain.hpp.

        : CylinderDomain( pradius, axis_direction, axis_point )
    {
    }

Member Function Documentation

void MBMesquite::BoundedCylinderDomain::create_curve ( double  distance,
const std::vector< Mesh::VertexHandle > &  handles 
)

define a circular curve bounding the cylinder

Parameters:
distanceLocation on cylinder at which to create a circular curve, specified as the distance along the cylinder axis from axis_point specified to the constructor.
handlesA list of handles which are to be constidered bound to the curve.

Definition at line 53 of file BoundedCylinderDomain.cpp.

References curveList, MBMesquite::BoundedCylinderDomain::Curve::handles, and MBMesquite::BoundedCylinderDomain::Curve::t.

Referenced by create_curve(), BoundedCylinderDomainTest::test_create_curve_from_mesh(), BoundedCylinderDomainTest::test_domain_DoF(), BoundedCylinderDomainTest::test_x_snap_to(), and BoundedCylinderDomainTest::test_z_snap_to().

{
    Curve c;
    c.t       = distance;
    c.handles = handles;
    std::sort( c.handles.begin(), c.handles.end() );
    curveList.push_back( c );
}
void MBMesquite::BoundedCylinderDomain::create_curve ( double  distance,
Mesh mesh,
double  tolerance,
MsqError err 
)

define a circular curve bounding the cylinder

Parameters:
distanceLocation on cylinder at which to create a circular curve, specified as the distance along the cylinder axis from axis_point specified to the constructor.
meshAll vertices in this mesh within the specified tolerance of the curve will be considered bound to the curve.
toleranceThe distance tolerance to use.

Definition at line 62 of file BoundedCylinderDomain.cpp.

References MBMesquite::arrptr(), create_curve(), evaluate(), MBMesquite::Mesh::get_all_vertices(), MBMesquite::MsqError::INVALID_ARG, MBMesquite::length(), MSQ_ERRRTN, MSQ_SETERR, and MBMesquite::Mesh::vertices_get_coordinates().

{
    std::vector< Mesh::VertexHandle > handles;
    mesh->get_all_vertices( handles, err );MSQ_ERRRTN( err );
    if( handles.empty() )
    {
        MSQ_SETERR( err )( "No vertices in mesh.\n", MsqError::INVALID_ARG );
        return;
    }

    std::vector< MsqVertex > coords( handles.size() );
    mesh->vertices_get_coordinates( arrptr( handles ), arrptr( coords ), handles.size(), err );MSQ_ERRRTN( err );

    std::vector< Mesh::EntityHandle > list;
    Vector3D close, normal;
    for( size_t i = 0; i < handles.size(); ++i )
    {
        evaluate( distance, coords[i], close, normal );
        if( ( coords[i] - close ).length() < tolerance ) list.push_back( handles[i] );
    }

    if( list.empty() )
    {
        MSQ_SETERR( err )( "No vertices within specified tolerance.\n", MsqError::INVALID_ARG );
        return;
    }

    create_curve( distance, list );
}
void MBMesquite::BoundedCylinderDomain::domain_DoF ( const Mesh::VertexHandle handle_array,
unsigned short *  dof_array,
size_t  count,
MsqError err 
) const [virtual]

Reimplemented from MBMesquite::CylinderDomain.

Definition at line 40 of file BoundedCylinderDomain.cpp.

References find_curve(), and t.

Referenced by BoundedCylinderDomainTest::test_create_curve_from_mesh(), and BoundedCylinderDomainTest::test_domain_DoF().

{
    double t;
    for( size_t i = 0; i < count; ++i )
        if( find_curve( handle_array[i], t ) )
            dof_array[i] = 1;
        else
            dof_array[i] = 2;
}
void MBMesquite::BoundedCylinderDomain::evaluate ( double  t,
const Vector3D point,
Vector3D closest,
Vector3D normal 
) const [protected]

Definition at line 92 of file BoundedCylinderDomain.cpp.

References MBMesquite::CylinderDomain::axis(), MBMesquite::CylinderDomain::center(), MBMesquite::EPSILON, epsilon, MBMesquite::Vector3D::length(), and MBMesquite::CylinderDomain::radius().

Referenced by create_curve(), and evaluate().

{
    const double EPSILON       = std::numeric_limits< double >::epsilon();
    double t2                  = axis() % ( point - center() );
    const Vector3D circ_center = center() + t * axis();
    const Vector3D axis_point  = center() + t2 * axis();

    normal           = point - axis_point;
    const double len = normal.length();
    if( len < EPSILON )
    {
        this->CylinderDomain::evaluate( 0, axis_point, closest, normal );
    }
    else
    {
        normal /= len;
        closest = circ_center + radius() * normal;
    }
}
void MBMesquite::BoundedCylinderDomain::evaluate ( Mesh::VertexHandle  handle,
const Vector3D point,
Vector3D closest,
Vector3D normal 
) const [protected, virtual]

Reimplemented from MBMesquite::CylinderDomain.

Definition at line 112 of file BoundedCylinderDomain.cpp.

References evaluate(), find_curve(), and t.

{
    double t;
    if( find_curve( handle, t ) )
        evaluate( t, point, closest, normal );
    else
        this->CylinderDomain::evaluate( handle, point, closest, normal );
}
bool MBMesquite::BoundedCylinderDomain::find_curve ( Mesh::VertexHandle  handle,
double &  t 
) const [protected]

Definition at line 124 of file BoundedCylinderDomain.cpp.

References curveList.

Referenced by domain_DoF(), and evaluate().

{
    for( std::list< Curve >::const_iterator i = curveList.begin(); i != curveList.end(); ++i )
        if( std::binary_search( i->handles.begin(), i->handles.end(), handle ) )
        {
            t = i->t;
            return true;
        }

    return false;
}

Member Data Documentation

Definition at line 97 of file BoundedCylinderDomain.hpp.

Referenced by create_curve(), and find_curve().

List of all members.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines