SCOREC core
Parallel unstructured mesh tools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
apf::Vector3 Class Reference

convenience wrapper over apf::Vector<3> More...

Inheritance diagram for apf::Vector3:
apf::Vector< 3 >

Public Member Functions

 Vector3 (double a, double b, double c)
 construct from 3 values More...
 
 Vector3 (double const *abc)
 construct from array More...
 
void toArray (double *abc) const
 write vector to array More...
 
void fromArray (const double *abc)
 read vector from array More...
 
double x () const
 immutable x component
 
double y () const
 immutable y component
 
double z () const
 immutable z component
 
double & x ()
 mutable x component
 
double & y ()
 mutable y component
 
double & z ()
 mutable z component
 
- Public Member Functions inherited from apf::Vector< 3 >
 Vector ()
 mandatory
 
 Vector (double const *v)
 construct from array
 
Vector< N > operator+ (Vector< N > const &b) const
 add two vectors
 
Vector< N > & operator+= (Vector< N > const &b)
 add a vector to this vector
 
Vector< N > operator- (Vector< N > const &b) const
 subtract two vectors
 
Vector< N > operator* (double s) const
 multiply a vector times a scalar More...
 
double operator* (Vector< N > const &b) const
 vector dot product More...
 
Vector< N > operator/ (double s) const
 divide a vector by a scalar More...
 
double getLength () const
 get the vector magnitude
 
Vector< N > normalize () const
 divide the vector by its magnitude
 
void zero ()
 zero the vector
 

Detailed Description

convenience wrapper over apf::Vector<3>

this class adds some functions that could not be filled in by templates, mainly component-specific initialization and x/y/z names

Definition at line 150 of file apfVector.h.

Constructor & Destructor Documentation

apf::Vector3::Vector3 ( double  a,
double  b,
double  c 
)
inline

construct from 3 values

this is commonly used for hardcoding vectors

Definition at line 159 of file apfVector.h.

160  {
161  (*this)[0] = a;
162  (*this)[1] = b;
163  (*this)[2] = c;
164  }
apf::Vector3::Vector3 ( double const *  abc)
inline

construct from array

Todo:
this could maybe be templated

Definition at line 167 of file apfVector.h.

168  {
169  (*this)[0] = abc[0];
170  (*this)[1] = abc[1];
171  (*this)[2] = abc[2];
172  }

Member Function Documentation

void apf::Vector3::fromArray ( const double *  abc)
inline

read vector from array

Todo:
this could be templated

Definition at line 183 of file apfVector.h.

184  {
185  (*this)[0] = abc[0];
186  (*this)[1] = abc[1];
187  (*this)[2] = abc[2];
188  }
void apf::Vector3::toArray ( double *  abc) const
inline

write vector to array

Todo:
this could be templated

Definition at line 175 of file apfVector.h.

176  {
177  abc[0] = (*this)[0];
178  abc[1] = (*this)[1];
179  abc[2] = (*this)[2];
180  }

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