Field< Type > Class Template Reference

Generic templated field type. More...

Inheritance diagram for Field< Type >:
[legend]

Public Types

typedef pTraits< Type >::cmptType cmptType
 Component type. More...
 
typedef SubField< Type > subField
 Declare type of subField. More...
 

Public Member Functions

constexpr Field () noexcept
 Default construct. More...
 
 Field (const label len)
 Construct given size. More...
 
 Field (const label len, const Type &val)
 Construct given size and initial value. More...
 
 Field (const label len, const Foam::zero)
 Construct given size and initial values of zero. More...
 
 Field (const Foam::one, const Type &val)
 Construct with length=1, copying the value as the only content. More...
 
 Field (const Foam::one, Type &&val)
 Construct with length=1, moving the value as the only content. More...
 
 Field (const Foam::one, const Foam::zero)
 Construct with length=1, initializing content to zero. More...
 
 Field (const Field< Type > &fld)
 Copy construct. More...
 
 Field (const UList< Type > &list)
 Copy construct from UList<Type> More...
 
template<class Addr >
 Field (const IndirectListBase< Type, Addr > &list)
 Copy construct from IndirectList. More...
 
 Field (Field< Type > &&fld)
 Move construct from Field. More...
 
 Field (List< Type > &&list)
 Move construct from List. More...
 
template<int SizeMin>
 Field (DynamicList< Type, SizeMin > &&list)
 Move construct from DynamicList. More...
 
 Field (const UList< Type > &mapF, const labelUList &mapAddressing)
 Construct by 1 to 1 mapping from the given field. More...
 
 Field (const tmp< Field< Type >> &tmapF, const labelUList &mapAddressing)
 Construct by 1 to 1 mapping from the given tmp field. More...
 
 Field (const UList< Type > &mapF, const labelListList &mapAddressing, const scalarListList &weights)
 Construct by interpolative mapping from the given field. More...
 
 Field (const tmp< Field< Type >> &tmapF, const labelListList &mapAddressing, const scalarListList &weights)
 Construct by interpolative mapping from the given tmp field. More...
 
 Field (const UList< Type > &mapF, const FieldMapper &map, const bool applyFlip=true)
 Construct by mapping from the given field. More...
 
 Field (const UList< Type > &mapF, const FieldMapper &map, const Type &defaultValue, const bool applyFlip=true)
 Construct by mapping from the given field. More...
 
 Field (const UList< Type > &mapF, const FieldMapper &map, const UList< Type > &defaultValues, const bool applyFlip=true)
 Construct by mapping from the given field. More...
 
 Field (const tmp< Field< Type >> &tmapF, const FieldMapper &map, const bool applyFlip=true)
 Construct by mapping from the given tmp field. More...
 
 Field (const tmp< Field< Type >> &tmapF, const FieldMapper &map, const Type &defaultValue, const bool applyFlip=true)
 
 Field (const tmp< Field< Type >> &tmapF, const FieldMapper &map, const UList< Type > &defaultValues, const bool applyFlip=true)
 
 Field (Field< Type > &fld, bool reuse)
 Copy construct or re-use as specified. More...
 
 Field (const tmp< Field< Type >> &tfld)
 Copy or move construct from tmp. More...
 
 Field (Istream &is)
 Construct from Istream. More...
 
 Field (const word &keyword, const dictionary &dict, const label len)
 Construct from a dictionary entry. More...
 
tmp< Field< Type > > clone () const
 Clone. More...
 
void map (const UList< Type > &mapF, const labelUList &mapAddressing)
 1 to 1 map from the given field More...
 
void map (const tmp< Field< Type >> &tmapF, const labelUList &mapAddressing)
 1 to 1 map from the given tmp field More...
 
void map (const UList< Type > &mapF, const labelListList &mapAddressing, const scalarListList &weights)
 Interpolative map from the given field. More...
 
void map (const tmp< Field< Type >> &tmapF, const labelListList &mapAddressing, const scalarListList &weights)
 Interpolative map from the given tmp field. More...
 
void map (const UList< Type > &mapF, const FieldMapper &map, const bool applyFlip=true)
 Map from the given field. More...
 
void map (const tmp< Field< Type >> &tmapF, const FieldMapper &map, const bool applyFlip=true)
 Map from the given tmp field. More...
 
void autoMap (const FieldMapper &map, const bool applyFlip=true)
 Map from self. More...
 
void rmap (const UList< Type > &mapF, const labelUList &mapAddressing)
 1 to 1 reverse-map from the given field More...
 
void rmap (const tmp< Field< Type >> &tmapF, const labelUList &mapAddressing)
 1 to 1 reverse-map from the given tmp field More...
 
void rmap (const UList< Type > &mapF, const labelUList &mapAddressing, const UList< scalar > &weights)
 Interpolative reverse map from the given field. More...
 
void rmap (const tmp< Field< Type >> &tmapF, const labelUList &mapAddressing, const UList< scalar > &weights)
 Interpolative reverse map from the given tmp field. More...
 
void negate ()
 Negate this field (negative). More...
 
tmp< Field< cmptType > > component (const direction) const
 Return a component field of the field. More...
 
void replace (const direction, const UList< cmptType > &)
 Replace a component field of the field. More...
 
void replace (const direction, const tmp< Field< cmptType >> &)
 Replace a component field of the field. More...
 
void replace (const direction, const cmptType &)
 Replace a component field of the field. More...
 
template<class VSForm >
VSForm block (const label start) const
 
tmp< Field< Type > > T () const
 Return the field transpose (only defined for second rank tensors) More...
 
void writeEntry (const word &keyword, Ostream &os) const
 Write the field as a dictionary entry. More...
 
SubField< Type > slice (const label pos, label len=-1)
 Return SubField slice (non-const access) - no range checking. More...
 
const SubField< Type > slice (const label pos, label len=-1) const
 Return SubField slice (const access) - no range checking. More...
 
SubField< Type > slice (const labelRange &range)
 Return SubField slice (non-const access) - with range checking. More...
 
const SubField< Type > slice (const labelRange &range) const
 Return SubField slice (const access) - with range checking. More...
 
void operator= (const Field< Type > &)
 Copy assignment. More...
 
void operator= (const tmp< Field< Type >> &)
 
void operator= (const UList< Type > &rhs)
 
void operator= (const SubField< Type > &rhs)
 
template<class Addr >
void operator= (const IndirectListBase< Type, Addr > &rhs)
 Copy assign from IndirectList. More...
 
void operator= (Field< Type > &&rhs)
 Move assignment. More...
 
void operator= (List< Type > &&rhs)
 
template<int SizeMin>
void operator= (DynamicList< Type, SizeMin > &&rhs)
 
void operator= (const Type &val)
 Value assignment. More...
 
void operator= (const Foam::zero)
 
template<class Form , class Cmpt , direction nCmpt>
void operator= (const VectorSpace< Form, Cmpt, nCmpt > &)
 
void operator+= (const UList< Type > &)
 
void operator+= (const tmp< Field< Type >> &)
 
void operator-= (const UList< Type > &)
 
void operator-= (const tmp< Field< Type >> &)
 
void operator*= (const UList< scalar > &)
 
void operator*= (const tmp< Field< scalar >> &)
 
void operator/= (const UList< scalar > &)
 
void operator/= (const tmp< Field< scalar >> &)
 
void operator+= (const Type &)
 
void operator-= (const Type &)
 
void operator*= (const scalar &)
 
void operator/= (const scalar &)
 
template<class Type>
void operator= (const tmp< Field > &rhs)
 

Static Public Member Functions

static const Field< Type > & null ()
 Return nullObject reference Field. More...
 
static autoPtr< Field< Type > > New (Istream &is)
 Return a pointer to a new Field created on freestore. More...
 
template<class Type2 >
static tmp< Field< Type > > NewCalculatedType (const Field< Type2 > &f)
 

Friends

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

Detailed Description

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

Generic templated field type.

Source files

Definition at line 63 of file Field.H.

Member Typedef Documentation

◆ cmptType

typedef pTraits<Type>::cmptType cmptType

Component type.

Definition at line 86 of file Field.H.

◆ subField

typedef SubField<Type> subField

Declare type of subField.

Definition at line 89 of file Field.H.

Constructor & Destructor Documentation

◆ Field() [1/27]

constexpr Field ( )
inlineconstexprnoexcept

Default construct.

For temporary fields that are initialised after construction

Definition at line 40 of file FieldI.H.

◆ Field() [2/27]

Field ( const label  len)
inlineexplicit

Construct given size.

For temporary fields that are initialised after construction

Definition at line 47 of file FieldI.H.

◆ Field() [3/27]

Field ( const label  len,
const Type &  val 
)
inline

Construct given size and initial value.

Definition at line 54 of file FieldI.H.

◆ Field() [4/27]

Field ( const label  len,
const Foam::zero   
)
inline

Construct given size and initial values of zero.

Definition at line 61 of file FieldI.H.

◆ Field() [5/27]

Field ( const Foam::one  ,
const Type &  val 
)
inline

Construct with length=1, copying the value as the only content.

Definition at line 68 of file FieldI.H.

◆ Field() [6/27]

Field ( const Foam::one  ,
Type &&  val 
)
inline

Construct with length=1, moving the value as the only content.

Definition at line 75 of file FieldI.H.

◆ Field() [7/27]

Field ( const Foam::one  ,
const Foam::zero   
)
inline

Construct with length=1, initializing content to zero.

Definition at line 82 of file FieldI.H.

◆ Field() [8/27]

Field ( const Field< Type > &  fld)
inline

Copy construct.

Definition at line 89 of file FieldI.H.

◆ Field() [9/27]

Field ( const UList< Type > &  list)
inlineexplicit

Copy construct from UList<Type>

Definition at line 96 of file FieldI.H.

◆ Field() [10/27]

Field ( const IndirectListBase< Type, Addr > &  list)
inlineexplicit

Copy construct from IndirectList.

Definition at line 104 of file FieldI.H.

◆ Field() [11/27]

Field ( Field< Type > &&  fld)
inline

Move construct from Field.

Definition at line 111 of file FieldI.H.

◆ Field() [12/27]

Field ( List< Type > &&  list)
inline

Move construct from List.

Definition at line 120 of file FieldI.H.

◆ Field() [13/27]

Field ( DynamicList< Type, SizeMin > &&  list)
inline

Move construct from DynamicList.

Definition at line 130 of file FieldI.H.

◆ Field() [14/27]

Field ( const UList< Type > &  mapF,
const labelUList mapAddressing 
)

Construct by 1 to 1 mapping from the given field.

Definition at line 39 of file Field.C.

◆ Field() [15/27]

Field ( const tmp< Field< Type >> &  tmapF,
const labelUList mapAddressing 
)

Construct by 1 to 1 mapping from the given tmp field.

Definition at line 52 of file Field.C.

◆ Field() [16/27]

Field ( const UList< Type > &  mapF,
const labelListList mapAddressing,
const scalarListList weights 
)

Construct by interpolative mapping from the given field.

Definition at line 65 of file Field.C.

◆ Field() [17/27]

Field ( const tmp< Field< Type >> &  tmapF,
const labelListList mapAddressing,
const scalarListList weights 
)

Construct by interpolative mapping from the given tmp field.

Definition at line 79 of file Field.C.

◆ Field() [18/27]

Field ( const UList< Type > &  mapF,
const FieldMapper map,
const bool  applyFlip = true 
)

Construct by mapping from the given field.

Definition at line 93 of file Field.C.

◆ Field() [19/27]

Field ( const UList< Type > &  mapF,
const FieldMapper map,
const Type &  defaultValue,
const bool  applyFlip = true 
)

Construct by mapping from the given field.

Definition at line 107 of file Field.C.

◆ Field() [20/27]

Field ( const UList< Type > &  mapF,
const FieldMapper map,
const UList< Type > &  defaultValues,
const bool  applyFlip = true 
)

Construct by mapping from the given field.

Definition at line 122 of file Field.C.

◆ Field() [21/27]

Field ( const tmp< Field< Type >> &  tmapF,
const FieldMapper map,
const bool  applyFlip = true 
)

Construct by mapping from the given tmp field.

Definition at line 137 of file Field.C.

◆ Field() [22/27]

Field ( const tmp< Field< Type >> &  tmapF,
const FieldMapper map,
const Type &  defaultValue,
const bool  applyFlip = true 
)

Construct by mapping from the given tmp field. Uses supplied uniform value for unmapped items

Definition at line 151 of file Field.C.

◆ Field() [23/27]

Field ( const tmp< Field< Type >> &  tmapF,
const FieldMapper map,
const UList< Type > &  defaultValues,
const bool  applyFlip = true 
)

Construct by mapping from the given tmp field. Uses supplied values for unmapped items

Definition at line 166 of file Field.C.

◆ Field() [24/27]

Field ( Field< Type > &  fld,
bool  reuse 
)
inline

Copy construct or re-use as specified.

Definition at line 139 of file FieldI.H.

◆ Field() [25/27]

Field ( const tmp< Field< Type >> &  tfld)
inline

Copy or move construct from tmp.

Definition at line 146 of file FieldI.H.

◆ Field() [26/27]

Field ( Istream is)
inline

Construct from Istream.

Definition at line 155 of file FieldI.H.

◆ Field() [27/27]

Field ( const word keyword,
const dictionary dict,
const label  len 
)

Construct from a dictionary entry.

Definition at line 181 of file Field.C.

Member Function Documentation

◆ null()

const Foam::Field< Type > & null ( )
inlinestatic

Return nullObject reference Field.

Definition at line 31 of file FieldI.H.

Referenced by meshedSurfRef::clear(), meshedSurf::emptySurface::points(), lumpedPointMovement::writeVTP(), and lumpedPointMovement::writeZonesVTP().

Here is the caller graph for this function:

◆ clone()

Foam::tmp< Foam::Field< Type > > clone ( ) const
inline

Clone.

Definition at line 162 of file FieldI.H.

◆ New()

static autoPtr<Field<Type> > New ( Istream is)
inlinestatic

Return a pointer to a new Field created on freestore.

Definition at line 243 of file Field.H.

Referenced by Field< Foam::Vector2D >::NewCalculatedType().

Here is the caller graph for this function:

◆ NewCalculatedType()

static tmp<Field<Type> > NewCalculatedType ( const Field< Type2 > &  f)
inlinestatic

Return a pointer to a new calculatedFvPatchFieldField created on freestore without setting patchField values

Definition at line 251 of file Field.H.

◆ map() [1/6]

void map ( const UList< Type > &  mapF,
const labelUList mapAddressing 
)

1 to 1 map from the given field

Definition at line 240 of file Field.C.

Referenced by conjugateGradient::computeCorrection(), sampledPatchInternalField::sampleOnFaces(), SR1::update(), DBFGS::update(), BFGS::update(), and polyMesh::updateMesh().

Here is the caller graph for this function:

◆ map() [2/6]

void map ( const tmp< Field< Type >> &  tmapF,
const labelUList mapAddressing 
)

1 to 1 map from the given tmp field

Definition at line 269 of file Field.C.

◆ map() [3/6]

void map ( const UList< Type > &  mapF,
const labelListList mapAddressing,
const scalarListList weights 
)

Interpolative map from the given field.

Definition at line 281 of file Field.C.

◆ map() [4/6]

void map ( const tmp< Field< Type >> &  tmapF,
const labelListList mapAddressing,
const scalarListList weights 
)

Interpolative map from the given tmp field.

Definition at line 318 of file Field.C.

◆ map() [5/6]

void map ( const UList< Type > &  mapF,
const FieldMapper map,
const bool  applyFlip = true 
)

Map from the given field.

Definition at line 331 of file Field.C.

◆ map() [6/6]

void map ( const tmp< Field< Type >> &  tmapF,
const FieldMapper map,
const bool  applyFlip = true 
)

Map from the given tmp field.

Definition at line 390 of file Field.C.

◆ autoMap()

void autoMap ( const FieldMapper map,
const bool  applyFlip = true 
)

Map from self.

Definition at line 403 of file Field.C.

Referenced by fvsPatchField< Type >::autoMap().

Here is the caller graph for this function:

◆ rmap() [1/4]

void rmap ( const UList< Type > &  mapF,
const labelUList mapAddressing 
)

1 to 1 reverse-map from the given field

Definition at line 466 of file Field.C.

Referenced by extendedEdgeMesh::add(), extendedEdgeMesh::flipNormals(), fvMeshAdder::MapDimField(), fvMeshAdder::MapSurfaceField(), fvMeshAdder::MapVolField(), and fvsPatchField< Type >::rmap().

Here is the caller graph for this function:

◆ rmap() [2/4]

void rmap ( const tmp< Field< Type >> &  tmapF,
const labelUList mapAddressing 
)

1 to 1 reverse-map from the given tmp field

Definition at line 487 of file Field.C.

◆ rmap() [3/4]

void rmap ( const UList< Type > &  mapF,
const labelUList mapAddressing,
const UList< scalar > &  weights 
)

Interpolative reverse map from the given field.

Definition at line 499 of file Field.C.

◆ rmap() [4/4]

void rmap ( const tmp< Field< Type >> &  tmapF,
const labelUList mapAddressing,
const UList< scalar > &  weights 
)

Interpolative reverse map from the given tmp field.

Definition at line 518 of file Field.C.

◆ negate()

void negate ( )

Negate this field (negative).

Inverts the state for a bool field.

Definition at line 530 of file Field.C.

◆ component()

◆ replace() [1/3]

void replace ( const direction  d,
const UList< cmptType > &  sf 
)

Replace a component field of the field.

Definition at line 551 of file Field.C.

Referenced by velocityComponentLaplacianFvMotionSolver::curPoints(), displacementComponentLaplacianFvMotionSolver::curPoints(), Bezier::dndbBasedSensitivities(), Bezier::dxdbFace(), setFlow::execute(), particleDistribution::generateDistribution(), fvMatrix< Type >::H(), faMatrix< Type >::residual(), fvMatrix< Type >::residual(), and dynamicInkJetFvMesh::update().

Here is the caller graph for this function:

◆ replace() [2/3]

void replace ( const direction  d,
const tmp< Field< cmptType >> &  tsf 
)

Replace a component field of the field.

Definition at line 563 of file Field.C.

◆ replace() [3/3]

void replace ( const direction  d,
const cmptType c 
)

Replace a component field of the field.

Definition at line 575 of file Field.C.

◆ block()

VSForm block ( const label  start) const

Definition at line 587 of file Field.C.

Referenced by rigidBodyModel::forwardDynamics(), rigidBodyModel::forwardDynamicsCorrection(), Pxyz::jcalc(), Rxyz::jcalc(), Ryxz::jcalc(), Rzyx::jcalc(), Rs::jcalc(), and joint::unitQuaternion().

Here is the caller graph for this function:

◆ T()

Foam::tmp< Foam::Field< Type > > T ( ) const

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

Definition at line 599 of file Field.C.

Referenced by linearDamper::restrain(), sphericalAngularDamper::restrain(), linearAxialAngularSpring::restrain(), prescribedRotation::restrain(), and filmPyrolysisTemperatureCoupledFvPatchScalarField::updateCoeffs().

Here is the caller graph for this function:

◆ writeEntry()

void writeEntry ( const word keyword,
Ostream os 
) const

Write the field as a dictionary entry.

Definition at line 608 of file Field.C.

Referenced by codedFixedValueFvPatchField< Type >::redirectPatchField(), codedFixedValuePointPatchField< Type >::redirectPatchField(), oscillatingVelocityPointPatchVectorField::write(), sixDoFRigidBodyDisplacementPointPatchVectorField::write(), and alphatPhaseChangeWallFunctionFvPatchScalarField::write().

Here is the caller graph for this function:

◆ slice() [1/4]

Foam::SubField< Type > slice ( const label  pos,
label  len = -1 
)

Return SubField slice (non-const access) - no range checking.

Definition at line 178 of file SubField.H.

◆ slice() [2/4]

const Foam::SubField< Type > slice ( const label  pos,
label  len = -1 
) const

Return SubField slice (const access) - no range checking.

Definition at line 190 of file SubField.H.

◆ slice() [3/4]

Foam::SubField< Type > slice ( const labelRange range)

Return SubField slice (non-const access) - with range checking.

Definition at line 202 of file SubField.H.

◆ slice() [4/4]

const Foam::SubField< Type > slice ( const labelRange range) const

Return SubField slice (const access) - with range checking.

Definition at line 210 of file SubField.H.

◆ operator=() [1/12]

◆ operator=() [2/12]

void operator= ( const tmp< Field< Type >> &  )

◆ operator=() [3/12]

void operator= ( const UList< Type > &  rhs)
inline

Definition at line 171 of file FieldI.H.

◆ operator=() [4/12]

void operator= ( const SubField< Type > &  rhs)
inline

Definition at line 178 of file FieldI.H.

◆ operator=() [5/12]

void operator= ( const IndirectListBase< Type, Addr > &  rhs)
inline

Copy assign from IndirectList.

Definition at line 187 of file FieldI.H.

◆ operator=() [6/12]

void operator= ( Field< Type > &&  rhs)
inline

Move assignment.

Definition at line 196 of file FieldI.H.

◆ operator=() [7/12]

void operator= ( List< Type > &&  rhs)
inline

Definition at line 203 of file FieldI.H.

◆ operator=() [8/12]

void operator= ( DynamicList< Type, SizeMin > &&  rhs)
inline

Definition at line 211 of file FieldI.H.

◆ operator=() [9/12]

void operator= ( const Type &  val)
inline

Value assignment.

Definition at line 218 of file FieldI.H.

◆ operator=() [10/12]

void operator= ( const Foam::zero  )
inline

Definition at line 225 of file FieldI.H.

◆ operator=() [11/12]

void operator= ( const VectorSpace< Form, Cmpt, nCmpt > &  vs)

Definition at line 660 of file Field.C.

◆ operator+=() [1/3]

void operator+= ( const UList< Type > &  f)

Definition at line 687 of file Field.C.

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

Here is the caller graph for this function:

◆ operator+=() [2/3]

void operator+= ( const tmp< Field< Type >> &  tf)

Definition at line 687 of file Field.C.

◆ operator-=() [1/3]

void operator-= ( const UList< Type > &  f)

Definition at line 688 of file Field.C.

Referenced by fvsPatchField< Type >::operator-=().

Here is the caller graph for this function:

◆ operator-=() [2/3]

void operator-= ( const tmp< Field< Type >> &  tf)

Definition at line 688 of file Field.C.

◆ operator*=() [1/3]

void operator*= ( const UList< scalar > &  f)

Definition at line 689 of file Field.C.

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

Here is the caller graph for this function:

◆ operator*=() [2/3]

void operator*= ( const tmp< Field< scalar >> &  tf)

Definition at line 689 of file Field.C.

◆ operator/=() [1/3]

void operator/= ( const UList< scalar > &  f)

Definition at line 690 of file Field.C.

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

Here is the caller graph for this function:

◆ operator/=() [2/3]

void operator/= ( const tmp< Field< scalar >> &  tf)

Definition at line 690 of file Field.C.

◆ operator+=() [3/3]

void operator+= ( const Type &  t)

Definition at line 687 of file Field.C.

◆ operator-=() [3/3]

void operator-= ( const Type &  t)

Definition at line 688 of file Field.C.

◆ operator*=() [3/3]

void operator*= ( const scalar &  t)

Definition at line 689 of file Field.C.

◆ operator/=() [3/3]

void operator/= ( const scalar &  t)

Definition at line 690 of file Field.C.

◆ operator=() [12/12]

void operator= ( const tmp< Field< Type > > &  rhs)

Definition at line 647 of file Field.C.

Friends And Related Function Documentation

◆ operator [1/2]

Ostream& operator ( Ostream ,
const Field< Type > &   
)
friend

◆ operator [2/2]

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

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