mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Extended API to allow results to be accessed outside of class
This commit is contained in:
@ -177,6 +177,9 @@ bool Foam::fieldValues::cellSource::writeValues(const word& fieldName)
|
||||
{
|
||||
Type result = processValues(values, V, weightField);
|
||||
|
||||
// add to result dictionary, over-writing any previous entry
|
||||
resultDict_.add(fieldName, result, true);
|
||||
|
||||
if (valueOutput_)
|
||||
{
|
||||
IOField<Type>
|
||||
|
||||
@ -291,6 +291,9 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName)
|
||||
{
|
||||
Type result = processValues(values, Sf, weightField);
|
||||
|
||||
// add to result dictionary, over-writing any previous entry
|
||||
resultDict_.add(fieldName, result, true);
|
||||
|
||||
file()<< tab << result;
|
||||
|
||||
if (log_)
|
||||
|
||||
@ -92,7 +92,8 @@ Foam::fieldValue::fieldValue
|
||||
log_(false),
|
||||
sourceName_(dict.lookupOrDefault<word>("sourceName", "sampledSurface")),
|
||||
fields_(dict.lookup("fields")),
|
||||
valueOutput_(dict.lookup("valueOutput"))
|
||||
valueOutput_(dict.lookup("valueOutput")),
|
||||
resultDict_(fileName("name"), dictionary::null)
|
||||
{
|
||||
// Only active if obr is an fvMesh
|
||||
if (isA<fvMesh>(obr_))
|
||||
|
||||
@ -42,6 +42,7 @@ SourceFiles
|
||||
#include "Switch.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "OFstream.H"
|
||||
#include "dictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -49,7 +50,6 @@ namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class dictionary;
|
||||
class objectRegistry;
|
||||
class fvMesh;
|
||||
class mapPolyMesh;
|
||||
@ -88,6 +88,9 @@ protected:
|
||||
//- Output field values flag
|
||||
Switch valueOutput_;
|
||||
|
||||
//- Results dictionary for external access of results
|
||||
dictionary resultDict_;
|
||||
|
||||
|
||||
// Functions to be over-ridden from IOoutputFilter class
|
||||
|
||||
@ -147,6 +150,9 @@ public:
|
||||
//- Helper function to return the reference to the mesh
|
||||
inline const fvMesh& mesh() const;
|
||||
|
||||
//- Return access to the latest set of results
|
||||
inline const dictionary& resultDict() const;
|
||||
|
||||
|
||||
// Function object functions
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -75,4 +75,10 @@ inline const Foam::fvMesh& Foam::fieldValue::mesh() const
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::dictionary& Foam::fieldValue::resultDict() const
|
||||
{
|
||||
return resultDict_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Reference in New Issue
Block a user