Go to the documentation of this file.
36 const word& entryName,
45 isUniform_(isUniform),
47 value_(nonUniformValue)
49 if (faceValues && nonUniformValue.size() != pp.size())
52 <<
"Supplied field size " << nonUniformValue.size()
53 <<
" is not equal to the number of faces " << pp.size()
56 else if (!faceValues && nonUniformValue.size() != pp.
nPoints())
59 <<
"Supplied field size " << nonUniformValue.size()
60 <<
" is not equal to the number of points " << pp.
nPoints()
88 if (firstToken.isWord())
92 firstToken.wordToken() ==
"uniform"
93 || firstToken.wordToken() ==
"constant"
100 else if (firstToken.wordToken() ==
"nonuniform")
106 label currentSize =
fld.size();
107 if (currentSize != len)
112 && FieldBase::allowConstructFromLargerSize
117 <<
"Sizes do not match. "
118 <<
"Re-sizing " << currentSize
119 <<
" entries to " << len
129 <<
"size " <<
fld.size()
130 <<
" is not equal to the given value of " << len
139 <<
"Expected keyword 'uniform', 'nonuniform' or 'constant'"
140 <<
", found " << firstToken.wordToken()
162 const word& entryName,
164 const bool faceValues
174 (faceValues ? pp.size() : pp.
nPoints()),
189 isUniform_(cnst.isUniform_),
190 uniformValue_(cnst.uniformValue_),
203 isUniform_(cnst.isUniform_),
204 uniformValue_(cnst.uniformValue_),
211 ? this->patch_.size()
212 : this->patch_.nPoints()
216 value_ = uniformValue_;
229 value_.autoMap(mapper);
234 value_ = uniformValue_;
246 const auto& cst = refCast<const ConstantField<Type>>(pf1);
247 value_.rmap(cst.value_, addr);
262 <<
word(
"constant") << token::SPACE << uniformValue_
263 << token::END_STATEMENT <<
nl;
267 value_.writeEntry(this->name_, os);
A class for handling words, derived from Foam::string.
virtual void writeData(Ostream &os) const
Write in dictionary format.
static constexpr const zero Zero
Global zero (0)
Templated function that returns a constant value.
const bool writeData(pdfDictionary.get< bool >("writeData"))
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.
Generic templated field type.
An input stream of tokens.
A patch is a list of labels that address the faces in the global face list.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
label nPoints() const
Return number of points supporting patch faces.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
virtual Ostream & writeKeyword(const keyType &kw)
Write the keyword followed by an appropriate indentation.
ConstantField(const polyPatch &pp, const word &entryName, const bool isUniform, const Type &uniformValue, const Field< Type > &nonUniformValue, const dictionary &dict=dictionary::null, const bool faceValues=true)
Construct from components.
virtual void autoMap(const FieldMapper &mapper)
Map (and resize as needed) from self given a mapping object.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void putBack(const token &tok)
Put back token.
virtual void rmap(const PatchFunction1< Type > &pf1, const labelList &addr)
Reverse map the given PatchFunction1 onto this PatchFunction1.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
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.
const word & name() const
The patch name.