diff --git a/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C index 6c5c6c5af4..ff9313195d 100644 --- a/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C +++ b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C @@ -34,53 +34,9 @@ defineTypeNameAndDebug(Foam::cloudInfo, 0); // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -void Foam::cloudInfo::makeFiles() +void Foam::cloudInfo::writeFileHeader(const label i) { - if (debug) - { - Info<< "Creating cloudInfo output files." << endl; - } - - outputFilePtr_.clear(); - outputFilePtr_.setSize(cloudSet_.size()); - - if (Pstream::master()) - { - label i = 0; - forAllConstIter(wordHashSet, cloudSet_, iter) - { - const word& cloudName = iter.key(); - fileName cloudInfoDir(obr_.time().path()); - word timeName = Foam::name(obr_.time().startTime().value()); - - if (Pstream::parRun()) - { - // Put in undecomposed case (Note: gives problems for - // distributed data running) - cloudInfoDir = cloudInfoDir/".."/name_/timeName; - } - else - { - cloudInfoDir = cloudInfoDir/name_/timeName; - } - - // Create directory if does not exist - mkDir(cloudInfoDir); - - // Open new files at start up - outputFilePtr_.set - ( - i, - new OFstream(cloudInfoDir/(cloudName + ".dat")) - ); - - // Add headers - outputFilePtr_[i] - << "# Time" << tab << "nParcels" << tab << "mass" << endl; - - i++; - } - } + file(i) << "# Time" << tab << "nParcels" << tab << "mass" << endl; } @@ -94,11 +50,10 @@ Foam::cloudInfo::cloudInfo const bool loadFromFiles ) : + functionObjectFile(obr, name), name_(name), obr_(obr), - active_(true), - cloudSet_(), - outputFilePtr_() + active_(true) { read(dict); } @@ -116,19 +71,17 @@ void Foam::cloudInfo::read(const dictionary& dict) { if (active_) { - cloudSet_.insert(wordList(dict.lookup("clouds"))); + functionObjectFile::resetNames(dict.lookup("clouds")); Info<< type() << ": "; - if (cloudSet_.size()) + if (names_.size()) { Info<< "applying to clouds:" << nl; - forAllConstIter(wordHashSet, cloudSet_, iter) + forAllConstIter(wordHashSet, names_, iter) { Info<< " " << iter.key() << nl; } Info<< endl; - - makeFiles(); } else { @@ -154,8 +107,10 @@ void Foam::cloudInfo::write() { if (active_) { + functionObjectFile::write(); + label i = 0; - forAllConstIter(wordHashSet, cloudSet_, iter) + forAllConstIter(wordHashSet, names_, iter) { const word& cloudName = iter.key(); @@ -168,7 +123,7 @@ void Foam::cloudInfo::write() if (Pstream::master()) { - outputFilePtr_[i] + file(i) << obr_.time().value() << token::TAB << nParcels << token::TAB << massInSystem << endl; diff --git a/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.H b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.H index bf75dcacc4..edd5d6897d 100644 --- a/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.H +++ b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.H @@ -72,7 +72,7 @@ SourceFiles #ifndef cloudInfo_H #define cloudInfo_H -#include "OFstream.H" +#include "functionObjectFile.H" #include "PtrList.H" #include "pointFieldFwd.H" #include "volFields.H" @@ -93,6 +93,8 @@ class mapPolyMesh; \*---------------------------------------------------------------------------*/ class cloudInfo +: + public functionObjectFile { protected: @@ -101,22 +103,17 @@ protected: //- Name of this set of cloudInfo object word name_; + //- Reference to the database const objectRegistry& obr_; //- on/off switch bool active_; - //- Clouds to process - wordHashSet cloudSet_; - - //- Output file pointers - PtrList outputFilePtr_; - // Protected Member Functions - //- If the output file has not been created create it - void makeFiles(); + //- File header information + virtual void writeFileHeader(const label i); //- Disallow default bitwise copy construct cloudInfo(const cloudInfo&); diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C index 6d62648e46..e268fa4c93 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C @@ -62,14 +62,13 @@ Foam::fieldMinMax::fieldMinMax const bool loadFromFiles ) : + functionObjectFile(obr, name, typeName), name_(name), obr_(obr), active_(true), - write_(true), log_(false), mode_(mdMag), - fieldSet_(), - fieldMinMaxFilePtr_(NULL) + fieldSet_() { // Check if the available mesh is an fvMesh otherise deactivate if (!isA(obr_)) @@ -99,7 +98,6 @@ void Foam::fieldMinMax::read(const dictionary& dict) { if (active_) { - write_ = dict.lookupOrDefault("write", true); log_ = dict.lookupOrDefault("log", false); mode_ = modeTypeNames_[dict.lookupOrDefault("mode", "magnitude")]; @@ -108,72 +106,25 @@ void Foam::fieldMinMax::read(const dictionary& dict) } -void Foam::fieldMinMax::makeFile() +void Foam::fieldMinMax::writeFileHeader(const label i) { - // Create the fieldMinMax file if not already created - if (fieldMinMaxFilePtr_.empty()) + file() + << "# Time" << token::TAB << "field" << token::TAB + << "min" << token::TAB << "position(min)"; + + if (Pstream::parRun()) { - if (debug) - { - Info<< "Creating fieldMinMax file." << endl; - } - - // File update - if (Pstream::master()) - { - fileName fieldMinMaxDir; - if (Pstream::parRun()) - { - // Put in undecomposed case (Note: gives problems for - // distributed data running) - fieldMinMaxDir = - obr_.time().path()/".."/name_/obr_.time().timeName(); - } - else - { - fieldMinMaxDir = - obr_.time().path()/name_/obr_.time().timeName(); - } - - // Create directory if does not exist. - mkDir(fieldMinMaxDir); - - // Open new file at start up - fieldMinMaxFilePtr_.reset - ( - new OFstream(fieldMinMaxDir/(type() + ".dat")) - ); - - // Add headers to output data - writeFileHeader(); - } + file() << token::TAB << "proc"; } -} + file() << token::TAB << "max" << token::TAB << "position(max)"; -void Foam::fieldMinMax::writeFileHeader() -{ - if (fieldMinMaxFilePtr_.valid()) + if (Pstream::parRun()) { - fieldMinMaxFilePtr_() - << "# Time" << token::TAB << "field" << token::TAB - << "min" << token::TAB << "position(min)"; - - if (Pstream::parRun()) - { - fieldMinMaxFilePtr_() << token::TAB << "proc"; - } - - fieldMinMaxFilePtr_() - << token::TAB << "max" << token::TAB << "position(max)"; - - if (Pstream::parRun()) - { - fieldMinMaxFilePtr_() << token::TAB << "proc"; - } - - fieldMinMaxFilePtr_() << endl; + file() << token::TAB << "proc"; } + + file() << endl; } @@ -193,11 +144,7 @@ void Foam::fieldMinMax::write() { if (active_) { - // Create the fieldMinMax file if not already created - if (write_) - { - makeFile(); - } + functionObjectFile::write(); if (log_) { diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H index a2fbb10f71..dbaf40b1da 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H @@ -76,6 +76,7 @@ SourceFiles #ifndef fieldMinMax_H #define fieldMinMax_H +#include "functionObjectFile.H" #include "primitiveFieldsFwd.H" #include "volFieldsFwd.H" #include "HashSet.H" @@ -99,6 +100,8 @@ class mapPolyMesh; \*---------------------------------------------------------------------------*/ class fieldMinMax +: + public functionObjectFile { public: @@ -115,8 +118,8 @@ protected: //- Mode type names static const NamedEnum modeTypeNames_; - //- Name of this set of field min/max. - // Also used as the name of the output directory. + //- Name of this set of field min/max + // Also used as the name of the output directory word name_; const objectRegistry& obr_; @@ -124,9 +127,6 @@ protected: //- on/off switch bool active_; - //- Switch to enable/disable writing to file - Switch write_; - //- Switch to send output to Info as well Switch log_; @@ -136,15 +136,9 @@ protected: //- Fields to assess min/max wordList fieldSet_; - //- Min/max file ptr - autoPtr fieldMinMaxFilePtr_; - // Private Member Functions - //- If the output file has not been created create it - void makeFile(); - //- Disallow default bitwise copy construct fieldMinMax(const fieldMinMax&); @@ -152,7 +146,7 @@ protected: void operator=(const fieldMinMax&); //- Output file header information - virtual void writeFileHeader(); + virtual void writeFileHeader(const label i); public: diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C index cfde197248..64a03c43b1 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C @@ -83,29 +83,25 @@ void Foam::fieldMinMax::calcMinMaxFields scalar maxValue = maxVs[maxI]; const vector& maxC = maxCs[maxI]; - if (write_) + file() + << obr_.time().value() << token::TAB + << fieldName << token::TAB + << minValue << token::TAB << minC; + + if (Pstream::parRun()) { - fieldMinMaxFilePtr_() - << obr_.time().value() << token::TAB - << fieldName << token::TAB - << minValue << token::TAB << minC; - - if (Pstream::parRun()) - { - fieldMinMaxFilePtr_() << token::TAB << minI; - } - - fieldMinMaxFilePtr_() - << token::TAB << maxValue << token::TAB << maxC; - - if (Pstream::parRun()) - { - fieldMinMaxFilePtr_() << token::TAB << maxI; - } - - fieldMinMaxFilePtr_() << endl; + file() << token::TAB << minI; } + file() << token::TAB << maxValue << token::TAB << maxC; + + if (Pstream::parRun()) + { + file() << token::TAB << maxI; + } + + file() << endl; + if (log_) { Info<< " min(mag(" << fieldName << ")) = " @@ -163,29 +159,25 @@ void Foam::fieldMinMax::calcMinMaxFields Type maxValue = maxVs[maxI]; const vector& maxC = maxCs[maxI]; - if (write_) + file() + << obr_.time().value() << token::TAB + << fieldName << token::TAB + << minValue << token::TAB << minC; + + if (Pstream::parRun()) { - fieldMinMaxFilePtr_() - << obr_.time().value() << token::TAB - << fieldName << token::TAB - << minValue << token::TAB << minC; - - if (Pstream::parRun()) - { - fieldMinMaxFilePtr_() << token::TAB << minI; - } - - fieldMinMaxFilePtr_() - << token::TAB << maxValue << token::TAB << maxC; - - if (Pstream::parRun()) - { - fieldMinMaxFilePtr_() << token::TAB << maxI; - } - - fieldMinMaxFilePtr_() << endl; + file() << token::TAB << minI; } + file() << token::TAB << maxValue << token::TAB << maxC; + + if (Pstream::parRun()) + { + file() << token::TAB << maxI; + } + + file() << endl; + if (log_) { Info<< " min(" << fieldName << ") = " diff --git a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C index 9caa7a85b9..488f690ca4 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C +++ b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C @@ -153,24 +153,21 @@ void Foam::fieldValues::cellSource::initialise(const dictionary& dict) } -void Foam::fieldValues::cellSource::writeFileHeader() +void Foam::fieldValues::cellSource::writeFileHeader(const label i) { - if (outputFilePtr_.valid()) + file() + << "# Source : " << sourceTypeNames_[source_] << " " + << sourceName_ << nl << "# Cells : " << nCells_ << nl + << "# Time" << tab << "sum(V)"; + + forAll(fields_, i) { - outputFilePtr_() - << "# Source : " << sourceTypeNames_[source_] << " " - << sourceName_ << nl << "# Cells : " << nCells_ << nl - << "# Time" << tab << "sum(V)"; - - forAll(fields_, i) - { - outputFilePtr_() - << tab << operationTypeNames_[operation_] - << "(" << fields_[i] << ")"; - } - - outputFilePtr_() << endl; + file() + << tab << operationTypeNames_[operation_] + << "(" << fields_[i] << ")"; } + + file() << endl; } @@ -184,7 +181,7 @@ Foam::fieldValues::cellSource::cellSource const bool loadFromFiles ) : - fieldValue(name, obr, dict, loadFromFiles), + fieldValue(name, obr, dict, typeName, loadFromFiles), source_(sourceTypeNames_.read(dict.lookup("source"))), operation_(operationTypeNames_.read(dict.lookup("operation"))), nCells_(0), @@ -223,7 +220,7 @@ void Foam::fieldValues::cellSource::write() scalar totalVolume = gSum(filterField(mesh().V())); if (Pstream::master()) { - outputFilePtr_() << obr_.time().value() << tab << totalVolume; + file() << obr_.time().value() << tab << totalVolume; } forAll(fields_, i) @@ -237,7 +234,7 @@ void Foam::fieldValues::cellSource::write() if (Pstream::master()) { - outputFilePtr_()<< endl; + file()<< endl; } if (log_) diff --git a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.H b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.H index 7548f0e2a8..f0ad57d9ad 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.H +++ b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.H @@ -214,7 +214,7 @@ protected: ) const; //- Output file header information - virtual void writeFileHeader(); + virtual void writeFileHeader(const label i); public: diff --git a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C index 942ae6a0a9..ab59cf13b8 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C @@ -195,7 +195,7 @@ bool Foam::fieldValues::cellSource::writeValues(const word& fieldName) } - outputFilePtr_()<< tab << result; + file()<< tab << result; if (log_) { diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C index 43e3bdc768..d9f822dde5 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C @@ -472,24 +472,21 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict) } -void Foam::fieldValues::faceSource::writeFileHeader() +void Foam::fieldValues::faceSource::writeFileHeader(const label i) { - if (outputFilePtr_.valid()) + file() + << "# Source : " << sourceTypeNames_[source_] << " " + << sourceName_ << nl << "# Faces : " << nFaces_ << nl + << "# Time" << tab << "sum(magSf)"; + + forAll(fields_, i) { - outputFilePtr_() - << "# Source : " << sourceTypeNames_[source_] << " " - << sourceName_ << nl << "# Faces : " << nFaces_ << nl - << "# Time" << tab << "sum(magSf)"; - - forAll(fields_, i) - { - outputFilePtr_() - << tab << operationTypeNames_[operation_] - << "(" << fields_[i] << ")"; - } - - outputFilePtr_() << endl; + file() + << tab << operationTypeNames_[operation_] + << "(" << fields_[i] << ")"; } + + file() << endl; } @@ -532,7 +529,7 @@ Foam::fieldValues::faceSource::faceSource const bool loadFromFiles ) : - fieldValue(name, obr, dict, loadFromFiles), + fieldValue(name, obr, dict, typeName, loadFromFiles), surfaceWriterPtr_(NULL), source_(sourceTypeNames_.read(dict.lookup("source"))), operation_(operationTypeNames_.read(dict.lookup("operation"))), @@ -586,7 +583,7 @@ void Foam::fieldValues::faceSource::write() if (Pstream::master()) { - outputFilePtr_() << obr_.time().value() << tab << totalArea; + file() << obr_.time().value() << tab << totalArea; } forAll(fields_, i) @@ -600,7 +597,7 @@ void Foam::fieldValues::faceSource::write() if (Pstream::master()) { - outputFilePtr_()<< endl; + file()<< endl; } if (log_) diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H index 6c33df8611..42bc27a311 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H @@ -296,7 +296,7 @@ protected: ) const; //- Output file header information - virtual void writeFileHeader(); + virtual void writeFileHeader(const label i); public: diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C index 1d58245010..4092bf4400 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C @@ -269,19 +269,8 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName) combineMeshGeometry(faces, points); } - fileName outputDir; - if (Pstream::parRun()) - { - // Put in undecomposed case (Note: gives problems for - // distributed data running) - outputDir = obr_.time().path()/".."/name_; - } - else - { - outputDir = obr_.time().path()/name_; - } - - outputDir = outputDir/"surface"/obr_.time().timeName(); + fileName outputDir = + baseFileDir()/name_/"surface"/obr_.time().timeName(); surfaceWriterPtr_->write ( @@ -302,7 +291,7 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName) { Type result = processValues(values, Sf, weightField); - outputFilePtr_()<< tab << result; + file()<< tab << result; if (log_) { diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.C b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.C index 06f18f61c7..cc2aeb0423 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.C +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.C @@ -49,48 +49,6 @@ void Foam::fieldValue::movePoints(const Field&) } -void Foam::fieldValue::makeFile() -{ - // Create the output file if not already created - if (outputFilePtr_.empty()) - { - if (debug) - { - Info<< "Creating output file." << endl; - } - - // File update - if (Pstream::master()) - { - fileName outputDir; - word startTimeName = - obr_.time().timeName(obr_.time().startTime().value()); - - if (Pstream::parRun()) - { - // Put in undecomposed case (Note: gives problems for - // distributed data running) - outputDir = - obr_.time().path()/".."/name_/startTimeName; - } - else - { - outputDir = obr_.time().path()/name_/startTimeName; - } - - // Create directory if does not exist - mkDir(outputDir); - - // Open new file at start up - outputFilePtr_.reset(new OFstream(outputDir/(type() + ".dat"))); - - // Add headers to output data - writeFileHeader(); - } - } -} - - void Foam::fieldValue::read(const dictionary& dict) { if (active_) @@ -106,12 +64,12 @@ void Foam::fieldValue::write() { if (active_) { + functionObjectFile::write(); + if (log_) { Info<< type() << " " << name_ << " output:" << nl; } - - makeFile(); } } @@ -123,17 +81,18 @@ Foam::fieldValue::fieldValue const word& name, const objectRegistry& obr, const dictionary& dict, + const word& valueType, const bool loadFromFiles ) : + functionObjectFile(obr, name, valueType), name_(name), obr_(obr), active_(true), log_(false), sourceName_(dict.lookupOrDefault("sourceName", "sampledSurface")), fields_(dict.lookup("fields")), - valueOutput_(dict.lookup("valueOutput")), - outputFilePtr_(NULL) + valueOutput_(dict.lookup("valueOutput")) { // Only active if obr is an fvMesh if (isA(obr_)) diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H index 2a67404c43..8e52e3ee45 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H @@ -38,6 +38,7 @@ SourceFiles #ifndef fieldValue_H #define fieldValue_H +#include "functionObjectFile.H" #include "Switch.H" #include "pointFieldFwd.H" #include "OFstream.H" @@ -58,6 +59,8 @@ class mapPolyMesh; \*---------------------------------------------------------------------------*/ class fieldValue +: + public functionObjectFile { protected: @@ -85,18 +88,9 @@ protected: //- Output field values flag Switch valueOutput_; - //- Output file pointer - autoPtr outputFilePtr_; - // Functions to be over-ridden from IOoutputFilter class - //- Make the output file - virtual void makeFile(); - - //- Write the output file header - virtual void writeFileHeader() = 0; - //- Update mesh virtual void updateMesh(const mapPolyMesh&); @@ -116,6 +110,7 @@ public: const word& name, const objectRegistry& obr, const dictionary& dict, + const word& valueType, const bool loadFromFiles = false ); diff --git a/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C b/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C index 4aa1596b5a..66cbea4120 100644 --- a/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C +++ b/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C @@ -69,26 +69,19 @@ void Foam::regionSizeDistribution::writeGraph const wordList valNames(1, valueName); - fileName outputPath; - if (Pstream::parRun()) - { - outputPath = mesh.time().path()/".."/name_; - } - else - { - outputPath = mesh.time().path()/name_; - } + fileName outputPath = baseFileDir()/name_; if (mesh.name() != fvMesh::defaultRegion) { outputPath = outputPath/mesh.name(); } - mkDir(outputPath/mesh.time().timeName()); + outputPath = outputPath/mesh.time().timeName(); + + mkDir(outputPath); OFstream str ( outputPath - / mesh.time().timeName() / formatterPtr_().getFileName(coords, valNames) ); Info<< "Writing distribution of " << valueName << " to " << str.name() @@ -341,6 +334,7 @@ Foam::regionSizeDistribution::regionSizeDistribution const bool loadFromFiles ) : + functionObjectFile(obr, name, typeName), name_(name), obr_(obr), active_(true), diff --git a/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H b/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H index ce4174162e..e24a4fd5ac 100644 --- a/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H +++ b/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H @@ -98,6 +98,7 @@ SourceFiles #ifndef regionSizeDistribution_H #define regionSizeDistribution_H +#include "functionObjectFile.H" #include "pointFieldFwd.H" #include "writer.H" #include "Map.H" @@ -121,6 +122,8 @@ class polyMesh; \*---------------------------------------------------------------------------*/ class regionSizeDistribution +: + public functionObjectFile { // Private data diff --git a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C index 90f6a3a4e9..bc9f2599e4 100644 --- a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C +++ b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C @@ -85,14 +85,11 @@ void Foam::forceCoeffs::read(const dictionary& dict) } -void Foam::forceCoeffs::writeFileHeader() +void Foam::forceCoeffs::writeFileHeader(const label i) { - if (forcesFilePtr_.valid()) - { - forcesFilePtr_() - << "# Time" << tab << "Cm" << tab << "Cd" << tab << "Cl" << tab - << "Cl(f)" << "Cl(r)" << endl; - } + file() + << "# Time" << tab << "Cm" << tab << "Cd" << tab << "Cl" << tab + << "Cl(f)" << "Cl(r)" << endl; } @@ -112,12 +109,12 @@ void Foam::forceCoeffs::write() { if (active_) { - // Create the forces file if not already created - makeFile(); forces::calcForcesMoment(); if (Pstream::master()) { + functionObjectFile::write(); + scalar pDyn = 0.5*rhoRef_*magUInf_*magUInf_; Field totForce(force_[0] + force_[1]); @@ -140,7 +137,7 @@ void Foam::forceCoeffs::write() scalar Clf = Cl/2.0 - Cm; scalar Clr = Cl/2.0 + Cm; - forcesFilePtr_() + file() << obr_.time().value() << tab << Cm << tab << Cd << tab << Cl << tab << Clf << tab << Clr << endl; diff --git a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.H b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.H index fe6d074c54..74b129ea45 100644 --- a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.H +++ b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.H @@ -146,7 +146,7 @@ class forceCoeffs protected: //- Output file header information - virtual void writeFileHeader(); + virtual void writeFileHeader(const label i); public: diff --git a/src/postProcessing/functionObjects/forces/forces/forces.C b/src/postProcessing/functionObjects/forces/forces/forces.C index 318e732b31..e9e56701f7 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.C +++ b/src/postProcessing/functionObjects/forces/forces/forces.C @@ -45,74 +45,21 @@ defineTypeNameAndDebug(Foam::forces, 0); // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -Foam::fileName Foam::forces::baseFileDir() const +void Foam::forces::writeFileHeader(const label i) { - fileName baseDir; + file() + << "# Time" << tab + << "forces(pressure, viscous) moment(pressure, viscous)"; - if (Pstream::parRun()) + if (localSystem_) { - // Put in undecomposed case (Note: gives problems for - // distributed data running) - baseDir = obr_.time().path()/".."/name_; - } - else - { - baseDir = obr_.time().path()/name_; + file() + << tab + << "local forces(pressure, viscous) " + << "local moment(pressure, viscous)"; } - return baseDir; -} - - -void Foam::forces::makeFile() -{ - // Create the forces file if not already created - if (forcesFilePtr_.empty()) - { - if (debug) - { - Info<< "Creating forces file" << endl; - } - - // File update - if (Pstream::master()) - { - word startTimeName = - obr_.time().timeName(obr_.time().startTime().value()); - - fileName forcesDir = baseFileDir()/startTimeName; - - // Create directory if does not exist. - mkDir(forcesDir); - - // Open new file at start up - forcesFilePtr_.reset(new OFstream(forcesDir/(type() + ".dat"))); - - // Add headers to output data - writeFileHeader(); - } - } -} - - -void Foam::forces::writeFileHeader() -{ - if (forcesFilePtr_.valid()) - { - forcesFilePtr_() - << "# Time" << tab - << "forces(pressure, viscous) moment(pressure, viscous)"; - - if (localSystem_) - { - forcesFilePtr_() - << tab - << "local forces(pressure, viscous) " - << "local moment(pressure, viscous)"; - } - - forcesFilePtr_()<< endl; - } + file()<< endl; } @@ -281,13 +228,12 @@ void Foam::forces::writeBins() const autoPtr > binWriterPtr(writer::New(binFormat_)); coordSet axis("forces", "distance", binPoints_, mag(binPoints_)); - fileName forcesDir = baseFileDir()/"bins"/obr_.time().timeName(); + fileName forcesDir = baseFileDir()/name_/"bins"/obr_.time().timeName(); mkDir(forcesDir); if (log_) { Info<< " Writing bins to " << forcesDir << endl; - } wordList fieldNames(IStringStream("(pressure viscous)")()); @@ -327,6 +273,7 @@ Foam::forces::forces const bool loadFromFiles ) : + functionObjectFile(obr, name, typeName), name_(name), obr_(obr), active_(true), @@ -348,8 +295,7 @@ Foam::forces::forces binDx_(0.0), binMin_(GREAT), binPoints_(), - binFormat_("undefined"), - forcesFilePtr_(NULL) + binFormat_("undefined") { // Check if the available mesh is an fvMesh otherise deactivate if (!isA(obr_)) @@ -385,6 +331,7 @@ Foam::forces::forces const coordinateSystem& coordSys ) : + functionObjectFile(obr, name, typeName), name_(name), obr_(obr), active_(true), @@ -406,8 +353,7 @@ Foam::forces::forces binDx_(0.0), binMin_(GREAT), binPoints_(), - binFormat_("undefined"), - forcesFilePtr_(NULL) + binFormat_("undefined") {} @@ -592,13 +538,12 @@ void Foam::forces::write() return; } - // Create the forces file if not already created - makeFile(); - calcForcesMoment(); if (Pstream::master()) { + functionObjectFile::write(); + if (log_) { Info<< type() << " output:" << nl @@ -609,7 +554,7 @@ void Foam::forces::write() << nl; } - forcesFilePtr_() << obr_.time().value() << tab + file() << obr_.time().value() << tab << "(" << sum(force_[0]) << "," << sum(force_[1]) << ") " << "(" << sum(moment_[0]) << "," << sum(moment_[1]) << ")" << endl; @@ -621,7 +566,7 @@ void Foam::forces::write() vectorField localMomentP(coordSys_.localVector(moment_[0])); vectorField localMomentV(coordSys_.localVector(moment_[1])); - forcesFilePtr_() << obr_.time().value() << tab + file() << obr_.time().value() << tab << "(" << sum(localForceP) << "," << sum(localForceV) << ") " << "(" << sum(localMomentP) << "," << sum(localMomentV) << ")" << endl; @@ -633,8 +578,6 @@ void Foam::forces::write() { Info<< endl; } - - forcesFilePtr_() << endl; } } diff --git a/src/postProcessing/functionObjects/forces/forces/forces.H b/src/postProcessing/functionObjects/forces/forces/forces.H index 72be597994..d2d2e4b2dc 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.H +++ b/src/postProcessing/functionObjects/forces/forces/forces.H @@ -103,6 +103,7 @@ SourceFiles #ifndef forces_H #define forces_H +#include "functionObjectFile.H" #include "coordinateSystem.H" #include "coordinateSystems.H" #include "primitiveFieldsFwd.H" @@ -129,6 +130,8 @@ class mapPolyMesh; \*---------------------------------------------------------------------------*/ class forces +: + public functionObjectFile { protected: @@ -207,20 +210,10 @@ protected: word binFormat_; - //- Forces/moment file ptr - autoPtr forcesFilePtr_; - - // Protected Member Functions - //- Return the base file directory for output - fileName baseFileDir() const; - - //- If the forces file has not been created create it - void makeFile(); - //- Output file header information - virtual void writeFileHeader(); + virtual void writeFileHeader(const label i); //- Return the effective viscous stress (laminar + turbulent). tmp devRhoReff() const; diff --git a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C index 604cf2fd89..94e375304a 100644 --- a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C +++ b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C @@ -35,49 +35,13 @@ License defineTypeNameAndDebug(Foam::DESModelRegions, 0); -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // -void Foam::DESModelRegions::makeFile() +void Foam::DESModelRegions::writeFileHeader(const label i) { - // Create the output file if not already created - if (outputFilePtr_.empty()) - { - if (debug) - { - Info<< "Creating output file." << endl; - } - - // File update - if (Pstream::master()) - { - fileName outputDir; - word startTimeName = - obr_.time().timeName(obr_.time().startTime().value()); - - if (Pstream::parRun()) - { - // Put in undecomposed case (Note: gives problems for - // distributed data running) - outputDir = - obr_.time().path()/".."/name_/startTimeName; - } - else - { - outputDir = obr_.time().path()/name_/startTimeName; - } - - // Create directory if does not exist - mkDir(outputDir); - - // Open new file at start up - outputFilePtr_.reset(new OFstream(outputDir/(type() + ".dat"))); - - // Add headers to output data - outputFilePtr_() << "# DES model region coverage (% volume)" << nl - << "# time " << token::TAB << "LES" << token::TAB << "RAS" - << endl; - } - } + file() << "# DES model region coverage (% volume)" << nl + << "# time " << token::TAB << "LES" << token::TAB << "RAS" + << endl; } @@ -91,11 +55,11 @@ Foam::DESModelRegions::DESModelRegions const bool loadFromFiles ) : + functionObjectFile(obr, name, typeName), name_(name), obr_(obr), active_(true), - log_(false), - outputFilePtr_(NULL) + log_(false) { // Check if the available mesh is an fvMesh, otherwise deactivate if (!isA(obr_)) @@ -114,8 +78,6 @@ Foam::DESModelRegions::DESModelRegions << endl; } - makeFile(); - read(dict); } @@ -159,6 +121,8 @@ void Foam::DESModelRegions::write() if (active_) { + functionObjectFile::write(); + const fvMesh& mesh = refCast(obr_); if (log_) @@ -203,7 +167,7 @@ void Foam::DESModelRegions::write() if (Pstream::master()) { - outputFilePtr_() << obr_.time().timeName() << token::TAB + file() << obr_.time().timeName() << token::TAB << prc << token::TAB << 100.0 - prc << endl; } diff --git a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.H b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.H index 38c8be7c13..fe36b462de 100644 --- a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.H +++ b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.H @@ -43,6 +43,7 @@ SourceFiles #ifndef DESModelRegions_H #define DESModelRegions_H +#include "functionObjectFile.H" #include "volFieldsFwd.H" #include "pointFieldFwd.H" #include "Switch.H" @@ -64,8 +65,12 @@ class fvMesh; \*---------------------------------------------------------------------------*/ class DESModelRegions +: + public functionObjectFile { - // Private data +protected: + + // Protected data //- Name of this set of DESModelRegions object word name_; @@ -78,14 +83,11 @@ class DESModelRegions //- Switch to send output to Info as well as to file Switch log_; - //- Output file pointer - autoPtr outputFilePtr_; + // Protected Member Functions - // Private Member Functions - - //- Make the output file - virtual void makeFile(); + //- File header information + virtual void writeFileHeader(const label i); //- Disallow default bitwise copy construct DESModelRegions(const DESModelRegions&); diff --git a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C index 91e5eb7f04..9803f154ef 100644 --- a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C +++ b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C @@ -35,49 +35,14 @@ License defineTypeNameAndDebug(Foam::wallShearStress, 0); -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // -void Foam::wallShearStress::makeFile() +void Foam::wallShearStress::writeFileHeader(const label i) { - // Create the output file if not already created - if (outputFilePtr_.empty()) - { - if (debug) - { - Info<< "Creating output file." << endl; - } - - // File update - if (Pstream::master()) - { - fileName outputDir; - word startTimeName = - obr_.time().timeName(obr_.time().startTime().value()); - - if (Pstream::parRun()) - { - // Put in undecomposed case (Note: gives problems for - // distributed data running) - outputDir = - obr_.time().path()/".."/name_/startTimeName; - } - else - { - outputDir = obr_.time().path()/name_/startTimeName; - } - - // Create directory if does not exist - mkDir(outputDir); - - // Open new file at start up - outputFilePtr_.reset(new OFstream(outputDir/(type() + ".dat"))); - - // Add headers to output data - outputFilePtr_() << "# Wall shear stress" << nl - << "# time " << token::TAB << "patch" << token::TAB - << "min" << token::TAB << "max" << endl; - } - } + // Add headers to output data + file() << "# Wall shear stress" << nl + << "# time " << token::TAB << "patch" << token::TAB + << "min" << token::TAB << "max" << endl; } @@ -104,7 +69,7 @@ void Foam::wallShearStress::calcShearStress vector minSsp = min(ssp); vector maxSsp = max(ssp); - outputFilePtr_() << mesh.time().timeName() << token::TAB + file() << mesh.time().timeName() << token::TAB << pp.name() << token::TAB << minSsp << token::TAB << maxSsp << endl; @@ -128,12 +93,12 @@ Foam::wallShearStress::wallShearStress const bool loadFromFiles ) : + functionObjectFile(obr, name, typeName), name_(name), obr_(obr), active_(true), log_(false), - phiName_("phi"), - outputFilePtr_(NULL) + phiName_("phi") { // Check if the available mesh is an fvMesh, otherwise deactivate if (!isA(obr_)) @@ -152,8 +117,6 @@ Foam::wallShearStress::wallShearStress << endl; } - makeFile(); - read(dict); } @@ -195,6 +158,8 @@ void Foam::wallShearStress::write() if (active_) { + functionObjectFile::write(); + const fvMesh& mesh = refCast(obr_); volVectorField wallShearStress diff --git a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.H b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.H index 71c3b5c34f..80f12d0c24 100644 --- a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.H +++ b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.H @@ -54,6 +54,7 @@ SourceFiles #ifndef wallShearStress_H #define wallShearStress_H +#include "functionObjectFile.H" #include "volFieldsFwd.H" #include "pointFieldFwd.H" #include "Switch.H" @@ -75,8 +76,12 @@ class fvMesh; \*---------------------------------------------------------------------------*/ class wallShearStress +: + public functionObjectFile { - // Private data +protected: + + // Protected data //- Name of this set of wallShearStress object word name_; @@ -92,14 +97,11 @@ class wallShearStress //- Name of mass/volume flux field (optional, default = phi) word phiName_; - //- Output file pointer - autoPtr outputFilePtr_; + // Protected Member Functions - // Private Member Functions - - //- Make the output file - virtual void makeFile(); + //- File header information + virtual void writeFileHeader(const label i); //- Calculate the shear stress void calcShearStress diff --git a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C index 433af459ec..e02c1957b3 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C +++ b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C @@ -39,48 +39,12 @@ defineTypeNameAndDebug(Foam::yPlusLES, 0); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::yPlusLES::makeFile() +void Foam::yPlusLES::writeFileHeader(const label i) { - // Create the output file if not already created - if (outputFilePtr_.empty()) - { - if (debug) - { - Info<< "Creating output file." << endl; - } - - // File update - if (Pstream::master()) - { - fileName outputDir; - word startTimeName = - obr_.time().timeName(obr_.time().startTime().value()); - - if (Pstream::parRun()) - { - // Put in undecomposed case (Note: gives problems for - // distributed data running) - outputDir = - obr_.time().path()/".."/name_/startTimeName; - } - else - { - outputDir = obr_.time().path()/name_/startTimeName; - } - - // Create directory if does not exist - mkDir(outputDir); - - // Open new file at start up - outputFilePtr_.reset(new OFstream(outputDir/(type() + ".dat"))); - - // Add headers to output data - outputFilePtr_() << "# y+ (LES)" << nl - << "# time " << token::TAB << "patch" << token::TAB - << "min" << token::TAB << "max" << token::TAB << "average" - << endl; - } - } + file() << "# y+ (LES)" << nl + << "# time " << token::TAB << "patch" << token::TAB + << "min" << token::TAB << "max" << token::TAB << "average" + << endl; } @@ -133,7 +97,7 @@ void Foam::yPlusLES::calcIncompressibleYPlus if (Pstream::master()) { - outputFilePtr_() << obr_.time().value() << token::TAB + file() << obr_.time().value() << token::TAB << currPatch.name() << token::TAB << minYp << token::TAB << maxYp << token::TAB << avgYp << endl; @@ -199,7 +163,7 @@ void Foam::yPlusLES::calcCompressibleYPlus if (Pstream::master()) { - outputFilePtr_() << obr_.time().value() << token::TAB + file() << obr_.time().value() << token::TAB << currPatch.name() << token::TAB << minYp << token::TAB << maxYp << token::TAB << avgYp << endl; @@ -224,13 +188,13 @@ Foam::yPlusLES::yPlusLES const bool loadFromFiles ) : + functionObjectFile(obr, name, typeName), name_(name), obr_(obr), active_(true), log_(false), phiName_("phi"), - UName_("U"), - outputFilePtr_(NULL) + UName_("U") { // Check if the available mesh is an fvMesh, otherwise deactivate if (!isA(obr_)) @@ -248,8 +212,6 @@ Foam::yPlusLES::yPlusLES ) << "No fvMesh available, deactivating." << nl << endl; } - - makeFile(); } @@ -287,6 +249,8 @@ void Foam::yPlusLES::write() { if (active_) { + functionObjectFile::write(); + const surfaceScalarField& phi = obr_.lookupObject(phiName_); diff --git a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.H b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.H index 795e9aed89..45f8fec68e 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.H +++ b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.H @@ -40,6 +40,7 @@ SourceFiles #ifndef yPlusLES_H #define yPlusLES_H +#include "functionObjectFile.H" #include "volFieldsFwd.H" #include "pointFieldFwd.H" #include "Switch.H" @@ -61,6 +62,8 @@ class fvMesh; \*---------------------------------------------------------------------------*/ class yPlusLES +: + public functionObjectFile { // Private data @@ -81,14 +84,11 @@ class yPlusLES //- Name of velocity field word UName_; - //- Output file pointer - autoPtr outputFilePtr_; - // Private Member Functions - //- Make the output file - virtual void makeFile(); + //- File header information + virtual void writeFileHeader(const label i); //- Calculate incompressible form of y+ void calcIncompressibleYPlus diff --git a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C index 104a6f58e5..8d7a46f67c 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C +++ b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C @@ -41,48 +41,12 @@ defineTypeNameAndDebug(Foam::yPlusRAS, 0); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::yPlusRAS::makeFile() +void Foam::yPlusRAS::writeFileHeader(const label i) { - // Create the output file if not already created - if (outputFilePtr_.empty()) - { - if (debug) - { - Info<< "Creating output file." << endl; - } - - // File update - if (Pstream::master()) - { - fileName outputDir; - word startTimeName = - obr_.time().timeName(obr_.time().startTime().value()); - - if (Pstream::parRun()) - { - // Put in undecomposed case (Note: gives problems for - // distributed data running) - outputDir = - obr_.time().path()/".."/name_/startTimeName; - } - else - { - outputDir = obr_.time().path()/name_/startTimeName; - } - - // Create directory if does not exist - mkDir(outputDir); - - // Open new file at start up - outputFilePtr_.reset(new OFstream(outputDir/(type() + ".dat"))); - - // Add headers to output data - outputFilePtr_() << "# y+ (RAS)" << nl - << "# time " << token::TAB << "patch" << token::TAB - << "min" << token::TAB << "max" << token::TAB << "average" - << endl; - } - } + file() << "# y+ (RAS)" << nl + << "# time " << token::TAB << "patch" << token::TAB + << "min" << token::TAB << "max" << token::TAB << "average" + << endl; } @@ -128,7 +92,7 @@ void Foam::yPlusRAS::calcIncompressibleYPlus if (Pstream::master()) { - outputFilePtr_() << obr_.time().value() << token::TAB + file() << obr_.time().value() << token::TAB << nutPw.patch().name() << token::TAB << minYp << token::TAB << maxYp << token::TAB << avgYp << endl; @@ -186,7 +150,7 @@ void Foam::yPlusRAS::calcCompressibleYPlus if (Pstream::master()) { - outputFilePtr_() << obr_.time().value() << token::TAB + file() << obr_.time().value() << token::TAB << mutPw.patch().name() << token::TAB << minYp << token::TAB << maxYp << token::TAB << avgYp << endl; @@ -212,12 +176,12 @@ Foam::yPlusRAS::yPlusRAS const bool loadFromFiles ) : + functionObjectFile(obr, name, typeName), name_(name), obr_(obr), active_(true), log_(false), - phiName_("phi"), - outputFilePtr_(NULL) + phiName_("phi") { // Check if the available mesh is an fvMesh, otherwise deactivate if (!isA(obr_)) @@ -235,8 +199,6 @@ Foam::yPlusRAS::yPlusRAS ) << "No fvMesh available, deactivating." << nl << endl; } - - makeFile(); } @@ -274,6 +236,8 @@ void Foam::yPlusRAS::write() { if (active_) { + functionObjectFile::write(); + const surfaceScalarField& phi = obr_.lookupObject(phiName_); diff --git a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.H b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.H index 38085ae722..98b8134e0c 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.H +++ b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.H @@ -40,6 +40,7 @@ SourceFiles #ifndef yPlusRAS_H #define yPlusRAS_H +#include "functionObjectFile.H" #include "volFieldsFwd.H" #include "pointFieldFwd.H" #include "Switch.H" @@ -61,6 +62,8 @@ class fvMesh; \*---------------------------------------------------------------------------*/ class yPlusRAS +: + public functionObjectFile { // Private data @@ -78,14 +81,11 @@ class yPlusRAS //- Name of mass/volume flux field (optional, default = phi) word phiName_; - //- Output file pointer - autoPtr outputFilePtr_; - // Private Member Functions - //- Make the output file - virtual void makeFile(); + //- File header information + virtual void writeFileHeader(const label i); //- Calculate incompressible form of y+ void calcIncompressibleYPlus(const fvMesh& mesh, volScalarField& yPlus);