utils Namespace Reference

AMR-Wind API: amr_wind::utils Namespace Reference
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
amr_wind::utils Namespace Reference

Classes

class  MultiParser
 
struct  Slice
 

Functions

template<typename T >
Slice< T > slice (std::vector< T > &vec, const size_t start, const size_t count)
 
template<typename T >
Slice< T > slice (std::vector< T > &vec, const size_t start)
 
template<typename T >
Slice< T > slice (amrex::Vector< T > &vec, const size_t start, const size_t count)
 
template<typename T >
Slice< T > slice (amrex::Vector< T > &vec, const size_t start)
 
template<typename T >
Slice< T > slice (amrex::Gpu::DeviceVector< T > &vec, const size_t start, const size_t count)
 
template<typename T >
Slice< T > slice (amrex::Gpu::DeviceVector< T > &vec, const size_t start)
 
std::pair< bool, bool > has_extdir (amrex::BCRec const *bcrec, int ncomp, int dir)
 
std::pair< bool, bool > has_extdir_or_ho (amrex::BCRec const *bcrec, int ncomp, int dir)
 
amrex::Box realbox_to_box (const amrex::RealBox &rbx, const amrex::Geometry &geom)
 
AMREX_FORCE_INLINE int closest_index (const amrex::Vector< amrex::Real > &vec, const amrex::Real value, const amrex::Real tol=0.0)
 Return closest index (from lower) of value in vector.
 
template<typename T = amrex::GpuArray<int, 2>>
AMREX_FORCE_INLINE T perpendicular_idx (const int normal)
 Return indices perpendicular to normal.
 
amrex::Box face_aware_boundary_box_intersection (amrex::IntVect &shift_to_cc, amrex::Box grown_interior_box, const amrex::Box &domain_boundary_box, const amrex::Orientation &ori)
 
amrex::Box face_aware_boundary_box_intersection (amrex::Box grown_interior_box, const amrex::Box &domain_boundary_box, const amrex::Orientation &ori)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool contains (const amrex::Box &box, const amrex::RealVect &pos, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &prob_lo, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dxinv)
 Check if a point is inside a box.
 
template<typename Function >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real trapz (const amrex::Real xa, const amrex::Real xb, const int n, const Function &f)
 
template<typename T >
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T dot_prod (const T *x, const T *y)
 
template<typename T >
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T vec_mag (const T *x)
 
template<typename T >
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void vec_normalize (T *x)
 
template<typename T >
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T dot_prod (const T *x, const T *y, const int ndim)
 
template<typename T >
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void cross_prod (const T *a, const T *b, T *c)
 
template<typename T >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void transform_vec (const amrex::Array2D< T, 0, AMREX_SPACEDIM, 0, AMREX_SPACEDIM > &tmat, const T *x, T *y)
 
template<typename T >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void inv_transform_vec (const amrex::Array2D< T, 0, AMREX_SPACEDIM, 0, AMREX_SPACEDIM > &tmat, const T *x, T *y)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr amrex::Real pi ()
 Return \(\pi\) as an amrex::Real.
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr amrex::Real two_pi ()
 Return \(2 \pi\).
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr amrex::Real half_pi ()
 Return \(\pi / 2\).
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real radians (const amrex::Real deg_val)
 Convert from degrees to radians.
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real degrees (const amrex::Real rad_val)
 Convert from radians to degrees.
 

Function Documentation

◆ closest_index()

AMREX_FORCE_INLINE int amr_wind::utils::closest_index ( const amrex::Vector< amrex::Real > & vec,
const amrex::Real value,
const amrex::Real tol = 0.0 )

Return closest index (from lower) of value in vector.

◆ contains()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool amr_wind::utils::contains ( const amrex::Box & box,
const amrex::RealVect & pos,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > & prob_lo,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > & dxinv )

Check if a point is inside a box.

◆ cross_prod()

template<typename T >
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void amr_wind::utils::cross_prod ( const T * a,
const T * b,
T * c )

Compute the cross product of two vectors a, b and update c

◆ degrees()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real amr_wind::utils::degrees ( const amrex::Real rad_val)

Convert from radians to degrees.

◆ dot_prod() [1/2]

template<typename T >
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T amr_wind::utils::dot_prod ( const T * x,
const T * y )

Compute the dot product of two vectors

◆ dot_prod() [2/2]

template<typename T >
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T amr_wind::utils::dot_prod ( const T * x,
const T * y,
const int ndim )

◆ face_aware_boundary_box_intersection() [1/2]

amrex::Box amr_wind::utils::face_aware_boundary_box_intersection ( amrex::Box grown_interior_box,
const amrex::Box & domain_boundary_box,
const amrex::Orientation & ori )
inline

◆ face_aware_boundary_box_intersection() [2/2]

amrex::Box amr_wind::utils::face_aware_boundary_box_intersection ( amrex::IntVect & shift_to_cc,
amrex::Box grown_interior_box,
const amrex::Box & domain_boundary_box,
const amrex::Orientation & ori )
inline

Get the intersection with a boundary box while considering if on face or cell. Intended for auxiliary boundary fill calls.

Parameters
shift_to_ccoutput index vector to shift from output box to a cell-centered representation.
grown_interior_boxbox grown from domain interior to overlap with boundary
domain_boundary_boxbox representing domain boundary containing data
oriorientation of current boundary condition being evaluated
Returns
The Box instance representing the intersection of the two inputs with shifts added to consider the location of the field associated with the grown_interior_box

◆ half_pi()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr amrex::Real amr_wind::utils::half_pi ( )
constexpr

Return \(\pi / 2\).

◆ has_extdir()

std::pair< bool, bool > amr_wind::utils::has_extdir ( amrex::BCRec const * bcrec,
int ncomp,
int dir )

Return a pair of bools, value is true if at least one boundary has an ext_dir specified

◆ has_extdir_or_ho()

std::pair< bool, bool > amr_wind::utils::has_extdir_or_ho ( amrex::BCRec const * bcrec,
int ncomp,
int dir )

◆ inv_transform_vec()

template<typename T >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void amr_wind::utils::inv_transform_vec ( const amrex::Array2D< T, 0, AMREX_SPACEDIM, 0, AMREX_SPACEDIM > & tmat,
const T * x,
T * y )

Compute the transformation {y} = {x}^T [A]

◆ perpendicular_idx()

template<typename T = amrex::GpuArray<int, 2>>
AMREX_FORCE_INLINE T amr_wind::utils::perpendicular_idx ( const int normal)

Return indices perpendicular to normal.

◆ pi()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr amrex::Real amr_wind::utils::pi ( )
constexpr

Return \(\pi\) as an amrex::Real.

◆ radians()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real amr_wind::utils::radians ( const amrex::Real deg_val)

Convert from degrees to radians.

◆ realbox_to_box()

amrex::Box amr_wind::utils::realbox_to_box ( const amrex::RealBox & rbx,
const amrex::Geometry & geom )

Convert a bounding box into amrex::Box index space at a given level

Parameters
rbxBounding box as defined in global domain coordinates
geomAMReX geometry information for a given level
Returns
The Box instance that defines the index space equivalent to bounding box

◆ slice() [1/6]

template<typename T >
Slice< T > amr_wind::utils::slice ( amrex::Gpu::DeviceVector< T > & vec,
const size_t start )
inline

◆ slice() [2/6]

template<typename T >
Slice< T > amr_wind::utils::slice ( amrex::Gpu::DeviceVector< T > & vec,
const size_t start,
const size_t count )
inline

◆ slice() [3/6]

template<typename T >
Slice< T > amr_wind::utils::slice ( amrex::Vector< T > & vec,
const size_t start )
inline

◆ slice() [4/6]

template<typename T >
Slice< T > amr_wind::utils::slice ( amrex::Vector< T > & vec,
const size_t start,
const size_t count )
inline

◆ slice() [5/6]

template<typename T >
Slice< T > amr_wind::utils::slice ( std::vector< T > & vec,
const size_t start )
inline

◆ slice() [6/6]

template<typename T >
Slice< T > amr_wind::utils::slice ( std::vector< T > & vec,
const size_t start,
const size_t count )
inline

◆ transform_vec()

template<typename T >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void amr_wind::utils::transform_vec ( const amrex::Array2D< T, 0, AMREX_SPACEDIM, 0, AMREX_SPACEDIM > & tmat,
const T * x,
T * y )

Compute the transformation {y} = [A] {x}

◆ trapz()

template<typename Function >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real amr_wind::utils::trapz ( const amrex::Real xa,
const amrex::Real xb,
const int n,
const Function & f )

Trapezoid integration

Prefer exact evaluation of the integral over using this function

◆ two_pi()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr amrex::Real amr_wind::utils::two_pi ( )
constexpr

Return \(2 \pi\).

◆ vec_mag()

template<typename T >
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T amr_wind::utils::vec_mag ( const T * x)

Return the magnitude of a 3-D vector

◆ vec_normalize()

template<typename T >
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void amr_wind::utils::vec_normalize ( T * x)

Convert a given vector to a unit vector