45 value_(this->
size(), uniformValue_)
53 const word& entryName,
62 isUniform_(isUniform),
66 if (fieldValues.
size() != this->size())
68 FatalIOErrorInFunction(dict)
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
73 << exit(FatalIOError);
80Foam::PatchFunction1Types::ConstantField<Type>::getValue
82 const word& entryName,
97 if (entryName ==
dict.dictName())
112 <<
"Null entry" <<
nl
121 dict.readEntry(
"value", uniformValue);
128 ITstream& is = eptr->
stream();
130 if (is.peek().isWord())
132 const word contentType(is);
134 if (contentType ==
"constant" || contentType ==
"uniform")
140 else if (contentType ==
"nonuniform")
147 is >>
static_cast<List<Type>&
>(
fld);
148 const label lenRead =
fld.size();
159 <<
"Sizes do not match. Truncating " << lenRead
160 <<
" entries to " << len <<
endl;
169 <<
"size " << lenRead
170 <<
" is not equal to the expected length " << len
178 <<
"Expected keyword 'constant', 'uniform', or 'nonuniform'"
179 <<
", found " << contentType
199 const word& redirectType,
200 const word& entryName,
202 const bool faceValues
228 const word& entryName,
230 const bool faceValues
259 isUniform_(
rhs.isUniform_),
260 uniformValue_(
rhs.uniformValue_),
268 value_ = uniformValue_;
276 const ConstantField<Type>&
rhs
291 value_.autoMap(mapper);
296 value_ = uniformValue_;
309 value_.rmap(cst.value_, addr);
323 os.writeKeyword(this->
name())
329 value_.writeEntry(this->
name(), os);
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
static bool allowConstructFromLargerSize
Permit read construct from a larger size.
Abstract base class to hold the Field mapping addressing and weights.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Templated function that returns a constant value.
virtual void rmap(const PatchFunction1< Type > &pf1, const labelList &addr)
Reverse map the given PatchFunction1 onto this PatchFunction1.
virtual void autoMap(const FieldMapper &mapper)
Map (and resize as needed) from self given a mapping object.
virtual void writeData(Ostream &os) const
Write in dictionary format.
ConstantField(const polyPatch &pp, const word &entryName, const Type &uniformValue, const dictionary &dict=dictionary::null, const bool faceValues=true)
Construct from a uniform value.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
const polyPatch const word const word & entryName
virtual void writeData(Ostream &os) const
Write in dictionary format.
const polyPatch const word const word const dictionary & dict
const polyPatch const word const word const dictionary const bool faceValues
void size(const label n)
Older name for setAddressableSize.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A keyword and a list of tokens is an 'entry'.
virtual ITstream & stream() const =0
Return token stream, if entry is a primitive entry.
virtual bool isStream() const noexcept
True if this entry is a stream.
A class for handling keywords in dictionaries.
const polyPatch & patch() const noexcept
Reference to the patch.
label size() const
Number of faces or points on the patch.
A patch is a list of labels that address the faces in the global face list.
A class for handling words, derived from Foam::string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
OBJstream os(runTime.globalPath()/outputName)
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
List< label > labelList
A List of labels.
Ostream & endl(Ostream &os)
Add newline and flush stream.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
static constexpr const zero Zero
Global zero (0).
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).