From 0e04d88628a9c899cc33e9bdc45446bb4dad99f3 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Wed, 5 Apr 2017 11:08:42 +0100 Subject: [PATCH] Added zero CoeffField --- src/foam/fields/CoeffField/CoeffField.C | 4 ++++ src/foam/fields/CoeffField/CoeffField.H | 24 ++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/foam/fields/CoeffField/CoeffField.C b/src/foam/fields/CoeffField/CoeffField.C index 6fb7a6201..ea3233901 100644 --- a/src/foam/fields/CoeffField/CoeffField.C +++ b/src/foam/fields/CoeffField/CoeffField.C @@ -31,6 +31,10 @@ License template const char* const Foam::CoeffField::typeName("CoeffField"); +template +const Foam::CoeffField Foam::CoeffField::zero(0); + + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/foam/fields/CoeffField/CoeffField.H b/src/foam/fields/CoeffField/CoeffField.H index 159e73c38..a46ee682d 100644 --- a/src/foam/fields/CoeffField/CoeffField.H +++ b/src/foam/fields/CoeffField/CoeffField.H @@ -122,6 +122,19 @@ public: static const char* const typeName; + //- Empty field + static const CoeffField zero; + + + // Static Member Functions + + //- Return a null field + inline static const CoeffField& null() + { + return zero; + } + + // Constructors @@ -138,12 +151,8 @@ public: tmp > clone() const; - // Destructor - - ~CoeffField(); - - //- Clear data - void clear(); + //- Destructor + ~CoeffField(); // Member functions @@ -163,6 +172,9 @@ public: //- Return the field transpose tmp > transpose() const; + //- Clear data + void clear(); + // Return as typed. Fails when asked for the incorrect type