Block-Structured AMR Software Framework
amrex::RealVect Class Reference

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

#include <AMReX_RealVect.H>

Public Member Functions

Constructors and Accessors
constexpr RealVect () noexcept
 
 RealVect (const std::vector< Real > &vr) noexcept
 
constexpr AMREX_GPU_HOST_DEVICE RealVect (Real i) noexcept
 
AMREX_GPU_HOST_DEVICE RealVect (const Real *a) noexcept
 
AMREX_GPU_HOST_DEVICE RealVect (const IntVect &iv) noexcept
 
Real & operator[] (int i) &&=delete
 
AMREX_GPU_HOST_DEVICE Real & operator[] (int i) &noexcept
 
AMREX_GPU_HOST_DEVICE const Real & operator[] (int i) const &noexcept
 
Iterators
AMREX_GPU_HOST_DEVICE Real * begin () noexcept
 
AMREX_GPU_HOST_DEVICE const Real * begin () const noexcept
 
AMREX_GPU_HOST_DEVICE Real * end () noexcept
 
AMREX_GPU_HOST_DEVICE const Real * end () const noexcept
 
Comparison Operators
AMREX_GPU_HOST_DEVICE bool operator== (const RealVect &p) const noexcept
 
AMREX_GPU_HOST_DEVICE bool operator!= (const RealVect &p) const noexcept
 
AMREX_GPU_HOST_DEVICE bool operator< (const RealVect &p) const noexcept
 
AMREX_GPU_HOST_DEVICE bool operator<= (const RealVect &p) const noexcept
 
AMREX_GPU_HOST_DEVICE bool operator> (const RealVect &p) const noexcept
 
AMREX_GPU_HOST_DEVICE bool operator>= (const RealVect &p) const noexcept
 
Arithmetic Operators
AMREX_GPU_HOST_DEVICE RealVectoperator+= (Real s) noexcept
 
AMREX_GPU_HOST_DEVICE RealVect operator+ (Real s) const noexcept
 
AMREX_GPU_HOST_DEVICE RealVectoperator+= (const RealVect &p) noexcept
 
AMREX_GPU_HOST_DEVICE RealVectoperator-= (Real s) noexcept
 
AMREX_GPU_HOST_DEVICE RealVectoperator-= (const RealVect &p) noexcept
 
AMREX_GPU_HOST_DEVICE RealVect operator- (Real s) const noexcept
 
AMREX_GPU_HOST_DEVICE RealVectoperator*= (Real s) noexcept
 
AMREX_GPU_HOST_DEVICE Real dotProduct (const RealVect &a_rhs) const noexcept
 
AMREX_GPU_HOST_DEVICE RealVectoperator*= (const RealVect &p) noexcept
 
AMREX_GPU_HOST_DEVICE RealVect operator* (Real s) const noexcept
 
AMREX_GPU_HOST_DEVICE RealVectoperator/= (Real s) noexcept
 
AMREX_GPU_HOST_DEVICE RealVectoperator/= (const RealVect &p) noexcept
 
AMREX_GPU_HOST_DEVICE RealVect operator/ (Real s) const noexcept
 
AMREX_GPU_HOST_DEVICE RealVectscale (Real s) noexcept
 
AMREX_GPU_HOST_DEVICE IntVect floor () const noexcept
 
AMREX_GPU_HOST_DEVICE IntVect ceil () const noexcept
 
AMREX_GPU_HOST_DEVICE IntVect round () const noexcept
 
Unary operators
AMREX_GPU_HOST_DEVICE RealVect operator+ () const noexcept
 
AMREX_GPU_HOST_DEVICE RealVect operator- () const noexcept
 
AMREX_GPU_HOST_DEVICE Real sum () const noexcept
 
AMREX_GPU_HOST_DEVICE Real vectorLength () const noexcept
 
AMREX_GPU_HOST_DEVICE Real radSquared () const noexcept
 
AMREX_GPU_HOST_DEVICE Real product () const noexcept
 
AMREX_GPU_HOST_DEVICE int minDir (const bool &a_doAbs) const noexcept
 
AMREX_GPU_HOST_DEVICE int maxDir (const bool &a_doAbs) const noexcept
 
Data pointer functions
AMREX_GPU_HOST_DEVICE const Real * dataPtr () const noexcept
 
AMREX_GPU_HOST_DEVICE Real * dataPtr () noexcept
 

Static Public Member Functions

Static public members functions
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE RealVect TheZeroVector () noexcept
 
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE RealVect TheUnitVector () noexcept
 

Constants

static AMREX_EXPORT const RealVect Zero = RealVect::TheZeroVector()
 
static AMREX_EXPORT const RealVect Unit = RealVect::TheUnitVector()
 
AMREX_GPU_HOST_DEVICE RealVect BASISREALV (int dir) noexcept
 

Arithmetic friend functions

Real vect [SpaceDim] = {AMREX_D_DECL(Real(0.),Real(0.),Real(0.))}
 
AMREX_GPU_HOST_DEVICE RealVect operator+ (Real s, const RealVect &p) noexcept
 
AMREX_GPU_HOST_DEVICE RealVect operator- (Real s, const RealVect &p) noexcept
 
AMREX_GPU_HOST_DEVICE RealVect operator* (Real s, const RealVect &p) noexcept
 
AMREX_GPU_HOST_DEVICE RealVect operator/ (Real s, const RealVect &p) noexcept
 
AMREX_GPU_HOST_DEVICE RealVect operator+ (const RealVect &s, const RealVect &p) noexcept
 
AMREX_GPU_HOST_DEVICE RealVect operator- (const RealVect &s, const RealVect &p) noexcept
 
AMREX_GPU_HOST_DEVICE RealVect operator* (const RealVect &s, const RealVect &p) noexcept
 
AMREX_GPU_HOST_DEVICE RealVect operator/ (const RealVect &s, const RealVect &p) noexcept
 
AMREX_GPU_HOST_DEVICE RealVect scale (const RealVect &p, Real s) noexcept
 
std::ostream & operator<< (std::ostream &ostr, const RealVect &p)
 
std::istream & operator>> (std::istream &is, RealVect &iv)
 

Other arithmetic operators

AMREX_GPU_HOST_DEVICE RealVectmin (const RealVect &p) noexcept
 
AMREX_GPU_HOST_DEVICE RealVectmax (const RealVect &p) noexcept
 
AMREX_GPU_HOST_DEVICE RealVect min (const RealVect &p1, const RealVect &p2) noexcept
 
AMREX_GPU_HOST_DEVICE RealVect max (const RealVect &p1, const RealVect &p2) noexcept
 

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/5]

constexpr amrex::RealVect::RealVect ( )
inlineconstexprnoexcept

Construct a RealVect whose components are zero.

◆ RealVect() [2/5]

amrex::RealVect::RealVect ( const std::vector< Real > &  vr)
inlineexplicitnoexcept

◆ RealVect() [3/5]

constexpr AMREX_GPU_HOST_DEVICE amrex::RealVect::RealVect ( Real  i)
inlineexplicitconstexprnoexcept

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

◆ RealVect() [4/5]

AMREX_GPU_HOST_DEVICE amrex::RealVect::RealVect ( const Real *  a)
inlineexplicitnoexcept

Construct a RealVect setting the coordinates to the corresponding values in the Real array a.

◆ RealVect() [5/5]

AMREX_GPU_HOST_DEVICE amrex::RealVect::RealVect ( const IntVect iv)
inlinenoexcept

Construct a RealVect from an IntVect by coercing each component from int to Real.

Member Function Documentation

◆ begin() [1/2]

AMREX_GPU_HOST_DEVICE const Real* amrex::RealVect::begin ( ) const
inlinenoexcept

Return pointer to the first component.

◆ begin() [2/2]

AMREX_GPU_HOST_DEVICE Real* amrex::RealVect::begin ( )
inlinenoexcept

Return pointer to the first component.

◆ ceil()

AMREX_GPU_HOST_DEVICE IntVect amrex::RealVect::ceil ( ) const
inlinenoexcept

Returns an IntVect whose components are the std::floor of the RealVect components.

◆ dataPtr() [1/2]

AMREX_GPU_HOST_DEVICE const Real* amrex::RealVect::dataPtr ( ) const
inlinenoexcept

Only for sending stuff to Fortran

◆ dataPtr() [2/2]

AMREX_GPU_HOST_DEVICE Real* amrex::RealVect::dataPtr ( )
inlinenoexcept

Only for sending stuff to Fortran

◆ dotProduct()

AMREX_GPU_HOST_DEVICE Real amrex::RealVect::dotProduct ( const RealVect a_rhs) const
inlinenoexcept

Returns the result of the scalar product with another RealVect

◆ end() [1/2]

AMREX_GPU_HOST_DEVICE const Real* amrex::RealVect::end ( ) const
inlinenoexcept

Return pointer to the one past last component

◆ end() [2/2]

AMREX_GPU_HOST_DEVICE Real* amrex::RealVect::end ( )
inlinenoexcept

Return pointer to the one past last component

◆ floor()

AMREX_GPU_HOST_DEVICE IntVect amrex::RealVect::floor ( ) const
inlinenoexcept

Returns an IntVect whose components are the std::floor of the RealVect components.

◆ max()

AMREX_GPU_HOST_DEVICE RealVect & amrex::RealVect::max ( const RealVect p)
inlinenoexcept

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

◆ maxDir()

AMREX_GPU_HOST_DEVICE int amrex::RealVect::maxDir ( const bool &  a_doAbs) const
inlinenoexcept

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

◆ min()

AMREX_GPU_HOST_DEVICE RealVect & amrex::RealVect::min ( const RealVect p)
inlinenoexcept

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

◆ minDir()

AMREX_GPU_HOST_DEVICE int amrex::RealVect::minDir ( const bool &  a_doAbs) const
inlinenoexcept

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

◆ operator!=()

AMREX_GPU_HOST_DEVICE bool amrex::RealVect::operator!= ( const RealVect p) const
inlinenoexcept

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

◆ operator*()

AMREX_GPU_HOST_DEVICE RealVect amrex::RealVect::operator* ( Real  s) const
inlinenoexcept

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

◆ operator*=() [1/2]

AMREX_GPU_HOST_DEVICE RealVect & amrex::RealVect::operator*= ( const RealVect p)
inlinenoexcept

Modifies this RealVect by component-wise multiplication by argument.

◆ operator*=() [2/2]

AMREX_GPU_HOST_DEVICE RealVect & amrex::RealVect::operator*= ( Real  s)
inlinenoexcept

Modifies this RealVect by multiplying each component by a scalar.

◆ operator+() [1/2]

AMREX_GPU_HOST_DEVICE RealVect amrex::RealVect::operator+ ( ) const
inlinenoexcept

Unary plus – for completeness.

◆ operator+() [2/2]

AMREX_GPU_HOST_DEVICE RealVect amrex::RealVect::operator+ ( Real  s) const
inlinenoexcept

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

◆ operator+=() [1/2]

AMREX_GPU_HOST_DEVICE RealVect & amrex::RealVect::operator+= ( const RealVect p)
inlinenoexcept

Modifies this RealVect by component-wise addition by argument.

◆ operator+=() [2/2]

AMREX_GPU_HOST_DEVICE RealVect & amrex::RealVect::operator+= ( Real  s)
inlinenoexcept

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

◆ operator-() [1/2]

AMREX_GPU_HOST_DEVICE RealVect amrex::RealVect::operator- ( ) const
inlinenoexcept

Unary minus – negates all components of this RealVect.

◆ operator-() [2/2]

AMREX_GPU_HOST_DEVICE RealVect amrex::RealVect::operator- ( Real  s) const
inlinenoexcept

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

◆ operator-=() [1/2]

AMREX_GPU_HOST_DEVICE RealVect & amrex::RealVect::operator-= ( const RealVect p)
inlinenoexcept

Modifies this RealVect by component-wise subtraction by argument.

◆ operator-=() [2/2]

AMREX_GPU_HOST_DEVICE RealVect & amrex::RealVect::operator-= ( Real  s)
inlinenoexcept

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

◆ operator/()

AMREX_GPU_HOST_DEVICE RealVect amrex::RealVect::operator/ ( Real  s) const
inlinenoexcept

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

◆ operator/=() [1/2]

AMREX_GPU_HOST_DEVICE RealVect & amrex::RealVect::operator/= ( const RealVect p)
inlinenoexcept

Modifies this RealVect by component-wise division by argument.

◆ operator/=() [2/2]

AMREX_GPU_HOST_DEVICE RealVect & amrex::RealVect::operator/= ( Real  s)
inlinenoexcept

Modifies this RealVect by dividing each component by a scalar.

◆ operator<()

AMREX_GPU_HOST_DEVICE bool amrex::RealVect::operator< ( const RealVect p) const
inlinenoexcept

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.

◆ operator<=()

AMREX_GPU_HOST_DEVICE bool amrex::RealVect::operator<= ( const RealVect p) const
inlinenoexcept

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.

◆ operator==()

AMREX_GPU_HOST_DEVICE bool amrex::RealVect::operator== ( const RealVect p) const
inlinenoexcept

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

◆ operator>()

AMREX_GPU_HOST_DEVICE bool amrex::RealVect::operator> ( const RealVect p) const
inlinenoexcept

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.

◆ operator>=()

AMREX_GPU_HOST_DEVICE bool amrex::RealVect::operator>= ( const RealVect p) const
inlinenoexcept

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.

◆ operator[]() [1/3]

Real& amrex::RealVect::operator[] ( int  i) &&
delete

Prevent rvalue assignment to the i'th coordinate of the RealVect.

◆ operator[]() [2/3]

AMREX_GPU_HOST_DEVICE Real& amrex::RealVect::operator[] ( int  i) &
inlinenoexcept

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

◆ operator[]() [3/3]

AMREX_GPU_HOST_DEVICE const Real& amrex::RealVect::operator[] ( int  i) const &
inlinenoexcept

Returns the i'th coordinate of the RealVect.

◆ product()

AMREX_GPU_HOST_DEVICE Real amrex::RealVect::product ( ) const
inlinenoexcept

Product of all components of this RealVect.

◆ radSquared()

AMREX_GPU_HOST_DEVICE Real amrex::RealVect::radSquared ( ) const
inlinenoexcept

sum squares–no square root

◆ round()

AMREX_GPU_HOST_DEVICE IntVect amrex::RealVect::round ( ) const
inlinenoexcept

Returns an IntVect whose components are the std::floor of the RealVect components.

◆ scale()

AMREX_GPU_HOST_DEVICE RealVect & amrex::RealVect::scale ( Real  s)
inlinenoexcept

Modifies this RealVect by multiplying each component by a scalar.

◆ sum()

AMREX_GPU_HOST_DEVICE Real amrex::RealVect::sum ( ) const
inlinenoexcept

Sum of all components of this RealVect.

◆ TheUnitVector()

AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE RealVect amrex::RealVect::TheUnitVector ( )
inlinestaticconstexprnoexcept

The unit vector in AMREX_SPACEDIM-dimensional space.

◆ TheZeroVector()

AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE RealVect amrex::RealVect::TheZeroVector ( )
inlinestaticconstexprnoexcept

The zero vector in AMREX_SPACEDIM-dimensional space.

◆ vectorLength()

AMREX_GPU_HOST_DEVICE Real amrex::RealVect::vectorLength ( ) const
inlinenoexcept

sqrt(sum squares)

Friends And Related Function Documentation

◆ BASISREALV

AMREX_GPU_HOST_DEVICE 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.

◆ max

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

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

◆ min

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

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

◆ operator* [1/2]

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

Returns component-wise product of s and p.

◆ operator* [2/2]

AMREX_GPU_HOST_DEVICE 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]

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

Returns component-wise sum of RealVects s and p.

◆ operator+ [2/2]

AMREX_GPU_HOST_DEVICE 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]

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

Returns s - p.

◆ operator- [2/2]

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

Returns s - p.

◆ operator/ [1/2]

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

Returns component-wise quotient p / s.

◆ operator/ [2/2]

AMREX_GPU_HOST_DEVICE 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<<

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

Print to the given output stream in ASCII.

◆ operator>>

std::istream& operator>> ( std::istream &  is,
RealVect iv 
)
friend

◆ scale

AMREX_GPU_HOST_DEVICE 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.

Member Data Documentation

◆ Unit

const RealVect amrex::RealVect::Unit = RealVect::TheUnitVector()
static

This is a RealVect all of whose components are equal to one.

◆ vect

Real amrex::RealVect::vect[SpaceDim] = {AMREX_D_DECL(Real(0.),Real(0.),Real(0.))}
protected

The individual components of this RealVect.

◆ Zero

const RealVect amrex::RealVect::Zero = RealVect::TheZeroVector()
static

This is a RealVect all of whose components are equal to zero.


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