Shiokaze Framework
A research-oriented fluid solver for computer graphics
macarray3< T > Class Template Reference

Three dimensional staggered grid class designed to be defined as instance member in recursive_configurable class. More...

#include <macarray3.h>

Inheritance diagram for macarray3< T >:
recursive_configurable messageable configurable

Classes

struct  type3
 Collection of properties of this grid. More...
 

Public Types

enum  { ACTIVES = true, ALL = false }
 
- Public Types inherited from configurable
using environment_map = std::map< std::string, const void * >
 Type for environment_map.
 

Public Member Functions

 macarray3 (recursive_configurable *parent, const shape3 &shape, vec3< T > value=vec3< T >(), std::string core_name="")
 Constructor for macarray3. More...
 
 macarray3 (recursive_configurable *parent, std::string core_name="")
 Constructor for macarray3. More...
 
 macarray3 (std::string core_name="")
 Constructor for macarray3. More...
 
 macarray3 (const shape3 &shape, vec3< T > value=vec3< T >(), std::string core_name="")
 Constructor for macarray3. More...
 
 macarray3 (const macarray3 &v)
 Copy constructor for macarray3. More...
 
virtual bool send_message (std::string message, void *ptr) override
 Send a message to the core module. More...
 
virtual bool const_send_message (std::string message, void *ptr) const override
 Send a message to the core module. More...
 
macarray3operator= (const macarray3 &array)
 Deep copy operation for macarray3. More...
 
void copy (const macarray3 &array)
 Deep copy function for macarray3. More...
 
void initialize (const shape3 &shape, vec3< T > value=vec3< T >())
 Allocate grid memory with value. More...
 
void set_touch_only_actives (bool touch_only_actives)
 Set whether to force grid manipulation only on active cells. If true, operatios such operator+=() only acts on active cells. More...
 
size_t count () const
 Function to count the number of active cells. More...
 
std::array< std::vector< vec3i >, DIM3 > actives () const
 Function to return the list of active cells positions. More...
 
void activate (const std::array< std::vector< vec3i >, DIM3 > &active_entries, const std::array< vec3i, DIM3 > &offsets={vec3i(), vec3i(), vec3i()})
 Activate cells at the positons of active_entries. More...
 
template<class Y >
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. More...
 
template<class Y >
void activate_as_bit (const Y &array, const std::array< vec3i, DIM3 > &offsets={vec3i(), vec3i()})
 Activate cells at the same positons where an input array is active with an offset. More...
 
template<class Y >
void activate_inside_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 filled with an offset. More...
 
void activate_all ()
 Activate all the cells.
 
void activate_inside ()
 Activate all the filled cells.
 
template<class Y >
void copy_active_as (const macarray3< Y > &array, const vec3i &offset=vec3i())
 Copy the states of active and inactive cells as same as input array with an offset. More...
 
vec3< T > get_background_value () const
 Get the background value (alternatively, initial value) of the grid.
 
void set_background_value (const vec3< T > &value)
 Set the background value (alternatively, initial value) of the grid. More...
 
void convert_to_full (array3< vec3< T > > &cell_array) const
 Convert staggered values to a cell centered full vector grid. More...
 
void convert_to_full (macarray3< vec3< T > > &face_array) const
 Convert staggered values to the a centered full vector grid. More...
 
shape3 shape () const
 Get the shape of the array. More...
 
shape3 shape (int dim) const
 Get the shape of the staggered grid of a specified dimension. More...
 
void clear ()
 Clear out the grid. More...
 
void clear (vec3< T > v)
 Clear out the grid with the new backgroud value. More...
 
bool operator!= (const macarray3< T > &v) const
 Return if the grid is different from an input array. More...
 
bool operator== (const macarray3< T > &v) const
 Return if the grid is same to an input array. More...
 
void operator= (T v)
 Set all the grid values with an input value. More...
 
void operator+= (const macarray3< T > &v)
 Increment all the values with the values of an input array. More...
 
void operator-= (const macarray3< T > &v)
 Subtract all the values with the values of an input array. More...
 
void operator+= (const vec3< T > &v)
 Increment all the grid values with an input vector value. More...
 
void operator+= (T v)
 Increment all the grid values with an input value. More...
 
void operator-= (const vec3< T > &v)
 Subtract all the grid values with an input vector value. More...
 
void operator-= (T v)
 Subtract all the grid values with an input value. More...
 
void operator*= (T v)
 Multiply all the grid values with an input value. More...
 
void operator/= (const T &v)
 Divide all the grid values with an input value. More...
 
const array3< T > & operator[] (int dim) const
 Get the read-only reference to the staggered array of a specified dimension. More...
 
array3< T > & operator[] (int dim)
 Get the reference to the staggered array of a specified dimension. More...
 
void set_thread_num (int number)
 Set the number of threads for parallel processing on this grid. More...
 
int get_thread_num () const
 Get the current number of threads for parallel processing on this grid. More...
 
void parallel_actives (std::function< void(typename array3< T >::iterator &it)> func)
 Loop over all the active cells in parallel. More...
 
void parallel_all (std::function< void(typename array3< T >::iterator &it)> func)
 Loop over all the cells in parallel. More...
 
void parallel_op (std::function< void(typename array3< T >::iterator &it)> func, bool type=ALL)
 Loop over cells in parallel. More...
 
void parallel_actives (std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it)> func)
 Loop over all the active cells in parallel. More...
 
void parallel_all (std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it)> func)
 Loop over all the cells in parallel. More...
 
void parallel_op (std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it)> func, bool type=ALL)
 Loop over cells in parallel. More...
 
void parallel_actives (std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it, int thread_index)> func)
 Loop over all the active cells in parallel. More...
 
void parallel_all (std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it, int thread_index)> func)
 Loop over all the cells in parallel. More...
 
void parallel_op (std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it, int thread_index)> func, bool type=ALL)
 Loop over cells in parallel. More...
 
void const_parallel_actives (std::function< void(const typename array3< T >::const_iterator &it)> func) const
 Loop over all the active cells in parallel by read-only fashion. More...
 
void const_parallel_all (std::function< void(const typename array3< T >::const_iterator &it)> func) const
 Loop over all the cells in parallel by read-only fashion. More...
 
void const_parallel_op (std::function< void(const typename array3< T >::const_iterator &it)> func, bool type=ALL) const
 Loop over cells in parallel by read-only fashion. More...
 
void const_parallel_actives (std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)> func) const
 Loop over all the active cells in parallel by read-only fashion. More...
 
void const_parallel_all (std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)> func) const
 Loop over all the cells in parallel by read-only fashion. More...
 
void const_parallel_op (std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)> func, bool type=ALL) const
 Loop over cells in parallel by read-only fashion. More...
 
void const_parallel_actives (std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it, int thread_index)> func) const
 Loop over all the active cells in parallel by read-only fashion. More...
 
void const_parallel_all (std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it, int thread_index)> func) const
 Loop over all the cells in parallel by read-only fashion. More...
 
void const_parallel_op (std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it, int thread_index)> func, bool type=ALL) const
 Loop over cells in parallel by read-only fashion. More...
 
void serial_actives (std::function< void(typename array3< T >::iterator &it)> func)
 Loop over all the active cells in serial order. More...
 
void serial_all (std::function< void(typename array3< T >::iterator &it)> func)
 Loop over all the cells in serial order. More...
 
void serial_op (std::function< void(typename array3< T >::iterator &it)> func, bool type=ALL)
 Loop over cells in serial order. More...
 
void serial_actives (std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it)> func)
 Loop over all the active cells in serial order. More...
 
void serial_all (std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it)> func)
 Loop over all the cells in serial order. More...
 
void serial_op (std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it)> func, bool type=ALL)
 Loop over cells in serial order. More...
 
void const_serial_actives (std::function< void(const typename array3< T >::const_iterator &it)> func) const
 Loop over all the active cells in serial order by read-only fashion. More...
 
void const_serial_all (std::function< void(const typename array3< T >::const_iterator &it)> func) const
 Loop over all the cells in serial order by read-only fashion. More...
 
void const_serial_op (std::function< void(const typename array3< T >::const_iterator &it)> func, bool type=ALL) const
 Loop over the cells in serial order by read-only fashion. More...
 
void const_serial_actives (std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)> func) const
 Loop over all the active cells in serial order by read-only fashion. More...
 
void const_serial_all (std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)> func) const
 Loop over all the cells in serial order by read-only fashion. More...
 
void const_serial_op (std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)> func, bool type=ALL) const
 Loop over cells in serial order by read-only fashion. More...
 
void interruptible_serial_actives (std::function< bool(typename array3< T >::iterator &it)> func)
 Loop over all the active cells in serial order. More...
 
void interruptible_serial_all (std::function< bool(typename array3< T >::iterator &it)> func)
 Loop over all the cells in serial order. More...
 
void interruptible_serial_op (std::function< bool(typename array3< T >::iterator &it)> func, bool type=ALL)
 Loop over cells in serial order. More...
 
void interruptible_serial_actives (std::function< bool(int dim, int i, int j, int k, typename array3< T >::iterator &it)> func)
 Loop over all the active cells in serial order. More...
 
void interruptible_serial_all (std::function< bool(int dim, int i, int j, int k, typename array3< T >::iterator &it)> func)
 Loop over all the cells in serial order. More...
 
void interruptible_serial_op (std::function< bool(int dim, int i, int j, int k, typename array3< T >::iterator &it)> func, bool type=ALL)
 Loop over cells in serial order. More...
 
void interruptible_const_serial_actives (std::function< bool(const typename array3< T >::const_iterator &it)> func) const
 Loop over all the active cells in serial order by read-only fashion. More...
 
void interruptible_const_serial_all (std::function< bool(const typename array3< T >::const_iterator &it)> func) const
 Loop over all the cells in serial order by read-only fashion. More...
 
void interruptible_const_serial_op (std::function< bool(const typename array3< T >::const_iterator &it)> func, bool type=ALL) const
 Loop over cells in serial order by read-only fashion. More...
 
void interruptible_const_serial_actives (std::function< bool(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)> func) const
 Loop over all the active cells in serial order by read-only fashion. More...
 
void interruptible_const_serial_all (std::function< bool(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)> func) const
 Loop over all the cells in serial order by read-only fashion. More...
 
void interruptible_const_serial_op (std::function< bool(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)> func, bool type=ALL) const
 Loop over cells in serial order by read-only fashion. More...
 
void dilate (std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it, int thread_index)> func, int count=1)
 Dilate cells. More...
 
void dilate (std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it)> func, int count=1)
 Dilate cells. More...
 
void dilate (int count=1)
 Dilate cells. More...
 
void erode (std::function< bool(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it, int thread_index)> func, int count=1)
 Erode cells. More...
 
void erode (std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)> func, int count=1)
 Erode cells. More...
 
void erode (int count=1)
 Erode cells. More...
 
void set_core_name (std::string core_name)
 Set the core name of module of this grid. More...
 
std::string get_core_name () const
 Get the core name of module of this grid. More...
 
type3 type () const
 Get the type of this grid. More...
 
void set_type (const type3 &type)
 Set the type of this grid. More...
 
- Public Member Functions inherited from recursive_configurable
 recursive_configurable ()=default
 Default constructor.
 
virtual void recursive_load (configuration &config)
 Load the program itself and relay the same to its children. Used to load files and libraries into memory. More...
 
virtual void recursive_configure (configuration &config)
 Configure the program itself and relay the same to its children. Used to load and set parameters. More...
 
virtual void recursive_initialize (const configurable::environment_map &environment=configurable::environment_map())
 Initialize the program itself and relay the same to its children. Used to get things ready for actual use. More...
 
virtual bool is_ready () const
 Get if the instance is initialized. More...
 
virtual void add_child (configurable *child)
 Add a child instance. More...
 
virtual void add_child (recursive_configurable *child)
 Add a child instance. More...
 
virtual void remove_child (configurable *child)
 Remove a child instance. More...
 
virtual void remove_child (recursive_configurable *child)
 Remove a child instance. More...
 
virtual void setup_now (configuration &config=get_global_configuration()) override
 Run recursive_load - recursive_configure - recursive_initialize processes.
 
virtual bool not_recursive () override
 Check if this instance is not derived from recursive_configurable. More...
 
void set_environment (std::string name, const void *value)
 Set the pointer to an environmental value associated with an input name. More...
 
- Public Member Functions inherited from configurable
virtual void load (configuration &config)
 Load the program. Used to load files and libraries into memory. More...
 
virtual void configure (configuration &config)
 Configure the program. Used to load and set parameters. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from configurable
static configurationset_global_configuration (const configuration &config)
 Assign the global settings of the program. More...
 
static configurationget_global_configuration ()
 Get the global settings of the program. More...
 
template<class T >
static const T & get_env (const environment_map &environment, std::string key)
 Extract an specified type of pointer from the input environment. More...
 
- Protected Member Functions inherited from configurable
bool check_set (const environment_map &environment, std::vector< std::string > names)
 Check if the values for a variable keys exist. More...
 

Detailed Description

template<class T>
class macarray3< T >

Three dimensional staggered grid class designed to be defined as instance member in recursive_configurable class.

Constructor & Destructor Documentation

◆ macarray3() [1/5]

template<class T >
macarray3< T >::macarray3 ( recursive_configurable parent,
const shape3 shape,
vec3< T >  value = vec3<T>(),
std::string  core_name = "" 
)
inline

Constructor for macarray3.

Parameters
[in]parentPointer to a parent recursive_configurable instance. Can be nullptr.
[in]shapeShape of the grid
[in]valueBackground value (initial value).
[in]core_nameCore module name. Default value is "lineararray_core3". Can be also "tiledarray_core3".

◆ macarray3() [2/5]

template<class T >
macarray3< T >::macarray3 ( recursive_configurable parent,
std::string  core_name = "" 
)
inline

Constructor for macarray3.

Parameters
[in]parentPointer to a parent recursive_configurable instance. Can be nullptr.
[in]core_nameCore module name. Default value is "lineararray_core3". Can be also "tiledarray_core3".

◆ macarray3() [3/5]

template<class T >
macarray3< T >::macarray3 ( std::string  core_name = "")
inline

Constructor for macarray3.

Parameters
[in]core_nameCore module name. Default value is "lineararray_core3". Can be also "tiledarray_core3".

◆ macarray3() [4/5]

template<class T >
macarray3< T >::macarray3 ( const shape3 shape,
vec3< T >  value = vec3<T>(),
std::string  core_name = "" 
)
inline

Constructor for macarray3.

Parameters
[in]shapeShape of the grid
[in]valueBackground value (initial value).
[in]core_nameCore module name. Default value is "lineararray_core3". Can be also "tiledarray_core3".

◆ macarray3() [5/5]

template<class T >
macarray3< T >::macarray3 ( const macarray3< T > &  v)
inline

Copy constructor for macarray3.

Parameters
[in]arrayReference to an instance of array to copy from.

Member Function Documentation

◆ activate()

template<class T >
void macarray3< T >::activate ( const std::array< std::vector< vec3i >, DIM3 > &  active_entries,
const std::array< vec3i, DIM3 > &  offsets = {vec3i(),vec3i(),vec3i()} 
)
inline

Activate cells at the positons of active_entries.

Parameters
[in]active_entriesThe list of target positions to activate.
[in]offsetOffset applied to the active_entries.

◆ activate_as()

template<class T >
template<class Y >
void macarray3< T >::activate_as ( const macarray3< Y > &  array,
const std::array< vec3i, DIM3 > &  offsets = {vec3i(),vec3i(),vec3i()} 
)
inline

Activate cells at the same positons where an input array is active with an offset.

Parameters
[in]arrayTarget array.
[in]offsetOffset applied to the target array.

◆ activate_as_bit()

template<class T >
template<class Y >
void macarray3< T >::activate_as_bit ( const Y &  array,
const std::array< vec3i, DIM3 > &  offsets = {vec3i(),vec3i()} 
)
inline

Activate cells at the same positons where an input array is active with an offset.

Parameters
[in]arrayTarget array.
[in]offsetOffset applied to the target array.

◆ activate_inside_as()

template<class T >
template<class Y >
void macarray3< T >::activate_inside_as ( const macarray3< Y > &  array,
const std::array< vec3i, DIM3 > &  offsets = {vec3i(),vec3i(),vec3i()} 
)
inline

Activate cells at the same positons where an input array is filled with an offset.

Parameters
[in]arrayTarget array.
[in]offsetOffset applied to the target array.

◆ actives()

template<class T >
std::array<std::vector<vec3i>,DIM3> macarray3< T >::actives ( ) const
inline

Function to return the list of active cells positions.

Returns
The list of active cells positions.

◆ clear() [1/2]

template<class T >
void macarray3< T >::clear ( )
inline

Clear out the grid.

Note that size, the memory allocation, background values and the information regarding level set or fillable left intact.

◆ clear() [2/2]

template<class T >
void macarray3< T >::clear ( vec3< T >  v)
inline

Clear out the grid with the new backgroud value.

Background values regarding level set and the fillable will be dicarded. Size and the memory allocation left intact.

◆ const_parallel_actives() [1/3]

template<class T >
void macarray3< T >::const_parallel_actives ( std::function< void(const typename array3< T >::const_iterator &it)>  func) const
inline

Loop over all the active cells in parallel by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ const_parallel_actives() [2/3]

template<class T >
void macarray3< T >::const_parallel_actives ( std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)>  func) const
inline

Loop over all the active cells in parallel by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ const_parallel_actives() [3/3]

template<class T >
void macarray3< T >::const_parallel_actives ( std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it, int thread_index)>  func) const
inline

Loop over all the active cells in parallel by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ const_parallel_all() [1/3]

template<class T >
void macarray3< T >::const_parallel_all ( std::function< void(const typename array3< T >::const_iterator &it)>  func) const
inline

Loop over all the cells in parallel by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ const_parallel_all() [2/3]

template<class T >
void macarray3< T >::const_parallel_all ( std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)>  func) const
inline

Loop over all the cells in parallel by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ const_parallel_all() [3/3]

template<class T >
void macarray3< T >::const_parallel_all ( std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it, int thread_index)>  func) const
inline

Loop over all the cells in parallel by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ const_parallel_op() [1/3]

template<class T >
void macarray3< T >::const_parallel_op ( std::function< void(const typename array3< T >::const_iterator &it)>  func,
bool  type = ALL 
) const
inline

Loop over cells in parallel by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed.
[in]typeType of target cells. ACTIVE or ALL.

◆ const_parallel_op() [2/3]

template<class T >
void macarray3< T >::const_parallel_op ( std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)>  func,
bool  type = ALL 
) const
inline

Loop over cells in parallel by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed.
[in]typeType of target cells. ACTIVE or ALL.

◆ const_parallel_op() [3/3]

template<class T >
void macarray3< T >::const_parallel_op ( std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it, int thread_index)>  func,
bool  type = ALL 
) const
inline

Loop over cells in parallel by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed.
[in]typeType of target cells. ACTIVE or ALL.

◆ const_send_message()

template<class T >
virtual bool macarray3< T >::const_send_message ( std::string  message,
void *  ptr 
) const
inlineoverridevirtual

Send a message to the core module.

Parameters
[in]messageMessage
[in]ptrPointer to some value.
Returns
true if handled false otherwise.

Reimplemented from messageable.

◆ const_serial_actives() [1/2]

template<class T >
void macarray3< T >::const_serial_actives ( std::function< void(const typename array3< T >::const_iterator &it)>  func) const
inline

Loop over all the active cells in serial order by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ const_serial_actives() [2/2]

template<class T >
void macarray3< T >::const_serial_actives ( std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)>  func) const
inline

Loop over all the active cells in serial order by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ const_serial_all() [1/2]

template<class T >
void macarray3< T >::const_serial_all ( std::function< void(const typename array3< T >::const_iterator &it)>  func) const
inline

Loop over all the cells in serial order by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ const_serial_all() [2/2]

template<class T >
void macarray3< T >::const_serial_all ( std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)>  func) const
inline

Loop over all the cells in serial order by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ const_serial_op() [1/2]

template<class T >
void macarray3< T >::const_serial_op ( std::function< void(const typename array3< T >::const_iterator &it)>  func,
bool  type = ALL 
) const
inline

Loop over the cells in serial order by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed.
[in]typeType of target cells. ACTIVE or ALL.

◆ const_serial_op() [2/2]

template<class T >
void macarray3< T >::const_serial_op ( std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)>  func,
bool  type = ALL 
) const
inline

Loop over cells in serial order by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed.
[in]typeType of target cells. ACTIVE or ALL.

◆ convert_to_full() [1/2]

template<class T >
void macarray3< T >::convert_to_full ( array3< vec3< T > > &  cell_array) const
inline

Convert staggered values to a cell centered full vector grid.

Parameters
[out]cell_arrayOutput cell grid.

◆ convert_to_full() [2/2]

template<class T >
void macarray3< T >::convert_to_full ( macarray3< vec3< T > > &  face_array) const
inline

Convert staggered values to the a centered full vector grid.

Parameters
[out]cell_arrayOutput cell grid.

◆ copy()

template<class T >
void macarray3< T >::copy ( const macarray3< T > &  array)
inline

Deep copy function for macarray3.

Parameters
[in]arrayReference to an instance of array to copy from.

◆ copy_active_as()

template<class T >
template<class Y >
void macarray3< T >::copy_active_as ( const macarray3< Y > &  array,
const vec3i offset = vec3i() 
)
inline

Copy the states of active and inactive cells as same as input array with an offset.

Parameters
[in]arrayTarget input array from which the states to be copied.
[in]offsetOffset

◆ count()

template<class T >
size_t macarray3< T >::count ( ) const
inline

Function to count the number of active cells.

Returns
Active cell count.

◆ dilate() [1/3]

template<class T >
void macarray3< T >::dilate ( int  count = 1)
inline

Dilate cells.

Parameters
[in]countNumber of dilation count.

◆ dilate() [2/3]

template<class T >
void macarray3< T >::dilate ( std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it)>  func,
int  count = 1 
)
inline

Dilate cells.

Parameters
[in]funcFunction that specifies what value to assign on dilated cells.
[in]countNumber of dilation count.

◆ dilate() [3/3]

template<class T >
void macarray3< T >::dilate ( std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it, int thread_index)>  func,
int  count = 1 
)
inline

Dilate cells.

Parameters
[in]funcFunction that specifies what value to assign on dilated cells.
[in]countNumber of dilation count.

◆ erode() [1/3]

template<class T >
void macarray3< T >::erode ( int  count = 1)
inline

Erode cells.

Parameters
[in]countNumber of erode count.

◆ erode() [2/3]

template<class T >
void macarray3< T >::erode ( std::function< bool(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it, int thread_index)>  func,
int  count = 1 
)
inline

Erode cells.

Parameters
[in]funcFunction that specifies whether to inactivate the cell.
[in]countNumber of erode count.

◆ erode() [3/3]

template<class T >
void macarray3< T >::erode ( std::function< void(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)>  func,
int  count = 1 
)
inline

Erode cells.

Parameters
[in]funcFunction that specifies whether to inactivate the cell.
[in]countNumber of erode count.

◆ get_core_name()

template<class T >
std::string macarray3< T >::get_core_name ( ) const
inline

Get the core name of module of this grid.

Returns
Name of the core name.

◆ get_thread_num()

template<class T >
int macarray3< T >::get_thread_num ( ) const
inline

Get the current number of threads for parallel processing on this grid.

Returns
number Number of threads.

◆ initialize()

template<class T >
void macarray3< T >::initialize ( const shape3 shape,
vec3< T >  value = vec3<T>() 
)
inline

Allocate grid memory with value.

Parameters
[in]shapeShape of the grid.
[in]valueInitial value

◆ interruptible_const_serial_actives() [1/2]

template<class T >
void macarray3< T >::interruptible_const_serial_actives ( std::function< bool(const typename array3< T >::const_iterator &it)>  func) const
inline

Loop over all the active cells in serial order by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed. Stop the loop if return true.

◆ interruptible_const_serial_actives() [2/2]

template<class T >
void macarray3< T >::interruptible_const_serial_actives ( std::function< bool(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)>  func) const
inline

Loop over all the active cells in serial order by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed. Stop the loop if return true.

◆ interruptible_const_serial_all() [1/2]

template<class T >
void macarray3< T >::interruptible_const_serial_all ( std::function< bool(const typename array3< T >::const_iterator &it)>  func) const
inline

Loop over all the cells in serial order by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed. Stop the loop if return true.

◆ interruptible_const_serial_all() [2/2]

template<class T >
void macarray3< T >::interruptible_const_serial_all ( std::function< bool(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)>  func) const
inline

Loop over all the cells in serial order by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed. Stop the loop if return true.

◆ interruptible_const_serial_op() [1/2]

template<class T >
void macarray3< T >::interruptible_const_serial_op ( std::function< bool(const typename array3< T >::const_iterator &it)>  func,
bool  type = ALL 
) const
inline

Loop over cells in serial order by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed. Stop the loop if return true.
[in]typeType of target cells. ACTIVE or ALL. Stop the loop if return true.

◆ interruptible_const_serial_op() [2/2]

template<class T >
void macarray3< T >::interruptible_const_serial_op ( std::function< bool(int dim, int i, int j, int k, const typename array3< T >::const_iterator &it)>  func,
bool  type = ALL 
) const
inline

Loop over cells in serial order by read-only fashion.

Parameters
[in]funcFunction that defines how each grid cell is processed. Stop the loop if return true.
[in]typeType of target cells. ACTIVE or ALL. Stop the loop if return true.

◆ interruptible_serial_actives() [1/2]

template<class T >
void macarray3< T >::interruptible_serial_actives ( std::function< bool(int dim, int i, int j, int k, typename array3< T >::iterator &it)>  func)
inline

Loop over all the active cells in serial order.

Parameters
[in]funcFunction that defines how each grid cell is processed. Stop the loop if return true.

◆ interruptible_serial_actives() [2/2]

template<class T >
void macarray3< T >::interruptible_serial_actives ( std::function< bool(typename array3< T >::iterator &it)>  func)
inline

Loop over all the active cells in serial order.

Parameters
[in]funcFunction that defines how each grid cell is processed. Stop the loop if return true.

◆ interruptible_serial_all() [1/2]

template<class T >
void macarray3< T >::interruptible_serial_all ( std::function< bool(int dim, int i, int j, int k, typename array3< T >::iterator &it)>  func)
inline

Loop over all the cells in serial order.

Parameters
[in]funcFunction that defines how each grid cell is processed. Stop the loop if return true.

◆ interruptible_serial_all() [2/2]

template<class T >
void macarray3< T >::interruptible_serial_all ( std::function< bool(typename array3< T >::iterator &it)>  func)
inline

Loop over all the cells in serial order.

Parameters
[in]funcFunction that defines how each grid cell is processed. Stop the loop if return true.

◆ interruptible_serial_op() [1/2]

template<class T >
void macarray3< T >::interruptible_serial_op ( std::function< bool(int dim, int i, int j, int k, typename array3< T >::iterator &it)>  func,
bool  type = ALL 
)
inline

Loop over cells in serial order.

Parameters
[in]funcFunction that defines how each grid cell is processed.
[in]typeType of target cells. ACTIVE or ALL. Stop the loop if return true.

◆ interruptible_serial_op() [2/2]

template<class T >
void macarray3< T >::interruptible_serial_op ( std::function< bool(typename array3< T >::iterator &it)>  func,
bool  type = ALL 
)
inline

Loop over cells in serial order.

Parameters
[in]funcFunction that defines how each grid cell is processed. Stop the loop if return true.
[in]typeType of target cells. ACTIVE or ALL.

◆ operator!=()

template<class T >
bool macarray3< T >::operator!= ( const macarray3< T > &  v) const
inline

Return if the grid is different from an input array.

Parameters
[in]arrayTarget array to compare.
Returns
true if the array is different from the input array and false otherwise.

◆ operator*=()

template<class T >
void macarray3< T >::operator*= ( v)
inline

Multiply all the grid values with an input value.

Parameters
[in]vValue to multiply.

◆ operator+=() [1/3]

template<class T >
void macarray3< T >::operator+= ( const macarray3< T > &  v)
inline

Increment all the values with the values of an input array.

Parameters
[in]vInput array.

◆ operator+=() [2/3]

template<class T >
void macarray3< T >::operator+= ( const vec3< T > &  v)
inline

Increment all the grid values with an input vector value.

Parameters
[in]vValue to increment.

◆ operator+=() [3/3]

template<class T >
void macarray3< T >::operator+= ( v)
inline

Increment all the grid values with an input value.

Parameters
[in]vValue to increment.

◆ operator-=() [1/3]

template<class T >
void macarray3< T >::operator-= ( const macarray3< T > &  v)
inline

Subtract all the values with the values of an input array.

Parameters
[in]vInput array.

◆ operator-=() [2/3]

template<class T >
void macarray3< T >::operator-= ( const vec3< T > &  v)
inline

Subtract all the grid values with an input vector value.

Parameters
[in]vValue to subtract.

◆ operator-=() [3/3]

template<class T >
void macarray3< T >::operator-= ( v)
inline

Subtract all the grid values with an input value.

Parameters
[in]vValue to subtract.

◆ operator/=()

template<class T >
void macarray3< T >::operator/= ( const T &  v)
inline

Divide all the grid values with an input value.

Parameters
[in]vValue to divide.

◆ operator=() [1/2]

template<class T >
macarray3& macarray3< T >::operator= ( const macarray3< T > &  array)
inline

Deep copy operation for macarray3.

Parameters
[in]arrayReference to an instance of macarray to copy from.

◆ operator=() [2/2]

template<class T >
void macarray3< T >::operator= ( v)
inline

Set all the grid values with an input value.

Parameters
[in]vInput value to set.

◆ operator==()

template<class T >
bool macarray3< T >::operator== ( const macarray3< T > &  v) const
inline

Return if the grid is same to an input array.

Parameters
[in]arrayTarget array to compare.
Returns
true if the array is the same to the input and false otherwise.

◆ operator[]() [1/2]

template<class T >
array3<T>& macarray3< T >::operator[] ( int  dim)
inline

Get the reference to the staggered array of a specified dimension.

Parameters
[in]dimDimensiton of the grid.

◆ operator[]() [2/2]

template<class T >
const array3<T>& macarray3< T >::operator[] ( int  dim) const
inline

Get the read-only reference to the staggered array of a specified dimension.

Parameters
[in]dimDimensiton of the grid.

◆ parallel_actives() [1/3]

template<class T >
void macarray3< T >::parallel_actives ( std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it)>  func)
inline

Loop over all the active cells in parallel.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ parallel_actives() [2/3]

template<class T >
void macarray3< T >::parallel_actives ( std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it, int thread_index)>  func)
inline

Loop over all the active cells in parallel.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ parallel_actives() [3/3]

template<class T >
void macarray3< T >::parallel_actives ( std::function< void(typename array3< T >::iterator &it)>  func)
inline

Loop over all the active cells in parallel.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ parallel_all() [1/3]

template<class T >
void macarray3< T >::parallel_all ( std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it)>  func)
inline

Loop over all the cells in parallel.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ parallel_all() [2/3]

template<class T >
void macarray3< T >::parallel_all ( std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it, int thread_index)>  func)
inline

Loop over all the cells in parallel.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ parallel_all() [3/3]

template<class T >
void macarray3< T >::parallel_all ( std::function< void(typename array3< T >::iterator &it)>  func)
inline

Loop over all the cells in parallel.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ parallel_op() [1/3]

template<class T >
void macarray3< T >::parallel_op ( std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it)>  func,
bool  type = ALL 
)
inline

Loop over cells in parallel.

Parameters
[in]funcFunction that defines how each grid cell is processed.
[in]typeType of target cells. ACTIVE or ALL.

◆ parallel_op() [2/3]

template<class T >
void macarray3< T >::parallel_op ( std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it, int thread_index)>  func,
bool  type = ALL 
)
inline

Loop over cells in parallel.

Parameters
[in]funcFunction that defines how each grid cell is processed.
[in]typeType of target cells. ACTIVE or ALL.

◆ parallel_op() [3/3]

template<class T >
void macarray3< T >::parallel_op ( std::function< void(typename array3< T >::iterator &it)>  func,
bool  type = ALL 
)
inline

Loop over cells in parallel.

Parameters
[in]funcFunction that defines how each grid cell is processed.
[in]typeType of target cells. ACTIVE or ALL.

◆ send_message()

template<class T >
virtual bool macarray3< T >::send_message ( std::string  message,
void *  ptr 
)
inlineoverridevirtual

Send a message to the core module.

Parameters
[in]messageMessage
[in]ptrPointer to some value.
Returns
true if handled false otherwise.

Reimplemented from messageable.

◆ serial_actives() [1/2]

template<class T >
void macarray3< T >::serial_actives ( std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it)>  func)
inline

Loop over all the active cells in serial order.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ serial_actives() [2/2]

template<class T >
void macarray3< T >::serial_actives ( std::function< void(typename array3< T >::iterator &it)>  func)
inline

Loop over all the active cells in serial order.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ serial_all() [1/2]

template<class T >
void macarray3< T >::serial_all ( std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it)>  func)
inline

Loop over all the cells in serial order.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ serial_all() [2/2]

template<class T >
void macarray3< T >::serial_all ( std::function< void(typename array3< T >::iterator &it)>  func)
inline

Loop over all the cells in serial order.

Parameters
[in]funcFunction that defines how each grid cell is processed.

◆ serial_op() [1/2]

template<class T >
void macarray3< T >::serial_op ( std::function< void(int dim, int i, int j, int k, typename array3< T >::iterator &it)>  func,
bool  type = ALL 
)
inline

Loop over cells in serial order.

Parameters
[in]funcFunction that defines how each grid cell is processed.
[in]typeType of target cells. ACTIVE or ALL.

◆ serial_op() [2/2]

template<class T >
void macarray3< T >::serial_op ( std::function< void(typename array3< T >::iterator &it)>  func,
bool  type = ALL 
)
inline

Loop over cells in serial order.

Parameters
[in]funcFunction that defines how each grid cell is processed.
[in]typeType of target cells. ACTIVE or ALL.

◆ set_background_value()

template<class T >
void macarray3< T >::set_background_value ( const vec3< T > &  value)
inline

Set the background value (alternatively, initial value) of the grid.

Parameters
[in]valueNew background value

◆ set_core_name()

template<class T >
void macarray3< T >::set_core_name ( std::string  core_name)
inline

Set the core name of module of this grid.

Parameters
[in]Nameof the core name.

◆ set_thread_num()

template<class T >
void macarray3< T >::set_thread_num ( int  number)
inline

Set the number of threads for parallel processing on this grid.

Parameters
[in]numberNumber of threads.

◆ set_touch_only_actives()

template<class T >
void macarray3< T >::set_touch_only_actives ( bool  touch_only_actives)
inline

Set whether to force grid manipulation only on active cells. If true, operatios such operator+=() only acts on active cells.

Parameters
[in]touch_only_activesWhether to turn this on or off.

◆ set_type()

template<class T >
void macarray3< T >::set_type ( const type3 type)
inline

Set the type of this grid.

Parameters
[in]typeAn instance of type to set.

◆ shape() [1/2]

template<class T >
shape3 macarray3< T >::shape ( ) const
inline

Get the shape of the array.

Returns
Shape of the array.

◆ shape() [2/2]

template<class T >
shape3 macarray3< T >::shape ( int  dim) const
inline

Get the shape of the staggered grid of a specified dimension.

Returns
Shape of the grid of an input dimension.

◆ type()

template<class T >
type3 macarray3< T >::type ( ) const
inline

Get the type of this grid.

Returns
Type of this grid.

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