netxsimdg
Loading...
Searching...
No Matches
Nextsim::ModelArray Class Reference

A class that holds the array data for the model. More...

#include <ModelArray.hpp>

Collaboration diagram for Nextsim::ModelArray:
Collaboration graph

Classes

struct  DimensionSpec
 

Public Types

typedef std::map< Type, std::vector< Dimension > > TypeDimensions
 
typedef Eigen::Array< double, Eigen::Dynamic, Eigen::Dynamic, majority > DataType
 
typedef DataType::RowXpr Component
 
typedef DataType::ConstRowXpr ConstComponent
 
typedef std::vector< size_t > MultiDim
 

Public Member Functions

 ModelArray ()
 
 ModelArray (const Type type)
 Construct a ModelArray of the given type and name.
 
 ModelArray (const ModelArray &)
 Copy constructor.
 
ModelArrayoperator= (const ModelArray &)
 Copy assignment operator.
 
ModelArrayoperator= (const double &val)
 Assigns a double value to all elements of the object.
 
ModelArrayoperator+= (const ModelArray &b)
 In place addition of another ModelArray.
 
ModelArrayoperator-= (const ModelArray &b)
 In place subtraction of another ModelArray.
 
ModelArrayoperator*= (const ModelArray &b)
 In place multiplication by another ModelArray.
 
ModelArrayoperator/= (const ModelArray &b)
 In place division by another ModelArray.
 
ModelArrayoperator+= (double b)
 In place addition of a double.
 
ModelArrayoperator-= (double b)
 In place subtraction of a double.
 
ModelArrayoperator*= (double b)
 In place multiplication by a double.
 
ModelArrayoperator/= (double b)
 In place division by a double.
 
ModelArray operator+ (const ModelArray &) const
 Returns a ModelArray containing the per-element sum of the object and the provided ModelArray.
 
ModelArray operator- (const ModelArray &) const
 Returns a ModelArray containing the per-element difference between the object and the provided ModelArray.
 
ModelArray operator* (const ModelArray &) const
 Returns a ModelArray containing the per-element product of the object and the provided ModelArray.
 
ModelArray operator/ (const ModelArray &) const
 Returns a ModelArray containing the per-element ratio between the object and the provided ModelArray.
 
ModelArray operator- () const
 
ModelArray operator+ (const double &) const
 Returns a ModelArray with a constant added to every element of the object.
 
ModelArray operator- (const double &) const
 Returns a ModelArray with a constant subtracted from every element of the object.
 
ModelArray operator* (const double &) const
 Returns a ModelArray with every element of the object multiplied by a constant.
 
ModelArray operator/ (const double &) const
 Returns a ModelArray with every element of the object divided by a constant.
 
ModelArray max (double max) const
 Calculates element-wise maximum of the data and the given scalar value.
 
ModelArray min (double min) const
 Calculates element-wise minimum of the data and the given scalar value.
 
ModelArray max (const ModelArray &maxArr) const
 Calculates element-wise maximum of the data and the given second array.
 
ModelArray min (const ModelArray &minArr) const
 Calculates element-wise minimum of the data and the given second array.
 
ModelArrayclampAbove (double max)
 Clamps the values in the array to the given maximum.
 
ModelArrayclampBelow (double min)
 Clamps the values in the array to the given minimum.
 
ModelArrayclampAbove (const ModelArray &maxArr)
 Clamps the values in the array to maximum values in the given array.
 
ModelArrayclampBelow (const ModelArray &minArr)
 Clamps the values in the array to minimum values in the given array.
 
size_t nDimensions () const
 Returns the number of dimensions of this type of ModelArray.
 
const MultiDim & dimensions () const
 Returns a vector<size_t> of the size of each dimension of this type of ModelArray.
 
size_t size () const
 Returns the total number of elements of this type of ModelArray.
 
size_t trueSize () const
 Returns the size of the data array of this object.
 
const double * getData () const
 Returns a read-only pointer to the underlying data buffer.
 
const DataType & data () const
 Returns a const reference to the Eigen data.
 
Type getType () const
 Returns the (enum of) the ModelArray::Type of this.
 
void setDimensions (const MultiDim &dims)
 Sets the number and size of the dimensions of this type of ModelArray.
 
void resize ()
 Conditionally updates the size of the object data buffer to match the class specification.
 
void setData (double value)
 Sets the value of every element in the object to the provided value.
 
void setData (const double *pData)
 Reads and sets data from a raw buffer of double data.
 
void setData (const DataType &data)
 Reads and sets data from an instance of the underlying data class (Eigen::Array).
 
void setData (const ModelArray &source)
 Reads and sets data from another ModelArray.
 
const double & operator[] (size_t i) const
 Returns the data at the specified one dimensional index.
 
const double & operator[] (const MultiDim &dims) const
 Returns the data at the indices.
 
template<typename... Args>
const double & operator() (Args... args) const
 Returns the data at the given set of indices.
 
double & operator[] (size_t i)
 Returns the data at the specified one dimensional index.
 
double & operator[] (const MultiDim &)
 Returns the data at the indices.
 
template<typename... Args>
double & operator() (Args... args)
 Returns the specified point from a ModelArray.
 
void setNComponents (size_t nComp)
 Sets the number of components for this array's type.
 
Component components (size_t i)
 Accesses the full Discontinuous Galerkin coefficient vector at the indexed location.
 
const ConstComponent components (size_t i) const
 
Component components (const MultiDim &loc)
 Accesses the full Discontinuous Galerkin coefficient vector at the specified location.
 
const ConstComponent components (const MultiDim &loc) const
 
double & zIndexAndLayer (size_t hIndex, size_t layer)
 Special access function for ZFields.
 
const double & zIndexAndLayer (size_t hIndex, size_t layer) const
 Special access function for ZFields, const version.
 
size_t indexFromLocation (const MultiDim &loc) const
 Returns the index for a given set of multi-dimensional location for this array's type.
 
MultiDim locationFromIndex (size_t index) const
 Returns the multi-dimensional location for a given index for this array's type.
 
size_t nComponents () const
 Returns the number of discontinuous Galerkin components held in this type of ModelArray.
 
bool hasDoF () const
 Returns whether this type of ModelArray has additional discontinuous Galerkin components.
 

Static Public Member Functions

static size_t nDimensions (Type type)
 Returns the number of dimensions of the specified type of ModelArray.
 
static const MultiDim & dimensions (Type type)
 Returns a vector<size_t> of the size of each dimension of the specified type of ModelArray.
 
static size_t size (Type type)
 Returns the total number of elements of the specified type of ModelArray.
 
static void setDimensions (Type, const MultiDim &)
 Sets the number and size of the dimensions of a specified type of ModelArray.
 
static void setDimension (Dimension dim, size_t length)
 Sets the length of an individual dimension before propagating it to the defined array types.
 
static void setNComponents (std::map< Type, size_t > cMap)
 Sets the number of components for DG & CG array types.
 
static void setNComponents (Type type, size_t nComp)
 Sets the number of components for a single D/CG array type.
 
static size_t indexFromLocation (Type type, const MultiDim &loc)
 Returns the index for a given set of multi-dimensional location for the given Type.
 
static MultiDim locationFromIndex (Type type, size_t index)
 Returns the multi-dimensional location for a given index for the given Type.
 
static size_t nComponents (const Type type)
 Returns the number of discontinuous Galerkin components held in the specified type of ModelArray.
 
static bool hasDoF (const Type type)
 Returns whether the specified type of ModelArray has additional discontinuous Galerkin components.
 

Static Public Attributes

static const int N_DEFINED_DIMENSIONS = static_cast<int>(Dimension::COUNT)
 
static TypeDimensions typeDimensions
 The dimensions that make up each defined type. Defined in ModelArrayDetails.cpp.
 
static std::map< Dimension, DimensionSpecdefinedDimensions
 The name and length of each dimension that is defined.
 
static const std::map< Type, std::string > typeNames
 The name of each type of ModelArray.
 
static const std::map< Type, Dimension > componentMap
 

Protected Member Functions

size_t zLayerIndex (size_t hIndex, size_t layer) const
 Special access function for ZFields, common implementation version.
 

Protected Attributes

Type type
 

Detailed Description

A class that holds the array data for the model.

This class holds n-dimensional data for the model. It is designed to be a light (not transparent) wrapper around Eigen::Array. The underlying Array is two dimensional, with the first dimension acting like the one dimensional vector backing an n-dimensional array type. All of the n dimensional indexing is collapsed onto the first dimension. Any access to components for Discontinuous Galerkin variables is done through the second dimension. For finite volume variables, there is one component in the second dimension.

Sizes and dimensionality as calculated by the static and member functions only pertain to the grid, with the DG components being ignored. For a degree-2 DG variable the size in memory would be 6 times that reported by the size() function.

Definition at line 47 of file ModelArray.hpp.

Member Typedef Documentation

◆ Component

DataType::RowXpr Nextsim::ModelArray::Component

Definition at line 74 of file ModelArray.hpp.

◆ ConstComponent

DataType::ConstRowXpr Nextsim::ModelArray::ConstComponent

Definition at line 75 of file ModelArray.hpp.

◆ DataType

Eigen::Array<double, Eigen::Dynamic, Eigen::Dynamic, majority> Nextsim::ModelArray::DataType

Definition at line 72 of file ModelArray.hpp.

◆ MultiDim

std::vector<size_t> Nextsim::ModelArray::MultiDim

Definition at line 218 of file ModelArray.hpp.

◆ TypeDimensions

std::map<Type, std::vector<Dimension> > Nextsim::ModelArray::TypeDimensions

Definition at line 61 of file ModelArray.hpp.

Constructor & Destructor Documentation

◆ ModelArray() [1/3]

Nextsim::ModelArray::ModelArray ( )

Construct an unnamed ModelArray of Type::H

Definition at line 88 of file ModelArrayDetails.cpp.

Here is the caller graph for this function:

◆ ModelArray() [2/3]

Nextsim::ModelArray::ModelArray ( const Type type)

Construct a ModelArray of the given type and name.

Parameters
typeThe ModelArray::Type for the new object.
nameThe name of the new object.

Definition at line 23 of file ModelArray.cpp.

Here is the call graph for this function:

◆ ModelArray() [3/3]

Nextsim::ModelArray::ModelArray ( const ModelArray & orig)

Copy constructor.

Definition at line 30 of file ModelArray.cpp.

Here is the call graph for this function:

◆ ~ModelArray()

virtual Nextsim::ModelArray::~ModelArray ( )
inlinevirtual

Definition at line 90 of file ModelArray.hpp.

Member Function Documentation

◆ clampAbove() [1/2]

ModelArray & Nextsim::ModelArray::clampAbove ( const ModelArray & maxArr)

Clamps the values in the array to maximum values in the given array.

Parameters
maxArrthe array of clamp maximum target values.

Definition at line 159 of file ModelArray.cpp.

Here is the call graph for this function:

◆ clampAbove() [2/2]

ModelArray & Nextsim::ModelArray::clampAbove ( double max)

Clamps the values in the array to the given maximum.

Parameters
maxthe maximum value of the final array.

Definition at line 147 of file ModelArray.cpp.

Here is the call graph for this function:

◆ clampBelow() [1/2]

ModelArray & Nextsim::ModelArray::clampBelow ( const ModelArray & minArr)

Clamps the values in the array to minimum values in the given array.

Parameters
minArrthe array of clamp minimum target values.

Definition at line 165 of file ModelArray.cpp.

Here is the call graph for this function:

◆ clampBelow() [2/2]

ModelArray & Nextsim::ModelArray::clampBelow ( double min)

Clamps the values in the array to the given minimum.

Parameters
minthe minimum value of the final array.

Definition at line 153 of file ModelArray.cpp.

Here is the call graph for this function:

◆ components() [1/4]

ModelArray::Component Nextsim::ModelArray::components ( const MultiDim & loc)

Accesses the full Discontinuous Galerkin coefficient vector at the specified location.

Parameters
dimsindexing argument of the target point.

Definition at line 219 of file ModelArray.cpp.

Here is the call graph for this function:

◆ components() [2/4]

const ModelArray::ConstComponent Nextsim::ModelArray::components ( const MultiDim & loc) const

Definition at line 224 of file ModelArray.cpp.

◆ components() [3/4]

Component Nextsim::ModelArray::components ( size_t i)
inline

Accesses the full Discontinuous Galerkin coefficient vector at the indexed location.

Parameters
ione-dimensional index of the target point.

Definition at line 461 of file ModelArray.hpp.

Here is the caller graph for this function:

◆ components() [4/4]

const ConstComponent Nextsim::ModelArray::components ( size_t i) const
inline

Definition at line 463 of file ModelArray.hpp.

◆ data()

const DataType & Nextsim::ModelArray::data ( ) const
inline

Returns a const reference to the Eigen data.

Definition at line 239 of file ModelArray.hpp.

Here is the caller graph for this function:

◆ dimensions() [1/2]

const MultiDim & Nextsim::ModelArray::dimensions ( ) const
inline

Returns a vector<size_t> of the size of each dimension of this type of ModelArray.

Definition at line 225 of file ModelArray.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dimensions() [2/2]

static const MultiDim & Nextsim::ModelArray::dimensions ( Type type)
inlinestatic

Returns a vector<size_t> of the size of each dimension of the specified type of ModelArray.

Definition at line 227 of file ModelArray.hpp.

◆ getData()

const double * Nextsim::ModelArray::getData ( ) const
inline

Returns a read-only pointer to the underlying data buffer.

Definition at line 236 of file ModelArray.hpp.

◆ getType()

Type Nextsim::ModelArray::getType ( ) const
inline

Returns the (enum of) the ModelArray::Type of this.

Definition at line 241 of file ModelArray.hpp.

◆ hasDoF() [1/2]

bool Nextsim::ModelArray::hasDoF ( ) const
inline

Returns whether this type of ModelArray has additional discontinuous Galerkin components.

Definition at line 541 of file ModelArray.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasDoF() [2/2]

bool Nextsim::ModelArray::hasDoF ( const Type type)
static

Returns whether the specified type of ModelArray has additional discontinuous Galerkin components.

Definition at line 93 of file ModelArrayDetails.cpp.

◆ indexFromLocation() [1/2]

size_t Nextsim::ModelArray::indexFromLocation ( const MultiDim & loc) const
inline

Returns the index for a given set of multi-dimensional location for this array's type.

Parameters
locThe multi-dimensional location to return the index for.

Definition at line 505 of file ModelArray.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ indexFromLocation() [2/2]

size_t Nextsim::ModelArray::indexFromLocation ( Type type,
const MultiDim & loc )
static

Returns the index for a given set of multi-dimensional location for the given Type.

Parameters
typeThe type to act on.
locThe multi-dimensional location to return the index for.

Definition at line 235 of file ModelArray.cpp.

◆ locationFromIndex() [1/2]

MultiDim Nextsim::ModelArray::locationFromIndex ( size_t index) const
inline

Returns the multi-dimensional location for a given index for this array's type.

Parameters
indexThe index to return the multi-dimensional location for.

Definition at line 520 of file ModelArray.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ locationFromIndex() [2/2]

ModelArray::MultiDim Nextsim::ModelArray::locationFromIndex ( Type type,
size_t index )
static

Returns the multi-dimensional location for a given index for the given Type.

Parameters
typeThe type to act on.
indexThe index to return the multi-dimensional location for.

Definition at line 246 of file ModelArray.cpp.

◆ max() [1/2]

ModelArray Nextsim::ModelArray::max ( const ModelArray & maxArr) const

Calculates element-wise maximum of the data and the given second array.

Parameters
maxArrthe array containing the maximum values.

Definition at line 133 of file ModelArray.cpp.

Here is the call graph for this function:

◆ max() [2/2]

ModelArray Nextsim::ModelArray::max ( double max) const

Calculates element-wise maximum of the data and the given scalar value.

Parameters
maxthe maximum value of the resultant array.

Definition at line 119 of file ModelArray.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ min() [1/2]

ModelArray Nextsim::ModelArray::min ( const ModelArray & minArr) const

Calculates element-wise minimum of the data and the given second array.

Parameters
minArrthe array containing the minimum values.

Definition at line 140 of file ModelArray.cpp.

Here is the call graph for this function:

◆ min() [2/2]

ModelArray Nextsim::ModelArray::min ( double min) const

Calculates element-wise minimum of the data and the given scalar value.

Parameters
minthe minimum value of the resultant array.

Definition at line 126 of file ModelArray.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nComponents() [1/2]

size_t Nextsim::ModelArray::nComponents ( ) const
inline

Returns the number of discontinuous Galerkin components held in this type of ModelArray.

Definition at line 532 of file ModelArray.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nComponents() [2/2]

static size_t Nextsim::ModelArray::nComponents ( const Type type)
inlinestatic

Returns the number of discontinuous Galerkin components held in the specified type of ModelArray.

Definition at line 535 of file ModelArray.hpp.

Here is the call graph for this function:

◆ nDimensions() [1/2]

size_t Nextsim::ModelArray::nDimensions ( ) const
inline

Returns the number of dimensions of this type of ModelArray.

Definition at line 221 of file ModelArray.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nDimensions() [2/2]

static size_t Nextsim::ModelArray::nDimensions ( Type type)
inlinestatic

Returns the number of dimensions of the specified type of ModelArray.

Definition at line 223 of file ModelArray.hpp.

◆ operator()() [1/2]

template<typename... Args>
double & Nextsim::ModelArray::operator() ( Args... args)
inline

Returns the specified point from a ModelArray.

If the object holds discontinuous Galerkin components, only the cell averaged value is returned. Non-const version.

Definition at line 423 of file ModelArray.hpp.

◆ operator()() [2/2]

template<typename... Args>
const double & Nextsim::ModelArray::operator() ( Args... args) const
inline

Returns the data at the given set of indices.

Definition at line 392 of file ModelArray.hpp.

Here is the call graph for this function:

◆ operator*() [1/2]

ModelArray Nextsim::ModelArray::operator* ( const double & x) const

Returns a ModelArray with every element of the object multiplied by a constant.

Definition at line 94 of file ModelArray.cpp.

◆ operator*() [2/2]

ModelArray Nextsim::ModelArray::operator* ( const ModelArray & multiplier) const

Returns a ModelArray containing the per-element product of the object and the provided ModelArray.

Definition at line 63 of file ModelArray.cpp.

◆ operator*=() [1/2]

ModelArray & Nextsim::ModelArray::operator*= ( const ModelArray & b)
inline

In place multiplication by another ModelArray.

Definition at line 115 of file ModelArray.hpp.

◆ operator*=() [2/2]

ModelArray & Nextsim::ModelArray::operator*= ( double b)
inline

In place multiplication by a double.

Definition at line 140 of file ModelArray.hpp.

◆ operator+() [1/2]

ModelArray Nextsim::ModelArray::operator+ ( const double & x) const

Returns a ModelArray with a constant added to every element of the object.

Definition at line 82 of file ModelArray.cpp.

◆ operator+() [2/2]

ModelArray Nextsim::ModelArray::operator+ ( const ModelArray & addend) const

Returns a ModelArray containing the per-element sum of the object and the provided ModelArray.

Definition at line 51 of file ModelArray.cpp.

◆ operator+=() [1/2]

ModelArray & Nextsim::ModelArray::operator+= ( const ModelArray & b)
inline

In place addition of another ModelArray.

Definition at line 103 of file ModelArray.hpp.

◆ operator+=() [2/2]

ModelArray & Nextsim::ModelArray::operator+= ( double b)
inline

In place addition of a double.

Definition at line 128 of file ModelArray.hpp.

◆ operator-() [1/3]

ModelArray Nextsim::ModelArray::operator- ( ) const

Definition at line 75 of file ModelArray.cpp.

◆ operator-() [2/3]

ModelArray Nextsim::ModelArray::operator- ( const double & x) const

Returns a ModelArray with a constant subtracted from every element of the object.

Definition at line 88 of file ModelArray.cpp.

◆ operator-() [3/3]

ModelArray Nextsim::ModelArray::operator- ( const ModelArray & subtrahend) const

Returns a ModelArray containing the per-element difference between the object and the provided ModelArray.

Definition at line 57 of file ModelArray.cpp.

◆ operator-=() [1/2]

ModelArray & Nextsim::ModelArray::operator-= ( const ModelArray & b)
inline

In place subtraction of another ModelArray.

Definition at line 109 of file ModelArray.hpp.

◆ operator-=() [2/2]

ModelArray & Nextsim::ModelArray::operator-= ( double b)
inline

In place subtraction of a double.

Definition at line 134 of file ModelArray.hpp.

◆ operator/() [1/2]

ModelArray Nextsim::ModelArray::operator/ ( const double & x) const

Returns a ModelArray with every element of the object divided by a constant.

Definition at line 100 of file ModelArray.cpp.

◆ operator/() [2/2]

ModelArray Nextsim::ModelArray::operator/ ( const ModelArray & divisor) const

Returns a ModelArray containing the per-element ratio between the object and the provided ModelArray.

Definition at line 69 of file ModelArray.cpp.

◆ operator/=() [1/2]

ModelArray & Nextsim::ModelArray::operator/= ( const ModelArray & b)
inline

In place division by another ModelArray.

Definition at line 121 of file ModelArray.hpp.

◆ operator/=() [2/2]

ModelArray & Nextsim::ModelArray::operator/= ( double b)
inline

In place division by a double.

Definition at line 146 of file ModelArray.hpp.

◆ operator=() [1/2]

ModelArray & Nextsim::ModelArray::operator= ( const double & val)

Assigns a double value to all elements of the object.

Parameters
valThe value to be assigned.

Definition at line 44 of file ModelArray.cpp.

Here is the call graph for this function:

◆ operator=() [2/2]

ModelArray & Nextsim::ModelArray::operator= ( const ModelArray & orig)

Copy assignment operator.

Definition at line 36 of file ModelArray.cpp.

Here is the call graph for this function:

◆ operator[]() [1/4]

double & Nextsim::ModelArray::operator[] ( const MultiDim & dims)

Returns the data at the indices.

The argument is a list of dimension indices (actually a std::vector<size_t>). The number of dimensions provided can be lower than that of the ModelArray type. If the object holds discontinuous Galerkin components, only the cell averaged value is returned. Here the data is a reference and so can be used for assignment.

Parameters
dimsThe indices of the target point.

Definition at line 214 of file ModelArray.cpp.

◆ operator[]() [2/4]

const double & Nextsim::ModelArray::operator[] ( const MultiDim & dims) const

Returns the data at the indices.

The argument is a list of dimension indices (actually a std::vector<size_t>). The number of dimensions provided can be lower than that of the ModelArray type. If the object holds discontinuous Galerkin components, only the cell averaged value is returned. Here the data is a const reference.

Parameters
dimsThe indices of the target point.

Definition at line 209 of file ModelArray.cpp.

Here is the call graph for this function:

◆ operator[]() [3/4]

double & Nextsim::ModelArray::operator[] ( size_t i)
inline

Returns the data at the specified one dimensional index.

The argument is used to directly index the data buffer. If the object holds discontinuous Galerkin components, only the cell averaged value is returned. Here the data is a reference and so can be used for assignment.

Parameters
iThe one dimensional index of the target point.

Definition at line 407 of file ModelArray.hpp.

◆ operator[]() [4/4]

const double & Nextsim::ModelArray::operator[] ( size_t i) const
inline

Returns the data at the specified one dimensional index.

The argument is used to directly index the data buffer. If the object holds discontinuous Galerkin components, only the cell averaged value is returned. Here the data is a const reference.

Parameters
iThe one dimensional index of the target point.

Definition at line 375 of file ModelArray.hpp.

Here is the caller graph for this function:

◆ resize()

void Nextsim::ModelArray::resize ( )
inline

Conditionally updates the size of the object data buffer to match the class specification.

Definition at line 277 of file ModelArray.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setData() [1/4]

void Nextsim::ModelArray::setData ( const DataType & data)

Reads and sets data from an instance of the underlying data class (Eigen::Array).

Parameters
dataThe data object to be copied from.

Definition at line 183 of file ModelArray.cpp.

◆ setData() [2/4]

void Nextsim::ModelArray::setData ( const double * pData)

Reads and sets data from a raw buffer of double data.

The given pointer is the address of the first element read. Subsequent doubles in memory are read until every element in the object has been read. Ensure the provided buffer contains sufficient data to fill every element of the object, as no further bounds checking is performed.

Parameters
pDataThe pointer to the data buffer to be read.

Definition at line 177 of file ModelArray.cpp.

Here is the call graph for this function:

◆ setData() [3/4]

void Nextsim::ModelArray::setData ( const ModelArray & source)

Reads and sets data from another ModelArray.

This function reads the data buffer only, and performs no bounds checking on the ModelArray argument. Unlike the assignment operator or copy constructor, it does not change the size or type of the object.

Parameters
sourceThe object to be copied from.

Definition at line 185 of file ModelArray.cpp.

Here is the call graph for this function:

◆ setData() [4/4]

void Nextsim::ModelArray::setData ( double value)

Sets the value of every element in the object to the provided value.

Parameters
valueThe new value for every element.

Definition at line 171 of file ModelArray.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDimension()

void Nextsim::ModelArray::setDimension ( Dimension dim,
size_t length )
static

Sets the length of an individual dimension before propagating it to the defined array types.

Parameters
dimThe dimension to be altered.
lengthThe new length of the dimension.

Definition at line 203 of file ModelArray.cpp.

Here is the caller graph for this function:

◆ setDimensions() [1/2]

void Nextsim::ModelArray::setDimensions ( const MultiDim & dims)
inline

Sets the number and size of the dimensions of this type of ModelArray.

Sets the number and size of the dimensions of this type of ModelArray. The data buffer of this object is then resized to match the new definition.

Parameters
dimThe per-dimension size to be set.

Definition at line 260 of file ModelArray.hpp.

Here is the call graph for this function:

◆ setDimensions() [2/2]

void Nextsim::ModelArray::setDimensions ( Type type,
const MultiDim & newDims )
static

Sets the number and size of the dimensions of a specified type of ModelArray.

Parameters
typeThe type of array the dimensions are to be specified for.
dimThe per-dimension size to be set.

Definition at line 187 of file ModelArray.cpp.

Here is the caller graph for this function:

◆ setNComponents() [1/3]

void Nextsim::ModelArray::setNComponents ( size_t nComp)
inline

Sets the number of components for this array's type.

Parameters
nCompthe number of components to be set.

Definition at line 453 of file ModelArray.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNComponents() [2/3]

void Nextsim::ModelArray::setNComponents ( std::map< Type, size_t > cMap)
static

Sets the number of components for DG & CG array types.

Parameters
cMapa map from ModelArray::Type to the number of components.

Definition at line 196 of file ModelArray.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNComponents() [3/3]

static void Nextsim::ModelArray::setNComponents ( Type type,
size_t nComp )
inlinestatic

Sets the number of components for a single D/CG array type.

Parameters
typethe DG or CG array type to set the number of components for.
nCompthe number of components to be set.

Definition at line 441 of file ModelArray.hpp.

Here is the call graph for this function:

◆ size() [1/2]

size_t Nextsim::ModelArray::size ( ) const
inline

Returns the total number of elements of this type of ModelArray.

Definition at line 229 of file ModelArray.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ size() [2/2]

static size_t Nextsim::ModelArray::size ( Type type)
inlinestatic

Returns the total number of elements of the specified type of ModelArray.

Definition at line 231 of file ModelArray.hpp.

◆ trueSize()

size_t Nextsim::ModelArray::trueSize ( ) const
inline

Returns the size of the data array of this object.

Definition at line 233 of file ModelArray.hpp.

Here is the caller graph for this function:

◆ zIndexAndLayer() [1/2]

double & Nextsim::ModelArray::zIndexAndLayer ( size_t hIndex,
size_t layer )
inline

Special access function for ZFields.

@detail Index a ZField using an index from an HField of the same horizontal extent and a layer index for the final dimension.

Parameters
hIndexthe equivalent positional index in an HField array
layerthe vertical layer to be accessed

Definition at line 482 of file ModelArray.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ zIndexAndLayer() [2/2]

const double & Nextsim::ModelArray::zIndexAndLayer ( size_t hIndex,
size_t layer ) const
inline

Special access function for ZFields, const version.

@detail Index a ZField using an index from an HField of the same horizontal extent and a layer index for the final dimension.

Parameters
hIndexthe equivalent positional index in an HField array
layerthe vertical layer to be accessed

Definition at line 495 of file ModelArray.hpp.

Here is the call graph for this function:

◆ zLayerIndex()

size_t Nextsim::ModelArray::zLayerIndex ( size_t hIndex,
size_t layer ) const
inlineprotected

Special access function for ZFields, common implementation version.

@detail Index a ZField using an index from an HField of the same horizontal extent and a layer index for the final dimension.

Parameters
hIndexthe equivalent positional index in an HField array
layerthe vertical layer to be accessed

Definition at line 558 of file ModelArray.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ componentMap

const std::map< ModelArray::Type, ModelArray::Dimension > Nextsim::ModelArray::componentMap
static
Initial value:
= {
{ Type::DG, Dimension::DG },
{ Type::DGSTRESS, Dimension::DGSTRESS },
{ Type::VERTEX, Dimension::NCOORDS },
}

Definition at line 70 of file ModelArray.hpp.

◆ definedDimensions

std::map< ModelArray::Dimension, ModelArray::DimensionSpec > Nextsim::ModelArray::definedDimensions
static
Initial value:
= {
{ ModelArray::Dimension::X, { "x", 0 } },
{ ModelArray::Dimension::Y, { "y", 0 } },
{ ModelArray::Dimension::Z, { "z", 1 } },
{ ModelArray::Dimension::XVERTEX, { "xvertex", 1 } },
{ ModelArray::Dimension::YVERTEX, { "yvertex", 1 } },
{ ModelArray::Dimension::XCG, { "x_cg", 1 } },
{ ModelArray::Dimension::YCG, { "y_cg", 1 } },
{ ModelArray::Dimension::DG, { "dg_comp", 1 } },
{ ModelArray::Dimension::DGSTRESS, { "dgstress_comp", 1 } },
{ ModelArray::Dimension::NCOORDS, { "ncoords", 2 } },
}

The name and length of each dimension that is defined.

Definition at line 66 of file ModelArray.hpp.

◆ N_DEFINED_DIMENSIONS

const int Nextsim::ModelArray::N_DEFINED_DIMENSIONS = static_cast<int>(Dimension::COUNT)
static

Definition at line 55 of file ModelArray.hpp.

◆ type

Type Nextsim::ModelArray::type
protected

Definition at line 547 of file ModelArray.hpp.

◆ typeDimensions

ModelArray::TypeDimensions Nextsim::ModelArray::typeDimensions
static

The dimensions that make up each defined type. Defined in ModelArrayDetails.cpp.

Definition at line 64 of file ModelArray.hpp.

◆ typeNames

const std::map< ModelArray::Type, std::string > Nextsim::ModelArray::typeNames
static
Initial value:
= {
{ ModelArray::Type::H, "HField" },
{ ModelArray::Type::VERTEX, "VertexField" },
{ ModelArray::Type::U, "UField" },
{ ModelArray::Type::V, "VField" },
{ ModelArray::Type::Z, "ZField" },
{ ModelArray::Type::DG, "DGField" },
{ ModelArray::Type::DGSTRESS, "DGStressField" },
{ ModelArray::Type::CG, "CGField" },
}

The name of each type of ModelArray.

Definition at line 68 of file ModelArray.hpp.


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