Go to the documentation of this file.
107 <<
"Unknown source type. Valid source types are:"
121 return gSum(filterField(
mesh().V()));
134 <<
type() <<
" " << name_ <<
": "
135 << sourceTypeNames_[source_] <<
"(" << sourceName_ <<
"):" <<
nl
136 <<
" Source has no cells - deactivating" <<
endl;
145 <<
type() <<
" " << name_ <<
":"
146 << sourceTypeNames_[source_] <<
"(" << sourceName_ <<
"):" <<
nl
147 <<
" total cells = " << nCells_ <<
nl
148 <<
" total volume = " << volume_
151 if (
dict.readIfPresent(
"weightField", weightFieldName_))
153 if (log_)
Info <<
" weight field = " << weightFieldName_;
162 writeHeaderValue(os,
"Source", sourceTypeNames_[source_]);
163 writeHeaderValue(os,
"Name", sourceName_);
164 writeHeaderValue(os,
"Cells", nCells_);
165 writeHeaderValue(os,
"Volume", volume_);
166 writeHeaderValue(os,
"Scale factor", scaleFactor_);
169 writeCommented(os,
"Time");
172 os <<
tab <<
"Volume";
177 os <<
tab << operationTypeNames_[operation_]
178 <<
"(" << fields_[i] <<
")";
192 const bool loadFromFiles
196 source_(sourceTypeNames_.read(
dict.lookup(
"source"))),
197 operation_(operationTypeNames_.read(
dict.lookup(
"operation"))),
200 weightFieldName_(
"none"),
201 writeVolume_(
dict.lookupOrDefault(
"writeVolume",
false))
206 writeFileHeader(file());
241 if (weightFieldName_ !=
"none")
243 weightField = setFieldValues<scalar>(weightFieldName_,
true);
249 file() <<
tab << volume_;
250 if (log_)
Info<<
" total volume = " << volume_ <<
endl;
255 const word& fieldName = fields_[i];
258 ok = ok || writeValues<scalar>(fieldName, weightField);
259 ok = ok || writeValues<vector>(fieldName, weightField);
260 ok = ok || writeValues<sphericalTensor>(fieldName, weightField);
261 ok = ok || writeValues<symmTensor>(fieldName, weightField);
262 ok = ok || writeValues<tensor>(fieldName, weightField);
267 <<
"Requested field " << fieldName
268 <<
" not found in database and not processed"
label nCells_
Global number of cells.
virtual ~cellSource()
Destructor.
A class for handling words, derived from string.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
#define forAll(list, i)
Loop across all elements in list.
virtual void write()
Calculate and write.
static const NamedEnum< operationType, 11 > operationTypeNames_
Operation type names.
void initialise(const dictionary &dict)
Initialise, e.g. cell addressing.
bool read(const char *, int32_t &)
scalar volume() const
Calculate and return volume of the cellSource: sum(V)
word sourceName_
Name of source object.
const cellZoneMesh & cellZones() const
Return cell zone mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static const NamedEnum< sourceType, 2 > sourceTypeNames_
Source type names.
Type gSum(const FieldField< Field, Type > &f)
Registry of regIOobjects.
sourceType source_
Source type.
virtual void read(const dictionary &dict)
Read from dictionary.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
virtual void writeFileHeader(Ostream &os) const
Output file header information.
cellSource(const word &name, const objectRegistry &obr, const dictionary &dict, const bool loadFromFiles=false)
Construct from components.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Macros for easy insertion into run-time selection tables.
label findZoneID(const word &zoneName) const
Find zone index given a name.
wordList names() const
Return a list of zone names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
prefixOSstream Pout(cout, "Pout")
Base class for field value-based function objects.
virtual void read(const dictionary &)
Read from dictionary.
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,...
virtual void write()
Write to screen/file.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
addToRunTimeSelectionTable(fieldValue, cellSource, dictionary)
const fvMesh & mesh() const
Helper function to return the reference to the mesh.
#define WarningInFunction
Report a warning using Foam::Warning.
word name(const complex &)
Return a string representation of a complex.
defineTypeNameAndDebug(cellSource, 0)
Initialise the NamedEnum HashTable from the static list of names.
This function object provides a 'cell source' variant of the fieldValues function object....
void setCellZoneCells()
Set cells to evaluate based on a cell zone.
labelList cellId_
Local list of cell IDs.