A non-const Field/List wrapper with possible data conversion. More...
#include <PrecisionAdaptor.H>


Public Types | |
| typedef Container< Type > | FieldType |
| The adapted field type. Same as element_type. | |
| Public Types inherited from refPtr< Field< Type > > | |
| typedef Field< Type > | element_type |
| Type of object being managed or referenced. | |
| typedef Field< Type > * | pointer |
| Pointer to type of object being managed or referenced. | |
| typedef Foam::refCount::zero | refCount |
| Null reference counter class. | |
Public Member Functions | |
| PrecisionAdaptor ()=default | |
| Default construct, setting content later. | |
| PrecisionAdaptor (Container< InputType > &input, const bool doCopy=true) | |
| Construct from Container<InputType>, copying input if required (and requested). | |
| ~PrecisionAdaptor () | |
| Destructor, copies back content changes (as required). | |
| bool | active () const noexcept |
| Is precision adaption being used (non-passive adaptor)? | |
| void | commit () |
| Commit adapted content changes back to original input (as required). | |
| void | set (Container< InputType > &input, const bool doCopy=true) |
| Set adaptor for different input, copying input as required. | |
| Public Member Functions inherited from refPtr< Field< Type > > | |
| constexpr | refPtr () noexcept |
| Construct with no managed pointer. | |
| ~refPtr () noexcept | |
| Destructor: deletes managed pointer. | |
| bool | good () const noexcept |
| True if pointer/reference is non-null. | |
| bool | is_const () const noexcept |
| If the stored/referenced content is const. | |
| bool | is_pointer () const noexcept |
| True if this is a managed pointer (not a reference). | |
| bool | is_reference () const noexcept |
| True if this is a reference (not a pointer). | |
| bool | movable () const noexcept |
| True if this is a non-null managed pointer. | |
| Field< Type > * | get () noexcept |
| Return pointer without nullptr checking. | |
| const Field< Type > & | cref () const |
| Return const reference to the object or to the contents of a (non-null) managed pointer. | |
| Field< Type > & | ref () const |
| Return non-const reference to the contents of a non-null managed pointer. | |
| Field< Type > & | constCast () const |
| Return non-const reference to the object or to the contents of a (non-null) managed pointer, with an additional const_cast. | |
| refPtr< Field< Type > > | shallowClone () const noexcept |
| Return a shallow copy as a wrapped reference, preserving the const/non-const status. | |
| Field< Type > * | release () noexcept |
| Release ownership and return the pointer. A no-op for reference objects (returns nullptr). | |
| Field< Type > * | ptr () const |
| Return managed pointer for reuse, or clone() the object reference. | |
| void | clear () const noexcept |
| If object pointer points to valid object: delete object and set pointer to nullptr. | |
| void | reset (Field< Type > *p=nullptr) noexcept |
| Delete managed pointer and set to new given pointer. | |
| Field< Type > & | emplace (Args &&... args) |
| Reset with emplace construction. Return reference to the new content. | |
| void | swap (refPtr< Field< Type > > &other) noexcept |
| Swaps the managed object with other. | |
| const Field< Type > & | operator* () const |
| Return const reference to the object. | |
| const Field< Type > * | operator-> () const |
| Dereferences (const) pointer to the managed object. | |
| const Field< Type > & | operator() () const |
| Return const reference to the object - same as cref() method. | |
| operator bool () const noexcept | |
| True if pointer/reference is non-null. Same as good(). | |
| operator const Field< Type > & () const | |
| Cast to underlying data type, using the cref() method. | |
| void | operator= (const refPtr< Field< Type > > &other) |
| Transfer ownership of managed pointer. | |
| operator tmp< Field< Type > > () | |
| Conversion to tmp, releases pointer or shallow-copies reference. | |
| bool | valid () const noexcept |
| Identical to good(), or bool operator. | |
| bool | empty () const noexcept |
| Deprecated(2020-07) True if a null managed pointer. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from refPtr< Field< Type > > | |
| static refPtr< Field< Type > > | New (Args &&... args) |
| Construct refPtr with forwarding arguments. | |
| static refPtr< Field< Type > > | NewFrom (Args &&... args) |
| Construct refPtr from derived type with forwarding arguments. | |
| static word | typeName () |
| The type-name, constructed from type-name of T. | |
A non-const Field/List wrapper with possible data conversion.
Conversion adaptor for Field/List that either wrap the input as a reference, or creates a temporary pointer and copies the values on construction/destruction.
This provides, for example, automatic conversion between types for linear solvers able to run mixed precision.
Definition at line 210 of file PrecisionAdaptor.H.
| typedef Container<Type> FieldType |
The adapted field type. Same as element_type.
Definition at line 255 of file PrecisionAdaptor.H.
|
default |
Default construct, setting content later.
|
inlineexplicit |
Construct from Container<InputType>, copying input if required (and requested).
Definition at line 269 of file PrecisionAdaptor.H.
|
inline |
Destructor, copies back content changes (as required).
Definition at line 282 of file PrecisionAdaptor.H.
References refPtr< Field< Type > >::clear(), and commit().

|
inlinenoexcept |
Is precision adaption being used (non-passive adaptor)?
Definition at line 294 of file PrecisionAdaptor.H.
References refPtr< Field< Type > >::good(), refPtr< Field< Type > >::is_pointer(), and Foam::noexcept.
Referenced by commit().


|
inline |
Commit adapted content changes back to original input (as required).
Definition at line 303 of file PrecisionAdaptor.H.
References active(), refPtr< Field< Type > >::cref(), and refPtr< T >::good().
Referenced by set(), and ~PrecisionAdaptor().


|
inline |
Set adaptor for different input, copying input as required.
Definition at line 317 of file PrecisionAdaptor.H.
References commit().
Referenced by kahipDecomp::decomposeSerial(), metisDecomp::decomposeSerial(), and scotchDecomp::decomposeSerial().

