76 void Foam::fieldValues::cellSource::setCellZoneCells()
82 dict().lookup(
"sourceName") >> sourceName_;
84 label zoneId =
mesh().cellZones().findZoneID(sourceName_);
88 FatalErrorIn(
"cellSource::cellSource::setCellZoneCells()")
89 <<
"Unknown cell zone name: " << sourceName_
90 <<
". Valid cell zones are: " <<
mesh().cellZones().names()
94 cellId_ =
mesh().cellZones()[zoneId];
109 <<
"Unknown source type. Valid source types are:" 116 Pout<<
"Selected source size = " << cellId_.size() <<
endl;
121 Foam::scalar Foam::fieldValues::cellSource::volume()
const 123 return gSum(filterField(
mesh().V()));
137 "Foam::fieldValues::cellSource::initialise(const dictionary&)" 138 ) <<
type() <<
" " << name_ <<
": " 139 << sourceTypeNames_[source_] <<
"(" << sourceName_ <<
"):" <<
nl 140 <<
" Source has no cells - deactivating" <<
endl;
148 Info<<
type() <<
" " << name_ <<
":" 149 << sourceTypeNames_[source_] <<
"(" << sourceName_ <<
"):" <<
nl 150 <<
" total cells = " << nCells_ <<
nl 151 <<
" total volume = " << volume_
156 Info<<
" weight field = " << weightFieldName_;
165 writeCommented(file(),
"Source : ");
166 file() << sourceTypeNames_[source_] <<
" " << sourceName_ <<
endl;
167 writeCommented(file(),
"Cells : ");
168 file() << nCells_ <<
endl;
169 writeCommented(file(),
"Volume : ");
170 file() << volume_ <<
endl;
172 writeCommented(file(),
"Time");
175 file() <<
tab <<
"Volume";
181 <<
tab << operationTypeNames_[operation_]
182 <<
"(" << fields_[i] <<
")";
196 const bool loadFromFiles
199 fieldValue(name, obr, dict, typeName, loadFromFiles),
200 source_(sourceTypeNames_.read(dict.
lookup(
"source"))),
201 operation_(operationTypeNames_.read(dict.
lookup(
"operation"))),
204 weightFieldName_(
"none"),
239 file() << obr_.time().value();
247 file() <<
tab << volume_;
249 if (log_)
Info<<
" total volume = " << volume_ <<
endl;
254 const word& fieldName = fields_[i];
255 bool processed =
false;
257 processed = processed || writeValues<scalar>(fieldName);
258 processed = processed || writeValues<vector>(fieldName);
259 processed = processed || writeValues<sphericalTensor>(fieldName);
260 processed = processed || writeValues<symmTensor>(fieldName);
261 processed = processed || writeValues<tensor>(fieldName);
265 WarningIn(
"void Foam::fieldValues::cellSource::write()")
266 <<
"Requested field " << fieldName
267 <<
" not found in database and not processed" cellSource(const word &name, const objectRegistry &obr, const dictionary &dict, const bool loadFromFiles=false)
Construct from components.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
virtual void write()
Calculate and write.
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Base class for field value -based function objects.
A list of keyword definitions, which are a keyword followed by any number of values (e...
virtual void write()
Write to screen/file.
virtual void read(const dictionary &dict)
Read from dictionary.
Type gSum(const FieldField< Field, Type > &f)
Ostream & endl(Ostream &os)
Add newline and flush stream.
#define WarningIn(functionName)
Report a warning using Foam::Warning.
static const NamedEnum< sourceType, 2 > sourceTypeNames_
Source type names.
void initialise(const dictionary &dict)
Initialise, e.g. cell addressing.
Macros for easy insertion into run-time selection tables.
virtual ~cellSource()
Destructor.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
virtual void read(const dictionary &)
Read from dictionary.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Initialise the NamedEnum HashTable from the static list of names.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
addToRunTimeSelectionTable(fieldValue, cellSource, dictionary)
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
virtual void writeFileHeader(const label i)
Output file header information.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
Registry of regIOobjects.
defineTypeNameAndDebug(cellSource, 0)
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
This function object provides a 'cell source' variant of the fieldValues function object...
static bool master(const label communicator=0)
Am I the master process.
bool read(const char *, int32_t &)
static const NamedEnum< operationType, 11 > operationTypeNames_
Operation type names.
prefixOSstream Pout(cout,"Pout")