Block-Structured AMR Software Framework
 
Loading...
Searching...
No Matches
amrex::RealVectND< dim > Class Template Reference

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

#include <AMReX_RealVect.H>

Public Member Functions

template<int N, std::enable_if_t<(N==3), int > >
__host__ __device__ RealVectND< dim > crossProduct (const RealVectND< dim > &a_rhs) const noexcept
 
Constructors and Accessors
constexpr RealVectND () noexcept
 
 RealVectND (const std::vector< Real > &vr) noexcept
 
template<class... Args, std::enable_if_t<(sizeof...(Args)+2==dim) &&IsConvertible_v< Real, Args... >, int > = 0>
__host__ __device__ constexpr RealVectND (Real i, Real j, Args... ks) noexcept
 
__host__ __device__ constexpr RealVectND (Real s) noexcept
 
__host__ __device__ RealVectND (const Real *a) noexcept
 
__host__ __device__ constexpr RealVectND (const IntVectND< dim > &iv) noexcept
 
__host__ __device__ constexpr RealVectND (const GpuArray< Real, dim > ga) noexcept
 
Real & operator[] (int i) &&=delete
 
__host__ __device__ constexpr Real & operator[] (int i) &noexcept
 
__host__ __device__ constexpr const Real & operator[] (int i) const &noexcept
 
template<std::size_t i>
__host__ __device__ constexpr Real & get () noexcept
 Returns a reference to the i'th coordinate of the RealVectND. Used by structured bindings.
 
template<std::size_t i>
__host__ __device__ constexpr const Real & get () const noexcept
 Returns a reference to the i'th coordinate of the RealVectND. Used by structured bindings.
 
__host__ __device__ constexpr GpuArray< Real, dim > to_array () const noexcept
 
Iterators
__host__ __device__ constexpr Real * begin () noexcept
 
__host__ __device__ constexpr const Real * begin () const noexcept
 
__host__ __device__ constexpr Real * end () noexcept
 
__host__ __device__ constexpr const Real * end () const noexcept
 
Comparison Operators
__host__ __device__ constexpr bool operator== (const RealVectND &p) const noexcept
 
__host__ __device__ constexpr bool operator!= (const RealVectND &p) const noexcept
 
__host__ __device__ bool operator< (const RealVectND &p) const noexcept
 
__host__ __device__ bool operator<= (const RealVectND &p) const noexcept
 
__host__ __device__ bool operator> (const RealVectND &p) const noexcept
 
__host__ __device__ bool operator>= (const RealVectND &p) const noexcept
 
Arithmetic Operators
__host__ __device__ RealVectNDoperator+= (Real s) noexcept
 
__host__ __device__ RealVectND operator+ (Real s) const noexcept
 
__host__ __device__ RealVectNDoperator+= (const RealVectND &p) noexcept
 
__host__ __device__ RealVectNDoperator-= (Real s) noexcept
 
__host__ __device__ RealVectNDoperator-= (const RealVectND &p) noexcept
 
__host__ __device__ RealVectND operator- (Real s) const noexcept
 
__host__ __device__ RealVectNDoperator*= (Real s) noexcept
 
__host__ __device__ Real dotProduct (const RealVectND &a_rhs) const noexcept
 
template<int N = dim, std::enable_if_t<(N==3), int > = 0>
__host__ __device__ RealVectND crossProduct (const RealVectND &a_rhs) const noexcept
 
__host__ __device__ RealVectNDoperator*= (const RealVectND &p) noexcept
 
__host__ __device__ RealVectND operator* (Real s) const noexcept
 
__host__ __device__ RealVectNDoperator/= (Real s) noexcept
 
__host__ __device__ RealVectNDoperator/= (const RealVectND &p) noexcept
 
__host__ __device__ RealVectND operator/ (Real s) const noexcept
 
__host__ __device__ RealVectNDscale (Real s) noexcept
 
__host__ __device__ IntVectND< dim > floor () const noexcept
 
__host__ __device__ IntVectND< dim > ceil () const noexcept
 
__host__ __device__ IntVectND< dim > round () const noexcept
 
Other arithmetic operators
__host__ __device__ RealVectNDmin (const RealVectND &p) noexcept
 
__host__ __device__ RealVectNDmax (const RealVectND &p) noexcept
 
Unary operators
__host__ __device__ RealVectND operator+ () const noexcept
 
__host__ __device__ RealVectND operator- () const noexcept
 
__host__ __device__ Real sum () const noexcept
 
__host__ __device__ Real vectorLength () const noexcept
 
__host__ __device__ Real radSquared () const noexcept
 
__host__ __device__ Real product () const noexcept
 
__host__ __device__ int minDir (const bool &a_doAbs) const noexcept
 
__host__ __device__ int maxDir (const bool &a_doAbs) const noexcept
 
Data pointer functions
__host__ __device__ const Real * dataPtr () const noexcept
 
__host__ __device__ Real * dataPtr () noexcept
 

Static Public Attributes

Constants
static const RealVectND Zero {Real(0)}
 
static const RealVectND Unit {Real(1)}
 

Static public members functions

using value_type = Real
 
Real vect [dim] = {}
 
template<int new_dim>
__host__ __device__ RealVectND< new_dim > shrink () const noexcept
 Returns a new RealVectND of size new_dim and assigns the first new_dim values of this RealVectND to it.
 
template<int new_dim>
__host__ __device__ RealVectND< new_dim > expand (Real fill_extra=0.) const noexcept
 Returns a new RealVectND of size new_dim and assigns all values of this RealVectND to it andĀ fill_extra to the remaining elements.
 
template<int new_dim>
__host__ __device__ RealVectND< new_dim > resize (Real fill_extra=0.) const noexcept
 Returns a new RealVectND of size new_dim by either shrinking or expanding this RealVectND.
 
__host__ static __device__ constexpr RealVectND TheZeroVector () noexcept
 
__host__ static __device__ constexpr RealVectND TheUnitVector () noexcept
 
__host__ static __device__ constexpr std::size_t size () noexcept
 
__host__ static __device__ constexpr int isize () noexcept
 

Detailed Description

template<int dim>
class amrex::RealVectND< dim >

A Real vector in dim-dimensional space.

The class RealVectND is an implementation of a Real vector in a dim-dimensional space. RealVectND 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.

Member Typedef Documentation

◆ value_type

template<int dim>
using amrex::RealVectND< dim >::value_type = Real

Constructor & Destructor Documentation

◆ RealVectND() [1/7]

template<int dim>
constexpr amrex::RealVectND< dim >::RealVectND ( )
inlineconstexprnoexcept

Construct a RealVectND whose components are zero.

◆ RealVectND() [2/7]

template<int dim>
amrex::RealVectND< dim >::RealVectND ( const std::vector< Real > &  vr)
inlineexplicitnoexcept

◆ RealVectND() [3/7]

template<int dim>
template<class... Args, std::enable_if_t<(sizeof...(Args)+2==dim) &&IsConvertible_v< Real, Args... >, int > = 0>
__host__ __device__ constexpr amrex::RealVectND< dim >::RealVectND ( Real  i,
Real  j,
Args...  ks 
)
inlineconstexprnoexcept

Construct a RealVectND given the specific values for its coordinates.

◆ RealVectND() [4/7]

template<int dim>
__host__ __device__ constexpr amrex::RealVectND< dim >::RealVectND ( Real  s)
inlineexplicitconstexprnoexcept

◆ RealVectND() [5/7]

template<int dim>
__host__ __device__ amrex::RealVectND< dim >::RealVectND ( const Real *  a)
inlineexplicitnoexcept

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

◆ RealVectND() [6/7]

template<int dim>
__host__ __device__ constexpr amrex::RealVectND< dim >::RealVectND ( const IntVectND< dim > &  iv)
inlineconstexprnoexcept

Construct a RealVectND from an IntVectND by coercing each component from int to Real.

◆ RealVectND() [7/7]

template<int dim>
__host__ __device__ constexpr amrex::RealVectND< dim >::RealVectND ( const GpuArray< Real, dim >  ga)
inlineconstexprnoexcept

Construct a RealVectND from a GpuArray

Member Function Documentation

◆ begin() [1/2]

template<int dim>
__host__ __device__ constexpr const Real * amrex::RealVectND< dim >::begin ( ) const
inlineconstexprnoexcept

Return pointer to the first component.

◆ begin() [2/2]

template<int dim>
__host__ __device__ constexpr Real * amrex::RealVectND< dim >::begin ( )
inlineconstexprnoexcept

Return pointer to the first component.

◆ ceil()

template<int dim>
__host__ __device__ IntVectND< dim > amrex::RealVectND< dim >::ceil ( ) const
inlinenoexcept

Returns an IntVectND<dim> whose components are the std::floor of the RealVectND components.

◆ crossProduct() [1/2]

template<int dim>
template<int N = dim, std::enable_if_t<(N==3), int > = 0>
__host__ __device__ RealVectND amrex::RealVectND< dim >::crossProduct ( const RealVectND< dim > &  a_rhs) const
inlinenoexcept

Returns the result of the cross product with another RealVectND

◆ crossProduct() [2/2]

template<int dim>
template<int N, std::enable_if_t<(N==3), int > >
__host__ __device__ RealVectND< dim > amrex::RealVectND< dim >::crossProduct ( const RealVectND< dim > &  a_rhs) const
inlinenoexcept

◆ dataPtr() [1/2]

template<int dim>
__host__ __device__ const Real * amrex::RealVectND< dim >::dataPtr ( ) const
inlinenoexcept

Only for sending stuff to Fortran

◆ dataPtr() [2/2]

template<int dim>
__host__ __device__ Real * amrex::RealVectND< dim >::dataPtr ( )
inlinenoexcept

Only for sending stuff to Fortran

◆ dotProduct()

template<int dim>
__host__ __device__ Real amrex::RealVectND< dim >::dotProduct ( const RealVectND< dim > &  a_rhs) const
inlinenoexcept

Returns the result of the scalar product with another RealVectND

◆ end() [1/2]

template<int dim>
__host__ __device__ constexpr const Real * amrex::RealVectND< dim >::end ( ) const
inlineconstexprnoexcept

Return pointer to the one past last component

◆ end() [2/2]

template<int dim>
__host__ __device__ constexpr Real * amrex::RealVectND< dim >::end ( )
inlineconstexprnoexcept

Return pointer to the one past last component

◆ expand()

template<int dim>
template<int new_dim>
__host__ __device__ RealVectND< new_dim > amrex::RealVectND< dim >::expand ( Real  fill_extra = 0.) const
inlinenoexcept

Returns a new RealVectND of size new_dim and assigns all values of this RealVectND to it andĀ fill_extra to the remaining elements.

◆ floor()

template<int dim>
__host__ __device__ IntVectND< dim > amrex::RealVectND< dim >::floor ( ) const
inlinenoexcept

Returns an IntVectND<dim> whose components are the std::floor of the RealVectND components.

◆ get() [1/2]

template<int dim>
template<std::size_t i>
__host__ __device__ constexpr const Real & amrex::RealVectND< dim >::get ( ) const
inlineconstexprnoexcept

Returns a reference to the i'th coordinate of the RealVectND. Used by structured bindings.

◆ get() [2/2]

template<int dim>
template<std::size_t i>
__host__ __device__ constexpr Real & amrex::RealVectND< dim >::get ( )
inlineconstexprnoexcept

Returns a reference to the i'th coordinate of the RealVectND. Used by structured bindings.

◆ isize()

template<int dim>
__host__ static __device__ constexpr int amrex::RealVectND< dim >::isize ( )
inlinestaticconstexprnoexcept

◆ max()

template<int dim>
__host__ __device__ RealVectND< dim > & amrex::RealVectND< dim >::max ( const RealVectND< dim > &  p)
inlinenoexcept

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

◆ maxDir()

template<int dim>
__host__ __device__ int amrex::RealVectND< dim >::maxDir ( const bool &  a_doAbs) const
inlinenoexcept

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

◆ min()

template<int dim>
__host__ __device__ RealVectND< dim > & amrex::RealVectND< dim >::min ( const RealVectND< dim > &  p)
inlinenoexcept

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

◆ minDir()

template<int dim>
__host__ __device__ int amrex::RealVectND< dim >::minDir ( const bool &  a_doAbs) const
inlinenoexcept

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

◆ operator!=()

template<int dim>
__host__ __device__ constexpr bool amrex::RealVectND< dim >::operator!= ( const RealVectND< dim > &  p) const
inlineconstexprnoexcept

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

◆ operator*()

template<int dim>
__host__ __device__ RealVectND< dim > amrex::RealVectND< dim >::operator* ( Real  s) const
inlinenoexcept

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

◆ operator*=() [1/2]

template<int dim>
__host__ __device__ RealVectND< dim > & amrex::RealVectND< dim >::operator*= ( const RealVectND< dim > &  p)
inlinenoexcept

Modifies this RealVectND by component-wise multiplication by argument.

◆ operator*=() [2/2]

template<int dim>
__host__ __device__ RealVectND< dim > & amrex::RealVectND< dim >::operator*= ( Real  s)
inlinenoexcept

Modifies this RealVectND by multiplying each component by a scalar.

◆ operator+() [1/2]

template<int dim>
__host__ __device__ RealVectND< dim > amrex::RealVectND< dim >::operator+ ( ) const
inlinenoexcept

Unary plus – for completeness.

◆ operator+() [2/2]

template<int dim>
__host__ __device__ RealVectND< dim > amrex::RealVectND< dim >::operator+ ( Real  s) const
inlinenoexcept

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

◆ operator+=() [1/2]

template<int dim>
__host__ __device__ RealVectND< dim > & amrex::RealVectND< dim >::operator+= ( const RealVectND< dim > &  p)
inlinenoexcept

Modifies this RealVectND by component-wise addition by argument.

◆ operator+=() [2/2]

template<int dim>
__host__ __device__ RealVectND< dim > & amrex::RealVectND< dim >::operator+= ( Real  s)
inlinenoexcept

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

◆ operator-() [1/2]

template<int dim>
__host__ __device__ RealVectND< dim > amrex::RealVectND< dim >::operator- ( ) const
inlinenoexcept

Unary minus – negates all components of this RealVectND.

◆ operator-() [2/2]

template<int dim>
__host__ __device__ RealVectND< dim > amrex::RealVectND< dim >::operator- ( Real  s) const
inlinenoexcept

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

◆ operator-=() [1/2]

template<int dim>
__host__ __device__ RealVectND< dim > & amrex::RealVectND< dim >::operator-= ( const RealVectND< dim > &  p)
inlinenoexcept

Modifies this RealVectND by component-wise subtraction by argument.

◆ operator-=() [2/2]

template<int dim>
__host__ __device__ RealVectND< dim > & amrex::RealVectND< dim >::operator-= ( Real  s)
inlinenoexcept

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

◆ operator/()

template<int dim>
__host__ __device__ RealVectND< dim > amrex::RealVectND< dim >::operator/ ( Real  s) const
inlinenoexcept

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

◆ operator/=() [1/2]

template<int dim>
__host__ __device__ RealVectND< dim > & amrex::RealVectND< dim >::operator/= ( const RealVectND< dim > &  p)
inlinenoexcept

Modifies this RealVectND by component-wise division by argument.

◆ operator/=() [2/2]

template<int dim>
__host__ __device__ RealVectND< dim > & amrex::RealVectND< dim >::operator/= ( Real  s)
inlinenoexcept

Modifies this RealVectND by dividing each component by a scalar.

◆ operator<()

template<int dim>
__host__ __device__ bool amrex::RealVectND< dim >::operator< ( const RealVectND< dim > &  p) const
inlinenoexcept

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

◆ operator<=()

template<int dim>
__host__ __device__ bool amrex::RealVectND< dim >::operator<= ( const RealVectND< dim > &  p) const
inlinenoexcept

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

◆ operator==()

template<int dim>
__host__ __device__ constexpr bool amrex::RealVectND< dim >::operator== ( const RealVectND< dim > &  p) const
inlineconstexprnoexcept

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

◆ operator>()

template<int dim>
__host__ __device__ bool amrex::RealVectND< dim >::operator> ( const RealVectND< dim > &  p) const
inlinenoexcept

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

◆ operator>=()

template<int dim>
__host__ __device__ bool amrex::RealVectND< dim >::operator>= ( const RealVectND< dim > &  p) const
inlinenoexcept

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

◆ operator[]() [1/3]

template<int dim>
Real & amrex::RealVectND< dim >::operator[] ( int  i) &&
delete

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

◆ operator[]() [2/3]

template<int dim>
__host__ __device__ constexpr Real & amrex::RealVectND< dim >::operator[] ( int  i) &
inlineconstexprnoexcept

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

◆ operator[]() [3/3]

template<int dim>
__host__ __device__ constexpr const Real & amrex::RealVectND< dim >::operator[] ( int  i) const &
inlineconstexprnoexcept

Returns the i'th coordinate of the RealVectND.

◆ product()

template<int dim>
__host__ __device__ Real amrex::RealVectND< dim >::product ( ) const
inlinenoexcept

Product of all components of this RealVectND.

◆ radSquared()

template<int dim>
__host__ __device__ Real amrex::RealVectND< dim >::radSquared ( ) const
inlinenoexcept

sum squares–no square root

◆ resize()

template<int dim>
template<int new_dim>
__host__ __device__ RealVectND< new_dim > amrex::RealVectND< dim >::resize ( Real  fill_extra = 0.) const
inlinenoexcept

Returns a new RealVectND of size new_dim by either shrinking or expanding this RealVectND.

◆ round()

template<int dim>
__host__ __device__ IntVectND< dim > amrex::RealVectND< dim >::round ( ) const
inlinenoexcept

Returns an IntVectND<dim> whose components are the std::floor of the RealVectND components.

◆ scale()

template<int dim>
__host__ __device__ RealVectND< dim > & amrex::RealVectND< dim >::scale ( Real  s)
inlinenoexcept

Modifies this RealVectND by multiplying each component by a scalar.

◆ shrink()

template<int dim>
template<int new_dim>
__host__ __device__ RealVectND< new_dim > amrex::RealVectND< dim >::shrink ( ) const
inlinenoexcept

Returns a new RealVectND of size new_dim and assigns the first new_dim values of this RealVectND to it.

◆ size()

template<int dim>
__host__ static __device__ constexpr std::size_t amrex::RealVectND< dim >::size ( )
inlinestaticconstexprnoexcept

◆ sum()

template<int dim>
__host__ __device__ Real amrex::RealVectND< dim >::sum ( ) const
inlinenoexcept

Sum of all components of this RealVectND.

◆ TheUnitVector()

template<int dim>
__host__ static __device__ constexpr RealVectND amrex::RealVectND< dim >::TheUnitVector ( )
inlinestaticconstexprnoexcept

The unit vector in dim-dimensional space.

◆ TheZeroVector()

template<int dim>
__host__ static __device__ constexpr RealVectND amrex::RealVectND< dim >::TheZeroVector ( )
inlinestaticconstexprnoexcept

The zero vector in dim-dimensional space.

◆ to_array()

template<int dim>
__host__ __device__ constexpr GpuArray< Real, dim > amrex::RealVectND< dim >::to_array ( ) const
inlineconstexprnoexcept

◆ vectorLength()

template<int dim>
__host__ __device__ Real amrex::RealVectND< dim >::vectorLength ( ) const
inlinenoexcept

sqrt(sum squares)

Member Data Documentation

◆ Unit

template<int dim>
constexpr const RealVectND< dim > amrex::RealVectND< dim >::Unit {Real(1)}
inlinestaticconstexpr

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

◆ vect

template<int dim>
Real amrex::RealVectND< dim >::vect[dim] = {}
protected

The individual components of this RealVectND.

◆ Zero

template<int dim>
constexpr const RealVectND< dim > amrex::RealVectND< dim >::Zero {Real(0)}
inlinestaticconstexpr

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


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