MOAB: Mesh Oriented datABase
(version 5.4.1)
|
#include <CylinderDomain.hpp>
Public Member Functions | |
CylinderDomain (double p_radius, Vector3D axis_direction=Vector3D(0, 0, 1), Vector3D axis_point=Vector3D(0, 0, 0), bool outward_normal=true) | |
virtual | ~CylinderDomain () |
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 *handle, Vector3D coords[], 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 count, MsqError &err) const |
const Vector3D & | axis () const |
const Vector3D & | center () const |
double | radius () const |
Protected Member Functions | |
virtual void | evaluate (Mesh::VertexHandle handle, const Vector3D &point, Vector3D &closest, Vector3D &normal) const |
Private Attributes | |
Vector3D | mAxis |
Vector3D | mCenter |
double | mRadius |
double | outwardSign |
Define the geometry of an unbounded cylinder.
Definition at line 39 of file CylinderDomain.hpp.
MBMesquite::CylinderDomain::CylinderDomain | ( | double | p_radius, |
Vector3D | axis_direction = Vector3D( 0, 0, 1 ) , |
||
Vector3D | axis_point = Vector3D( 0, 0, 0 ) , |
||
bool | outward_normal = true |
||
) | [inline] |
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 47 of file CylinderDomain.hpp.
: mAxis( axis_direction / axis_direction.length() ), mCenter( axis_point ), mRadius( p_radius ), outwardSign( outward_normal ? 1.0 : -1.0 ) { }
MBMesquite::CylinderDomain::~CylinderDomain | ( | ) | [virtual] |
Definition at line 37 of file CylinderDomain.cpp.
{}
const Vector3D& MBMesquite::CylinderDomain::axis | ( | ) | const [inline] |
Definition at line 80 of file CylinderDomain.hpp.
Referenced by MBMesquite::BoundedCylinderDomain::evaluate().
{ return mAxis; }
const Vector3D& MBMesquite::CylinderDomain::center | ( | ) | const [inline] |
Definition at line 84 of file CylinderDomain.hpp.
Referenced by MBMesquite::BoundedCylinderDomain::evaluate().
{ return mCenter; }
void MBMesquite::CylinderDomain::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.
entity_handle | Evaluate the subset of the domain contianing this entity |
position | Input position for which to evaluate |
closest | Closest position in the domain. |
normal | Domain normal at the location of 'closest' |
Implements MBMesquite::MeshDomain.
Definition at line 89 of file CylinderDomain.cpp.
References evaluate().
{ evaluate( handle, position, closest, normal ); }
void MBMesquite::CylinderDomain::domain_DoF | ( | const Mesh::VertexHandle * | handle_array, |
unsigned short * | dof_array, | ||
size_t | count, | ||
MsqError & | err | ||
) | const [virtual] |
Reimplemented in MBMesquite::BoundedCylinderDomain.
Definition at line 98 of file CylinderDomain.cpp.
{ std::fill( dof_array, dof_array + count, (unsigned short)2 ); }
void MBMesquite::CylinderDomain::element_normal_at | ( | Mesh::ElementHandle | entity_handle, |
Vector3D & | coordinate | ||
) | const [virtual] |
Implements MBMesquite::MeshDomain.
Definition at line 75 of file CylinderDomain.cpp.
References evaluate(), and l.
{ Vector3D p( v ), l; // NOTE: Explicitly invoke this class's evaluate method for elements. // BoundedCylindarDomain overrides evaluate for vertices only. CylinderDomain::evaluate( h, p, l, v ); }
void MBMesquite::CylinderDomain::evaluate | ( | Mesh::VertexHandle | handle, |
const Vector3D & | point, | ||
Vector3D & | closest, | ||
Vector3D & | normal | ||
) | const [protected, virtual] |
Reimplemented in MBMesquite::BoundedCylinderDomain.
Definition at line 39 of file CylinderDomain.cpp.
References MBMesquite::EPSILON, epsilon, MBMesquite::Vector3D::length(), MBMesquite::length(), mAxis, mCenter, mRadius, MBMesquite::Vector3D::normalize(), outwardSign, MBMesquite::Vector3D::set(), and t.
Referenced by closest_point(), element_normal_at(), snap_to(), and vertex_normal_at().
{ const double EPSILON = std::numeric_limits< double >::epsilon(); double t = mAxis % ( point - mCenter ); const Vector3D axis_point = mCenter + t * mAxis; normal = point - axis_point; const double len = normal.length(); if( len < EPSILON ) { Vector3D v( 1, 0, 0 ); if( ( v * mAxis ).length() < EPSILON ) v.set( 0, 1, 0 ); normal = v * mAxis; normal.normalize(); } else { normal /= len; } closest = axis_point + mRadius * normal; normal *= outwardSign; }
double MBMesquite::CylinderDomain::radius | ( | ) | const [inline] |
Definition at line 88 of file CylinderDomain.hpp.
Referenced by MBMesquite::BoundedCylinderDomain::evaluate(), BoundedCylinderDomainTest::test_x_snap_to(), and BoundedCylinderDomainTest::test_z_snap_to().
{ return mRadius; }
void MBMesquite::CylinderDomain::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 63 of file CylinderDomain.cpp.
References evaluate(), and n.
Referenced by BoundedCylinderDomainTest::test_x_snap_to(), and BoundedCylinderDomainTest::test_z_snap_to().
void MBMesquite::CylinderDomain::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 69 of file CylinderDomain.cpp.
References evaluate(), and l.
Referenced by vertex_normal_at().
void MBMesquite::CylinderDomain::vertex_normal_at | ( | const Mesh::VertexHandle * | handles, |
Vector3D | coordinates[], | ||
unsigned | count, | ||
MsqError & | err | ||
) | const [virtual] |
evaluate surface normals
Returns normals for a domain.
handles | The domain evaluated is the one in which this mesh entity is constrained. |
coordinates | As input, a list of positions at which to evaluate the domain. As output, the resulting domain normals. |
count | The length of the coordinates array. |
Implements MBMesquite::MeshDomain.
Definition at line 83 of file CylinderDomain.cpp.
References vertex_normal_at().
{ for( unsigned i = 0; i < count; ++i ) vertex_normal_at( h[i], coords[i] ); }
Vector3D MBMesquite::CylinderDomain::mAxis [private] |
Definition at line 100 of file CylinderDomain.hpp.
Referenced by evaluate().
Vector3D MBMesquite::CylinderDomain::mCenter [private] |
Definition at line 101 of file CylinderDomain.hpp.
Referenced by evaluate().
double MBMesquite::CylinderDomain::mRadius [private] |
Definition at line 102 of file CylinderDomain.hpp.
Referenced by evaluate().
double MBMesquite::CylinderDomain::outwardSign [private] |
Definition at line 103 of file CylinderDomain.hpp.
Referenced by evaluate().