44 List<Type>(mapAddressing.size())
46 map(mapF, mapAddressing);
57 List<Type>(mapAddressing.size())
59 map(tmapF, mapAddressing);
71 List<Type>(mapAddressing.size())
73 map(mapF, mapAddressing, mapWeights);
85 List<Type>(mapAddressing.size())
87 map(tmapF, mapAddressing, mapWeights);
99 List<Type>(mapper.size())
101 map(mapF, mapper, applyFlip);
110 const Type& defaultValue,
114 List<Type>(mapper.size(), defaultValue)
116 map(mapF, mapper, applyFlip);
129 List<Type>(defaultValues)
131 map(mapF, mapper, applyFlip);
143 List<Type>(mapper.size())
145 map(tmapF, mapper, applyFlip);
154 const Type& defaultValue,
160 map(tmapF, mapper, applyFlip);
175 map(tmapF, mapper, applyFlip);
192 token firstToken(is);
194 if (firstToken.isWord(
"uniform"))
199 else if (firstToken.isWord(
"nonuniform"))
202 const label lenRead = this->size();
205 if (len < lenRead && allowConstructFromLargerSize)
209 <<
"Sizes do not match. Truncating " << lenRead
210 <<
" entries to " << len <<
endl;
219 <<
"size " << lenRead
220 <<
" is not equal to the expected length " << len
228 <<
"Expected keyword 'uniform' or 'nonuniform', found "
229 << firstToken.info() <<
nl
256 const label mapI = mapAddressing[i];
274 map(tmapF(), mapAddressing);
294 if (mapWeights.
size() != mapAddressing.
size())
297 << mapWeights.
size() <<
" map size: " << mapAddressing.
size()
303 const labelList& localAddrs = mapAddressing[i];
304 const scalarList& localWeights = mapWeights[i];
310 f[i] += localWeights[j]*mapF[localAddrs[j]];
324 map(tmapF(), mapAddressing, mapWeights);
365 this->transfer(newMapF);
396 map(tmapF(), mapper, applyFlip);
430 this->map(fCpy, mapper);
437 this->transfer(fCpy);
453 Field<Type> fCpy(*
this);
475 label mapI = mapAddressing[i];
492 rmap(tmapF(), mapAddressing);
511 f[mapAddressing[i]] += mapF[i]*mapWeights[i];
524 rmap(tmapF(), mapAddressing, mapWeights);
592template<
class VSForm>
596 for (
direction i=0; i<VSForm::nComponents; i++)
598 vs[i] = this->operator[](start + i);
655 if (
this == &(rhs()))
665template<
class Form,
class Cmpt, Foam::direction nCmpt>
672#define COMPUTED_ASSIGNMENT(TYPE, op) \
674template<class Type> \
675void Foam::Field<Type>::operator op(const UList<TYPE>& f) \
677 TFOR_ALL_F_OP_F(Type, *this, op, TYPE, f) \
680template<class Type> \
681void Foam::Field<Type>::operator op(const tmp<Field<TYPE>>& tf) \
687template<class Type> \
688void Foam::Field<Type>::operator op(const TYPE& t) \
690 TFOR_ALL_F_OP_S(Type, *this, op, TYPE, t) \
698#undef COMPUTED_ASSIGNMENT
706 os << static_cast<const List<Type>&>(
f);
#define COMPUTED_ASSIGNMENT(TYPE, op)
High performance macro functions for Field<Type> algebra. These expand using either array element acc...
#define TFOR_ALL_F_OP_OP_F(typeF1, f1, OP1, OP2, typeF2, f2)
#define TFOR_ALL_F_OP_S(typeF, f, OP, typeS, s)
#define TFOR_ALL_F_OP_FUNC_S_S(typeF1, f1, OP, FUNC, typeS1, s1, typeS2, s2)
#define TFOR_ALL_F_OP_FUNC_S_F(typeF1, f1, OP, FUNC, typeS, s, typeF2, f2)
Abstract base class to hold the Field mapping addressing and weights.
virtual bool direct() const =0
Is it a direct (non-interpolating) mapper?
virtual const labelUList & directAddressing() const
Return the direct addressing values.
virtual const scalarListList & weights() const
Return the interpolation weights.
virtual label size() const =0
The size of the mapper.
virtual bool distributed() const
Does the mapper have remote contributions?
virtual const labelListList & addressing() const
Return the interpolation addressing.
virtual const mapDistributeBase & distributeMap() const
Return the distribution map.
Generic templated field type.
tmp< Field< Type > > T() const
Return the field transpose (only defined for second rank tensors)
void operator=(const Field< Type > &)
Copy assignment.
void autoMap(const FieldMapper &map, const bool applyFlip=true)
Map from self.
void writeEntry(const word &keyword, Ostream &os) const
Write the field as a dictionary entry.
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
constexpr Field() noexcept
Default construct.
void map(const UList< Type > &mapF, const labelListList &mapAddressing, const scalarListList &weights)
Interpolative map from the given field.
void negate()
Inplace negate this field (negative).
void map(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 map from the given field
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 reverse-map from the given field
An input stream of tokens.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(const label n)
Alias for resize()
void operator=(const UList< T > &a)
Assignment to UList operator. Takes linear time.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual Ostream & writeKeyword(const keyType &kw)
Write the keyword followed by an appropriate indentation.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void size(const label n)
Older name for setAddressableSize.
Creates a single block of cells from point coordinates, numbers of cells in each direction and an exp...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
ITstream & lookup(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Class containing processor-to-processor mapping information.
static void distribute(const Pstream::commsTypes commsType, const List< labelPair > &schedule, const label constructSize, const labelListList &subMap, const bool subHasFlip, const labelListList &constructMap, const bool constructHasFlip, List< T > &field, const NegateOp &negOp, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Distribute data with specified negate operator (for flips).
A traits class, which is primarily used for primitives.
A class for managing temporary objects.
A token holds an item read from Istream.
@ END_STATEMENT
End entry [isseparator].
A class for handling words, derived from Foam::string.
patchWriters resize(patchIds.size())
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
bool isNull(const T *ptr)
True if ptr is a pointer (of type T) to the nullObject.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
bool notNull(const T *ptr)
True if ptr is not a pointer (of type T) to the nullObject.
static constexpr const zero Zero
Global zero (0)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
constexpr char nl
The newline '\n' character (0x0a)
points setSize(newPointi)
#define forAll(list, i)
Loop across all elements in list.
A template class to specify that a data type can be considered as being contiguous in memory.