File fieldgroup.hxx#

Functions

FieldGroup operator+(const FieldGroup &lhs, const FieldGroup &rhs)

Combine two FieldGroups.

class FieldGroup#
#include <fieldgroup.hxx>

Group together fields for easier communication

Note: The FieldData class is used as a base class, which is inherited by Field2D, Field3D, Vector2D and Vector3D however Vector2D and Vector3D are stored by reference to their components (x,y,z) as Field2D or Field3D objects.

Public Types

using iterator = std::vector<FieldData*>::iterator#

Iteration over all fields.

using const_iterator = std::vector<FieldData*>::const_iterator#

Const iteration over all fields.

Public Functions

FieldGroup() = default#
FieldGroup(const FieldGroup &other) = default#
FieldGroup(FieldGroup &&other) = default#
FieldGroup &operator=(const FieldGroup &other) = default#
FieldGroup &operator=(FieldGroup &&other) = default#
inline FieldGroup(FieldData &f)#

Constructor with a single FieldData f.

inline FieldGroup(Field3D &f)#

Constructor with a single Field3D f.

inline FieldGroup(Vector2D &v)#

Constructor with a single Vector2D v

This is needed so that fvec only contains Field2D or Field3D

inline FieldGroup(Vector3D &v)#

Constructor with a single Vector3D v

This is needed so that fvec only contains Field2D or Field3D

template<typename ...Ts>
inline explicit FieldGroup(Ts&... ts)#

Variadic constructor. Allows an arbitrary number of FieldData arguments

The explicit keyword prevents FieldGroup being constructed with arbitrary types. In particular arguments to add() cannot be implicitly converted to FieldGroup, leading to an infinite loop.

inline void add(const FieldGroup &other)#

Copy contents of another FieldGroup other into this group.

inline FieldGroup &operator+=(const FieldGroup &other)#

Add the contents of other to this.

inline void add(FieldData &f)#

Add a FieldData f to the group.

A pointer to this field will be stored internally, so the lifetime of this variable should be longer than the lifetime of this group.

inline void add(Field3D &f)#
inline void add(Vector2D &v)#

Add a Vector2D v to the group.

Pointers to this vector’s components will be stored internally, so the lifetime of this variable should be longer than the lifetime of this group.

inline void add(Vector3D &v)#

Add a Vector3D v to the group.

Pointers to this vector’s components will be stored internally, so the lifetime of this variable should be longer than the lifetime of this group.

template<typename ...Ts>
inline void add(FieldData &t, Ts&... ts)#

Add multiple fields to this group

This is a variadic template which allows Field3D objects to be treated as a special case. An arbitrary number of fields can be added.

template<typename ...Ts>
inline void add(Field3D &t, Ts&... ts)#
template<typename ...Ts>
inline void add(Vector3D &t, Ts&... ts)#
template<typename ...Ts>
inline void add(Vector2D &t, Ts&... ts)#
inline int size() const#

Return number of fields.

inline int size_field3d() const#

Return number of Field3Ds.

inline bool empty() const#

Test whether this group is empty.

inline void clear()#

Remove all fields from this group.

inline iterator begin()#
inline iterator end()#
inline const_iterator begin() const#
inline const_iterator end() const#
inline const std::vector<FieldData*> &get() const#
inline const std::vector<Field3D*> &field3d() const#

Iteration over 3D fields.

void makeUnique()#

Ensure that each field appears only once.

Private Members

std::vector<FieldData*> fvec#
std::vector<Field3D*> f3vec#