A four dimensional field/lattice.
Implemented as a vector style container using consecutive memory to provide fixed time access to any member. The four coordinates are labeled x,y,z,f. Two memory layouts (linearization strategies) are offered, see Layout
Template Parameters:
See also Overview of Field Module
#include <FieldIterator.h>
Public Member Functions | |
Construction & Destruction | |
Field (uint_t xSize, uint_t ySize, uint_t zSize, const Layout &layout=fzyx, const shared_ptr< FieldAllocator< T > > &alloc=shared_ptr< FieldAllocator< T > >()) | |
Creates an uninitialized field of given size. More... | |
Field (uint_t xSize, uint_t ySize, uint_t zSize, const T &initValue, const Layout &layout=fzyx, const shared_ptr< FieldAllocator< T > > &alloc=shared_ptr< FieldAllocator< T > >()) | |
Creates a field and initializes it with constant. More... | |
Field (uint_t xSize, uint_t ySize, uint_t zSize, const std::vector< T > &fValues, const Layout &layout=fzyx, const shared_ptr< FieldAllocator< T > > &alloc=shared_ptr< FieldAllocator< T > >()) | |
Creates a field and initializes f coordinate with vector values. More... | |
virtual | ~Field () |
Destructor, using Allocator template parameter. More... | |
void | init (uint_t xSize, uint_t ySize, uint_t zSize, const Layout &layout=fzyx, shared_ptr< FieldAllocator< T > > alloc=shared_ptr< FieldAllocator< T > >(), uint_t innerGhostLayerSizeForAlignedAlloc=0) |
Initializes the field with a given size, in a given layout. More... | |
virtual void | resize (uint_t xSize, uint_t ySize, uint_t zSize) |
Deletes all stored data, and resizes the field. More... | |
Field< T, fSize_ > * | clone () const |
Returns a deep copy of the current field. More... | |
Field< T, fSize_ > * | cloneUninitialized () const |
Creates a new field that has equal size and layout as this field. More... | |
Field< T, fSize_ > * | cloneShallowCopy () const |
Returns a shallow copy of the current field. More... | |
FlattenedField * | flattenedShallowCopy () const |
Returns a flattened shallow copy of the current field. More... | |
Element Access | |
T & | get (cell_idx_t x, cell_idx_t y, cell_idx_t z) |
get function with only (x,y,z) coordinates, assumes fSize=1 More... | |
const T & | get (cell_idx_t x, cell_idx_t y, cell_idx_t z) const |
get function with only (x,y,z) coordinates, assumes fSize=1 More... | |
T & | get (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) |
Non-Const variant of get() More... | |
const T & | get (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) const |
Accesses the value at given coordinate. More... | |
T & | get (cell_idx_t x, cell_idx_t y, cell_idx_t z, uint_t f) |
get() variant which takes a uint_t as last coordinate, as for example Stencil::toIdx() returns More... | |
const T & | get (cell_idx_t x, cell_idx_t y, cell_idx_t z, uint_t f) const |
get() variant which takes a uint_t as last coordinate, as for example Stencil::toIdx() returns More... | |
T & | get (const Cell &cell) |
get overload using a cell as input, only possible if fSize=1 More... | |
const T & | get (const Cell &cell) const |
get overload using a cell as input, only possible if fSize=1 More... | |
T & | get (const Cell &c, cell_idx_t f) |
const T & | get (const Cell &c, cell_idx_t f) const |
T & | get (const Cell &c, uint_t f) |
const T & | get (const Cell &c, uint_t f) const |
T & | get (const base_iterator &iter) |
get overload, where position is specified using an iterator of another field with equal size More... | |
const T & | get (const base_iterator &iter) const |
get overload, where position is specified using an iterator of another field with equal size More... | |
T & | operator() (cell_idx_t x, cell_idx_t y, cell_idx_t z) |
const T & | operator() (cell_idx_t x, cell_idx_t y, cell_idx_t z) const |
T & | operator() (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) |
const T & | operator() (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) const |
T & | operator() (cell_idx_t x, cell_idx_t y, cell_idx_t z, uint_t f) |
const T & | operator() (cell_idx_t x, cell_idx_t y, cell_idx_t z, uint_t f) const |
T & | operator() (const Cell &cell) |
const T & | operator() (const Cell &cell) const |
T & | operator() (const Cell &cell, cell_idx_t f) |
const T & | operator() (const Cell &cell, cell_idx_t f) const |
T & | operator() (const Cell &cell, uint_t f) |
const T & | operator() (const Cell &cell, uint_t f) const |
T & | operator() (const base_iterator &iter) |
const T & | operator() (const base_iterator &iter) const |
T & | getNeighbor (cell_idx_t x, cell_idx_t y, cell_idx_t z, stencil::Direction d) |
returns neighboring value of cell in the given direction More... | |
const T & | getNeighbor (cell_idx_t x, cell_idx_t y, cell_idx_t z, stencil::Direction d) const |
returns neighboring value of cell in the given direction More... | |
T & | getNeighbor (cell_idx_t x, cell_idx_t y, cell_idx_t z, uint_t f, stencil::Direction d) |
returns neighboring value of cell in the given direction More... | |
const T & | getNeighbor (cell_idx_t x, cell_idx_t y, cell_idx_t z, uint_t f, stencil::Direction d) const |
returns neighboring value of cell in the given direction More... | |
T & | getNeighbor (const Cell &cell, stencil::Direction d) |
get overload using a cell as input, only possible if fSize=1, with neighbor access More... | |
const T & | getNeighbor (const Cell &cell, stencil::Direction d) const |
get overload using a cell as input, only possible if fSize=1, with neighbor access More... | |
T & | getF (T *const xyz0, const cell_idx_t f) |
const T & | getF (const T *const xyz0, const cell_idx_t f) const |
T & | getF (T *const xyz0, const uint_t f) |
const T & | getF (const T *const xyz0, const uint_t f) const |
void | set (const T &value) |
Sets all entries of the field to given value. More... | |
void | set (const std::vector< T > &fValues) |
Initializes the f coordinate to values from vector Sets the entry (x,y,z,f) to fValues[f]. More... | |
void | set (const Field< T, fSize_ > &other) |
Copies all entries of the given field to this field. More... | |
void | set (const Field< T, fSize_ > *other) |
void | swapDataPointers (Field< T, fSize_ > &other) |
Swap two fields efficiently by exchanging only values_ pointer The two fields have to have identical sizes and same layout. More... | |
void | swapDataPointers (Field< T, fSize_ > *other) |
Equality Checks | |
bool | operator== (const Field< T, fSize_ > &other) const |
Equality operator compares element-wise. More... | |
bool | operator!= (const Field< T, fSize_ > &other) const |
Inequality operator compares element-wise. More... | |
bool | hasSameAllocSize (const Field< T, fSize_ > &other) const |
True if allocation sizes of all dimensions match. More... | |
bool | hasSameSize (const Field< T, fSize_ > &other) const |
True if sizes of all dimensions match. More... | |
Iterators | |
iterator | begin () |
Returns iterator, which can iterate over complete field in a suitable order depending on layout. More... | |
const_iterator | begin () const |
iterator | beginXYZ () |
Iterates only over XYZ coordinate, f is always 0. More... | |
const_iterator | beginXYZ () const |
iterator | beginSlice (cell_idx_t xBeg, cell_idx_t yBeg, cell_idx_t zBeg, cell_idx_t fBeg, cell_idx_t xEnd, cell_idx_t yEnd, cell_idx_t zEnd, cell_idx_t fEnd) |
Returns iterator which iterates over a sub-block of the field. More... | |
const_iterator | beginSlice (cell_idx_t xBeg, cell_idx_t yBeg, cell_idx_t zBeg, cell_idx_t fBeg, cell_idx_t xEnd, cell_idx_t yEnd, cell_idx_t zEnd, cell_idx_t fEnd) const |
Const variant of beginSlice() More... | |
iterator | beginSliceXYZ (const CellInterval &interval, cell_idx_t f=0) |
Returns iterator which iterates over a slice, but only in x,y,z coordinates. More... | |
const_iterator | beginSliceXYZ (const CellInterval &interval, cell_idx_t f=0) const |
Const variant of beginSliceXYZ() More... | |
const iterator & | end () |
const const_iterator & | end () const |
Reverse Iterators | |
reverse_iterator | rbegin () |
Returns reverse iterator, which can iterate over complete field in a suitable order depending on layout. More... | |
const_reverse_iterator | rbegin () const |
reverse_iterator | rbeginXYZ () |
Iterates only over XYZ coordinate, f is always 0. More... | |
const_reverse_iterator | rbeginXYZ () const |
const reverse_iterator & | rend () |
const const_reverse_iterator & | rend () const |
Size and Layout Information | |
uint_t | xSize () const |
uint_t | ySize () const |
uint_t | zSize () const |
uint_t | fSize () const |
uint_t | size (uint_t coord) const |
uint_t | xAllocSize () const |
uint_t | yAllocSize () const |
uint_t | zAllocSize () const |
uint_t | fAllocSize () const |
uint_t | allocSize () const |
CellInterval | xyzSize () const |
CellInterval | xyzAllocSize () const |
Layout | layout () const |
int64_t | xStride () const |
int64_t | yStride () const |
int64_t | zStride () const |
int64_t | fStride () const |
cell_idx_t | xOff () const |
cell_idx_t | yOff () const |
cell_idx_t | zOff () const |
bool | coordinatesValid (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) const |
Slicing | |
Field< T, fSize_ > * | getSlicedField (const CellInterval &interval) const |
Create a different "view" of the field, where the created field has the size of the given sliceInterval. More... | |
virtual void | slice (const CellInterval &interval) |
Changes the coordinate system of the field. More... | |
virtual void | shiftCoordinates (cell_idx_t cx, cell_idx_t cy, cell_idx_t cz) |
Pointer to internal memory - use with care! | |
| |
T * | data () |
const T * | data () const |
T * | dataAt (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) |
const T * | dataAt (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) const |
T * | dataInner () |
const T * | dataInner () const |
shared_ptr< FieldAllocator< T > > | getAllocator () const |
Returns internal data allocator. More... | |
Protected Member Functions | |
Shallow Copy | |
Field (const Field &other) | |
Private copy constructor that creates a shallow copy i.e. More... | |
template<typename T2 , uint_t fSize2> | |
Field (const Field< T2, fSize2 > &other) | |
Private copy constructor that creates a flattened shallow copy i.e. More... | |
virtual uint_t | referenceCount () const |
Returns the number of objects that internally use the same data. More... | |
virtual Field< T, fSize_ > * | cloneShallowCopyInternal () const |
Does the same as cloneShallowCopy (but is virtual) More... | |
virtual FlattenedField * | flattenedShallowCopyInternal () const |
Does the same as flattenedShallowCopy (but is virtual) More... | |
Type Definitions | |
using | value_type = T |
using | iterator = ForwardFieldIterator< T, fSize_ > |
using | const_iterator = ForwardFieldIterator< const T, fSize_ > |
using | reverse_iterator = ReverseFieldIterator< T, fSize_ > |
using | const_reverse_iterator = ReverseFieldIterator< const T, fSize_ > |
using | base_iterator = FieldIterator< T, fSize_ > |
using | const_base_iterator = FieldIterator< const T, fSize_ > |
using | Ptr = FieldPointer< Field< T, fSize_ >, Field< T, fSize_ >, T > |
using | ConstPtr = FieldPointer< Field< T, fSize_ >, const Field< T, fSize_ >, const T > |
using | FlattenedField = typename std::conditional< VectorTrait< T >::F_SIZE !=0, Field< typename VectorTrait< T >::OutputType, VectorTrait< T >::F_SIZE *fSize_ >, Field< T, fSize_ > >::type |
static const uint_t | F_SIZE = fSize_ |
Monitoring | |
using | MonitorFunction = std::function< void(cell_idx_t, cell_idx_t, cell_idx_t, cell_idx_t, const T &)> |
void | addMonitoringFunction (const MonitorFunction &func) |
Registers a monitoring function. More... | |
Static cached end iterators | |
static const const_iterator | staticConstEnd = ForwardFieldIterator<const T,fSize_>() |
Const end iterator, see end() More... | |
static const iterator | staticEnd = ForwardFieldIterator<T,fSize_>() |
End iterator, can be used with begin() and beginBlock() More... | |
static const const_reverse_iterator | staticConstREnd = ReverseFieldIterator<const T,fSize_>() |
Const end iterator, see end() More... | |
static const reverse_iterator | staticREnd = ReverseFieldIterator<T,fSize_>() |
End iterator, can be used with begin() and beginBlock() More... | |
Field () | |
Creates an uninitialized field of size zero (no allocated memory) More... | |
Changing Offsets | |
T * | values_ |
Linearized, 1-dimensional representation of the 4D data grid. More... | |
T * | valuesWithOffset_ |
set by setOffsets(), to allow derived classes to change the offset More... | |
cell_idx_t | xOff_ |
Offset of the xSize() to xAllocSize() More... | |
cell_idx_t | yOff_ |
Offset of the ySize() to yAllocSize() More... | |
cell_idx_t | zOff_ |
Offset of the zSize() to zAllocSize() More... | |
uint_t | xSize_ |
Number of cells in x-dimension (excluding padded cells) More... | |
uint_t | ySize_ |
Number of cells in y-dimension (excluding padded cells) More... | |
uint_t | zSize_ |
Number of cells in z-dimension (excluding padded cells) More... | |
uint_t | xAllocSize_ |
Number of cells in x-dimension (including padded cells) More... | |
uint_t | yAllocSize_ |
Number of cells in y-dimension (including padded cells) More... | |
uint_t | zAllocSize_ |
Number of cells in z-dimension (including padded cells) More... | |
uint_t | fAllocSize_ |
Number of cells in f-dimension (including padded cells) More... | |
Layout | layout_ |
Determines in which order the values are stored. More... | |
uint_t | allocSize_ |
The overall size of the T* (padding included) More... | |
int64_t | ffact_ |
Access multiplication factor for the f-dimension. More... | |
int64_t | xfact_ |
Access multiplication factor for the x-dimension. More... | |
int64_t | yfact_ |
Access multiplication factor for the y-dimension. More... | |
int64_t | zfact_ |
Access multiplication factor for the z-dimension. More... | |
shared_ptr< FieldAllocator< T > > | allocator_ |
Allocator for the field. More... | |
class | FieldIterator< T, fSize_ > |
class | FieldIterator< const T, fSize_ > |
template<typename T2 , uint_t fSize2> | |
class | Field |
void | setOffsets (uint_t xOffset, uint_t xSize, uint_t yOffset, uint_t ySize, uint_t zOffset, uint_t zSizes) |
Moves the coordinate system of the field. More... | |
shared_ptr< FieldAllocator< T > > | allocator () const |
bool | addressInsideAllocedSpace (const T *const value) const |
void | assertValidCoordinates (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) const |
Field & | operator= (const Field &) |
using walberla::field::Field< T, fSize_ >::base_iterator = FieldIterator<T, fSize_> |
using walberla::field::Field< T, fSize_ >::const_base_iterator = FieldIterator<const T, fSize_> |
using walberla::field::Field< T, fSize_ >::const_iterator = ForwardFieldIterator<const T, fSize_> |
using walberla::field::Field< T, fSize_ >::const_reverse_iterator = ReverseFieldIterator<const T, fSize_> |
using walberla::field::Field< T, fSize_ >::ConstPtr = FieldPointer<Field<T, fSize_>, const Field<T, fSize_>, const T> |
using walberla::field::Field< T, fSize_ >::FlattenedField = typename std::conditional<VectorTrait<T>::F_SIZE != 0, Field<typename VectorTrait<T>::OutputType, VectorTrait<T>::F_SIZE * fSize_>, Field<T, fSize_> >::type |
using walberla::field::Field< T, fSize_ >::iterator = ForwardFieldIterator<T, fSize_> |
using walberla::field::Field< T, fSize_ >::MonitorFunction = std::function<void (cell_idx_t, cell_idx_t, cell_idx_t, cell_idx_t, const T &)> |
using walberla::field::Field< T, fSize_ >::Ptr = FieldPointer<Field<T, fSize_>, Field<T, fSize_>, T> |
using walberla::field::Field< T, fSize_ >::reverse_iterator = ReverseFieldIterator<T, fSize_> |
using walberla::field::Field< T, fSize_ >::value_type = T |
walberla::field::Field< T, fSize_ >::Field | ( | uint_t | _xSize, |
uint_t | _ySize, | ||
uint_t | _zSize, | ||
const Layout & | l = fzyx , |
||
const shared_ptr< FieldAllocator< T > > & | alloc = shared_ptr<FieldAllocator<T> >() |
||
) |
Creates an uninitialized field of given size.
_xSize | size of x dimension |
_ySize | size of y dimension |
_zSize | size of z dimension |
l | memory layout of the field (see Field::Layout) |
alloc | class that describes how to allocate memory for the field, see FieldAllocator |
walberla::field::Field< T, fSize_ >::Field | ( | uint_t | _xSize, |
uint_t | _ySize, | ||
uint_t | _zSize, | ||
const T & | initVal, | ||
const Layout & | l = fzyx , |
||
const shared_ptr< FieldAllocator< T > > & | alloc = shared_ptr<FieldAllocator<T> >() |
||
) |
Creates a field and initializes it with constant.
_xSize | size of x dimension |
_ySize | size of y dimension |
_zSize | size of z dimension |
initVal | every element of the field is set to initVal |
l | memory layout of the field (see Field::Layout) |
alloc | class that describes how to allocate memory for the field, see FieldAllocator |
walberla::field::Field< T, fSize_ >::Field | ( | uint_t | _xSize, |
uint_t | _ySize, | ||
uint_t | _zSize, | ||
const std::vector< T > & | fValues, | ||
const Layout & | l = fzyx , |
||
const shared_ptr< FieldAllocator< T > > & | alloc = shared_ptr<FieldAllocator<T> >() |
||
) |
Creates a field and initializes f coordinate with vector values.
_xSize | size of x dimension |
_ySize | size of y dimension |
_zSize | size of z dimension |
fValues | initializes f coordinate with values from vector (see set(std::vector&) ) |
l | memory layout of the field (see Field::Layout) |
alloc | class that describes how to allocate memory for the field, see FieldAllocator |
|
virtual |
Destructor, using Allocator template parameter.
|
protected |
Creates an uninitialized field of size zero (no allocated memory)
This field has to be initialized before it can be used using the init() method
|
protected |
Private copy constructor that creates a shallow copy i.e.
reuses the memory of the copied field
|
protected |
Private copy constructor that creates a flattened shallow copy i.e.
reuses the memory of the copied field
void walberla::field::Field< T, fSize >::addMonitoringFunction | ( | const MonitorFunction & | func | ) |
Registers a monitoring function.
Monitoring works only if compiled with WALBERLA_FIELD_MONITORED_ACCESS. When a field is accessed either by get() or operator() the monitoring function is called
|
inlineprotected |
|
inlineprotected |
|
inline |
|
protected |
|
inline |
Returns iterator, which can iterate over complete field in a suitable order depending on layout.
Returns const_iterator, see begin()
Use this when iterating over a complete field, faster than 4 nested loops and operator() calls in the innermost loop because no index calculations have to be done.
const_iterator walberla::field::Field< T, fSize_ >::begin | ( | ) | const |
|
inline |
Returns iterator which iterates over a sub-block of the field.
|
inline |
Const variant of beginSlice()
|
inline |
Returns iterator which iterates over a slice, but only in x,y,z coordinates.
f | fixed value of f coordinate, where iterator points to in each cell |
|
inline |
Const variant of beginSliceXYZ()
|
inline |
Iterates only over XYZ coordinate, f is always 0.
Const version of beginXYZ()
const_iterator walberla::field::Field< T, fSize_ >::beginXYZ | ( | ) | const |
Field< T, fSize_ > * walberla::field::Field< T, fSize_ >::clone |
Returns a deep copy of the current field.
The data is copied over.
Field< T, fSize_ > * walberla::field::Field< T, fSize_ >::cloneShallowCopy |
Returns a shallow copy of the current field.
Shallow copy means, that the new field internally uses the same memory as this field.
|
protectedvirtual |
Does the same as cloneShallowCopy (but is virtual)
This version has to be implemented by derived classes. The cloneShallowCopy() itself cannot be virtual, since the implementation of cloneShallowCopy() of derived classes has a different signature.
Reimplemented in walberla::lbm::PdfField< LatticeModel_T >, walberla::field::GhostLayerField< T, fSize_ >, walberla::field::GhostLayerField< double, 27 >, walberla::field::GhostLayerField< real_t, LatticeModel_T::Stencil::Size >, walberla::field::GhostLayerField< double, 19 >, walberla::field::GhostLayerField< real_t, LatticeStorageSpecification_T::Stencil::Size >, walberla::field::GhostLayerField< uint32_t, 1 >, walberla::field::GhostLayerField< Flag_T, 1 >, walberla::field::GhostLayerField< flag_t, 1 >, walberla::field::FlagField< uint32_t >, walberla::field::FlagField< Flag_T >, walberla::field::FlagField< flag_t >, and walberla::lbm_generated::PdfField< LatticeStorageSpecification_T >.
Field< T, fSize_ > * walberla::field::Field< T, fSize_ >::cloneUninitialized |
Creates a new field that has equal size and layout as this field.
The memory of the new field is uninitialized.
bool walberla::field::Field< T, fSize_ >::coordinatesValid | ( | cell_idx_t | x, |
cell_idx_t | y, | ||
cell_idx_t | z, | ||
cell_idx_t | f | ||
) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Field< T, fSize_ >::FlattenedField * walberla::field::Field< T, fSize_ >::flattenedShallowCopy |
Returns a flattened shallow copy of the current field.
Shallow copy means, that the new field internally uses the same memory as this field. Flattened means that any VectorTrait-compatible containers are absorbed into the fSize.
|
protectedvirtual |
Does the same as flattenedShallowCopy (but is virtual)
This version has to be implemented by derived classes. The flattenedShallowCopy() itself cannot be virtual, since the implementation of flattenedShallowCopy() of derived classes has a different signature.
Reimplemented in walberla::field::GhostLayerField< T, fSize_ >, walberla::field::GhostLayerField< double, 27 >, walberla::field::GhostLayerField< real_t, LatticeModel_T::Stencil::Size >, walberla::field::GhostLayerField< double, 19 >, walberla::field::GhostLayerField< real_t, LatticeStorageSpecification_T::Stencil::Size >, walberla::field::GhostLayerField< uint32_t, 1 >, walberla::field::GhostLayerField< Flag_T, 1 >, and walberla::field::GhostLayerField< flag_t, 1 >.
|
inline |
|
inline |
|
inline |
get function with only (x,y,z) coordinates, assumes fSize=1
|
inline |
get function with only (x,y,z) coordinates, assumes fSize=1
|
inline |
Non-Const variant of get()
|
inline |
Accesses the value at given coordinate.
When WALBERLA_FIELD_MONITORED_ACCESS is defined, all registered monitor functions are executed when get is called
|
inline |
get() variant which takes a uint_t as last coordinate, as for example Stencil::toIdx() returns
|
inline |
get() variant which takes a uint_t as last coordinate, as for example Stencil::toIdx() returns
|
inline |
get overload, where position is specified using an iterator of another field with equal size
Do not use this for iterator that belong to this field, here *iterator is more convenient
iter | Iterator that belongs to another field that has equal size |
|
inline |
get overload, where position is specified using an iterator of another field with equal size
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
get overload using a cell as input, only possible if fSize=1
|
inline |
get overload using a cell as input, only possible if fSize=1
shared_ptr< FieldAllocator< T > > walberla::field::Field< T, fSize_ >::getAllocator |
Returns internal data allocator.
The allocator can for example be used to prevent free() on the field data when class is deleted. This is useful if you keep a pointer to the internal data, to make sure it remains valid ( also after possible swapDataPointers() etc. )
field->getAllocator()->incrementReferenceCount( field->data() ); Use the data pointer field->getAllocator()->decrementReferenceCount( field->data() );
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
returns neighboring value of cell in the given direction
|
inline |
returns neighboring value of cell in the given direction
|
inline |
returns neighboring value of cell in the given direction
|
inline |
returns neighboring value of cell in the given direction
|
inline |
get overload using a cell as input, only possible if fSize=1, with neighbor access
|
inline |
get overload using a cell as input, only possible if fSize=1, with neighbor access
Field< T, fSize_ > * walberla::field::Field< T, fSize_ >::getSlicedField | ( | const CellInterval & | interval | ) | const |
Create a different "view" of the field, where the created field has the size of the given sliceInterval.
The ownership of the returned pointer is transfered to the caller i.e. the caller is responsible for deleting the returned object.
The returned field uses the same data as the original field. However the returned field has a different coordinate system defined by the given slice-interval. Modifying the returned slice field modifies also the original field! The sliced field has the size as given by the slice-interval.
|
inline |
True if allocation sizes of all dimensions match.
|
inline |
True if sizes of all dimensions match.
void walberla::field::Field< T, fSize_ >::init | ( | uint_t | _xSize, |
uint_t | _ySize, | ||
uint_t | _zSize, | ||
const Layout & | l = fzyx , |
||
shared_ptr< FieldAllocator< T > > | alloc = shared_ptr<FieldAllocator<T> >() , |
||
uint_t | innerGhostLayerSizeForAlignedAlloc = 0 |
||
) |
Initializes the field with a given size, in a given layout.
Must be called exactly once! This is automatically called by all constructors that take at least one argument
_xSize | size of x dimension |
_ySize | size of y dimension |
_zSize | size of z dimension |
l | memory layout of the field (see Field::Layout) |
alloc | the allocator to use. If a NULL shared pointer is given, a sensible default is selected, depending on layout |
innerGhostLayerSizeForAlignedAlloc | This parameter should be set to zero for field that have no ghost layers. This parameter is passed to the allocator and can there be used to ensure alignment of the first INNER cell in each line |
|
inline |
|
inline |
Inequality operator compares element-wise.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
|
inline |
Equality operator compares element-wise.
|
inline |
Returns reverse iterator, which can iterate over complete field in a suitable order depending on layout.
Returns const_reverse_iterator, see begin()
const_reverse_iterator walberla::field::Field< T, fSize_ >::rbegin | ( | ) | const |
|
inline |
Iterates only over XYZ coordinate, f is always 0.
Const version of beginXYZ()
const_reverse_iterator walberla::field::Field< T, fSize_ >::rbeginXYZ | ( | ) | const |
|
protectedvirtual |
Returns the number of objects that internally use the same data.
|
inline |
|
inline |
|
virtual |
Deletes all stored data, and resizes the field.
The resized field is uninitialized.
_xSize | size of x dimension |
_ySize | size of y dimension |
_zSize | size of z dimension |
Reimplemented in walberla::field::GhostLayerField< T, fSize_ >, walberla::field::GhostLayerField< double, 27 >, walberla::field::GhostLayerField< real_t, LatticeModel_T::Stencil::Size >, walberla::field::GhostLayerField< double, 19 >, walberla::field::GhostLayerField< real_t, LatticeStorageSpecification_T::Stencil::Size >, walberla::field::GhostLayerField< T, 1 >, walberla::field::GhostLayerField< uint32_t, 1 >, walberla::field::GhostLayerField< Flag_T, 1 >, and walberla::field::GhostLayerField< flag_t, 1 >.
|
inline |
Copies all entries of the given field to this field.
Only works when xSize(), ySize(), zSize() and allocSize() are equal Copies complete allocated region as specified by allocSize()
|
inline |
void walberla::field::Field< T, fSize_ >::set | ( | const std::vector< T > & | fValues | ) |
Initializes the f coordinate to values from vector Sets the entry (x,y,z,f) to fValues[f].
Works only in the regions specified by size(), not in the complete allocated region as specified by allocSize()
void walberla::field::Field< T, fSize_ >::set | ( | const T & | value | ) |
Sets all entries of the field to given value.
Works only in the regions specified by size(), not in the complete allocated region as specified by allocSize()
|
protected |
Moves the coordinate system of the field.
Can be used by derived classes, to use only a subset of the field. The complete field remains accessible, but now has coordinates smaller than 0 or bigger than [xyzf]Size() This is used for example in the constructor of the GhostLayerField
Internally this is implementing by adding an offset to the values_ pointer, and by adapting the size_ members.
xOffset | The x coordinate that is afterwards mapped to zero |
xs | The new size of the x coordinate. Has to be smaller than (old xSize())-xOffset |
yOffset | The y coordinate that is afterwards mapped to zero |
ys | The new size of the y coordinate. Has to be smaller than (old ySize())-yOffset |
zOffset | The z coordinate that is afterwards mapped to zero |
zs | The new size of the z coordinate. Has to be smaller than (old zSize())-zOffset |
|
virtual |
Reimplemented in walberla::field::GhostLayerField< T, fSize_ >, walberla::field::GhostLayerField< double, 27 >, walberla::field::GhostLayerField< real_t, LatticeModel_T::Stencil::Size >, walberla::field::GhostLayerField< double, 19 >, walberla::field::GhostLayerField< real_t, LatticeStorageSpecification_T::Stencil::Size >, walberla::field::GhostLayerField< T, 1 >, walberla::field::GhostLayerField< uint32_t, 1 >, walberla::field::GhostLayerField< Flag_T, 1 >, and walberla::field::GhostLayerField< flag_t, 1 >.
|
inline |
|
virtual |
Changes the coordinate system of the field.
The origin of the new coordinates is at the cell given by min() of the CellInterval. The new size of the field, is the size of the the CellInterval, however the alloc size does not change. Cells that are not in this cell interval can still be accessed ( by coordinates smaller 0, or bigger than [xyz]Size)
Reimplemented in walberla::field::GhostLayerField< T, fSize_ >, walberla::field::GhostLayerField< double, 27 >, walberla::field::GhostLayerField< real_t, LatticeModel_T::Stencil::Size >, walberla::field::GhostLayerField< double, 19 >, walberla::field::GhostLayerField< real_t, LatticeStorageSpecification_T::Stencil::Size >, walberla::field::GhostLayerField< T, 1 >, walberla::field::GhostLayerField< uint32_t, 1 >, walberla::field::GhostLayerField< Flag_T, 1 >, and walberla::field::GhostLayerField< flag_t, 1 >.
|
inline |
Swap two fields efficiently by exchanging only values_ pointer The two fields have to have identical sizes and same layout.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |
|
friend |
|
friend |
|
private |
Allocator for the field.
|
private |
The overall size of the T* (padding included)
|
static |
|
private |
Number of cells in f-dimension (including padded cells)
|
private |
Access multiplication factor for the f-dimension.
|
private |
Determines in which order the values are stored.
|
static |
Const end iterator, see end()
|
static |
Const end iterator, see end()
|
static |
End iterator, can be used with begin() and beginBlock()
|
static |
End iterator, can be used with begin() and beginBlock()
|
private |
Linearized, 1-dimensional representation of the 4D data grid.
|
private |
set by setOffsets(), to allow derived classes to change the offset
|
private |
Number of cells in x-dimension (including padded cells)
|
private |
Access multiplication factor for the x-dimension.
|
private |
Offset of the xSize() to xAllocSize()
|
private |
Number of cells in x-dimension (excluding padded cells)
|
private |
Number of cells in y-dimension (including padded cells)
|
private |
Access multiplication factor for the y-dimension.
|
private |
Offset of the ySize() to yAllocSize()
|
private |
Number of cells in y-dimension (excluding padded cells)
|
private |
Number of cells in z-dimension (including padded cells)
|
private |
Access multiplication factor for the z-dimension.
|
private |
Offset of the zSize() to zAllocSize()
|
private |
Number of cells in z-dimension (excluding padded cells)