From 62e5412802053ce6595f2e7be7a707e3262c28e2 Mon Sep 17 00:00:00 2001
From: andy <andy>
Date: Fri, 19 Oct 2012 11:29:38 +0100
Subject: [PATCH] ENH: Added 'alwaysApply' function to bypass the apply
 checking

---
 src/fieldSources/basicSource/basicSource.C | 12 ++++++++++++
 src/fieldSources/basicSource/basicSource.H |  3 +++
 2 files changed, 15 insertions(+)

diff --git a/src/fieldSources/basicSource/basicSource.C b/src/fieldSources/basicSource/basicSource.C
index 2d218de752a..9ebcdc5834f 100644
--- a/src/fieldSources/basicSource/basicSource.C
+++ b/src/fieldSources/basicSource/basicSource.C
@@ -56,6 +56,12 @@ namespace Foam
 
 // * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
 
+bool Foam::basicSource::alwaysApply() const
+{
+    return false;
+}
+
+
 void Foam::basicSource::setSelection(const dictionary& dict)
 {
     switch (selectionMode_)
@@ -314,6 +320,7 @@ Foam::basicSource::~basicSource()
     }
 }
 
+
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 bool Foam::basicSource::isActive()
@@ -341,6 +348,11 @@ bool Foam::basicSource::isActive()
 
 Foam::label Foam::basicSource::applyToField(const word& fieldName) const
 {
+    if (alwaysApply())
+    {
+        return 0;
+    }
+
     forAll(fieldNames_, i)
     {
         if (fieldNames_[i] == fieldName)
diff --git a/src/fieldSources/basicSource/basicSource.H b/src/fieldSources/basicSource/basicSource.H
index ca105f90b18..69e9dcf408b 100644
--- a/src/fieldSources/basicSource/basicSource.H
+++ b/src/fieldSources/basicSource/basicSource.H
@@ -150,6 +150,9 @@ protected:
 
     // Protected functions
 
+        //- Flag to bypass the apply flag list checking
+        virtual bool alwaysApply() const;
+
         //- Set the cellSet or points selection
         void setSelection(const dictionary& dict);
 
-- 
GitLab