diff --git a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.C b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.C index 72a120f4c..098a7649b 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,20 +34,13 @@ Foam::Ostream& Foam::operator<< const CSV& tbl ) { - if (os.format() == IOstream::ASCII) - { - os << static_cast& >(tbl) - << token::SPACE << tbl.nHeaderLine_ - << token::SPACE << tbl.timeColumn_ - << token::SPACE << tbl.componentColumns_ - << token::SPACE << tbl.separator_ - << token::SPACE << tbl.mergeSeparators_ - << token::SPACE << tbl.fileName_; - } - else - { - os << static_cast& >(tbl); - } + os << static_cast& >(tbl) + << token::SPACE << tbl.nHeaderLine_ + << token::SPACE << tbl.timeColumn_ + << token::SPACE << tbl.componentColumns_ + << token::SPACE << tbl.separator_ + << token::SPACE << tbl.mergeSeparators_ + << token::SPACE << tbl.fileName_; // Check state of Ostream os.check("Ostream& operator<<(Ostream&, const CSV&)"); diff --git a/src/OpenFOAM/primitives/functions/DataEntry/CompatibilityConstant/CompatibilityConstant.C b/src/OpenFOAM/primitives/functions/DataEntry/CompatibilityConstant/CompatibilityConstant.C deleted file mode 100644 index 953328f03..000000000 --- a/src/OpenFOAM/primitives/functions/DataEntry/CompatibilityConstant/CompatibilityConstant.C +++ /dev/null @@ -1,123 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "CompatibilityConstant.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -Foam::CompatibilityConstant::CompatibilityConstant -( - const word& entryName, - const dictionary& dict -) -: - DataEntry(entryName), - value_(pTraits::zero), - dimensions_(dimless) -{ - Istream& is(dict.lookup(entryName)); - - token firstToken(is); - if (firstToken.isWord()) - { - token nextToken(is); - if (nextToken == token::BEGIN_SQR) - { - is.putBack(nextToken); - is >> dimensions_; - is >> value_; - } - } - else - { - is.putBack(firstToken); - is >> value_; - } -} - - -template -Foam::CompatibilityConstant::CompatibilityConstant -( - const CompatibilityConstant& cnst -) -: - DataEntry(cnst), - value_(cnst.value_), - dimensions_(cnst.dimensions_) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::CompatibilityConstant::~CompatibilityConstant() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -Type Foam::CompatibilityConstant::value(const scalar x) const -{ - return value_; -} - - -template -Type Foam::CompatibilityConstant::integrate -( - const scalar x1, - const scalar x2 -) const -{ - return (x2 - x1)*value_; -} - - -template -Foam::dimensioned Foam::CompatibilityConstant:: -dimValue(const scalar x) const -{ - return dimensioned("dimensionedValue", dimensions_, value_); -} - - -template -Foam::dimensioned Foam::CompatibilityConstant::dimIntegrate -( - const scalar x1, const scalar x2 -) const -{ - return dimensioned("dimensionedValue", dimensions_, (x2-x1)*value_); -} - -// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // - -#include "CompatibilityConstantIO.C" - - -// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/DataEntry/CompatibilityConstant/CompatibilityConstant.H b/src/OpenFOAM/primitives/functions/DataEntry/CompatibilityConstant/CompatibilityConstant.H deleted file mode 100644 index 682a3a562..000000000 --- a/src/OpenFOAM/primitives/functions/DataEntry/CompatibilityConstant/CompatibilityConstant.H +++ /dev/null @@ -1,157 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Class - Foam::CompatibilityConstant - -Description - Templated basic entry that holds a constant value for backwards - compatibility (when DataEntry type is not present) - - Usage - for entry \ having the value : - \verbatim - - \endverbatim - -SourceFiles - CompatibilityConstant.C - -\*---------------------------------------------------------------------------*/ - -#ifndef CompatibilityConstant_H -#define CompatibilityConstant_H - -#include "DataEntry.H" -#include "dimensionSet.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -template -class CompatibilityConstant; - -template -Ostream& operator<<(Ostream&, const CompatibilityConstant&); - -/*---------------------------------------------------------------------------*\ - Class CompatibilityConstant Declaration -\*---------------------------------------------------------------------------*/ - -template -class CompatibilityConstant -: - public DataEntry -{ - // Private data - - //- Constant value - Type value_; - - //- The dimension set - dimensionSet dimensions_; - - - // Private Member Functions - - //- Disallow default bitwise assignment - void operator=(const CompatibilityConstant&); - - -public: - - // Runtime type information - TypeName("CompatibilityConstant"); - - - // Constructors - - //- Construct from entry name and Istream - CompatibilityConstant(const word& entryName, const dictionary& dict); - - //- Copy constructor - CompatibilityConstant(const CompatibilityConstant& cnst); - - //- Construct and return a clone - virtual tmp> clone() const - { - return tmp> - ( - new CompatibilityConstant(*this) - ); - } - - - //- Destructor - virtual ~CompatibilityConstant(); - - - // Member Functions - - //- Return constant value - Type value(const scalar) const; - - //- Integrate between two values - Type integrate(const scalar x1, const scalar x2) const; - - //- Return dimensioned constant value - dimensioned dimValue(const scalar) const; - - //- Integrate between two values and return dimensioned type - dimensioned dimIntegrate - ( - const scalar x1, - const scalar x2 - ) const; - - - // I/O - - //- Ostream Operator - friend Ostream& operator<< - ( - Ostream& os, - const CompatibilityConstant& cnst - ); - - //- Write in dictionary format - virtual void writeData(Ostream& os) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "CompatibilityConstant.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/DataEntry/CompatibilityConstant/CompatibilityConstantIO.C b/src/OpenFOAM/primitives/functions/DataEntry/CompatibilityConstant/CompatibilityConstantIO.C deleted file mode 100644 index 4cb72ab8c..000000000 --- a/src/OpenFOAM/primitives/functions/DataEntry/CompatibilityConstant/CompatibilityConstantIO.C +++ /dev/null @@ -1,69 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "DataEntry.H" - -// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // - -template -Foam::Ostream& Foam::operator<< -( - Ostream& os, - const CompatibilityConstant& cnst -) -{ - if (os.format() == IOstream::ASCII) - { - os << static_cast& >(cnst) - << token::SPACE << cnst.value_; - } - else - { - os << static_cast& >(cnst); - os.write - ( - reinterpret_cast(&cnst.value_), - sizeof(cnst.value_) - ); - } - - // Check state of Ostream - os.check - ( - "Ostream& operator<<(Ostream&, const CompatibilityConstant&)" - ); - - return os; -} - - -template -void Foam::CompatibilityConstant::writeData(Ostream& os) const -{ - os.writeKeyword(this->name_) << value_ << token::END_STATEMENT << nl; -} - - -// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.C b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.C index e4f60195a..8fea8cfe1 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,36 +31,27 @@ template Foam::Constant::Constant(const word& entryName, const dictionary& dict) : DataEntry(entryName), - value_(pTraits::zero), - dimensions_(dimless) + value_(pTraits::zero) { Istream& is(dict.lookup(entryName)); word entryType(is); - token firstToken(is); - if (firstToken.isWord()) - { - token nextToken(is); - if (nextToken == token::BEGIN_SQR) - { - is.putBack(nextToken); - is >> dimensions_; - is >> value_; - } - } - else - { - is.putBack(firstToken); - is >> value_; - } + is >> value_; } +template +Foam::Constant::Constant(const word& entryName, Istream& is) +: + DataEntry(entryName), + value_(pTraits(is)) +{} + + template Foam::Constant::Constant(const Constant& cnst) : DataEntry(cnst), - value_(cnst.value_), - dimensions_(cnst.dimensions_) + value_(cnst.value_) {} @@ -87,26 +78,8 @@ Type Foam::Constant::integrate(const scalar x1, const scalar x2) const } -template -Foam::dimensioned Foam::Constant::dimValue(const scalar x) const -{ - return dimensioned("dimensionedValue", dimensions_, value_); -} - - -template -Foam::dimensioned Foam::Constant::dimIntegrate -( - const scalar x1, const scalar x2 -) const -{ - return dimensioned("dimensionedValue", dimensions_, (x2-x1)*value_); -} - - // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // #include "ConstantIO.C" - // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.H b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.H index c59da3bec..76bb4706e 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.H @@ -41,18 +41,15 @@ SourceFiles #define Constant_H #include "DataEntry.H" -#include "dimensionSet.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -template -class Constant; - -template -Ostream& operator<<(Ostream&, const Constant&); +// Forward declaration of friend functions and operators +template class Constant; +template Ostream& operator<<(Ostream&, const Constant&); /*---------------------------------------------------------------------------*\ Class Constant Declaration @@ -68,9 +65,6 @@ class Constant //- Constant value Type value_; - //- The dimension set - dimensionSet dimensions_; - // Private Member Functions @@ -86,9 +80,14 @@ public: // Constructors - //- Construct from entry name and Istream + //- Construct from entry name and dictionary Constant(const word& entryName, const dictionary& dict); + //- Construct from entry name and Istream + // Reads the constant value without the DataEntry type + // for backward compatibility + Constant(const word& entryName, Istream& is); + //- Copy constructor Constant(const Constant& cnst); @@ -111,16 +110,6 @@ public: //- Integrate between two values Type integrate(const scalar x1, const scalar x2) const; - //- Return dimensioned constant value - dimensioned dimValue(const scalar) const; - - //- Integrate between two values and return dimensioned type - dimensioned dimIntegrate - ( - const scalar x1, - const scalar x2 - ) const; - // I/O @@ -144,6 +133,7 @@ public: #ifdef NoRepository # include "Constant.C" +# include "DataEntryNew.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Constant/ConstantIO.C b/src/OpenFOAM/primitives/functions/DataEntry/Constant/ConstantIO.C index c25e9b9f4..fd9186343 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Constant/ConstantIO.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/Constant/ConstantIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,20 +34,8 @@ Foam::Ostream& Foam::operator<< const Constant& cnst ) { - if (os.format() == IOstream::ASCII) - { - os << static_cast& >(cnst) - << token::SPACE << cnst.value_; - } - else - { - os << static_cast& >(cnst); - os.write - ( - reinterpret_cast(&cnst.value_), - sizeof(cnst.value_) - ); - } + os << static_cast& >(cnst) + << token::SPACE << cnst.value_; // Check state of Ostream os.check diff --git a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C index 3a4fb3aab..ab14e4080 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C @@ -120,79 +120,6 @@ Foam::tmp> Foam::DataEntry::integrate } - -template -Foam::dimensioned Foam::DataEntry::dimValue(const scalar x) const -{ - NotImplemented; - - return dimensioned("zero", dimless, pTraits::zero); -} - - -template -Foam::dimensioned Foam::DataEntry::dimIntegrate -( - const scalar x1, - const scalar x2 -) const -{ - NotImplemented; - - return dimensioned("zero", dimless, pTraits::zero); -} - - -template -Foam::tmp>> -Foam::DataEntry::dimValue -( - const scalarField& x -) const -{ - - tmp>> tfld - ( - new Field> - ( - x.size(), - dimensioned("zero", dimless, pTraits::zero) - ) - ); - - Field>& fld = tfld(); - - forAll(x, i) - { - fld[i] = this->dimValue(x[i]); - } - return tfld; -} - - -template -Foam::tmp>> -Foam::DataEntry::dimIntegrate -( - const scalarField& x1, - const scalarField& x2 -) const -{ - tmp>> tfld - ( - new Field>(x1.size()) - ); - - Field>& fld = tfld(); - - forAll(x1, i) - { - fld[i] = this->dimIntegrate(x1[i], x2[i]); - } - return tfld; -} - - // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // #include "DataEntryIO.C" diff --git a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H index 4422d50f0..d95bfa17e 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H @@ -41,23 +41,18 @@ SourceFiles #include "dictionary.H" #include "Field.H" -#include "dimensionedType.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { + +// Forward declarations class Time; -template -class DataEntry; - -template -Ostream& operator<< -( - Ostream&, - const DataEntry& -); +// Forward declaration of friend functions and operators +template class DataEntry; +template Ostream& operator<<(Ostream&, const DataEntry&); /*---------------------------------------------------------------------------*\ Class DataEntry Declaration @@ -160,30 +155,6 @@ public: const scalarField& x2 ) const; - //- Return dimensioned type - virtual dimensioned dimValue(const scalar x) const; - - //- Return dimensioned type as a function of (scalar) - virtual tmp>> dimValue - ( - const scalarField& x - ) const; - - //- Integrate between two scalars and return a dimensioned type - virtual dimensioned dimIntegrate - ( - const scalar x1, - const scalar x2 - ) const; - - //- Integrate between two scalar fields and return a field of - // dimensioned type - virtual tmp>> dimIntegrate - ( - const scalarField& x1, - const scalarField& x2 - ) const; - // I/O @@ -228,7 +199,7 @@ public: #ifdef NoRepository # include "DataEntry.C" -# include "DataEntryNew.C" +# include "Constant.H" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C index 6a0269e0e..ee17d0ff0 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "DataEntry.H" +#include "Constant.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -37,24 +37,16 @@ Foam::autoPtr> Foam::DataEntry::New Istream& is(dict.lookup(entryName, false)); token firstToken(is); - word DataEntryType; - if (firstToken.isWord()) + + if (!firstToken.isWord()) { - // Dimensioned type default compatibility - if (firstToken.wordToken() == entryName) - { - DataEntryType = "CompatibilityConstant"; - } - else - { - DataEntryType = firstToken.wordToken(); - } + is.putBack(firstToken); + return autoPtr>(new Constant(entryName, is)); } else { - // DataEntryType = CompatibilityConstant::typeName; - DataEntryType = "CompatibilityConstant"; + DataEntryType = firstToken.wordToken(); } typename dictionaryConstructorTable::iterator cstrIter = @@ -71,7 +63,7 @@ Foam::autoPtr> Foam::DataEntry::New << exit(FatalError); } - return autoPtr>(cstrIter()(entryName, dict)); + return cstrIter()(entryName, dict); } diff --git a/src/OpenFOAM/primitives/functions/DataEntry/PolynomialEntry/PolynomialEntry.C b/src/OpenFOAM/primitives/functions/DataEntry/PolynomialEntry/PolynomialEntry.C index f5d312f7d..c7f30964d 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/PolynomialEntry/PolynomialEntry.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/PolynomialEntry/PolynomialEntry.C @@ -36,19 +36,11 @@ Foam::PolynomialEntry::PolynomialEntry : DataEntry(entryName), coeffs_(), - canIntegrate_(true), - dimensions_(dimless) + canIntegrate_(true) { Istream& is(dict.lookup(entryName)); word entryType(is); - token firstToken(is); - is.putBack(firstToken); - if (firstToken == token::BEGIN_SQR) - { - is >> this->dimensions_; - } - is >> coeffs_; if (!coeffs_.size()) @@ -88,8 +80,7 @@ Foam::PolynomialEntry::PolynomialEntry : DataEntry(entryName), coeffs_(coeffs), - canIntegrate_(true), - dimensions_(dimless) + canIntegrate_(true) { if (!coeffs_.size()) { @@ -124,8 +115,7 @@ Foam::PolynomialEntry::PolynomialEntry(const PolynomialEntry& poly) : DataEntry(poly), coeffs_(poly.coeffs_), - canIntegrate_(poly.canIntegrate_), - dimensions_(poly.dimensions_) + canIntegrate_(poly.canIntegrate_) {} @@ -208,35 +198,8 @@ Type Foam::PolynomialEntry::integrate } -template -Foam::dimensioned Foam::PolynomialEntry::dimValue -( - const scalar x -) const -{ - return dimensioned("dimensionedValue", dimensions_, value(x)); -} - - -template -Foam::dimensioned Foam::PolynomialEntry::dimIntegrate -( - const scalar x1, - const scalar x2 -) const -{ - return dimensioned - ( - "dimensionedValue", - dimensions_, - integrate(x1, x2) - ); -} - - // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // #include "PolynomialEntryIO.C" - // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/DataEntry/PolynomialEntry/PolynomialEntry.H b/src/OpenFOAM/primitives/functions/DataEntry/PolynomialEntry/PolynomialEntry.H index 5bb241154..a2d46fa9a 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/PolynomialEntry/PolynomialEntry.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/PolynomialEntry/PolynomialEntry.H @@ -30,7 +30,7 @@ Description e.g. for an entry \ that describes y = x^2 + 2x^3 \verbatim - polynomial [0 0 1 0 0] // optional dimensions + polynomial ( (1 2) (2 3) @@ -47,7 +47,6 @@ SourceFiles #include "DataEntry.H" #include "Tuple2.H" -#include "dimensionSet.H" #include "DataEntryFwd.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -55,12 +54,8 @@ SourceFiles namespace Foam { -// Forward declaration of classes - -template -class PolynomialEntry; - -// Forward declaration of friend functions +// Forward declaration of friend functions and operators +template class PolynomialEntry; template Ostream& operator<<(Ostream&, const PolynomialEntry&); @@ -81,9 +76,6 @@ class PolynomialEntry //- Flag to indicate whether poly can be integrated bool canIntegrate_; - //- The dimension set - dimensionSet dimensions_; - // Private Member Functions @@ -138,16 +130,6 @@ public: //- Integrate between two (scalar) values Type integrate(const scalar x1, const scalar x2) const; - //- Return dimensioned constant value - dimensioned dimValue(const scalar) const; - - //- Integrate between two values and return dimensioned type - dimensioned dimIntegrate - ( - const scalar x1, - const scalar x2 - ) const; - // I/O diff --git a/src/OpenFOAM/primitives/functions/DataEntry/PolynomialEntry/PolynomialEntryIO.C b/src/OpenFOAM/primitives/functions/DataEntry/PolynomialEntry/PolynomialEntryIO.C index af6dacdb4..0a52a1096 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/PolynomialEntry/PolynomialEntryIO.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/PolynomialEntry/PolynomialEntryIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,20 +34,8 @@ Foam::Ostream& Foam::operator<< const PolynomialEntry& poly ) { - if (os.format() == IOstream::ASCII) - { - os << static_cast& >(poly) - << token::SPACE << poly.coeffs_; - } - else - { - os << static_cast& >(poly); - os.write - ( - reinterpret_cast(&poly.coeffs_), - sizeof(poly.coeffs_) - ); - } + os << static_cast& >(poly) + << token::SPACE << poly.coeffs_; // Check state of Ostream os.check diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.C b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.C index 1e1e0af54..9d0213fa3 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,15 +34,7 @@ Foam::Table::Table(const word& entryName, const dictionary& dict) { Istream& is(dict.lookup(entryName)); word entryType(is); - - token firstToken(is); - is.putBack(firstToken); - if (firstToken == token::BEGIN_SQR) - { - is >> this->dimensions_; - } is >> this->table_; - TableBase::check(); } diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C index e807adad9..1d29170ae 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C @@ -70,8 +70,7 @@ Foam::TableBase::TableBase(const word& name, const dictionary& dict) ( dict.lookupOrDefault("interpolationScheme", "linear") ), - table_(), - dimensions_(dimless) + table_() {} @@ -83,7 +82,6 @@ Foam::TableBase::TableBase(const TableBase& tbl) boundsHandling_(tbl.boundsHandling_), interpolationScheme_(tbl.interpolationScheme_), table_(tbl.table_), - dimensions_(tbl.dimensions_), tableSamplesPtr_(tbl.tableSamplesPtr_), interpolatorPtr_(tbl.interpolatorPtr_) {} @@ -369,29 +367,6 @@ Type Foam::TableBase::integrate(const scalar x1, const scalar x2) const } -template -Foam::dimensioned Foam::TableBase:: -dimValue(const scalar x) const -{ - return dimensioned("dimensionedValue", dimensions_, this->value(x)); -} - - -template -Foam::dimensioned Foam::TableBase::dimIntegrate -( - const scalar x1, const scalar x2 -) const -{ - return dimensioned - ( - "dimensionedValue", - dimensions_, - this->integrate(x2, x1) - ); -} - - template Foam::tmp Foam::TableBase::x() const { diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H index de931ad28..8d127663d 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H @@ -37,7 +37,6 @@ SourceFiles #include "DataEntry.H" #include "Tuple2.H" -#include "dimensionSet.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -95,9 +94,6 @@ protected: //- Table data List> table_; - //- The dimension set - dimensionSet dimensions_; - //- Extracted values mutable autoPtr tableSamplesPtr_; @@ -163,16 +159,6 @@ public: //- Integrate between two (scalar) values virtual Type integrate(const scalar x1, const scalar x2) const; - //- Return dimensioned constant value - virtual dimensioned dimValue(const scalar x) const; - - //- Integrate between two values and return dimensioned type - virtual dimensioned dimIntegrate - ( - const scalar x1, - const scalar x2 - ) const; - //- Return the reference values virtual tmp x() const; diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBaseIO.C b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBaseIO.C index d4f608b8a..79c4e4681 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBaseIO.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBaseIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,19 +35,7 @@ Foam::Ostream& Foam::operator<< ) { os << static_cast&>(tbl); - - if (os.format() == IOstream::ASCII) - { - os << token::SPACE << tbl.table_; - } - else - { - os.write - ( - reinterpret_cast(&tbl.table_), - tbl.table_.byteSize() - ); - } + os << token::SPACE << tbl.table_; // Check state of Ostream os.check diff --git a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.C b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.C index 25ed90dc6..37b89e075 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,11 +36,6 @@ Foam::TableFile::TableFile(const word& entryName, const dictionary& dict) const dictionary coeffs(dict.subDict(entryName + "Coeffs")); coeffs.lookup("fileName") >> fName_; - if (coeffs.found("dimensions")) - { - coeffs.lookup("dimensions") >> this->dimensions_; - } - fileName expandedFile(fName_); IFstream is(expandedFile.expand()); @@ -77,5 +72,4 @@ Foam::TableFile::~TableFile() #include "TableFileIO.C" - // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H index 6f519773f..5d3bb32a6 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H @@ -31,7 +31,6 @@ Description tableFile; Coeffs { - dimensions [0 0 1 0 0]; // optional dimensions fileName dataFile; // name of data file outOfBounds clamp; // optional out-of-bounds handling interpolationScheme linear; // optional interpolation method diff --git a/src/OpenFOAM/primitives/functions/DataEntry/makeDataEntries.C b/src/OpenFOAM/primitives/functions/DataEntry/makeDataEntries.C index 37fc55416..0ebd9b398 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/makeDataEntries.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/makeDataEntries.C @@ -23,11 +23,9 @@ License \*---------------------------------------------------------------------------*/ -#include "CompatibilityConstant.H" #include "Constant.H" #include "PolynomialEntry.H" #include "CSV.H" -#include "DataEntry.H" #include "Table.H" #include "TableFile.H" @@ -41,7 +39,6 @@ License namespace Foam { makeDataEntry(label); - makeDataEntryType(CompatibilityConstant, label); makeDataEntryType(Constant, label); // Polynomial functions and interpolation do evaluate to label @@ -52,7 +49,6 @@ namespace Foam // makeDataEntryType(TableFile, label); makeDataEntry(scalar); - makeDataEntryType(CompatibilityConstant, scalar); makeDataEntryType(Constant, scalar); makeDataEntryType(PolynomialEntry, scalar); makeDataEntryType(CSV, scalar); @@ -60,7 +56,6 @@ namespace Foam makeDataEntryType(TableFile, scalar); makeDataEntry(vector); - makeDataEntryType(CompatibilityConstant, vector); makeDataEntryType(Constant, vector); makeDataEntryType(PolynomialEntry, vector); makeDataEntryType(CSV, vector); @@ -68,7 +63,6 @@ namespace Foam makeDataEntryType(TableFile, vector); makeDataEntry(sphericalTensor); - makeDataEntryType(CompatibilityConstant, sphericalTensor); makeDataEntryType(Constant, sphericalTensor); makeDataEntryType(PolynomialEntry, sphericalTensor); makeDataEntryType(CSV, sphericalTensor); @@ -76,7 +70,6 @@ namespace Foam makeDataEntryType(TableFile, sphericalTensor); makeDataEntry(symmTensor); - makeDataEntryType(CompatibilityConstant, symmTensor); makeDataEntryType(Constant, symmTensor); makeDataEntryType(PolynomialEntry, symmTensor); makeDataEntryType(CSV, symmTensor); @@ -84,7 +77,6 @@ namespace Foam makeDataEntryType(TableFile, symmTensor); makeDataEntry(tensor); - makeDataEntryType(CompatibilityConstant, tensor); makeDataEntryType(Constant, tensor); makeDataEntryType(PolynomialEntry, tensor); makeDataEntryType(CSV, tensor);