mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: function objects - enabled 'fields' entry to use patterns for some objects
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -51,9 +51,22 @@ Foam::functionObjects::fieldMinMax::modeTypeNames_
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::fieldMinMax::writeFileHeader(Ostream& os) const
|
||||
void Foam::functionObjects::fieldMinMax::writeFileHeader(Ostream& os)
|
||||
{
|
||||
writeHeader(os, "Field minima and maxima");
|
||||
if (!fieldSet_.updateSelection())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (writtenHeader_)
|
||||
{
|
||||
writeBreak(file());
|
||||
}
|
||||
else
|
||||
{
|
||||
writeHeader(os, "Field minima and maxima");
|
||||
}
|
||||
|
||||
writeCommented(os, "Time");
|
||||
|
||||
if (location_)
|
||||
@ -77,14 +90,17 @@ void Foam::functionObjects::fieldMinMax::writeFileHeader(Ostream& os) const
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(fieldSet_, fieldi)
|
||||
forAllConstIters(fieldSet_.selection(), iter)
|
||||
{
|
||||
writeTabbed(os, "min(" + fieldSet_[fieldi] + ')');
|
||||
writeTabbed(os, "max(" + fieldSet_[fieldi] + ')');
|
||||
const word& fieldName = iter();
|
||||
writeTabbed(os, "min(" + fieldName + ')');
|
||||
writeTabbed(os, "max(" + fieldName + ')');
|
||||
}
|
||||
}
|
||||
|
||||
os << endl;
|
||||
|
||||
writtenHeader_ = true;
|
||||
}
|
||||
|
||||
|
||||
@ -101,10 +117,9 @@ Foam::functionObjects::fieldMinMax::fieldMinMax
|
||||
writeFile(mesh_, name, typeName, dict),
|
||||
location_(true),
|
||||
mode_(mdMag),
|
||||
fieldSet_()
|
||||
fieldSet_(mesh_)
|
||||
{
|
||||
read(dict);
|
||||
writeFileHeader(file());
|
||||
}
|
||||
|
||||
|
||||
@ -124,7 +139,8 @@ bool Foam::functionObjects::fieldMinMax::read(const dictionary& dict)
|
||||
location_ = dict.lookupOrDefault<Switch>("location", true);
|
||||
|
||||
mode_ = modeTypeNames_.lookupOrDefault("mode", dict, modeType::mdMag);
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
|
||||
fieldSet_.read(dict);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -138,16 +154,18 @@ bool Foam::functionObjects::fieldMinMax::execute()
|
||||
|
||||
bool Foam::functionObjects::fieldMinMax::write()
|
||||
{
|
||||
writeFileHeader(file());
|
||||
|
||||
if (!location_) writeTime(file());
|
||||
Log << type() << " " << name() << " write:" << nl;
|
||||
|
||||
forAll(fieldSet_, fieldi)
|
||||
for (const word& fieldName : fieldSet_.selection())
|
||||
{
|
||||
calcMinMaxFields<scalar>(fieldSet_[fieldi], mdCmpt);
|
||||
calcMinMaxFields<vector>(fieldSet_[fieldi], mode_);
|
||||
calcMinMaxFields<sphericalTensor>(fieldSet_[fieldi], mode_);
|
||||
calcMinMaxFields<symmTensor>(fieldSet_[fieldi], mode_);
|
||||
calcMinMaxFields<tensor>(fieldSet_[fieldi], mode_);
|
||||
calcMinMaxFields<scalar>(fieldName, mdCmpt);
|
||||
calcMinMaxFields<vector>(fieldName, mode_);
|
||||
calcMinMaxFields<sphericalTensor>(fieldName, mode_);
|
||||
calcMinMaxFields<symmTensor>(fieldName, mode_);
|
||||
calcMinMaxFields<tensor>(fieldName, mode_);
|
||||
}
|
||||
|
||||
if (!location_) file()<< endl;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -82,6 +82,7 @@ SourceFiles
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "writeFile.H"
|
||||
#include "vector.H"
|
||||
#include "volFieldSelection.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -124,7 +125,7 @@ protected:
|
||||
modeType mode_;
|
||||
|
||||
//- Fields to assess min/max
|
||||
wordList fieldSet_;
|
||||
volFieldSelection fieldSet_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
@ -147,7 +148,7 @@ protected:
|
||||
|
||||
|
||||
//- Output file header information
|
||||
virtual void writeFileHeader(Ostream& os) const;
|
||||
virtual void writeFileHeader(Ostream& os);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
fieldMinMax(const fieldMinMax&) = delete;
|
||||
|
||||
Reference in New Issue
Block a user