svFSIplus
|
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. More... | |
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. More... | |
Array< T > | rslice (const int slice) const |
rslice More... | |
T * | slice_data (const int slice) |
void | print (const std::string &label) |
Array< T > | slice (const int slice) const |
Get a slice. More... | |
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. More... | |
int | msize () const |
void | resize (const int num_rows, const int num_cols, const int num_slices) |
Resize the array. More... | |
void | set_values (Array< T > &rhs) |
Set the array values from an Array with the equivalent number of values. More... | |
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. More... | |
const T & | operator() (const int row, const int col, const int slice) const |
Get the array value at (row,col). More... | |
T & | operator() (const int row, const int col, const int slice) |
Set the array value at (row,col). More... | |
Array3 & | operator= (const double value) |
Array3< T > | operator* (const T value) const |
Multiply by a scalar. More... | |
Array3< T > & | operator*= (const T value) |
T * | data () const |
double | memory_in_use |
double | memory_returned |
int | num_allocated |
int | active |
bool | write_enabled |
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 |
The Array3 template class implements a simple interface to 3D arrays.
Copyright (c) Stanford University, The Regents of the University of California, and others.
All Rights Reserved.
See Copyright-SimVascular.txt for additional details.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
A 3D array is defined by (num_rows * num_cols) * num_slices values.
|
inline |
Test if an array has rows or columns or slices set but no data.
[NOTE] This is tfu but need to mimic fortran.
|
inline |
Free the array data.
This is to replicate the Fortran DEALLOCATE().
|
inline |
Set the array value at (row,col).
|
inline |
Get the array value at (row,col).
Multiply by a scalar.
Array assignment.
Copy data to replicate Fortran behavior.
|
inline |
Resize the array.
|
inline |
rslice
Return an Array with data pointing into the Array3 internal data.
|
inline |
Set the array values from an Array with the equivalent number of values.
This sort of replicates the Fortan reshape function.
|
inline |
Get a slice.