Chombo + EB  3.2
Static Public Attributes | Protected Attributes | Friends | List of all members
RealVect Class Reference

A Real vector in SpaceDim-dimensional space. More...

#include <RealVect.H>

Public Member Functions

Constructors and Accessors
 RealVect ()
 
 RealVect (const Vector< Real > &)
 
 RealVect (D_DECL6(Real i, Real j, Real k, Real l, Real m, Real n))
 
 RealVect (const RealVect &rhs)
 
 RealVect (const IndexTM< Real, CH_SPACEDIM > &a_tm)
 
 RealVect (const IntVect &iv)
 
RealVect & operator= (const RealVect &rhs)
 
Real & operator[] (int i)
 
const Real & operator[] (int i) const
 
Comparison Operators
bool operator== (const RealVect &p) const
 
bool operator!= (const RealVect &p) const
 
bool operator< (const RealVect &p) const
 
bool operator<= (const RealVect &p) const
 
bool operator> (const RealVect &p) const
 
bool operator>= (const RealVect &p) const
 
Arithmetic Operators
RealVect & operator+= (Real s)
 
RealVect operator+ (Real s) const
 
RealVect & operator+= (const RealVect &p)
 
RealVect & operator-= (Real s)
 
RealVect & operator-= (const RealVect &p)
 
RealVect operator- (Real s) const
 
RealVect & operator*= (Real s)
 
Real dotProduct (const RealVect &a_rhs) const
 
RealVect & operator*= (const RealVect &p)
 
RealVect operator* (Real s) const
 
RealVect & operator/= (Real s)
 
RealVect & operator/= (const RealVect &p)
 
RealVect operator/ (Real s) const
 
RealVect & scale (Real s)
 
Unary operators
RealVect operator+ () const
 
RealVect operator- () const
 
Real sum () const
 
Real vectorLength () const
 
Real radSquared () const
 
Real product () const
 
int minDir (const bool &a_doAbs) const
 
int maxDir (const bool &a_doAbs) const
 
Data pointer functions
const Real * dataPtr () const
 
Real * dataPtr ()
 

Static Public Attributes

static size_t io_offset
 

Protected Attributes

Real vect [SpaceDim]
 

Friends

class HDF5Handle
 
std::ostream & operator<< (std::ostream &ostr, const RealVect &p)
 
Arithmetic friend functions
RealVect operator+ (Real s, const RealVect &p)
 
RealVect operator- (Real s, const RealVect &p)
 
RealVect operator* (Real s, const RealVect &p)
 
RealVect operator/ (Real s, const RealVect &p)
 
RealVect operator+ (const RealVect &s, const RealVect &p)
 
RealVect operator- (const RealVect &s, const RealVect &p)
 
RealVect operator* (const RealVect &s, const RealVect &p)
 
RealVect operator/ (const RealVect &s, const RealVect &p)
 
RealVect scale (const RealVect &p, Real s)
 

Other arithmetic operators

RealVect min (const RealVect &p1, const RealVect &p2)
 
RealVect max (const RealVect &p1, const RealVect &p2)
 
RealVect & min (const RealVect &p)
 
RealVect & max (const RealVect &p)
 

Constants

static const RealVect Zero
 
static const RealVect Unit
 
RealVect BASISREALV (int dir)
 

Detailed Description

A Real vector in SpaceDim-dimensional space.

The class RealVect is an implementation of a Real vector in a SpaceDim-dimensional space. RealVect values are accessed using the operator[] function, as for a normal C++ array. In addition, the basic arithmetic operators have been overloaded to implement scaling and translation operations.

Constructor & Destructor Documentation

◆ RealVect() [1/6]

RealVect::RealVect ( )

Construct a RealVect whose components are zero.

Referenced by operator+(), operator-(), and scale().

◆ RealVect() [2/6]

RealVect::RealVect ( const Vector< Real > &  )
explicit

◆ RealVect() [3/6]

RealVect::RealVect ( D_DECL6(Real i, Real j, Real k, Real l, Real m, Real n)  )

Construct a RealVect given the specific values for its coordinates. D_DECL6 is a macro that sets the constructor to take CH_SPACEDIM arguments.

◆ RealVect() [4/6]

RealVect::RealVect ( const RealVect &  rhs)
inline

The copy constructor.

References vect.

◆ RealVect() [5/6]

RealVect::RealVect ( const IndexTM< Real, CH_SPACEDIM > &  a_tm)

Construct a RealVect from an IndexTM<Real,SpaceDim>.

◆ RealVect() [6/6]

RealVect::RealVect ( const IntVect &  iv)
inline

Member Function Documentation

◆ operator=()

RealVect& RealVect::operator= ( const RealVect &  rhs)

The assignment operator.

Referenced by RealVect().

◆ operator[]() [1/2]

Real & RealVect::operator[] ( int  i)
inline

Returns a modifiable lvalue reference to the i'th coordinate of the RealVect.

References CH_assert, SpaceDim, and vect.

Referenced by RealVect().

◆ operator[]() [2/2]

const Real & RealVect::operator[] ( int  i) const
inline

Returns the i'th coordinate of the RealVect.

References CH_assert, SpaceDim, and vect.

◆ operator==()

bool RealVect::operator== ( const RealVect &  p) const

Returns true if this RealVect is equivalent to argument RealVect. All comparisons between analogous components must be satisfied.

Referenced by RealVect().

◆ operator!=()

bool RealVect::operator!= ( const RealVect &  p) const

Returns true if this RealVect is different from argument RealVect. All comparisons between analogous components must be satisfied.

Referenced by RealVect().

◆ operator<()

bool RealVect::operator< ( const RealVect &  p) const
inline

Returns true if this RealVect is less than argument RealVect. All comparisons between analogous components must be satisfied. Note that, since the comparison is component-wise, it is possible for an RealVect to be neither greater than, less than, nor equal to another.

References D_TERM6, and vect.

Referenced by RealVect().

◆ operator<=()

bool RealVect::operator<= ( const RealVect &  p) const
inline

Returns true if this RealVect is less than or equal to argument RealVect. All comparisons between analogous components must be satisfied. Note that, since the comparison is component-wise, it is possible for an RealVect to be neither greater than or equal to, less than or equal to, nor equal to another.

References D_TERM6, and vect.

Referenced by RealVect().

◆ operator>()

bool RealVect::operator> ( const RealVect &  p) const
inline

Returns true if this RealVect is greater than argument RealVect. All comparisons between analogous components must be satisfied. Note that, since the comparison is component-wise, it is possible for an RealVect to be neither greater than, less than, nor equal to another.

References D_TERM6, and vect.

Referenced by RealVect().

◆ operator>=()

bool RealVect::operator>= ( const RealVect &  p) const
inline

Returns true if this RealVect is greater than or equal to argument RealVect. All comparisons between analogous components must be satisfied. Note that, since the comparison is component-wise, it is possible for an RealVect to be neither greater than or equal to, less than or equal to, nor equal to another.

References D_TERM6, and vect.

Referenced by RealVect().

◆ operator+=() [1/2]

RealVect& RealVect::operator+= ( Real  s)

Modifies this RealVect by addition of a scalar to each component.

Referenced by RealVect().

◆ operator+() [1/2]

RealVect RealVect::operator+ ( Real  s) const

Returns a RealVect that is this RealVect with a scalar s added to each component.

◆ operator+=() [2/2]

RealVect& RealVect::operator+= ( const RealVect &  p)

Modifies this RealVect by component-wise addition by argument.

◆ operator-=() [1/2]

RealVect & RealVect::operator-= ( Real  s)
inline

Modifies this RealVect by subtraction of a scalar from each component.

References vect.

Referenced by RealVect().

◆ operator-=() [2/2]

RealVect & RealVect::operator-= ( const RealVect &  p)
inline

Modifies this RealVect by component-wise subtraction by argument.

References vect.

◆ operator-() [1/2]

RealVect RealVect::operator- ( Real  s) const

Returns a RealVect that is this RealVect with a scalar s subtracted from each component.

◆ operator*=() [1/2]

RealVect& RealVect::operator*= ( Real  s)

Modifies this RealVect by multiplying each component by a scalar.

Referenced by RealVect().

◆ dotProduct()

Real RealVect::dotProduct ( const RealVect &  a_rhs) const

Referenced by RealVect().

◆ operator*=() [2/2]

RealVect& RealVect::operator*= ( const RealVect &  p)

Modifies this RealVect by component-wise multiplication by argument.

◆ operator*()

RealVect RealVect::operator* ( Real  s) const

Returns a RealVect that is this RealVect with each component multiplied by a scalar.

Referenced by RealVect().

◆ operator/=() [1/2]

RealVect& RealVect::operator/= ( Real  s)

Modifies this RealVect by dividing each component by a scalar.

Referenced by RealVect().

◆ operator/=() [2/2]

RealVect& RealVect::operator/= ( const RealVect &  p)

Modifies this RealVect by component-wise division by argument.

◆ operator/()

RealVect RealVect::operator/ ( Real  s) const

Returns a RealVect that is this RealVect with each component divided by a scalar.

Referenced by RealVect().

◆ scale()

RealVect & RealVect::scale ( Real  s)
inline

Modifies this RealVect by multiplying each component by a scalar.

References vect.

Referenced by RealVect().

◆ min()

RealVect & RealVect::min ( const RealVect &  p)
inline

Modifies this RealVect by taking component-wise min with RealVect argument.

References Min(), and vect.

Referenced by min(), and RealVect().

◆ max()

RealVect & RealVect::max ( const RealVect &  p)
inline

Modifies this RealVect by taking component-wise max with RealVect argument.

References Max(), and vect.

Referenced by max(), and RealVect().

◆ operator+() [2/2]

RealVect RealVect::operator+ ( ) const
inline

Unary plus – for completeness.

References RealVect().

Referenced by RealVect().

◆ operator-() [2/2]

RealVect RealVect::operator- ( ) const
inline

Unary minus – negates all components of this RealVect.

References D_DECL6, RealVect(), and vect.

Referenced by RealVect().

◆ sum()

Real RealVect::sum ( ) const
inline

Sum of all components of this RealVect.

References D_TERM6, and vect.

Referenced by RealVect().

◆ vectorLength()

Real RealVect::vectorLength ( ) const
inline

sqrt(sum squares)

References radSquared().

Referenced by RealVect().

◆ radSquared()

Real RealVect::radSquared ( ) const
inline

sum squares–no square root

References SpaceDim, and vect.

Referenced by RealVect(), and vectorLength().

◆ product()

Real RealVect::product ( ) const
inline

Product of all components of this RealVect.

References D_TERM6, and vect.

Referenced by RealVect().

◆ minDir()

int RealVect::minDir ( const bool &  a_doAbs) const

Component with the minimum value of this RealVect (returns 0 if they are all the same). a_doAbs : if true then take the absolute value before comparing

Referenced by RealVect().

◆ maxDir()

int RealVect::maxDir ( const bool &  a_doAbs) const

Component with the maximum value of this RealVect (returns 0 if they are all the same). a_doAbs : if true then take the absolute value before comparing

Referenced by RealVect().

◆ dataPtr() [1/2]

const Real* RealVect::dataPtr ( ) const

Only for sending stuff to Fortran

Referenced by RealVect().

◆ dataPtr() [2/2]

Real* RealVect::dataPtr ( )

Only for sending stuff to Fortran

Friends And Related Function Documentation

◆ HDF5Handle

friend class HDF5Handle
friend

◆ min

RealVect min ( const RealVect &  p1,
const RealVect &  p2 
)
friend

Returns the RealVect that is the component-wise minimum of two argument RealVects.

◆ max

RealVect max ( const RealVect &  p1,
const RealVect &  p2 
)
friend

Returns the RealVect that is the component-wise maximum of two argument RealVects.

◆ BASISREALV

RealVect BASISREALV ( int  dir)
friend

Returns a basis vector in the given coordinate direction.
In 2-D:
BASISREALV(0) == (1.,0.); BASISREALV(1) == (0.,1.).
In 3-D:
BASISREALV(0) == (1.,0.,0.); BASISREALV(1) == (0.,1.,0.); BASISREALV(2) == (0.,0.,1.).
Note that the coordinate directions are based at zero.

Referenced by max(), and RealVect().

◆ operator+ [1/2]

RealVect operator+ ( Real  s,
const RealVect &  p 
)
friend

Returns a RealVect that is a RealVect p with a scalar s added to each component.

◆ operator- [1/2]

RealVect operator- ( Real  s,
const RealVect &  p 
)
friend

Returns s - p.

◆ operator* [1/2]

RealVect operator* ( Real  s,
const RealVect &  p 
)
friend

Returns a RealVect that is a RealVect p with each component multiplied by a scalar s.

◆ operator/ [1/2]

RealVect operator/ ( Real  s,
const RealVect &  p 
)
friend

Returns a RealVect that is a RealVect p with each component divided by a scalar s.

◆ operator+ [2/2]

RealVect operator+ ( const RealVect &  s,
const RealVect &  p 
)
friend

Returns component-wise sum of RealVects s and p.

◆ operator- [2/2]

RealVect operator- ( const RealVect &  s,
const RealVect &  p 
)
friend

Returns s - p.

◆ operator* [2/2]

RealVect operator* ( const RealVect &  s,
const RealVect &  p 
)
friend

Returns component-wise product of s and p.

◆ operator/ [2/2]

RealVect operator/ ( const RealVect &  s,
const RealVect &  p 
)
friend

Returns component-wise quotient p / s.

◆ scale

RealVect scale ( const RealVect &  p,
Real  s 
)
friend

Returns a RealVect obtained by multiplying each of the components of the given RealVect by a scalar.

◆ operator<<

std::ostream& operator<< ( std::ostream &  ostr,
const RealVect &  p 
)
friend

Print to the given output stream in ASCII.

Member Data Documentation

◆ Zero

const RealVect RealVect::Zero
static

◆ Unit

const RealVect RealVect::Unit
static

◆ io_offset

size_t RealVect::io_offset
static

◆ vect

Real RealVect::vect[SpaceDim]
protected

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