MOAB: Mesh Oriented datABase  (version 5.4.1)
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
double length_squared () const
void normalize ()
make unit length, or 0 if length < DBL_MIN
void flip ()
flip direction
void scale (const CartVect &v)
double * array ()
const double * array () const
void get (double v[3]) const
void get (float v[3]) const

double d [3]

## Detailed Description

Cartesian Vector.

Examples:
ComputeTriDual.cpp, DeformMeshRemap.cpp, GenLargeMesh.cpp, LaplacianSmoother.cpp, and LloydRelaxation.cpp.

Definition at line 14 of file CartVect.hpp.

## Constructor & Destructor Documentation

 moab::CartVect::CartVect ( )  [inline]

Definition at line 20 of file CartVect.hpp.

{}

 moab::CartVect::CartVect ( double v )  [inline, explicit]

Initialze all three values to same scalar (typically zero)

Definition at line 22 of file CartVect.hpp.

References d.

    {
d[0] = d[1] = d[2] = v;
}

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

Definition at line 26 of file CartVect.hpp.

References d.

    {
d[0] = i;
d[1] = j;
d[2] = k;
}

 moab::CartVect::CartVect ( const double a[3] )  [inline, explicit]

Initialze from array

Definition at line 33 of file CartVect.hpp.

References d.

    {
d[0] = a[0];
d[1] = a[1];
d[2] = a[2];
}


## Member Function Documentation

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

Definition at line 131 of file CartVect.hpp.

References d.

    {
return d;
}

 void moab::CartVect::flip ( )  [inline]

flip direction

Definition at line 199 of file CartVect.hpp.

References d.

{
d[0] = -d[0];
d[1] = -d[1];
d[2] = -d[2];
}

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

initialize double array from this

Definition at line 137 of file CartVect.hpp.

References d.

    {
v[0] = d[0];
v[1] = d[1];
v[2] = d[2];
}

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

initialize float array from this

Definition at line 145 of file CartVect.hpp.

References d.

    {
v[0] = static_cast< float >( d[0] );
v[1] = static_cast< float >( d[1] );
v[2] = static_cast< float >( d[2] );
}

 double moab::CartVect::length_squared ( ) const [inline]
Examples:
DeformMeshRemap.cpp, and LaplacianSmoother.cpp.

Definition at line 185 of file CartVect.hpp.

References d.

{
return d[0] * d[0] + d[1] * d[1] + d[2] * d[2];
}

 void moab::CartVect::normalize ( )  [inline]

make unit length, or 0 if length < DBL_MIN

Definition at line 190 of file CartVect.hpp.

References d, and length().

{
double tmp = length();
if( tmp < DBL_MIN )
d[0] = d[1] = d[2] = 0;
else
*this /= tmp;
}

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

Assign cross product to this

Definition at line 175 of file CartVect.hpp.

{
return *this = *this * v;
}

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

Definition at line 87 of file CartVect.hpp.

References d.

    {
d[0] *= s;
d[1] *= s;
d[2] *= s;
return *this;
}

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

Definition at line 56 of file CartVect.hpp.

References d.

    {
d[0] += v.d[0];
d[1] += v.d[1];
d[2] += v.d[2];
return *this;
}

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

Definition at line 73 of file CartVect.hpp.

References d.

    {
d[0] += s;
d[1] += s;
d[2] += s;
return *this;
}

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

Definition at line 63 of file CartVect.hpp.

References d.

    {
d[0] -= v.d[0];
d[1] -= v.d[1];
d[2] -= v.d[2];
return *this;
}

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

Definition at line 80 of file CartVect.hpp.

References d.

    {
d[0] -= s;
d[1] -= s;
d[2] -= s;
return *this;
}

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

Definition at line 94 of file CartVect.hpp.

References d.

    {
d[0] /= s;
d[1] /= s;
d[2] /= s;
return *this;
}

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

Definition at line 39 of file CartVect.hpp.

References d.

    {
d[0] = v[0];
d[1] = v[1];
d[2] = v[2];
return *this;
}

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

Definition at line 101 of file CartVect.hpp.

References d.

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

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

Definition at line 105 of file CartVect.hpp.

References d.

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

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

Definition at line 47 of file CartVect.hpp.

References d.

    {
return d[i];
}

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

Definition at line 51 of file CartVect.hpp.

References d.

    {
return d[i];
}

 void moab::CartVect::scale ( const CartVect & v )  [inline]

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

Examples:
LaplacianSmoother.cpp.

Definition at line 119 of file CartVect.hpp.

References d.

Referenced by perform_laplacian_smoothing().

    {
d[0] *= v.d[0];
d[1] *= v.d[1];
d[2] *= v.d[2];
}


## Member Data Documentation

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

Definition at line 17 of file CartVect.hpp.

List of all members.

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