Go to the documentation of this file.
71 map(mapF, mapAddressing);
84 map(tmapF, mapAddressing);
96 List<Type>(mapAddressing.size())
98 map(mapF, mapAddressing, mapWeights);
105 const tmp<Field<Type> >& tmapF,
110 List<Type>(mapAddressing.size())
112 map(tmapF, mapAddressing, mapWeights);
119 const UList<Type>& mapF,
120 const FieldMapper& mapper,
124 List<Type>(mapper.size())
126 map(mapF, mapper, applyFlip);
133 const UList<Type>& mapF,
134 const FieldMapper& mapper,
135 const Type& defaultValue,
139 List<Type>(mapper.size(), defaultValue)
141 map(mapF, mapper, applyFlip);
148 const UList<Type>& mapF,
149 const FieldMapper& mapper,
150 const UList<Type>& defaultValues,
154 List<Type>(defaultValues)
156 map(mapF, mapper, applyFlip);
163 const tmp<Field<Type> >& tmapF,
164 const FieldMapper& mapper,
168 List<Type>(mapper.size())
170 map(tmapF, mapper, applyFlip);
177 const tmp<Field<Type> >& tmapF,
178 const FieldMapper& mapper,
179 const Type& defaultValue,
183 List<Type>(mapper.size(), defaultValue)
185 map(tmapF, mapper, applyFlip);
192 const tmp<Field<Type> >& tmapF,
193 const FieldMapper& mapper,
194 const UList<Type>& defaultValues,
198 List<Type>(defaultValues)
200 map(tmapF, mapper, applyFlip);
241 #ifndef NoConstructFromTmp
245 List<Type>(const_cast<Field<Type>&>(
tf()),
tf.isTmp())
247 const_cast<Field<Type>&
>(
tf()).resetRefCount();
263 const dictionary&
dict,
269 ITstream& is =
dict.lookup(keyword);
272 token firstToken(is);
274 if (firstToken.isWord())
276 if (firstToken.wordToken() ==
"uniform")
279 operator=(pTraits<Type>(is));
281 else if (firstToken.wordToken() ==
"nonuniform")
284 if (this->size() !=
s)
289 ) <<
"size " << this->size()
290 <<
" is not equal to the given value of " <<
s
299 ) <<
"expected keyword 'uniform' or 'nonuniform', found "
300 << firstToken.wordToken()
306 if (is.version() == 2.0)
311 ) <<
"expected keyword 'uniform' or 'nonuniform', "
312 "assuming deprecated Field format from "
313 "Foam version 2.0." <<
endl;
317 is.putBack(firstToken);
318 operator=(pTraits<Type>(is));
325 ) <<
"expected keyword 'uniform' or 'nonuniform', found "
352 if (
f.size() != mapAddressing.
size())
354 f.setSize(mapAddressing.
size());
361 label mapI = mapAddressing[i];
379 map(tmapF(), mapAddressing);
394 if (
f.size() != mapAddressing.
size())
396 f.setSize(mapAddressing.
size());
399 if (mapWeights.
size() != mapAddressing.
size())
402 << mapWeights.
size() <<
" map size: " << mapAddressing.
size()
408 const labelList& localAddrs = mapAddressing[i];
409 const scalarList& localWeights = mapWeights[i];
411 f[i] = pTraits<Type>::zero;
415 f[i] += localWeights[j]*mapF[localAddrs[j]];
424 const tmp<Field<Type> >& tmapF,
429 map(tmapF(), mapAddressing, mapWeights);
437 const UList<Type>& mapF,
438 const FieldMapper& mapper,
442 if (mapper.distributed())
445 const mapDistributeBase& distMap = mapper.distributeMap();
446 Field<Type> newMapF(mapF);
450 distMap.distribute(newMapF);
454 distMap.distribute(newMapF, noOp());
457 if (mapper.direct() &&
notNull(mapper.directAddressing()))
459 map(newMapF, mapper.directAddressing());
461 else if (!mapper.direct())
463 map(newMapF, mapper.addressing(), mapper.weights());
465 else if (mapper.direct() &&
isNull(mapper.directAddressing()))
470 this->transfer(newMapF);
479 &&
notNull(mapper.directAddressing())
480 && mapper.directAddressing().size()
483 map(mapF, mapper.directAddressing());
485 else if (!mapper.direct() && mapper.addressing().size())
487 map(mapF, mapper.addressing(), mapper.weights());
496 const tmp<Field<Type> >& tmapF,
497 const FieldMapper& mapper,
501 map(tmapF(), mapper, applyFlip);
535 this->map(fCpy, mapper);
542 this->transfer(fCpy);
580 label mapI = mapAddressing[i];
597 rmap(tmapF(), mapAddressing);
616 f[mapAddressing[i]] += mapF[i]*mapWeights[i];
624 const tmp<Field<Type> >& tmapF,
626 const UList<scalar>& mapWeights
629 rmap(tmapF(), mapAddressing, mapWeights);
670 const tmp<Field<cmptType> >& tsf
706 if (this->size() && contiguous<Type>())
712 if (this->
operator[](i) != this->
operator[](0))
722 os <<
"uniform " << this->operator[](0) << token::END_STATEMENT;
728 os << token::END_STATEMENT;
743 <<
"attempted assignment to self"
768 if (
this == &(rhs()))
771 <<
"attempted assignment to self"
790 template<
class Form,
class Cmpt,
int nCmpt>
797 #define COMPUTED_ASSIGNMENT(TYPE, op) \
799 template<class Type> \
800 void Foam::Field<Type>::operator op(const UList<TYPE>& f) \
802 TFOR_ALL_F_OP_F(Type, *this, op, TYPE, f) \
805 template<class Type> \
806 void Foam::Field<Type>::operator op(const tmp<Field<TYPE> >& tf) \
812 template<class Type> \
813 void Foam::Field<Type>::operator op(const TYPE& t) \
815 TFOR_ALL_F_OP_S(Type, *this, op, TYPE, t) \
823 #undef COMPUTED_ASSIGNMENT
831 os << static_cast<const List<Type>&>(
f);
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 string.
List< label > labelList
A List of labels.
#define forAll(list, i)
Loop across all elements in list.
A class for managing temporary objects.
void autoMap(const FieldMapper &map, const bool applyFlip=true)
Map from self.
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())
Distribute data. Note:schedule only used for Pstream::scheduled.
static const char *const typeName
bool notNull(const T &t)
Return true if t is not a reference to the nullObject of type T.
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)
Add newline and flush stream.
virtual bool direct() const =0
tmp< Field< Type > > clone() const
Clone.
#define TFOR_ALL_F_OP_S(typeF, f, OP, typeS, s)
void map(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 map from the given field
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
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.
Ostream & operator<<(Ostream &, const edgeMesh &)
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 reverse-map from the given field
void negate()
Negate this field.
virtual const labelUList & directAddressing() const
T * ptr() const
Return tmp pointer for reuse.
errorManip< error > abort(error &err)
volScalarField sf(fieldObject, mesh)
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
void operator=(const Field< Type > &)
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.
List< labelList > labelListList
A List of labelList.
#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)
Template function to specify if the data of a type are contiguous.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Traits class for primitives.
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
bool isNull(const T &t)
Return true if t is a reference to the nullObject of type T.
const dimensionedScalar c
Speed of light in a vacuum.
Class containing processor-to-processor mapping information.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
void size(const label)
Override size to be inconsistent with allocated storage.
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.
List< scalarList > scalarListList
UList< label > labelUList
label size() const
Return the number of elements in the UList.
#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)