Loading...
Searching...
No Matches
FieldField< Field, Type > Class Template Reference

A field of fields is a PtrList of fields with reference counting. More...

#include <FieldField.H>

Inheritance diagram for FieldField< Field, Type >:
Collaboration diagram for FieldField< Field, Type >:

Public Types

typedef pTraits< Type >::cmptType cmptType
 Component type.
Public Types inherited from UPtrList< Field< Type > >
typedef Field< Type > value_type
 Type of values the list contains.
typedef Field< Type > & reference
 A non-const reference to the value_type.
typedef const Field< Type > & const_reference
 A const reference to the value_type.

Public Member Functions

constexpr FieldField () noexcept
 Construct null.
 FieldField (const label size)
 Construct given size.
 FieldField (const word &type, const FieldField< Field, Type > &ff)
 Clone construct with new type.
 FieldField (const FieldField< Field, Type > &ff)
 Copy construct, cloning each element.
 FieldField (FieldField< Field, Type > &&ff)
 Move construct.
 FieldField (FieldField< Field, Type > &ff, bool reuse)
 Construct as copy or re-use as specified.
 FieldField (const PtrList< Field< Type > > &list)
 Copy construct from PtrList.
 FieldField (PtrList< Field< Type > > &&list)
 Move construct from PtrList.
 FieldField (const tmp< FieldField< Field, Type > > &tf)
 Move/copy construct from tmp<FieldField>.
 FieldField (Istream &is)
 Construct from Istream.
tmp< FieldField< Field, Type > > clone () const
 Clone.
void negate ()
 Negate this field. See notes in Field.
void normalise ()
 Normalise this field. See notes in Field.
tmp< FieldField< Field, cmptType > > component (const direction) const
 Return a component field of the field.
void replace (const direction, const FieldField< Field, cmptType > &)
 Replace a component field of the field.
void replace (const direction, const cmptType &)
 Replace a component field of the field.
void clamp_min (const Type &lower)
 Impose lower (floor) clamp on the field values (in-place).
void clamp_min (const FieldField< Field, Type > &lower)
 Impose lower (floor) clamp on the field values (in-place).
void clamp_max (const Type &upper)
 Impose upper (ceiling) clamp on the field values (in-place).
void clamp_max (const FieldField< Field, Type > &upper)
 Impose upper (ceiling) clamp on the field values (in-place).
void clamp_range (const Type &lower, const Type &upper)
 Clamp field values (in-place) to the specified range.
void clamp_range (const MinMax< Type > &range)
 Clamp field values (in-place) to the specified range.
tmp< FieldField< Field, Type > > T () const
 Return the field transpose (only defined for second rank tensors).
const Type & operator[] (const labelPair &index) const
 Const access to a single field element via (fieldi, elemi).
Type & operator[] (const labelPair &index)
 Non-const access to a single field element via (fieldi, elemi).
void operator= (const FieldField< Field, Type > &)
 Copy assignment.
void operator= (FieldField< Field, Type > &&)
 Move assignment.
void operator= (const tmp< FieldField< Field, Type > > &)
 Move or clone assignment.
void operator= (const Type &val)
 Assign uniform value.
void operator= (Foam::zero)
 Assign uniform zero.
void operator+= (const FieldField< Field, Type > &)
void operator+= (const tmp< FieldField< Field, Type > > &)
void operator-= (const FieldField< Field, Type > &)
void operator-= (const tmp< FieldField< Field, Type > > &)
void operator*= (const FieldField< Field, scalar > &)
void operator*= (const tmp< FieldField< Field, scalar > > &)
void operator/= (const FieldField< Field, scalar > &)
void operator/= (const tmp< FieldField< Field, scalar > > &)
void operator+= (const Type &)
void operator-= (const Type &)
void operator*= (const scalar &)
void operator/= (const scalar &)
Public Member Functions inherited from refCount
constexpr refCount () noexcept
 Default construct, initializing count to 0.
int use_count () const noexcept
 Return the current reference count.
bool unique () const noexcept
 Return true if the reference count is zero.
void operator++ () noexcept
 Increment the reference count.
void operator++ (int) noexcept
 Increment the reference count.
void operator-- () noexcept
 Decrement the reference count.
void operator-- (int) noexcept
 Decrement the reference count.
Public Member Functions inherited from PtrList< Field< Type > >
Foam::PtrList< Field< Type > > clone (Args &&... args) const
constexpr PtrList () noexcept
 Default construct.
 ~PtrList ()
 Destructor. Frees all pointers.
const Field< Type > * set (const label i) const
 Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie, with bounds checking).
void clear ()
 Clear the PtrList. Delete allocated entries and set size to zero.
void free ()
 Free memory and nullify all entries. Does not change the list size.
void resize (const label newLen)
 Adjust size of PtrList.
void resize_null (const label newLen)
 Set the addressed list to the given size, deleting all existing entries. Afterwards the list contains all nullptr entries.
Field< Type > & emplace_back (Args &&... args)
 Construct and append an element to the end of the list, return reference to the new list element.
void push_back (Field< Type > *ptr)
 Append an element to the end of the list.
Field< Type > & emplace_set (const label i, Args &&... args)
 Construct and set a new element at given position, (discard old element at that location).
Field< Type > & emplace (const label i, Args &&... args)
 Same as emplace_set().
Field< Type > & try_emplace (const label i, Args &&... args)
 Like emplace_set() but will not overwrite an occupied (non-null) location.
autoPtr< Field< Type > > release (const label i)
 Release ownership of the pointer at the given position.
void transfer (PtrList< Field< Type > > &list)
 Transfer into this list and annul the argument list.
void operator= (const UPtrList< Field< Type > > &list)
 Copy assignment.
void setSize (const label n)
 Same as resize().
void append (autoPtr< Field< Type > > &ptr)
 Move append an element to the end of the list.
Public Member Functions inherited from UPtrList< Field< Type > >
bool empty () const noexcept
 True if the list is empty (ie, size() is zero).
label size () const noexcept
 The number of entries in the list.
label capacity () const noexcept
 Size of the underlying storage.
label count_nonnull () const noexcept
 The number of non-nullptr entries in the list.
Field< Type > & front ()
 Reference to the first element of the list.
Field< Type > & back ()
 Reference to the last element of the list.
const Field< Type > * test (const label i) const
 Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie, with bounds checking).
const Field< Type > * get (const label i) const
 Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie, with bounds checking).
const Field< Type > * set (const label i) const
 Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie, with bounds checking).
void clear ()
 Set list size to zero.
void free ()
 Nullify all entries. Does not change the list size.
void resize (const label newLen)
 Change the size of the list. Any new entries are nullptr.
void resize_null (const label newLen)
 Set the list to the given size and set all entries to nullptr.
label squeezeNull ()
 Squeeze out nullptr entries in the list of pointers after which any null pointers will be at the end of the list.
void push_back (Field< Type > *ptr)
 Append an element to the end of the list.
void swap (UPtrList< Field< Type > > &list) noexcept
 Swap content.
void transfer (UPtrList< Field< Type > > &list)
 Transfer contents into this list and annul the argument.
void reorder (const labelUList &oldToNew, const bool check=false)
 Reorder elements. Reordering must be unique (ie, shuffle).
void sortOrder (const labelUList &order, const bool check=false)
 Reorder elements according to new order mapping (newToOld). Reordering must be unique (ie, shuffle).
void checkNonNull () const
 Check and raise FatalError if any nullptr exists in the list.
const Field< Type > & at (const label i) const
 Return const reference to the element at given position. FatalError for bounds problem or nullptr.
const Field< Type > & operator[] (const label i) const
 Return const reference to the element at given position. FatalError for bounds problem or nullptr. Same as at().
 FOAM_DEPRECATED_FOR (2022-09, "get(), set() or test() methods") const Field< Type > *operator()(const label i) const
 Deprecated(2022-09) - same as get().
void operator= (const UPtrList< Field< Type > > &list)
 Copy assignment (shallow copies addresses).
OstreamprintAddresses (Ostream &os) const
 Print pointer addresses to Ostream (debugging only).
OstreamwriteList (Ostream &os, const bool trimNull=false) const
 Write UPtrList to Ostream, optionally ignoring null entries.
Field< Type > ** begin_ptr () noexcept
 Iterator to begin of raw pointers traversal (use with caution).
Field< Type > ** end_ptr () noexcept
 Iterator beyond end of raw pointers traversal (use with caution).
iterator begin ()
 Return iterator to begin traversal of non-nullptr entries.
iterator end () noexcept
 Return iterator beyond end of UPtrList traversal.
const_iterator cbegin () const
 Return const_iterator to begin traversal of non-nullptr entries.
const_iterator cend () const noexcept
 Return const_iterator beyond end of UPtrList traversal.
void setSize (const label n)
 Alias for resize().
Field< Type > & first ()
 Reference to the first element of the list.
Field< Type > & last ()
 Return reference to the last element of the list.
void append (Field< Type > *ptr)
 Append an element to the end of the list.
label count () const noexcept
 The number of non-nullptr entries in the list.

Static Public Member Functions

template<class Type2>
static tmp< FieldField< Field, Type > > NewCalculatedType (const FieldField< Field, Type2 > &ff)
 Return a pointer to a new calculatedFvPatchFieldField created on.

Friends

Ostreamoperator (Ostream &, const FieldField< Field, Type > &)
Ostreamoperator (Ostream &, const tmp< FieldField< Field, Type > > &)

Additional Inherited Members

Protected Member Functions inherited from PtrList< Field< Type > >
void readIstream (Istream &is, const INew &inew)
 Read from Istream using Istream constructor class.
Protected Member Functions inherited from UPtrList< Field< Type > >
void setAddressableSize (const label n) noexcept
 Adjust addressable size.
label find_next (label pos) const
 The next non-null entry after the specified position.
 UPtrList (Detail::PtrListDetail< Field< Type > > &&ptrs) noexcept
 Low-level move construct.
Protected Attributes inherited from UPtrList< Field< Type > >
Detail::PtrListDetail< Field< Type > > ptrs_
 The list of pointers.

Detailed Description

template<template< class > class Field, class Type>
class Foam::FieldField< Field, Type >

A field of fields is a PtrList of fields with reference counting.

Source files

Definition at line 73 of file FieldField.H.

Member Typedef Documentation

◆ cmptType

template<template< class > class Field, class Type>
typedef pTraits<Type>::cmptType cmptType

Component type.

Definition at line 83 of file FieldField.H.

Constructor & Destructor Documentation

◆ FieldField() [1/10]

◆ FieldField() [2/10]

template<template< class > class Field, class Type>
FieldField ( const label size)
explicit

Construct given size.

Used for temporary fields which are initialised after construction

Definition at line 108 of file FieldField.C.

References PtrList< Field< Type > >::PtrList(), and UPtrList< Field< Type > >::size().

Here is the call graph for this function:

◆ FieldField() [3/10]

template<template< class > class Field, class Type>
FieldField ( const word & type,
const FieldField< Field, Type > & ff )

Clone construct with new type.

Definition at line 115 of file FieldField.C.

References FieldField(), forAll, Field< Type >::New(), PtrList< Field< Type > >::PtrList(), PtrList< Field< Type > >::set(), and UPtrList< Field< Type > >::size().

Here is the call graph for this function:

◆ FieldField() [4/10]

template<template< class > class Field, class Type>
FieldField ( const FieldField< Field, Type > & ff)

Copy construct, cloning each element.

Definition at line 131 of file FieldField.C.

References FieldField(), and PtrList< Field< Type > >::PtrList().

Here is the call graph for this function:

◆ FieldField() [5/10]

template<template< class > class Field, class Type>
FieldField ( FieldField< Field, Type > && ff)

Move construct.

Definition at line 138 of file FieldField.C.

References FieldField(), and PtrList< Field< Type > >::PtrList().

Here is the call graph for this function:

◆ FieldField() [6/10]

template<template< class > class Field, class Type>
FieldField ( FieldField< Field, Type > & ff,
bool reuse )

Construct as copy or re-use as specified.

Definition at line 145 of file FieldField.C.

◆ FieldField() [7/10]

template<template< class > class Field, class Type>
FieldField ( const PtrList< Field< Type > > & list)

Copy construct from PtrList.

Definition at line 152 of file FieldField.C.

References PtrList< Field< Type > >::PtrList().

Here is the call graph for this function:

◆ FieldField() [8/10]

template<template< class > class Field, class Type>
FieldField ( PtrList< Field< Type > > && list)

Move construct from PtrList.

Definition at line 159 of file FieldField.C.

References PtrList< Field< Type > >::PtrList().

Here is the call graph for this function:

◆ FieldField() [9/10]

template<template< class > class Field, class Type>
FieldField ( const tmp< FieldField< Field, Type > > & tf)

Move/copy construct from tmp<FieldField>.

Definition at line 166 of file FieldField.C.

References FieldField(), and PtrList< Field< Type > >::PtrList().

Here is the call graph for this function:

◆ FieldField() [10/10]

template<template< class > class Field, class Type>
FieldField ( Istream & is)

Construct from Istream.

Definition at line 175 of file FieldField.C.

References PtrList< Field< Type > >::PtrList().

Here is the call graph for this function:

Member Function Documentation

◆ clone()

template<template< class > class Field, class Type>
tmp< FieldField< Field, Type > > clone ( ) const

Clone.

Definition at line 182 of file FieldField.C.

References Foam::New().

Here is the call graph for this function:

◆ NewCalculatedType()

template<template< class > class Field, class Type>
template<class Type2>
tmp< FieldField< Field, Type > > NewCalculatedType ( const FieldField< Field, Type2 > & ff)
static

◆ negate()

template<template< class > class Field, class Type>
void negate ( )

Negate this field. See notes in Field.

Definition at line 212 of file FieldField.C.

References forAll, and operator[]().

Here is the call graph for this function:

◆ normalise()

template<template< class > class Field, class Type>
void normalise ( )

Normalise this field. See notes in Field.

Definition at line 222 of file FieldField.C.

◆ component()

template<template< class > class Field, class Type>
tmp< FieldField< Field, typename FieldField< Field, Type >::cmptType > > component ( const direction d) const

Return a component field of the field.

Definition at line 233 of file FieldField.C.

◆ replace() [1/2]

template<template< class > class Field, class Type>
void replace ( const direction d,
const FieldField< Field, cmptType > & sf )

Replace a component field of the field.

Definition at line 251 of file FieldField.C.

References FieldField(), forAll, and operator[]().

Here is the call graph for this function:

◆ replace() [2/2]

template<template< class > class Field, class Type>
void replace ( const direction d,
const cmptType & s )

Replace a component field of the field.

Definition at line 265 of file FieldField.C.

◆ clamp_min() [1/2]

template<template< class > class Field, class Type>
void clamp_min ( const Type & lower)

Impose lower (floor) clamp on the field values (in-place).

Definition at line 279 of file FieldField.C.

◆ clamp_min() [2/2]

template<template< class > class Field, class Type>
void clamp_min ( const FieldField< Field, Type > & lower)

Impose lower (floor) clamp on the field values (in-place).

Definition at line 305 of file FieldField.C.

References FieldField(), and UPtrList< Field< Type > >::size().

Here is the call graph for this function:

◆ clamp_max() [1/2]

template<template< class > class Field, class Type>
void clamp_max ( const Type & upper)

Impose upper (ceiling) clamp on the field values (in-place).

Definition at line 292 of file FieldField.C.

◆ clamp_max() [2/2]

template<template< class > class Field, class Type>
void clamp_max ( const FieldField< Field, Type > & upper)

Impose upper (ceiling) clamp on the field values (in-place).

Definition at line 320 of file FieldField.C.

References FieldField(), and UPtrList< Field< Type > >::size().

Here is the call graph for this function:

◆ clamp_range() [1/2]

template<template< class > class Field, class Type>
void clamp_range ( const Type & lower,
const Type & upper )

Clamp field values (in-place) to the specified range.

Does not check if range is valid or not.

Definition at line 335 of file FieldField.C.

◆ clamp_range() [2/2]

template<template< class > class Field, class Type>
void clamp_range ( const MinMax< Type > & range)

Clamp field values (in-place) to the specified range.

Does not check if range is valid or not.

Definition at line 351 of file FieldField.C.

References range.

◆ T()

template<template< class > class Field, class Type>
tmp< FieldField< Field, Type > > T ( ) const

Return the field transpose (only defined for second rank tensors).

Definition at line 366 of file FieldField.C.

References NewCalculatedType(), and Foam::T().

Referenced by Dual< Type >::interpolateGrad(), and Moment< Type >::Moment().

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

◆ operator[]() [1/2]

template<template< class > class Field, class Type>
const Type & operator[] ( const labelPair & index) const
inline

Const access to a single field element via (fieldi, elemi).

Definition at line 381 of file FieldField.C.

References Pair< T >::first(), operator[](), and Pair< T >::second().

Referenced by negate(), operator=(), operator[](), operator[](), and replace().

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

◆ operator[]() [2/2]

template<template< class > class Field, class Type>
Type & operator[] ( const labelPair & index)
inline

Non-const access to a single field element via (fieldi, elemi).

Definition at line 388 of file FieldField.C.

References Pair< T >::first(), operator[](), and Pair< T >::second().

Here is the call graph for this function:

◆ operator=() [1/5]

template<template< class > class Field, class Type>
void operator= ( const FieldField< Field, Type > & ff)

◆ operator=() [2/5]

template<template< class > class Field, class Type>
void operator= ( FieldField< Field, Type > && ff)

Move assignment.

Definition at line 412 of file FieldField.C.

References FieldField(), PtrList< Field< Type > >::PtrList(), and PtrList< Field< Type > >::transfer().

Here is the call graph for this function:

◆ operator=() [3/5]

template<template< class > class Field, class Type>
void operator= ( const tmp< FieldField< Field, Type > > & )

Move or clone assignment.

References FieldField(), and operator.

Here is the call graph for this function:

◆ operator=() [4/5]

template<template< class > class Field, class Type>
void operator= ( const Type & val)

Assign uniform value.

Definition at line 444 of file FieldField.C.

◆ operator=() [5/5]

template<template< class > class Field, class Type>
void operator= ( Foam::zero )

Assign uniform zero.

Definition at line 454 of file FieldField.C.

◆ operator+=() [1/3]

template<template< class > class Field, class Type>
void operator+= ( const FieldField< Field, Type > & f)

Definition at line 493 of file FieldField.C.

Referenced by AveragingMethod< Type >::operator+=().

Here is the caller graph for this function:

◆ operator+=() [2/3]

template<template< class > class Field, class Type>
void operator+= ( const tmp< FieldField< Field, Type > > & tf)

Definition at line 493 of file FieldField.C.

◆ operator-=() [1/3]

template<template< class > class Field, class Type>
void operator-= ( const FieldField< Field, Type > & f)

Definition at line 494 of file FieldField.C.

References COMPUTED_ASSIGNMENT.

◆ operator-=() [2/3]

template<template< class > class Field, class Type>
void operator-= ( const tmp< FieldField< Field, Type > > & tf)

Definition at line 494 of file FieldField.C.

◆ operator*=() [1/3]

template<template< class > class Field, class Type>
void operator*= ( const FieldField< Field, scalar > & f)

Definition at line 495 of file FieldField.C.

References COMPUTED_ASSIGNMENT.

Referenced by AveragingMethod< Type >::operator*=().

Here is the caller graph for this function:

◆ operator*=() [2/3]

template<template< class > class Field, class Type>
void operator*= ( const tmp< FieldField< Field, scalar > > & tf)

Definition at line 495 of file FieldField.C.

◆ operator/=() [1/3]

template<template< class > class Field, class Type>
void operator/= ( const FieldField< Field, scalar > & f)

Definition at line 496 of file FieldField.C.

References COMPUTED_ASSIGNMENT.

Referenced by AveragingMethod< Type >::operator/=().

Here is the caller graph for this function:

◆ operator/=() [2/3]

template<template< class > class Field, class Type>
void operator/= ( const tmp< FieldField< Field, scalar > > & tf)

Definition at line 496 of file FieldField.C.

◆ operator+=() [3/3]

template<template< class > class Field, class Type>
void operator+= ( const Type & val)

Definition at line 493 of file FieldField.C.

◆ operator-=() [3/3]

template<template< class > class Field, class Type>
void operator-= ( const Type & val)

Definition at line 494 of file FieldField.C.

◆ operator*=() [3/3]

template<template< class > class Field, class Type>
void operator*= ( const scalar & val)

Definition at line 495 of file FieldField.C.

◆ operator/=() [3/3]

template<template< class > class Field, class Type>
void operator/= ( const scalar & val)

Definition at line 496 of file FieldField.C.

◆ operator [1/2]

◆ operator [2/2]

template<template< class > class Field, class Type>
Ostream & operator ( Ostream & ,
const tmp< FieldField< Field, Type > > &  )
friend

References FieldField(), and operator.


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