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
97 <<
"Null or invalid entry" <<
nl
104 const word contentType(is);
106 if (contentType ==
"constant" || contentType ==
"uniform")
112 else if (contentType ==
"nonuniform")
119 is >>
static_cast<List<Type>&
>(
fld);
120 const label lenRead =
fld.size();
126 && FieldBase::allowConstructFromLargerSize
131 <<
"Sizes do not match. Truncating " << lenRead
132 <<
" entries to " << len <<
endl;
141 <<
"size " << lenRead
142 <<
" is not equal to the expected length " << len
150 <<
"Expected keyword 'constant', 'uniform', or 'nonuniform'"
151 <<
", found " << contentType
171 const word& redirectType,
172 const word& entryName,
174 const bool faceValues
184 dict.findEntry(entryName, keyType::LITERAL),
199 const word& entryName,
201 const bool faceValues
239 isUniform_(rhs.isUniform_),
240 uniformValue_(rhs.uniformValue_),
244 value_.resize(this->size(),
Zero);
248 value_ = uniformValue_;
261 value_.autoMap(mapper);
266 value_ = uniformValue_;
278 const auto& cst = refCast<const ConstantField<Type>>(pf1);
279 value_.rmap(cst.value_, addr);
293 os.writeKeyword(this->
name())
294 <<
word(
"constant") << token::SPACE << uniformValue_;
299 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)
virtual bool isStream() const noexcept
Return true if this entry is a stream.
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.
bool isWord() const noexcept
Token is word-variant (WORD, DIRECTIVE)
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.
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,...
OBJstream os(runTime.globalPath()/outputName)
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
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)
virtual void rmap(const PatchFunction1< Type > &pf1, const labelList &addr)
Reverse map the given PatchFunction1 onto this PatchFunction1.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
const word & name() const noexcept
The patch name.
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 token & peek() const
Failsafe peek at what the next read would return,.