Go to the documentation of this file.
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,
158 List<Type>(mapper.size(), defaultValue)
160 map(tmapF, mapper, applyFlip);
173 List<Type>(defaultValues)
175 map(tmapF, mapper, applyFlip);
192 token firstToken(is);
194 if (firstToken.isWord(
"uniform"))
199 else if (firstToken.isWord(
"nonuniform"))
201 is >>
static_cast<List<Type>&
>(*this);
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];
270 const tmp<Field<Type>>& tmapF,
274 map(tmapF(), mapAddressing);
282 const UList<Type>& mapF,
287 Field<Type>&
f = *
this;
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]];
319 const tmp<Field<Type>>& tmapF,
324 map(tmapF(), mapAddressing, mapWeights);
332 const UList<Type>& mapF,
333 const FieldMapper& mapper,
337 if (mapper.distributed())
340 const mapDistributeBase& distMap = mapper.distributeMap();
341 Field<Type> newMapF(mapF);
345 distMap.distribute(newMapF);
349 distMap.distribute(newMapF, noOp());
352 if (mapper.direct() &&
notNull(mapper.directAddressing()))
354 map(newMapF, mapper.directAddressing());
356 else if (!mapper.direct())
358 map(newMapF, mapper.addressing(), mapper.weights());
360 else if (mapper.direct() &&
isNull(mapper.directAddressing()))
365 this->transfer(newMapF);
374 &&
notNull(mapper.directAddressing())
375 && mapper.directAddressing().size()
378 map(mapF, mapper.directAddressing());
380 else if (!mapper.direct() && mapper.addressing().size())
382 map(mapF, mapper.addressing(), mapper.weights());
391 const tmp<Field<Type>>& tmapF,
392 const FieldMapper& mapper,
396 map(tmapF(), mapper, applyFlip);
430 this->map(fCpy, mapper);
437 this->transfer(fCpy);
453 Field<Type> fCpy(*
this);
467 const UList<Type>& mapF,
471 Field<Type>&
f = *
this;
475 label mapI = mapAddressing[i];
488 const tmp<Field<Type>>& tmapF,
492 rmap(tmapF(), mapAddressing);
500 const UList<Type>& mapF,
502 const UList<scalar>& mapWeights
505 Field<Type>&
f = *
this;
511 f[mapAddressing[i]] += mapF[i]*mapWeights[i];
519 const tmp<Field<Type>>& tmapF,
521 const UList<scalar>& mapWeights
524 rmap(tmapF(), mapAddressing, mapWeights);
553 const UList<cmptType>& sf
565 const tmp<Field<cmptType>>& tsf
586 template<
class VSForm>
590 for (
direction i=0; i<VSForm::nComponents; i++)
592 vs[i] = this->operator[](start + i);
612 os.writeKeyword(keyword);
618 if (is_contiguous<Type>::value && List<Type>::uniform())
620 os << word(
"uniform") << token::SPACE << this->first();
624 os << word(
"nonuniform") << token::SPACE;
625 List<Type>::writeEntry(
os);
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);
List< label > labelList
A List of labels.
List< scalarList > scalarListList
A List of scalarList.
points setSize(newPointi)
List< scalar > scalarList
A List of scalars.
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)
static constexpr const zero Zero
High performance macro functions for Field<Type> algebra. These expand using either array element acc...
virtual label size() const =0
#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)
A token holds an item read from Istream.
virtual bool direct() const =0
constexpr Field() noexcept
#define TFOR_ALL_F_OP_S(typeF, f, OP, typeS, s)
bool isWord() const noexcept
void map(const UList< Type > &mapF, const labelUList &mapAddressing)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
pTraits< Type >::cmptType cmptType
patchWriters resize(patchIds.size())
InfoProxy< token > info() const
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)
tmp< Field< Type > > T() const
void replace(const direction, const UList< cmptType > &)
bool notNull(const T *ptr)
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
virtual const labelUList & directAddressing() const
errorManip< error > abort(error &err)
tmp< Field< cmptType > > component(const direction) const
void operator=(const Field< Type > &)
errorManipArg< error, int > exit(error &err, const int errNo=1)
void writeEntry(const word &keyword, Ostream &os) const
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
List< labelList > labelListList
A List of labelList.
#define FatalErrorInFunction
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
Class containing processor-to-processor mapping information.
bool isNull(const T *ptr)
#define FatalIOErrorInFunction(ios)
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
#define IOWarningInFunction(ios)
UList< label > labelUList
A UList of labels.
#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.