faceSource: Changed option to write faceSource area to 'writeArea'

This commit is contained in:
Henry
2015-04-26 21:34:27 +01:00
parent 8b058bf928
commit aa965f6612
3 changed files with 11 additions and 9 deletions

View File

@ -399,6 +399,8 @@ Foam::scalar Foam::fieldValues::faceSource::totalArea() const
void Foam::fieldValues::faceSource::initialise(const dictionary& dict) void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
{ {
dict.lookup("sourceName") >> sourceName_;
switch (source_) switch (source_)
{ {
case stFaceZone: case stFaceZone:
@ -533,9 +535,9 @@ void Foam::fieldValues::faceSource::writeFileHeader(const label i)
file() << nFaces_ << endl; file() << nFaces_ << endl;
writeCommented(file(), "Area : "); writeCommented(file(), "Area : ");
file() << totalArea() << endl; file() << totalArea() << endl;
writeCommented(file(), "Time");
if (writeTotalArea_) writeCommented(file(), "Time");
if (writeArea_)
{ {
file() << tab << "Area"; file() << tab << "Area";
} }
@ -639,13 +641,13 @@ Foam::fieldValues::faceSource::faceSource
: :
fieldValue(name, obr, dict, typeName, loadFromFiles), fieldValue(name, obr, dict, typeName, loadFromFiles),
surfaceWriterPtr_(NULL), surfaceWriterPtr_(NULL),
writeTotalArea_(dict.lookupOrDefault("writeTotalArea", false)),
source_(sourceTypeNames_.read(dict.lookup("source"))), source_(sourceTypeNames_.read(dict.lookup("source"))),
operation_(operationTypeNames_.read(dict.lookup("operation"))), operation_(operationTypeNames_.read(dict.lookup("operation"))),
weightFieldName_("none"), weightFieldName_("none"),
orientWeightField_(false), orientWeightField_(false),
orientedFieldsStart_(labelMax), orientedFieldsStart_(labelMax),
scaleFactor_(1.0), scaleFactor_(1.0),
writeArea_(dict.lookupOrDefault("writeArea", false)),
nFaces_(0), nFaces_(0),
faceId_(), faceId_(),
facePatchId_(), facePatchId_(),
@ -690,7 +692,7 @@ void Foam::fieldValues::faceSource::write()
file() << obr_.time().value(); file() << obr_.time().value();
} }
if (writeTotalArea_) if (writeArea_)
{ {
if (Pstream::master()) if (Pstream::master())
{ {

View File

@ -66,6 +66,7 @@ Description
type | type name: faceSource | yes | type | type name: faceSource | yes |
log | write data to standard output | no | no log | write data to standard output | no | no
valueOutput | write the output values | yes | valueOutput | write the output values | yes |
writeArea | Write the area of the faceSource | no |
surfaceFormat | output value format | no | surfaceFormat | output value format | no |
source | face source: see below | yes | source | face source: see below | yes |
sourceName | name of face source if required | no | sourceName | name of face source if required | no |
@ -239,9 +240,6 @@ protected:
//- Surface writer //- Surface writer
autoPtr<surfaceWriter> surfaceWriterPtr_; autoPtr<surfaceWriter> surfaceWriterPtr_;
//- Optionally write the totalArea
bool writeTotalArea_;
//- Source type //- Source type
sourceType source_; sourceType source_;
@ -260,6 +258,9 @@ protected:
//- Scale factor - optional //- Scale factor - optional
scalar scaleFactor_; scalar scaleFactor_;
//- Optionally write the area of the faceSource
bool writeArea_;
//- Global number of faces //- Global number of faces
label nFaces_; label nFaces_;

View File

@ -354,7 +354,7 @@ bool Foam::fieldValues::faceSource::writeValues
file()<< tab << result; file()<< tab << result;
Info(log_)<< " " << operationTypeNames_[operation_] Info(log_)<< " " << operationTypeNames_[operation_]
<< "(" << sourceName_ << ") for " << fieldName << "(" << sourceName_ << ") of " << fieldName
<< " = " << result << endl; << " = " << result << endl;
} }
} }
@ -447,4 +447,3 @@ Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::filterField
// ************************************************************************* // // ************************************************************************* //