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

#include <MeshDomain1D.hpp>

+ Inheritance diagram for MBMesquite::CircleDomain:
+ Collaboration diagram for MBMesquite::CircleDomain:

Public Member Functions

 CircleDomain (const Vector3D &center, const Vector3D &normal, double radius)
 CircleDomain (const MsqCircle &circle)
const MsqCirclegeom () const
virtual void snap_to (Mesh::VertexHandle entity_handle, Vector3D &coordinate) const
virtual void vertex_normal_at (Mesh::VertexHandle entity_handle, Vector3D &coordinate) const
virtual void element_normal_at (Mesh::ElementHandle entity_handle, Vector3D &coordinate) const
virtual void vertex_normal_at (const Mesh::VertexHandle *handles, Vector3D coordinates[], unsigned count, MsqError &err) const
 evaluate surface normals
virtual void closest_point (Mesh::VertexHandle handle, const Vector3D &position, Vector3D &closest, Vector3D &normal, MsqError &err) const
 evaluate closest point and normal
virtual void domain_DoF (const Mesh::VertexHandle *handle_array, unsigned short *dof_array, size_t num_handles, MsqError &err) const
virtual double arc_length (const double position1[3], const double position2[3], MsqError &err)
 Measure arc length along curve.
virtual void position_from_length (const double from_here[3], double length, double result_point[3], MsqError &err)
 Get a position on the curve given an arc length.

Private Attributes

MsqCircle mGeom

Detailed Description

Definition at line 122 of file MeshDomain1D.hpp.


Constructor & Destructor Documentation

MBMesquite::CircleDomain::CircleDomain ( const Vector3D center,
const Vector3D normal,
double  radius 
) [inline]

Definition at line 128 of file MeshDomain1D.hpp.

: mGeom( center, normal, radius ) {}
MBMesquite::CircleDomain::CircleDomain ( const MsqCircle circle) [inline]

Definition at line 130 of file MeshDomain1D.hpp.

: mGeom( circle ) {}

Member Function Documentation

double MBMesquite::CircleDomain::arc_length ( const double  position1[3],
const double  position2[3],
MsqError err 
) [virtual]

Measure arc length along curve.

Get the length along a curve between two points on the curve.

Implements MBMesquite::CurveDomain.

Definition at line 188 of file MeshDomain1D.cpp.

References moab::angle(), MBMesquite::MsqCircle::center(), mGeom, MBMesquite::MsqCircle::normal(), and MBMesquite::MsqCircle::radius().

Referenced by MBMesquite::CircleDomainTest::test_arc_length().

{
    Vector3D p1  = Vector3D( position1 ) - mGeom.center();
    Vector3D p2  = Vector3D( position2 ) - mGeom.center();
    Vector3D vy  = mGeom.normal() * p1;
    Vector3D vx  = vy * mGeom.normal();
    double x     = p2 % vx;
    double y     = p2 % vy;
    double angle = atan2( y, x );
    return angle * mGeom.radius();
}
void MBMesquite::CircleDomain::closest_point ( Mesh::VertexHandle  handle,
const Vector3D position,
Vector3D closest,
Vector3D normal,
MsqError err 
) const [virtual]

evaluate closest point and normal

Given a position in space, return the closest position in the domain and the domain normal at that point.

Parameters:
entity_handleEvaluate the subset of the domain contianing this entity
positionInput position for which to evaluate
closestClosest position in the domain.
normalDomain normal at the location of 'closest'

Implements MBMesquite::MeshDomain.

Definition at line 165 of file MeshDomain1D.cpp.

References MBMesquite::MsqCircle::center(), geom(), INTERNAL_ERROR, MSQ_SETERR, and MBMesquite::MsqCircle::radial_vector().

{
    // no normal, get tangent instead
    if( !geom().closest( position, closest, normal ) )
    {  // at center?
        normal  = geom().radial_vector();
        closest = geom().center() + normal;
    }
    MSQ_SETERR( err )( "Cannot get normal for CircleDomain", MsqError::INTERNAL_ERROR );
}
void MBMesquite::CircleDomain::domain_DoF ( const Mesh::VertexHandle handle_array,
unsigned short *  dof_array,
size_t  num_handles,
MsqError err 
) const [virtual]

Definition at line 180 of file MeshDomain1D.cpp.

{
    std::fill( dof_array, dof_array + num_handles, 1 );
}
void MBMesquite::CircleDomain::element_normal_at ( Mesh::ElementHandle  entity_handle,
Vector3D coordinate 
) const [virtual]

Implements MBMesquite::MeshDomain.

Definition at line 150 of file MeshDomain1D.cpp.

References vertex_normal_at().

{
    CircleDomain::vertex_normal_at( h, coordinate );
}
const MsqCircle& MBMesquite::CircleDomain::geom ( ) const [inline]

Definition at line 132 of file MeshDomain1D.hpp.

Referenced by closest_point(), snap_to(), and vertex_normal_at().

    {
        return mGeom;
    }
void MBMesquite::CircleDomain::position_from_length ( const double  from_here[3],
double  length,
double  result_point[3],
MsqError err 
) [virtual]

Get a position on the curve given an arc length.

Measure a specified arc length along a curve.

Parameters:
from_herePoint on curve from which to measure
lengthLength along curve to move
result_pointOutput. A point on the curve length units from the point from_here in the forward direction along the curve.

Implements MBMesquite::CurveDomain.

Definition at line 200 of file MeshDomain1D.cpp.

References moab::angle(), b, MBMesquite::MsqCircle::center(), MBMesquite::Vector3D::get_coordinates(), MBMesquite::Vector3D::length(), mGeom, MBMesquite::MsqCircle::normal(), and MBMesquite::MsqCircle::radius().

Referenced by MBMesquite::CircleDomainTest::test_position_from_length().

{
    Vector3D b   = Vector3D( from_here ) - mGeom.center();
    Vector3D vy  = mGeom.normal() * b;
    Vector3D vx  = vy * mGeom.normal();
    double angle = length / mGeom.radius();
    double x     = std::cos( angle );
    double y     = std::sin( angle );
    vy *= y / vy.length();
    vx *= x / vx.length();
    Vector3D result = vx + vy;
    result *= mGeom.radius();
    result += mGeom.center();
    result.get_coordinates( result_point );
}
void MBMesquite::CircleDomain::snap_to ( Mesh::VertexHandle  entity_handle,
Vector3D coordinate 
) const [virtual]

Modifies "coordinate" so that it lies on the domain to which "entity_handle" is constrained. The handle determines the domain. The coordinate is the proposed new position on that domain.

Implements MBMesquite::MeshDomain.

Definition at line 137 of file MeshDomain1D.cpp.

References MBMesquite::MsqCircle::closest(), and geom().

Referenced by MBMesquite::CircleDomainTest::test_snap_to().

{
    coordinate = geom().closest( coordinate );
}
void MBMesquite::CircleDomain::vertex_normal_at ( Mesh::VertexHandle  entity_handle,
Vector3D coordinate 
) const [virtual]

Returns the normal of the domain to which "entity_handle" is constrained. For non-planar surfaces, the normal is calculated at the point on the domain that is closest to the passed in value of "coordinate". If the domain does not have a normal, or the normal cannot be determined, "coordinate" is set to (0,0,0). Otherwise, "coordinate" is set to the domain's normal at the appropriate point. In summary, the handle determines the domain. The coordinate determines the point of interest on that domain.

User should see also PatchData::get_domain_normal_at_vertex and PatchData::get_domain_normal_at_element .

Implements MBMesquite::MeshDomain.

Definition at line 142 of file MeshDomain1D.cpp.

References geom(), and MBMesquite::MsqCircle::radial_vector().

Referenced by element_normal_at(), and vertex_normal_at().

{
    // no normal, return tangent instead.
    Vector3D junk, copy( coordinate );
    if( !geom().closest( copy, junk, coordinate ) )  // at center?
        coordinate = geom().radial_vector();
}
void MBMesquite::CircleDomain::vertex_normal_at ( const Mesh::VertexHandle handles,
Vector3D  coordinates[],
unsigned  count,
MsqError err 
) const [virtual]

evaluate surface normals

Returns normals for a domain.

Parameters:
handlesThe domain evaluated is the one in which this mesh entity is constrained.
coordinatesAs input, a list of positions at which to evaluate the domain. As output, the resulting domain normals.
countThe length of the coordinates array.

Implements MBMesquite::MeshDomain.

Definition at line 155 of file MeshDomain1D.cpp.

References INTERNAL_ERROR, MSQ_SETERR, and vertex_normal_at().

{
    for( unsigned i = 0; i < count; ++i )
        vertex_normal_at( handles[i], coordinates[i] );
    MSQ_SETERR( err )( "Cannot get normal for CircleDomain", MsqError::INTERNAL_ERROR );
}

Member Data Documentation

Definition at line 125 of file MeshDomain1D.hpp.

Referenced by arc_length(), and position_from_length().

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