diff --git a/src/OpenFOAM/primitives/functions/DataEntry/CompatibilityConstant/CompatibilityConstant.C b/src/OpenFOAM/primitives/functions/DataEntry/CompatibilityConstant/CompatibilityConstant.C
new file mode 100644
index 0000000000..205b4b5732
--- /dev/null
+++ b/src/OpenFOAM/primitives/functions/DataEntry/CompatibilityConstant/CompatibilityConstant.C
@@ -0,0 +1,86 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / 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 "CompatibilityConstant.H"
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+template
+Foam::CompatibilityConstant::CompatibilityConstant
+(
+ const word& entryName, const dictionary& dict
+)
+:
+ DataEntry(entryName),
+ value_(pTraits::zero)
+{
+ dict.lookup(entryName) >> value_;
+}
+
+
+template
+Foam::CompatibilityConstant::CompatibilityConstant
+(
+ const CompatibilityConstant& cnst
+)
+:
+ DataEntry(cnst),
+ value_(cnst.value_)
+{}
+
+
+// * * * * * * * * * * * * * * * * 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_;
+}
+
+
+// * * * * * * * * * * * * * * 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
new file mode 100644
index 0000000000..9e2f46bb20
--- /dev/null
+++ b/src/OpenFOAM/primitives/functions/DataEntry/CompatibilityConstant/CompatibilityConstant.H
@@ -0,0 +1,143 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / 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 .
+
+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"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+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_;
+
+
+ // 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;
+
+
+ // 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
new file mode 100644
index 0000000000..4cb72ab8c2
--- /dev/null
+++ b/src/OpenFOAM/primitives/functions/DataEntry/CompatibilityConstant/CompatibilityConstantIO.C
@@ -0,0 +1,69 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / 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/DataEntry/DataEntryNew.C b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C
index 57cf79c419..b43eed2d6e 100644
--- a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C
+++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C
@@ -35,17 +35,29 @@ Foam::autoPtr > Foam::DataEntry::New
)
{
Istream& is(dict.lookup(entryName));
- word DataEntryType(is);
+
+ token firstToken(is);
+
+ word DataEntryType;
+ if (firstToken.isWord())
+ {
+ DataEntryType = firstToken.wordToken();
+ }
+ else
+ {
+ is.putBack(firstToken);
+// DataEntryType = CompatibilityConstant::typeName;
+ DataEntryType = "CompatibilityConstant";
+ }
+
typename dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(DataEntryType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
- FatalErrorIn
- (
- "DataEntry::New(Istream&)"
- ) << "Unknown DataEntry type "
+ FatalErrorIn("DataEntry::New(const word&, const dictionary&)")
+ << "Unknown DataEntry type "
<< DataEntryType << " for DataEntry "
<< entryName << nl << nl
<< "Valid DataEntry types are:" << nl
diff --git a/src/OpenFOAM/primitives/functions/DataEntry/makeDataEntries.C b/src/OpenFOAM/primitives/functions/DataEntry/makeDataEntries.C
index d443fb9b76..78935f0b80 100644
--- a/src/OpenFOAM/primitives/functions/DataEntry/makeDataEntries.C
+++ b/src/OpenFOAM/primitives/functions/DataEntry/makeDataEntries.C
@@ -23,6 +23,7 @@ License
\*---------------------------------------------------------------------------*/
+#include "CompatibilityConstant.H"
#include "Constant.H"
#include "CSV.H"
#include "DataEntry.H"
@@ -39,36 +40,42 @@ License
namespace Foam
{
makeDataEntry(label);
+ makeDataEntryType(CompatibilityConstant, label);
makeDataEntryType(Constant, label);
// makeDataEntryType(CSV, label);
makeDataEntryType(Table, label);
makeDataEntryType(TableFile, label);
makeDataEntry(scalar);
+ makeDataEntryType(CompatibilityConstant, scalar);
makeDataEntryType(Constant, scalar);
makeDataEntryType(CSV, scalar);
makeDataEntryType(Table, scalar);
makeDataEntryType(TableFile, scalar);
makeDataEntry(vector);
+ makeDataEntryType(CompatibilityConstant, vector);
makeDataEntryType(Constant, vector);
makeDataEntryType(CSV, vector);
makeDataEntryType(Table, vector);
makeDataEntryType(TableFile, vector);
makeDataEntry(sphericalTensor);
+ makeDataEntryType(CompatibilityConstant, sphericalTensor);
makeDataEntryType(Constant, sphericalTensor);
makeDataEntryType(CSV, sphericalTensor);
makeDataEntryType(Table, sphericalTensor);
makeDataEntryType(TableFile, sphericalTensor);
makeDataEntry(symmTensor);
+ makeDataEntryType(CompatibilityConstant, symmTensor);
makeDataEntryType(Constant, symmTensor);
makeDataEntryType(CSV, symmTensor);
makeDataEntryType(Table, symmTensor);
makeDataEntryType(TableFile, symmTensor);
makeDataEntry(tensor);
+ makeDataEntryType(CompatibilityConstant, tensor);
makeDataEntryType(Constant, tensor);
makeDataEntryType(CSV, tensor);
makeDataEntryType(Table, tensor);