netxsimdg
Loading...
Searching...
No Matches
Nextsim::ModelArrayRef< arrayName, S, access > Class Template Reference

A class which provides indirect access to ModelArray. More...

#include <ModelArrayRef.hpp>

Inheritance diagram for Nextsim::ModelArrayRef< arrayName, S, access >:
Inheritance graph
Collaboration diagram for Nextsim::ModelArrayRef< arrayName, S, access >:
Collaboration graph

Public Member Functions

 ModelArrayRef (const S &backingStoreIn)
 
const double & operator[] (const ModelArray::MultiDim &dims)
 Returns the data at the indices.
 
const double & operator[] (size_t index) const
 Returns the data at the specified one dimensional index.
 
const double & operator() (size_t i) const
 Returns the specified point from a 1 dimensional ModelArray.
 
const double & operator() (size_t i, size_t j) const
 Returns the specified point from a 2 dimensional ModelArray.
 
const double & operator() (size_t i, size_t j, size_t k) const
 Returns the specified point from a 3 dimensional ModelArray.
 
const double & operator() (size_t i, size_t j, size_t k, size_t l) const
 Returns the specified point from a 4 dimensional ModelArray.
 
const double & operator() (size_t i, size_t j, size_t k, size_t l, size_t m) const
 Returns the specified point from a 5 dimensional ModelArray.
 
const double & operator() (size_t i, size_t j, size_t k, size_t l, size_t m, size_t n) const
 Returns the specified point from a 6 dimensional ModelArray.
 
const double & operator() (size_t i, size_t j, size_t k, size_t l, size_t m, size_t n, size_t p) const
 Returns the specified point from a 7 dimensional ModelArray.
 
const double & operator() (size_t i, size_t j, size_t k, size_t l, size_t m, size_t n, size_t p, size_t q) const
 Returns the specified point from a 8 dimensional ModelArray.
 
const double & zIndexAndLayer (size_t hIndex, size_t layer)
 Special access function for ZFields.
 
const ModelArraydata () const
 Direct access top the underlying data array.
 
 operator const ModelArray & () const
 Cast the reference class to a real reference to the referenced ModelArray.
 
ModelArray operator+ (const ModelArray &addend) const
 Returns a ModelArray containing the per-element sum of the object and the provided ModelArray.
 
ModelArray operator- (const ModelArray &subtrahend) const
 Returns a ModelArray containing the per-element difference between the object and the provided ModelArray.
 
ModelArray operator* (const ModelArray &multiplier) const
 Returns a ModelArray containing the per-element product of the object and the provided ModelArray.
 
ModelArray operator/ (const ModelArray &divisor) const
 Returns a ModelArray containing the per-element ratio between the object and the provided ModelArray.
 
ModelArray operator+ (double addend) const
 Returns a ModelArray containing the per-element sum of the object and the provided ModelArray.
 
ModelArray operator- (double subtrahend) const
 Returns a ModelArray containing the per-element difference between the object and the provided ModelArray.
 
ModelArray operator* (double multiplier) const
 Returns a ModelArray containing the per-element product of the object and the provided ModelArray.
 
ModelArray operator/ (double divisor) const
 Returns a ModelArray containing the per-element ratio between the object and the provided ModelArray.
 

Detailed Description

template<auto arrayName, typename S, bool access = RO>
class Nextsim::ModelArrayRef< arrayName, S, access >

A class which provides indirect access to ModelArray.

Uses the ModelComponent registry of ModelArrays to access data from other ModelComponents. The class provides indexing, casting and access (by reference) to the pointed to ModelArray. Here the returned data are by const references, used for ProtectedArray and SharedArray in read-only (RO) mode.

Template Parameters
autoTypeThe ModelComponent::ProtectedArray of ModelComponent::SharedArray to be referenced.
accessWhether access to the data is read only (RO = false) or read-write (RW = true)

Definition at line 36 of file ModelArrayRef.hpp.

Constructor & Destructor Documentation

◆ ModelArrayRef()

template<auto arrayName, typename S , bool access = RO>
Nextsim::ModelArrayRef< arrayName, S, access >::ModelArrayRef ( const S & backingStoreIn)
inline

Definition at line 38 of file ModelArrayRef.hpp.

Member Function Documentation

◆ data()

template<auto arrayName, typename S , bool access = RO>
const ModelArray & Nextsim::ModelArrayRef< arrayName, S, access >::data ( ) const
inline

Direct access top the underlying data array.

Definition at line 155 of file ModelArrayRef.hpp.

Here is the caller graph for this function:

◆ operator const ModelArray &()

template<auto arrayName, typename S , bool access = RO>
Nextsim::ModelArrayRef< arrayName, S, access >::operator const ModelArray & ( ) const
inline

Cast the reference class to a real reference to the referenced ModelArray.

Definition at line 161 of file ModelArrayRef.hpp.

Here is the call graph for this function:

◆ operator()() [1/8]

template<auto arrayName, typename S , bool access = RO>
const double & Nextsim::ModelArrayRef< arrayName, S, access >::operator() ( size_t i) const
inline

Returns the specified point from a 1 dimensional ModelArray.

If the object holds discontinuous Galerkin components, only the cell averaged value is returned.

Definition at line 75 of file ModelArrayRef.hpp.

◆ operator()() [2/8]

template<auto arrayName, typename S , bool access = RO>
const double & Nextsim::ModelArrayRef< arrayName, S, access >::operator() ( size_t i,
size_t j ) const
inline

Returns the specified point from a 2 dimensional ModelArray.

If the object holds discontinuous Galerkin components, only the cell averaged value is returned.

Definition at line 83 of file ModelArrayRef.hpp.

◆ operator()() [3/8]

template<auto arrayName, typename S , bool access = RO>
const double & Nextsim::ModelArrayRef< arrayName, S, access >::operator() ( size_t i,
size_t j,
size_t k ) const
inline

Returns the specified point from a 3 dimensional ModelArray.

If the object holds discontinuous Galerkin components, only the cell averaged value is returned.

Definition at line 91 of file ModelArrayRef.hpp.

◆ operator()() [4/8]

template<auto arrayName, typename S , bool access = RO>
const double & Nextsim::ModelArrayRef< arrayName, S, access >::operator() ( size_t i,
size_t j,
size_t k,
size_t l ) const
inline

Returns the specified point from a 4 dimensional ModelArray.

If the object holds discontinuous Galerkin components, only the cell averaged value is returned.

Definition at line 99 of file ModelArrayRef.hpp.

◆ operator()() [5/8]

template<auto arrayName, typename S , bool access = RO>
const double & Nextsim::ModelArrayRef< arrayName, S, access >::operator() ( size_t i,
size_t j,
size_t k,
size_t l,
size_t m ) const
inline

Returns the specified point from a 5 dimensional ModelArray.

If the object holds discontinuous Galerkin components, only the cell averaged value is returned.

Definition at line 107 of file ModelArrayRef.hpp.

◆ operator()() [6/8]

template<auto arrayName, typename S , bool access = RO>
const double & Nextsim::ModelArrayRef< arrayName, S, access >::operator() ( size_t i,
size_t j,
size_t k,
size_t l,
size_t m,
size_t n ) const
inline

Returns the specified point from a 6 dimensional ModelArray.

If the object holds discontinuous Galerkin components, only the cell averaged value is returned.

Definition at line 115 of file ModelArrayRef.hpp.

◆ operator()() [7/8]

template<auto arrayName, typename S , bool access = RO>
const double & Nextsim::ModelArrayRef< arrayName, S, access >::operator() ( size_t i,
size_t j,
size_t k,
size_t l,
size_t m,
size_t n,
size_t p ) const
inline

Returns the specified point from a 7 dimensional ModelArray.

If the object holds discontinuous Galerkin components, only the cell averaged value is returned.

Definition at line 123 of file ModelArrayRef.hpp.

◆ operator()() [8/8]

template<auto arrayName, typename S , bool access = RO>
const double & Nextsim::ModelArrayRef< arrayName, S, access >::operator() ( size_t i,
size_t j,
size_t k,
size_t l,
size_t m,
size_t n,
size_t p,
size_t q ) const
inline

Returns the specified point from a 8 dimensional ModelArray.

If the object holds discontinuous Galerkin components, only the cell averaged value is returned.

Definition at line 132 of file ModelArrayRef.hpp.

◆ operator*() [1/2]

template<auto arrayName, typename S , bool access = RO>
ModelArray Nextsim::ModelArrayRef< arrayName, S, access >::operator* ( const ModelArray & multiplier) const
inline

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

Definition at line 171 of file ModelArrayRef.hpp.

Here is the call graph for this function:

◆ operator*() [2/2]

template<auto arrayName, typename S , bool access = RO>
ModelArray Nextsim::ModelArrayRef< arrayName, S, access >::operator* ( double multiplier) const
inline

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

Definition at line 184 of file ModelArrayRef.hpp.

Here is the call graph for this function:

◆ operator+() [1/2]

template<auto arrayName, typename S , bool access = RO>
ModelArray Nextsim::ModelArrayRef< arrayName, S, access >::operator+ ( const ModelArray & addend) const
inline

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

Definition at line 165 of file ModelArrayRef.hpp.

Here is the call graph for this function:

◆ operator+() [2/2]

template<auto arrayName, typename S , bool access = RO>
ModelArray Nextsim::ModelArrayRef< arrayName, S, access >::operator+ ( double addend) const
inline

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

Definition at line 178 of file ModelArrayRef.hpp.

Here is the call graph for this function:

◆ operator-() [1/2]

template<auto arrayName, typename S , bool access = RO>
ModelArray Nextsim::ModelArrayRef< arrayName, S, access >::operator- ( const ModelArray & subtrahend) const
inline

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

Definition at line 168 of file ModelArrayRef.hpp.

Here is the call graph for this function:

◆ operator-() [2/2]

template<auto arrayName, typename S , bool access = RO>
ModelArray Nextsim::ModelArrayRef< arrayName, S, access >::operator- ( double subtrahend) const
inline

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

Definition at line 181 of file ModelArrayRef.hpp.

Here is the call graph for this function:

◆ operator/() [1/2]

template<auto arrayName, typename S , bool access = RO>
ModelArray Nextsim::ModelArrayRef< arrayName, S, access >::operator/ ( const ModelArray & divisor) const
inline

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

Definition at line 174 of file ModelArrayRef.hpp.

Here is the call graph for this function:

◆ operator/() [2/2]

template<auto arrayName, typename S , bool access = RO>
ModelArray Nextsim::ModelArrayRef< arrayName, S, access >::operator/ ( double divisor) const
inline

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

Definition at line 187 of file ModelArrayRef.hpp.

Here is the call graph for this function:

◆ operator[]() [1/2]

template<auto arrayName, typename S , bool access = RO>
const double & Nextsim::ModelArrayRef< arrayName, S, access >::operator[] ( const ModelArray::MultiDim & dims)
inline

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.

Parameters
dimsThe indices of the target point.

Definition at line 53 of file ModelArrayRef.hpp.

◆ operator[]() [2/2]

template<auto arrayName, typename S , bool access = RO>
const double & Nextsim::ModelArrayRef< arrayName, S, access >::operator[] ( size_t index) 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.

Parameters
indexThe one dimensional index of the target point.

Definition at line 67 of file ModelArrayRef.hpp.

◆ zIndexAndLayer()

template<auto arrayName, typename S , bool access = RO>
const double & Nextsim::ModelArrayRef< arrayName, S, access >::zIndexAndLayer ( size_t hIndex,
size_t layer )
inline

Special access function for ZFields.

@detail Index the referenced 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 148 of file ModelArrayRef.hpp.

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

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