Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SphericalDomain Class Reference

#include <SphericalDomain.hpp>

Inheritance diagram for SphericalDomain:
Collaboration diagram for SphericalDomain:

Public Member Functions

 SphericalDomain (const Vector3D &center, double radius)
 
virtual ~SphericalDomain ()
 
DomainHint hint () const
 Give a hint about the nature of the domain for better performance. More...
 
void set_sphere (const Vector3D &center, double radius)
 
virtual void snap_to (Mesh::EntityHandle entity_handle, Vector3D &coordinate) const
 Modifies "coordinate" so that it lies on the domain to which "entity_handle" is constrained. More...
 
virtual void normal_at (Mesh::EntityHandle entity_handle, Vector3D &coordinate) const
 Returns the normal of the domain to which "entity_handle" is constrained. More...
 
virtual void normal_at (Mesh::EntityHandle handle, Vector3D coords[], unsigned count, MsqError &err) const
 evaluate surface normals More...
 
virtual void closest_point (Mesh::EntityHandle handle, const Vector3D &position, Vector3D &closest, Vector3D &normal, MsqError &err) const
 evaluate closest point and normal More...
 
 SphericalDomain (const Vector3D &center, double radius)
 
virtual ~SphericalDomain ()
 
DomainHint hint () const
 Give a hint about the nature of the domain for better performance. More...
 
void set_sphere (const Vector3D &center, double radius)
 
virtual void snap_to (Mesh::EntityHandle entity_handle, Vector3D &coordinate) const
 Modifies "coordinate" so that it lies on the domain to which "entity_handle" is constrained. More...
 
virtual void normal_at (Mesh::EntityHandle entity_handle, Vector3D &coordinate) const
 Returns the normal of the domain to which "entity_handle" is constrained. More...
 
virtual void normal_at (Mesh::EntityHandle handle, Vector3D coords[], unsigned count, MsqError &err) const
 evaluate surface normals More...
 
virtual void closest_point (Mesh::EntityHandle handle, const Vector3D &position, Vector3D &closest, Vector3D &normal, MsqError &err) const
 evaluate closest point and normal More...
 
- Public Member Functions inherited from MeshDomain
virtual ~MeshDomain ()
 

Private Attributes

Vector3D mCenter
 
double mRadius
 

Detailed Description

This is a template for a spherical domain. It will provide the normal information necessary for surface mesh optimization.

Definition at line 48 of file includeLinks/SphericalDomain.hpp.

Constructor & Destructor Documentation

SphericalDomain ( const Vector3D center,
double  radius 
)
inline
virtual ~SphericalDomain ( )
inlinevirtual

Definition at line 55 of file includeLinks/SphericalDomain.hpp.

55 { }
SphericalDomain ( const Vector3D center,
double  radius 
)
inline
virtual ~SphericalDomain ( )
inlinevirtual

Definition at line 55 of file src/Misc/SphericalDomain.hpp.

55 { }

Member Function Documentation

void closest_point ( Mesh::EntityHandle  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 MeshDomain.

Definition at line 76 of file Misc/SphericalDomain.cpp.

References Vector3D::normalize(), Vector3D::set(), and Vector3D::x().

81 {
82  normal = position - mCenter;
83  normal.normalize();
84  if (!finite(normal.x()))
85  normal.set( 1.0, 0.0, 0.0 );
86  closest = mCenter + mRadius * normal;
87 }
void set(const double x, const double y, const double z)

Here is the call graph for this function:

virtual void closest_point ( Mesh::EntityHandle  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 MeshDomain.

DomainHint hint ( ) const
inlinevirtual

Give a hint about the nature of the domain for better performance.

For implementations, if unsure, return NO_DOMAIN_HINT. SMOOTH_DOMAIN is a good default choice if the domain is a single geometric surface.

Implements MeshDomain.

Definition at line 57 of file includeLinks/SphericalDomain.hpp.

References Mesquite::SMOOTH_DOMAIN.

DomainHint hint ( ) const
inlinevirtual

Give a hint about the nature of the domain for better performance.

For implementations, if unsure, return NO_DOMAIN_HINT. SMOOTH_DOMAIN is a good default choice if the domain is a single geometric surface.

Implements MeshDomain.

Definition at line 57 of file src/Misc/SphericalDomain.hpp.

References Mesquite::SMOOTH_DOMAIN.

void normal_at ( Mesh::EntityHandle  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 MeshDomain.

Definition at line 53 of file Misc/SphericalDomain.cpp.

References Vector3D::length(), Mesquite::length(), Vector3D::set(), and Vector3D::x().

55 {
56  // normal is vector from center to input position
57  coordinate -= mCenter;
58  // make it a unit vector
59  double length = coordinate.length();
60  coordinate /= length;
61  // if input position was at center, choose same position
62  // on sphere as snap_to.
63  if (!finite(coordinate.x()))
64  coordinate.set( 1.0, 0.0, 0.0 );
65 }
double length(Vector3D *const v, int n)

Here is the call graph for this function:

virtual void normal_at ( Mesh::EntityHandle  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 MeshDomain.

virtual void normal_at ( Mesh::EntityHandle  handle,
Vector3D  coordinates[],
unsigned  count,
MsqError err 
) const
virtual

evaluate surface normals

Returns normals for a domain.

Parameters
entity_handleThe 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 MeshDomain.

void normal_at ( Mesh::EntityHandle  handle,
Vector3D  coordinates[],
unsigned  count,
MsqError err 
) const
virtual

evaluate surface normals

Returns normals for a domain.

Parameters
entity_handleThe 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 MeshDomain.

Definition at line 67 of file Misc/SphericalDomain.cpp.

References i.

71 {
72  for (unsigned i = 0; i < count; ++i)
73  normal_at( handle, coords[i] );
74 }
virtual void normal_at(Mesh::EntityHandle entity_handle, Vector3D &coordinate) const
Returns the normal of the domain to which &quot;entity_handle&quot; is constrained.
blockLoc i
Definition: read.cpp:79
void set_sphere ( const Vector3D center,
double  radius 
)
inline
void set_sphere ( const Vector3D center,
double  radius 
)
inline
void snap_to ( Mesh::EntityHandle  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 MeshDomain.

Definition at line 36 of file Misc/SphericalDomain.cpp.

References Vector3D::length(), SphericalDomain::mCenter, SphericalDomain::mRadius, Vector3D::set(), and Vector3D::x().

38 {
39  // Get vector center to coordinate, store in coordinate.
40  coordinate -= mCenter;
41  // Get distance from center of sphere
42  double len = coordinate.length();
43  // Scale vector to have length of radius
44  coordinate *= mRadius / len;
45  // If was at center, return arbitrary position on sphere
46  // (all possitions are equally close)
47  if (!finite(coordinate.x()))
48  coordinate.set( mRadius, 0.0, 0.0 );
49  // Get position from vector
50  coordinate += mCenter;
51 }

Here is the call graph for this function:

virtual void snap_to ( Mesh::EntityHandle  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 MeshDomain.

Member Data Documentation

Vector3D mCenter
private
double mRadius
private

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