 |
Shiokaze Framework
A research-oriented fluid solver for computer graphics
|
|
Go to the documentation of this file.
25 #ifndef SHKZ_ARRAY_GRADIENT3_H
26 #define SHKZ_ARRAY_GRADIENT3_H
38 template<
class T>
void compute_gradient(
const array3<T> &array,
macarray3<T> &gradient,
double dx ) {
39 for(
int dim : DIMS3 ) {
40 gradient[dim].
clear();
45 gradient.
parallel_actives([&](
int dim,
int i,
int j,
int k,
auto &it,
int tn ) {
47 (array(shape.
clamp(i,j,k))
48 -array(shape.
clamp(i-(dim==0),j-(dim==1),k-(dim==2)))
void activate_as(const macarray3< Y > &array, const std::array< vec3i, DIM3 > &offsets={vec3i(), vec3i(), vec3i()})
Activate cells at the same positons where an input array is active with an offset.
Definition: macarray3.h:215
void clear()
Clear out the grid.
Definition: macarray3.h:395
Structure that defines a three dimensional shape such as width, height and depth.
Definition: shape.h:478
#define SHKZ_BEGIN_NAMESPACE
Name space beggining definition for shiokaze.
Definition: common.h:39
Class that computes the gradient of physical quantities.
Definition: array_gradient3.h:36
Fixed sized vector structure.
Definition: vec.h:38
vec3i clamp(const vec3i &pi) const
Get the new constrained position within the index space of this shape.
Definition: shape.h:777
#define SHKZ_END_NAMESPACE
Name space end definition for shiokaze.
Definition: common.h:44
Three dimensional staggered grid class designed to be defined as instance member in recursive_configu...
Definition: macarray3.h:37
shape3 shape() const
Get the shape of the array.
Definition: array3.h:218
void parallel_actives(std::function< void(typename array3< T >::iterator &it)> func)
Loop over all the active cells in parallel.
Definition: macarray3.h:559
Three dimensional array class designed to be defined as instance member in recursive_configurable cla...
Definition: array3.h:42