utils Namespace Reference
|
Kynema-SGF API v0.1.0
CFD solver for wind plant simulations
|
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) |
| Return a pair of bools, value is true if at least one boundary has an ext_dir specified. | |
| std::pair< bool, bool > | has_extdir_or_ho (amrex::BCRec const *bcrec, int ncomp, int dir) |
| amrex::FArrayBox | interpolate_boundary_plane (const amrex::FArrayBox &coarse, const amrex::FArrayBox &fine, const amrex::Orientation ori, amrex::IntVect ratio, const amrex::Geometry &coarse_geom, const amrex::Geometry &fine_geom, const int nghost) |
| void | fill_transverse_ghosts (amrex::MultiFab &mfab, const amrex::Geometry &geom, const amrex::Vector< amrex::BCRec > &bcrec, const amrex::Orientation ori, const int dcomp, const int ncomp, const int orig_comp) |
| 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_rt) |
| 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_INLINE 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_INLINE amrex::Box | face_aware_boundary_box_intersection (amrex::Box grown_interior_box, const amrex::Box &domain_boundary_box, const amrex::Orientation &ori) |
| AMREX_INLINE void | extend_boundary_ghost_layers (const amrex::Box &bx, amrex::Array4< amrex::Real > const &arr, const amrex::Orientation &ori, const int scomp, const int ncomp) |
| 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) |
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real | powi (const amrex::Real &x, const int &y) |
| Helper function to do pow() with integer exponents and output amrex::Real. | |
| template<typename T, typename U> | |
| amrex::Real | powi (T, U)=delete |
| Prevent other argument types from accidentally being used. | |
| 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 | 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 kynema_sgf::utils::closest_index | ( | const amrex::Vector< amrex::Real > & | vec, |
| const amrex::Real | value, | ||
| const amrex::Real | tol = 0.0_rt ) |
Return closest index (from lower) of value in vector.
◆ contains()
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool kynema_sgf::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()
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void kynema_sgf::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 kynema_sgf::utils::degrees | ( | const amrex::Real | rad_val | ) |
Convert from radians to degrees.
◆ dot_prod() [1/2]
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T kynema_sgf::utils::dot_prod | ( | const T * | x, |
| const T * | y ) |
Compute the dot product of two vectors
◆ dot_prod() [2/2]
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T kynema_sgf::utils::dot_prod | ( | const T * | x, |
| const T * | y, | ||
| const int | ndim ) |
◆ extend_boundary_ghost_layers()
| AMREX_INLINE void kynema_sgf::utils::extend_boundary_ghost_layers | ( | const amrex::Box & | bx, |
| amrex::Array4< amrex::Real > const & | arr, | ||
| const amrex::Orientation & | ori, | ||
| const int | scomp, | ||
| const int | ncomp ) |
Replicate the first boundary ghost layer outward through all remaining ghost layers available in the array along the boundary normal.
This matches the AMReX ext_dir convention, where every ghost layer of a Dirichlet boundary holds the boundary value. Intended for auxiliary boundary fill calls that compute only the first ghost layer.
- Parameters
-
bx single-layer box of the first ghost cells (or ghost faces) that have already been filled, in the index space of arr arr array holding the data, including ghost cells ori orientation of the boundary being filled scomp first component to replicate ncomp number of components to replicate
◆ face_aware_boundary_box_intersection() [1/2]
| AMREX_INLINE amrex::Box kynema_sgf::utils::face_aware_boundary_box_intersection | ( | amrex::Box | grown_interior_box, |
| const amrex::Box & | domain_boundary_box, | ||
| const amrex::Orientation & | ori ) |
◆ face_aware_boundary_box_intersection() [2/2]
| AMREX_INLINE amrex::Box kynema_sgf::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 ) |
Get the intersection with a boundary box while considering if on face or cell. Intended for auxiliary boundary fill calls.
- Parameters
-
shift_to_cc output index vector to shift from output box to a cell-centered representation. grown_interior_box box grown from domain interior to overlap with boundary domain_boundary_box box representing domain boundary containing data ori orientation 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
◆ fill_transverse_ghosts()
| void kynema_sgf::utils::fill_transverse_ghosts | ( | amrex::MultiFab & | mfab, |
| const amrex::Geometry & | geom, | ||
| const amrex::Vector< amrex::BCRec > & | bcrec, | ||
| amrex::Orientation | ori, | ||
| int | dcomp, | ||
| int | ncomp, | ||
| int | orig_comp = 0 ) |
Extend an auxiliary-filled face across transverse grid, periodic, and physical boundaries using component-specific BCRec rules. Later Dirichlet orientations retain precedence. Normal ghosts must already be filled over valid transverse cell-centered indices. Existing coarse/fine fallback values are preserved wherever no valid same-level face donor or physical extension is available.
◆ half_pi()
|
constexpr |
Return \(\pi / 2\).
◆ has_extdir()
| std::pair< bool, bool > kynema_sgf::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 > kynema_sgf::utils::has_extdir_or_ho | ( | amrex::BCRec const * | bcrec, |
| int | ncomp, | ||
| int | dir ) |
◆ interpolate_boundary_plane()
| amrex::FArrayBox kynema_sgf::utils::interpolate_boundary_plane | ( | const amrex::FArrayBox & | coarse, |
| const amrex::FArrayBox & | fine, | ||
| amrex::Orientation | ori, | ||
| amrex::IntVect | ratio, | ||
| const amrex::Geometry & | coarse_geom, | ||
| const amrex::Geometry & | fine_geom, | ||
| int | nghost ) |
Complete a partial fine boundary plane with limited conservative interpolation of its coarse plane. Recorded fine values take precedence.
◆ inv_transform_vec()
| AMREX_GPU_DEVICE AMREX_FORCE_INLINE void kynema_sgf::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()
| AMREX_FORCE_INLINE T kynema_sgf::utils::perpendicular_idx | ( | const int | normal | ) |
Return indices perpendicular to normal.
◆ powi() [1/2]
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real kynema_sgf::utils::powi | ( | const amrex::Real & | x, |
| const int & | y ) |
Helper function to do pow() with integer exponents and output amrex::Real.
◆ powi() [2/2]
|
delete |
Prevent other argument types from accidentally being used.
◆ radians()
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real kynema_sgf::utils::radians | ( | const amrex::Real | deg_val | ) |
Convert from degrees to radians.
◆ realbox_to_box()
| amrex::Box kynema_sgf::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
-
rbx Bounding box as defined in global domain coordinates geom AMReX geometry information for a given level
- Returns
- The Box instance that defines the index space equivalent to bounding box
◆ slice() [1/6]
| Slice< T > kynema_sgf::utils::slice | ( | amrex::Gpu::DeviceVector< T > & | vec, |
| const size_t | start ) |
◆ slice() [2/6]
| Slice< T > kynema_sgf::utils::slice | ( | amrex::Gpu::DeviceVector< T > & | vec, |
| const size_t | start, | ||
| const size_t | count ) |
◆ slice() [3/6]
| Slice< T > kynema_sgf::utils::slice | ( | amrex::Vector< T > & | vec, |
| const size_t | start ) |
◆ slice() [4/6]
| Slice< T > kynema_sgf::utils::slice | ( | amrex::Vector< T > & | vec, |
| const size_t | start, | ||
| const size_t | count ) |
◆ slice() [5/6]
| Slice< T > kynema_sgf::utils::slice | ( | std::vector< T > & | vec, |
| const size_t | start ) |
◆ slice() [6/6]
| Slice< T > kynema_sgf::utils::slice | ( | std::vector< T > & | vec, |
| const size_t | start, | ||
| const size_t | count ) |
◆ transform_vec()
| AMREX_GPU_DEVICE AMREX_FORCE_INLINE void kynema_sgf::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()
| AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real kynema_sgf::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()
|
constexpr |
Return \(2 \pi\).
◆ vec_mag()
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T kynema_sgf::utils::vec_mag | ( | const T * | x | ) |
Return the magnitude of a 3-D vector
◆ vec_normalize()
| AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void kynema_sgf::utils::vec_normalize | ( | T * | x | ) |
Convert a given vector to a unit vector
Generated by