Go to the documentation of this file.
46 map(mapF, mapAddressing);
59 map(tmapF, mapAddressing);
73 map(mapF, mapAddressing, mapWeights);
87 map(tmapF, mapAddressing, mapWeights);
101 map(mapF, mapper, applyFlip);
110 const Type& defaultValue,
116 map(mapF, mapper, applyFlip);
131 map(mapF, mapper, applyFlip);
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
247 if (
f.size() != mapAddressing.
size())
249 f.setSize(mapAddressing.
size());
256 const label mapI = mapAddressing[i];
274 map(tmapF(), mapAddressing);
289 if (
f.size() != mapAddressing.size())
291 f.setSize(mapAddressing.size());
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);
356 else if (!mapper.
direct())
365 this->transfer(newMapF);
396 map(tmapF(), mapper, applyFlip);
430 this->map(fCpy, mapper);
437 this->transfer(fCpy);
475 label mapI = mapAddressing[i];
492 rmap(tmapF(), mapAddressing);
511 f[mapAddressing[i]] += mapF[i]*mapWeights[i];
524 rmap(tmapF(), mapAddressing, mapWeights);
586 template<
class VSForm>
590 for (
direction i=0; i<VSForm::nComponents; i++)
592 vs[i] = this->operator[](start + i);
612 os.writeKeyword(keyword);
620 os <<
word(
"uniform") << token::SPACE << this->first();
624 os <<
word(
"nonuniform") << token::SPACE;
628 os << token::END_STATEMENT <<
nl;
649 if (
this == &(rhs()))
659 template<
class Form,
class Cmpt, Foam::direction nCmpt>
666 #define COMPUTED_ASSIGNMENT(TYPE, op) \
668 template<class Type> \
669 void Foam::Field<Type>::operator op(const UList<TYPE>& f) \
671 TFOR_ALL_F_OP_F(Type, *this, op, TYPE, f) \
674 template<class Type> \
675 void Foam::Field<Type>::operator op(const tmp<Field<TYPE>>& tf) \
681 template<class Type> \
682 void Foam::Field<Type>::operator op(const TYPE& t) \
684 TFOR_ALL_F_OP_S(Type, *this, op, TYPE, t) \
692 #undef COMPUTED_ASSIGNMENT
700 os << static_cast<const List<Type>&>(
f);
points setSize(newPointi)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
A class for handling words, derived from Foam::string.
A class for managing temporary objects.
void autoMap(const FieldMapper &map, const bool applyFlip=true)
Map from self.
static constexpr const zero Zero
Global zero (0)
High performance macro functions for Field<Type> algebra. These expand using either array element acc...
virtual label size() const =0
virtual const scalarListList & weights() const
#define TFOR_ALL_F_OP_FUNC_S_S(typeF1, f1, OP, FUNC, typeS1, s1, typeS2, s2)
Abstract base class to hold the Field mapping addressing and weights.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A token holds an item read from Istream.
virtual bool direct() const =0
constexpr Field() noexcept
Default construct.
#define TFOR_ALL_F_OP_S(typeF, f, OP, typeS, s)
bool isWord() const noexcept
Token is word-variant (WORD, DIRECTIVE)
#define forAll(list, i)
Loop across all elements in list.
void map(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 map from the given field
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
pTraits< Foam::Vector2D >::cmptType cmptType
Component type.
patchWriters resize(patchIds.size())
Generic templated field type.
InfoProxy< token > info() const
Return info proxy for printing token information to a stream.
An input stream of tokens.
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 > &, const negateOp &negOp, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Distribute data. Note:schedule only used for.
tmp< Field< Type > > T() const
Return the field transpose (only defined for second rank tensors)
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
bool notNull(const T *ptr)
True if ptr is not a pointer (of type T) to the nullObject.
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 reverse-map from the given field
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
void negate()
Negate this field (negative).
OBJstream os(runTime.globalPath()/outputName)
virtual const labelUList & directAddressing() const
errorManip< error > abort(error &err)
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
void operator=(const Field< Type > &)
Copy assignment.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void writeEntry(const word &keyword, Ostream &os) const
Write the field as a dictionary entry.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual const labelListList & addressing() const
#define TFOR_ALL_F_OP_FUNC_S_F(typeF1, f1, OP, FUNC, typeS, s, typeF2, f2)
VSForm block(const label start) const
const dimensionedScalar c
Speed of light in a vacuum.
Class containing processor-to-processor mapping information.
bool isNull(const T *ptr)
True if ptr is a pointer (of type T) to the nullObject.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
void size(const label n)
Older name for setAddressableSize.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
#define TFOR_ALL_F_OP_OP_F(typeF1, f1, OP1, OP2, typeF2, f2)
virtual const mapDistributeBase & distributeMap() const
virtual bool distributed() const
#define COMPUTED_ASSIGNMENT(TYPE, op)
A template class to specify that a data type can be considered as being contiguous in memory.
Pass through value. Should never be specialized.