Mesh Oriented datABase  (version 5.5.0)
An array-based unstructured mesh library
moab::CartVect Class Reference

Cartesian Vector. More...

#include <CartVect.hpp>

+ Inheritance diagram for moab::CartVect:

Public Member Functions

 CartVect ()
 
 CartVect (double v)
 
 CartVect (double i, double j, double k)
 
 CartVect (const double a[3])
 
CartVectoperator= (const double v[3])
 
double & operator[] (unsigned i)
 
double operator[] (unsigned i) const
 
CartVectoperator+= (const CartVect &v)
 
CartVectoperator-= (const CartVect &v)
 
CartVectoperator*= (const CartVect &v)
 
CartVectoperator+= (double s)
 
CartVectoperator-= (double s)
 
CartVectoperator*= (double s)
 
CartVectoperator/= (double s)
 
bool operator== (const CartVect &v) const
 
bool operator== (double val) const
 
double length () const
 vector length More...
 
double length_squared () const
 
void normalize ()
 make unit length, or 0 if length < DBL_MIN More...
 
void flip ()
 flip direction More...
 
void scale (const CartVect &v)
 
double * array ()
 
const double * array () const
 
void get (double v[3]) const
 
void get (float v[3]) const
 

Private Attributes

double d [3]
 

Detailed Description

Cartesian Vector.

Examples
ComputeTriDual.cpp.

Definition at line 14 of file CartVect.hpp.

Constructor & Destructor Documentation

◆ CartVect() [1/4]

moab::CartVect::CartVect ( )
inline

Definition at line 20 of file CartVect.hpp.

20 {}

◆ CartVect() [2/4]

moab::CartVect::CartVect ( double  v)
inlineexplicit

Initialze all three values to same scalar (typically zero)

Definition at line 22 of file CartVect.hpp.

23  {
24  d[0] = d[1] = d[2] = v;
25  }

References d.

◆ CartVect() [3/4]

moab::CartVect::CartVect ( double  i,
double  j,
double  k 
)
inline

Definition at line 26 of file CartVect.hpp.

27  {
28  d[0] = i;
29  d[1] = j;
30  d[2] = k;
31  }

References d.

◆ CartVect() [4/4]

moab::CartVect::CartVect ( const double  a[3])
inlineexplicit

Initialze from array

Definition at line 33 of file CartVect.hpp.

34  {
35  d[0] = a[0];
36  d[1] = a[1];
37  d[2] = a[2];
38  }

References d.

Member Function Documentation

◆ array() [1/2]

double* moab::CartVect::array ( )
inline

Definition at line 127 of file CartVect.hpp.

128  {
129  return d;
130  }

References d.

Referenced by moab::AffineXform::accumulate(), moab::BoundBox::BoundBox(), moab::box_from_axes(), moab::AdaptiveKDTreeIter::box_max(), moab::AdaptiveKDTreeIter::box_min(), moab::BoxPlaneIter::BoxPlaneIter(), moab::BVHTree::bruteforce_find(), moab::AdaptiveKDTree::build_tree(), moab::BVHTree::build_tree(), moab::BSPTreeIter::calculate_polyhedron(), moab::GeomQueryTool::closest_to_location(), moab::AdaptiveKDTree::closest_triangle(), moab::OrientedBox::compute_from_vertices(), moab::AdaptiveKDTree::distance_search(), moab::BVHTree::distance_search(), moab::IntxUtils::EdgeIntxRllCs(), moab::EvalSet::evaluate_reverse(), moab::LinearTet::evaluate_reverse(), moab::LinearTri::evaluate_reverse(), moab::MergeMesh::find_merged_to(), moab::BVHTree::find_point(), moab::GeomQueryTool::find_volume(), moab::Intx2MeshInPlane::findNodes(), moab::Intx2MeshOnSphere::findNodes(), moab::IntxRllCssphere::findNodes(), moab::OrientedBoxTreeTool::get_close_tris(), moab::ElemEvaluator::get_normal(), moab::ElemEvaluator::get_vert_pos(), moab::FBEngine::getEntBoundBox(), moab::IntxUtils::global_gnomonic_projection(), moab::SmoothFace::init_gradient(), moab::Element::Map::inside_box(), moab::ElemEvaluator::integrate(), moab::LinearHex::integrateFcn(), moab::LinearQuad::integrateFcn(), moab::ElemEvaluator::jacobian(), main(), moab::OrientedBox::make_hex(), moab::AdaptiveKDTree::point_search(), moab::BVHTree::point_search(), moab::GeomQueryTool::poly_solid_angle(), moab::ray_intersect_halfspaces(), moab::ElemEvaluator::reverse_eval(), set_departure_points_position(), moab::ElemEvaluator::set_ent_handle(), moab::GeomQueryTool::test_volume_boundary(), moab::ReadNCDF::update(), moab::BoundBox::update(), and moab::BoundBox::update_box_spherical_elem().

◆ array() [2/2]

const double* moab::CartVect::array ( ) const
inline

Definition at line 131 of file CartVect.hpp.

132  {
133  return d;
134  }

References d.

◆ flip()

void moab::CartVect::flip ( )
inline

flip direction

Definition at line 199 of file CartVect.hpp.

200 {
201  d[0] = -d[0];
202  d[1] = -d[1];
203  d[2] = -d[2];
204 }

References d.

◆ get() [1/2]

◆ get() [2/2]

void moab::CartVect::get ( float  v[3]) const
inline

initialize float array from this

Definition at line 145 of file CartVect.hpp.

146  {
147  v[0] = static_cast< float >( d[0] );
148  v[1] = static_cast< float >( d[1] );
149  v[2] = static_cast< float >( d[2] );
150  }

References d.

◆ length()

◆ length_squared()

◆ normalize()

◆ operator*=() [1/2]

CartVect & moab::CartVect::operator*= ( const CartVect v)
inline

Assign cross product to this

Definition at line 175 of file CartVect.hpp.

176 {
177  return *this = *this * v;
178 }

◆ operator*=() [2/2]

CartVect& moab::CartVect::operator*= ( double  s)
inline

Definition at line 87 of file CartVect.hpp.

88  {
89  d[0] *= s;
90  d[1] *= s;
91  d[2] *= s;
92  return *this;
93  }

References d.

◆ operator+=() [1/2]

CartVect& moab::CartVect::operator+= ( const CartVect v)
inline

Definition at line 56 of file CartVect.hpp.

57  {
58  d[0] += v.d[0];
59  d[1] += v.d[1];
60  d[2] += v.d[2];
61  return *this;
62  }

References d.

◆ operator+=() [2/2]

CartVect& moab::CartVect::operator+= ( double  s)
inline

Definition at line 73 of file CartVect.hpp.

74  {
75  d[0] += s;
76  d[1] += s;
77  d[2] += s;
78  return *this;
79  }

References d.

◆ operator-=() [1/2]

CartVect& moab::CartVect::operator-= ( const CartVect v)
inline

Definition at line 63 of file CartVect.hpp.

64  {
65  d[0] -= v.d[0];
66  d[1] -= v.d[1];
67  d[2] -= v.d[2];
68  return *this;
69  }

References d.

◆ operator-=() [2/2]

CartVect& moab::CartVect::operator-= ( double  s)
inline

Definition at line 80 of file CartVect.hpp.

81  {
82  d[0] -= s;
83  d[1] -= s;
84  d[2] -= s;
85  return *this;
86  }

References d.

◆ operator/=()

CartVect& moab::CartVect::operator/= ( double  s)
inline

Definition at line 94 of file CartVect.hpp.

95  {
96  d[0] /= s;
97  d[1] /= s;
98  d[2] /= s;
99  return *this;
100  }

References d.

◆ operator=()

CartVect& moab::CartVect::operator= ( const double  v[3])
inline

Definition at line 39 of file CartVect.hpp.

40  {
41  d[0] = v[0];
42  d[1] = v[1];
43  d[2] = v[2];
44  return *this;
45  }

References d.

◆ operator==() [1/2]

bool moab::CartVect::operator== ( const CartVect v) const
inline

Definition at line 101 of file CartVect.hpp.

102  {
103  return d[0] == v[0] && d[1] == v[1] && d[2] == v[2];
104  }

References d.

◆ operator==() [2/2]

bool moab::CartVect::operator== ( double  val) const
inline

Definition at line 105 of file CartVect.hpp.

106  {
107  return d[0] == val && d[1] == val && d[2] == val;
108  }

References d.

◆ operator[]() [1/2]

double& moab::CartVect::operator[] ( unsigned  i)
inline

Definition at line 47 of file CartVect.hpp.

48  {
49  return d[i];
50  }

References d.

◆ operator[]() [2/2]

double moab::CartVect::operator[] ( unsigned  i) const
inline

Definition at line 51 of file CartVect.hpp.

52  {
53  return d[i];
54  }

References d.

◆ scale()

void moab::CartVect::scale ( const CartVect v)
inline

per-element scalar multiply (this[0] *= v[0], this[1] *= v[1], ...)

Definition at line 119 of file CartVect.hpp.

120  {
121  d[0] *= v.d[0];
122  d[1] *= v.d[1];
123  d[2] *= v.d[2];
124  }

References d.

Referenced by perform_laplacian_smoothing().

Member Data Documentation

◆ d

double moab::CartVect::d[3]
private

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