Go to the documentation of this file.
36 const word& entryName,
45 value_(this->size(), uniformValue_)
53 const word& entryName,
62 isUniform_(isUniform),
66 if (fieldValues.size() != this->size())
69 <<
"Supplied field size " << fieldValues.size()
70 <<
" is not equal to the number of "
71 << (faceValues ?
"faces" :
"points") <<
' '
72 << this->size() <<
" of patch " << pp.
name() <<
nl
99 <<
"Null or invalid entry" <<
nl
105 token firstToken(is);
107 if (firstToken.isWord())
111 firstToken.wordToken() ==
"uniform"
112 || firstToken.wordToken() ==
"constant"
119 else if (firstToken.wordToken() ==
"nonuniform")
121 List<Type>& list =
fld;
125 const label currentSize =
fld.size();
126 if (currentSize != len)
131 && FieldBase::allowConstructFromLargerSize
136 <<
"Sizes do not match. "
137 <<
"Re-sizing " << currentSize
138 <<
" entries to " << len
148 <<
"size " <<
fld.size()
149 <<
" is not equal to the given value of " << len
158 <<
"Expected keyword 'uniform', 'nonuniform' or 'constant'"
159 <<
", found " << firstToken.wordToken()
180 const word& redirectType,
181 const word& entryName,
183 const bool faceValues
193 dict.findEntry(entryName, keyType::LITERAL),
208 const word& entryName,
210 const bool faceValues
248 isUniform_(rhs.isUniform_),
249 uniformValue_(rhs.uniformValue_),
253 value_.resize(this->size(),
Zero);
257 value_ = uniformValue_;
270 value_.autoMap(mapper);
275 value_ = uniformValue_;
287 const auto& cst = refCast<const ConstantField<Type>>(pf1);
288 value_.rmap(cst.value_, addr);
303 <<
word(
"constant") << token::SPACE << uniformValue_
304 << token::END_STATEMENT <<
nl;
308 value_.writeEntry(this->
name(), os);
A keyword and a list of tokens is an 'entry'.
A class for handling words, derived from Foam::string.
virtual ITstream & stream() const =0
Return token stream, if entry is a primitive entry.
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.
virtual bool isStream() const
Return true if this entry is a stream.
Generic templated field type.
An input stream of tokens.
ConstantField(const polyPatch &pp, const word &entryName, const Type &uniformValue, const dictionary &dict=dictionary::null, const bool faceValues=true)
Construct from a uniform value.
A patch is a list of labels that address the faces in the global face list.
word name(const complex &c)
Return string representation of complex.
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))
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.
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.