svMultiPhysics
Loading...
Searching...
No Matches
Array3< T > Class Template Reference

The Array3 template class implements a simple interface to 3D arrays. More...

#include <Array3.h>

Public Member Functions

 Array3 (const int num_rows, const int num_cols, const int num_slices, bool row_major=true)
 Array3 (const Array3 &rhs)
 Array copy.
int ncols () const
int nrows () const
int nslices () const
void allocate (const int num_rows, const int num_cols, const int num_slices, const bool row_major=true)
void check_index (const int i, const int j, const int k) const
void clear ()
 Free the array data.
Array< T > rslice (const int slice) const
 rslice
T * slice_data (const int slice)
void print (const std::string &label)
Array< T > slice (const int slice) const
 Get a slice.
void set_row (const int col, const int slice, const std::vector< T > &values) const
void set_slice (const int slice, const Array< T > &values) const
int size () const
bool allocated ()
 Test if an array has rows or columns or slices set but no data.
int msize () const
void resize (const int num_rows, const int num_cols, const int num_slices)
 Resize the array.
void set_values (Array< T > &rhs)
 Set the array values from an Array with the equivalent number of values.
void read (const std::string &file_name)
void write (const std::string &label, bool memory=true)
void append (const std::string &label, bool memory=true)
Array3 & operator= (const Array3 &rhs)
 Array assignment.
const T & operator() (const int row, const int col, const int slice) const
 Get the array value at (row,col).
T & operator() (const int row, const int col, const int slice)
 Set the array value at (row,col).
Array3 & operator= (const double value)
Array3< T > operator* (const T value) const
 Multiply by a scalar.
Array3< T > & operator*= (const T value)
T * data () const
void memory (const std::string &prefix)
void stats (const std::string &prefix)

Static Public Member Functions

static void memory (const std::string &prefix="")
static void stats (const std::string &prefix="")

Static Public Attributes

static int num_allocated
static int active
static double memory_in_use
static double memory_returned
static bool write_enabled

Detailed Description

template<typename T>
class Array3< T >

The Array3 template class implements a simple interface to 3D arrays.

A 3D array is defined by (num_rows * num_cols) * num_slices values.

Constructor & Destructor Documentation

◆ Array3()

template<typename T>
Array3< T >::Array3 ( const Array3< T > & rhs)
inline

Array copy.

Member Function Documentation

◆ allocated()

template<typename T>
bool Array3< T >::allocated ( )
inline

Test if an array has rows or columns or slices set but no data.

[NOTE] This is tfu but need to mimic fortran.

◆ clear()

template<typename T>
void Array3< T >::clear ( )
inline

Free the array data.

This is to replicate the Fortran DEALLOCATE().

◆ operator()() [1/2]

template<typename T>
T & Array3< T >::operator() ( const int row,
const int col,
const int slice )
inline

Set the array value at (row,col).

◆ operator()() [2/2]

template<typename T>
const T & Array3< T >::operator() ( const int row,
const int col,
const int slice ) const
inline

Get the array value at (row,col).

◆ operator*()

template<typename T>
Array3< T > Array3< T >::operator* ( const T value) const
inline

Multiply by a scalar.

◆ operator=()

template<typename T>
Array3 & Array3< T >::operator= ( const Array3< T > & rhs)
inline

Array assignment.

Copy data to replicate Fortran behavior.

◆ resize()

template<typename T>
void Array3< T >::resize ( const int num_rows,
const int num_cols,
const int num_slices )
inline

Resize the array.

◆ rslice()

template<typename T>
Array< T > Array3< T >::rslice ( const int slice) const
inline

rslice

Return an Array with data pointing into the Array3 internal data.

◆ set_values()

template<typename T>
void Array3< T >::set_values ( Array< T > & rhs)
inline

Set the array values from an Array with the equivalent number of values.

This sort of replicates the Fortan reshape function.

◆ slice()

template<typename T>
Array< T > Array3< T >::slice ( const int slice) const
inline

Get a slice.


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