From c3a2dd3188f5abfd96fa21fbab5faa8a4c60c3be Mon Sep 17 00:00:00 2001 From: Sergio Ferraris Date: Fri, 7 Jun 2013 11:19:24 +0100 Subject: [PATCH] ENH: Adding virtual function timeSet() to function objects: probes, sampledSets and sampledSurfaces --- src/sampling/probes/probes.C | 8 +++++++- src/sampling/probes/probes.H | 3 +++ src/sampling/sampledSet/sampledSets/sampledSets.C | 6 ++++++ src/sampling/sampledSet/sampledSets/sampledSets.H | 3 +++ .../sampledSurface/sampledSurfaces/sampledSurfaces.C | 6 ++++++ .../sampledSurface/sampledSurfaces/sampledSurfaces.H | 3 +++ 6 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/sampling/probes/probes.C b/src/sampling/probes/probes.C index 8652fa9a25..608049c7f7 100644 --- a/src/sampling/probes/probes.C +++ b/src/sampling/probes/probes.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -293,6 +293,12 @@ void Foam::probes::end() } +void Foam::probes::timeSet() +{ + // Do nothing - only valid on write +} + + void Foam::probes::write() { if (size() && prepare()) diff --git a/src/sampling/probes/probes.H b/src/sampling/probes/probes.H index 80a4037571..f72581dbd7 100644 --- a/src/sampling/probes/probes.H +++ b/src/sampling/probes/probes.H @@ -243,6 +243,9 @@ public: //- Execute at the final time-loop, currently does nothing virtual void end(); + //- Called when time was set at the end of the Time::operator++ + virtual void timeSet(); + //- Sample and write virtual void write(); diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.C b/src/sampling/sampledSet/sampledSets/sampledSets.C index 44ea1691af..0286e54877 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSets.C +++ b/src/sampling/sampledSet/sampledSets/sampledSets.C @@ -188,6 +188,12 @@ void Foam::sampledSets::end() } +void Foam::sampledSets::timeSet() +{ + // Do nothing - only valid on write +} + + void Foam::sampledSets::write() { if (size()) diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.H b/src/sampling/sampledSet/sampledSets/sampledSets.H index a2ad2f1418..54744bbbf8 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSets.H +++ b/src/sampling/sampledSet/sampledSets/sampledSets.H @@ -288,6 +288,9 @@ public: //- Execute at the final time-loop, currently does nothing virtual void end(); + //- Called when time was set at the end of the Time::operator++ + virtual void timeSet(); + //- Sample and write virtual void write(); diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C index 34d5bd5b96..b33d6b30b7 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C @@ -143,6 +143,12 @@ void Foam::sampledSurfaces::end() } +void Foam::sampledSurfaces::timeSet() +{ + // Do nothing - only valid on write +} + + void Foam::sampledSurfaces::write() { if (size()) diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H index 050b2b6e38..3390c00348 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H @@ -221,6 +221,9 @@ public: //- Execute at the final time-loop, currently does nothing virtual void end(); + //- Called when time was set at the end of the Time::operator++ + virtual void timeSet(); + //- Sample and write virtual void write();