Skip to content
Snippets Groups Projects
Commit 3b62098b authored by andy's avatar andy
Browse files

ENH: Updated polynomial DataEntry - related to mantis bug #607

parent 3294238e
Branches
Tags
No related merge requests found
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef DataEntryFws_H
#define DataEntryFws_H
#include "DataEntry.H"
#include "vector.H"
#include "symmTensor.H"
#include "sphericalTensor.H"
#include "tensor.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef DataEntry<label> labelDataEntry;
typedef DataEntry<scalar> scalarDataEntry;
typedef DataEntry<vector> vectorDataEntry;
typedef DataEntry<symmTensor> symmTensorDataEntry;
typedef DataEntry<sphericalTensor> sphericalTensorDataEntry;
typedef DataEntry<tensor> tensorDataEntry;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
......@@ -25,14 +25,14 @@ License
#include "polynomial.H"
#include "Time.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(polynomial, 0);
DataEntry<scalar>::adddictionaryConstructorToTable<polynomial>
addpolynomialConstructorToTable_;
addToRunTimeSelectionTable(scalarDataEntry, polynomial, dictionary);
}
......@@ -40,7 +40,7 @@ namespace Foam
Foam::polynomial::polynomial(const word& entryName, const dictionary& dict)
:
DataEntry<scalar>(entryName),
scalarDataEntry(entryName),
coeffs_(),
canIntegrate_(true),
dimensions_(dimless)
......@@ -52,15 +52,17 @@ Foam::polynomial::polynomial(const word& entryName, const dictionary& dict)
is.putBack(firstToken);
if (firstToken == token::BEGIN_SQR)
{
is >> this->dimensions_;
is >> this->dimensions_;
}
is >> coeffs_;
if (!coeffs_.size())
{
FatalErrorIn("Foam::polynomial::polynomial(const word&, dictionary&)")
<< "polynomial coefficients for entry " << this->name_
FatalErrorIn
(
"Foam::polynomial::polynomial(const word&, const dictionary&)"
) << "polynomial coefficients for entry " << this->name_
<< " are invalid (empty)" << nl << exit(FatalError);
}
......@@ -77,8 +79,10 @@ Foam::polynomial::polynomial(const word& entryName, const dictionary& dict)
{
if (!canIntegrate_)
{
WarningIn("Foam::polynomial::polynomial(const word&, dictionary&)")
<< "Polynomial " << this->name_ << " cannot be integrated"
WarningIn
(
"Foam::polynomial::polynomial(const word&, const dictionary&)"
) << "Polynomial " << this->name_ << " cannot be integrated"
<< endl;
}
}
......@@ -91,7 +95,7 @@ Foam::polynomial::polynomial
const List<Tuple2<scalar, scalar> >& coeffs
)
:
DataEntry<scalar>(entryName),
scalarDataEntry(entryName),
coeffs_(coeffs),
canIntegrate_(true),
dimensions_(dimless)
......@@ -101,7 +105,7 @@ Foam::polynomial::polynomial
FatalErrorIn
(
"Foam::polynomial::polynomial"
"(const word&, const List<Tuple2<scalar, scalar> >&&)"
"(const word&, const List<Tuple2<scalar, scalar> >&)"
) << "polynomial coefficients for entry " << this->name_
<< " are invalid (empty)" << nl << exit(FatalError);
}
......@@ -122,7 +126,7 @@ Foam::polynomial::polynomial
WarningIn
(
"Foam::polynomial::polynomial"
"(const word&, const List<Tuple2<scalar, scalar> >&&)"
"(const word&, const List<Tuple2<scalar, scalar> >&)"
) << "Polynomial " << this->name_ << " cannot be integrated"
<< endl;
}
......@@ -132,7 +136,7 @@ Foam::polynomial::polynomial
Foam::polynomial::polynomial(const polynomial& poly)
:
DataEntry<scalar>(poly),
scalarDataEntry(poly),
coeffs_(poly.coeffs_),
canIntegrate_(poly.canIntegrate_),
dimensions_(poly.dimensions_)
......@@ -201,7 +205,8 @@ Foam::dimensioned<Foam::scalar> Foam::polynomial::dimValue
Foam::dimensioned<Foam::scalar> Foam::polynomial::dimIntegrate
(
const scalar x1, const scalar x2
const scalar x1,
const scalar x2
) const
{
return dimensioned<scalar>
......@@ -212,4 +217,5 @@ Foam::dimensioned<Foam::scalar> Foam::polynomial::dimIntegrate
);
}
// ************************************************************************* //
......@@ -48,6 +48,7 @@ SourceFiles
#include "DataEntry.H"
#include "Tuple2.H"
#include "dimensionSet.H"
#include "DataEntryFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -70,7 +71,7 @@ Ostream& operator<<
class polynomial
:
public DataEntry<scalar>
public scalarDataEntry
{
// Private data
......@@ -107,9 +108,9 @@ public:
polynomial(const polynomial& poly);
//- Construct and return a clone
virtual tmp<DataEntry<scalar> > clone() const
virtual tmp<scalarDataEntry> clone() const
{
return tmp<DataEntry<scalar> >(new polynomial(*this));
return tmp<scalarDataEntry>(new polynomial(*this));
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment