Commit 69243fda authored by Henry Weller's avatar Henry Weller
Browse files

OpenFOAM/primitives/functions/DataEntry/Table: Removed unnecessary multiple inheritance

This resolves issues with and complexities in the virtual function inheritance
parent 94401af0
......@@ -203,7 +203,6 @@ Foam::CSV<Type>::CSV
const word& ext
)
:
DataEntry<Type>(entryName),
TableBase<Type>(entryName, dict.subDict(entryName + ext)),
coeffs_(dict.subDict(entryName + ext)),
nHeaderLine_(readLabel(coeffs_.lookup("nHeaderLine"))),
......@@ -230,7 +229,6 @@ Foam::CSV<Type>::CSV
template<class Type>
Foam::CSV<Type>::CSV(const CSV<Type>& tbl)
:
DataEntry<Type>(tbl),
TableBase<Type>(tbl),
nHeaderLine_(tbl.nHeaderLine_),
refColumn_(tbl.refColumn_),
......
......@@ -79,7 +79,6 @@ Ostream& operator<<
template<class Type>
class CSV
:
public DataEntry<Type>,
public TableBase<Type>
{
// Private data
......@@ -150,52 +149,12 @@ public:
// Member Functions
// Manipulation
//- Convert time
virtual void convertTimeBase(const Time& t)
{
TableBase<Type>::convertTimeBase(t);
}
// Access
//- Return const access to the file name
virtual const fileName& fName() const;
// Evaluation
//- Return Table value
virtual Type value(const scalar x) const
{
return TableBase<Type>::value(x);
}
//- Integrate between two (scalar) values
virtual Type integrate(const scalar x1, const scalar x2) const
{
return TableBase<Type>::integrate(x1, x2);
}
//- Return dimensioned constant value
virtual dimensioned<Type> dimValue(const scalar x) const
{
return TableBase<Type>::dimValue(x);
}
//- Integrate between two values and return dimensioned type
virtual dimensioned<Type> dimIntegrate
(
const scalar x1,
const scalar x2
) const
{
return TableBase<Type>::dimIntegrate(x1, x2);
}
// I/O
//- Ostream Operator
......
......@@ -30,7 +30,6 @@ License
template<class Type>
Foam::Table<Type>::Table(const word& entryName, const dictionary& dict)
:
DataEntry<Type>(entryName),
TableBase<Type>(entryName, dict)
{
Istream& is(dict.lookup(entryName));
......@@ -51,7 +50,6 @@ Foam::Table<Type>::Table(const word& entryName, const dictionary& dict)
template<class Type>
Foam::Table<Type>::Table(const Table<Type>& tbl)
:
DataEntry<Type>(tbl),
TableBase<Type>(tbl)
{}
......@@ -63,9 +61,4 @@ Foam::Table<Type>::~Table()
{}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
#include "TableIO.C"
// ************************************************************************* //
......@@ -70,7 +70,6 @@ Ostream& operator<<
template<class Type>
class Table
:
public DataEntry<Type>,
public TableBase<Type>
{
// Private Member Functions
......@@ -102,42 +101,6 @@ public:
//- Destructor
virtual ~Table();
// Member Functions
// Manipulation
//- Inherit convertTimeBase from TableBase
using TableBase<Type>::convertTimeBase;
// Evaluation
//- Inherit value from TableBase
using TableBase<Type>::value;
//- Inherit integrate from TableBase
using TableBase<Type>::integrate;
//- Inherit dimValue from TableBase
using TableBase<Type>::dimValue;
//- Inherit dimIntegrate from TableBase
using TableBase<Type>::dimIntegrate;
// I/O
//- Ostream Operator
friend Ostream& operator<< <Type>
(
Ostream& os,
const Table<Type>& tbl
);
//- Write in dictionary format
virtual void writeData(Ostream& os) const;
};
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -57,6 +57,7 @@ const Foam::interpolationWeights& Foam::TableBase<Type>::interpolator() const
template<class Type>
Foam::TableBase<Type>::TableBase(const word& name, const dictionary& dict)
:
DataEntry<Type>(name),
name_(name),
boundsHandling_
(
......@@ -77,6 +78,7 @@ Foam::TableBase<Type>::TableBase(const word& name, const dictionary& dict)
template<class Type>
Foam::TableBase<Type>::TableBase(const TableBase<Type>& tbl)
:
DataEntry<Type>(tbl),
name_(tbl.name_),
boundsHandling_(tbl.boundsHandling_),
interpolationScheme_(tbl.interpolationScheme_),
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -62,6 +62,8 @@ class interpolationWeights;
template<class Type>
class TableBase
:
public DataEntry<Type>
{
public:
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -34,6 +34,8 @@ Foam::Ostream& Foam::operator<<
const TableBase<Type>& tbl
)
{
os << static_cast<const DataEntry<Type>&>(tbl);
if (os.format() == IOstream::ASCII)
{
os << token::SPACE << tbl.table_;
......@@ -60,6 +62,7 @@ Foam::Ostream& Foam::operator<<
template<class Type>
void Foam::TableBase<Type>::writeData(Ostream& os) const
{
DataEntry<Type>::writeData(os);
os << nl << indent << table_ << token::END_STATEMENT << nl;
writeEntries(os);
}
......
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "DataEntry.H"
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const Table<Type>& tbl
)
{
os << static_cast<const DataEntry<Type>&>(tbl)
<< static_cast<const TableBase<Type>&>(tbl);
// Check state of Ostream
os.check
(
"Ostream& operator<<(Ostream&, const Table<Type>&)"
);
return os;
}
template<class Type>
void Foam::Table<Type>::writeData(Ostream& os) const
{
DataEntry<Type>::writeData(os);
TableBase<Type>::writeData(os);
}
// ************************************************************************* //
......@@ -30,7 +30,6 @@ License
template<class Type>
Foam::TableFile<Type>::TableFile(const word& entryName, const dictionary& dict)
:
DataEntry<Type>(entryName),
TableBase<Type>(entryName, dict.subDict(entryName + "Coeffs")),
fName_("none")
{
......@@ -63,7 +62,6 @@ Foam::TableFile<Type>::TableFile(const word& entryName, const dictionary& dict)
template<class Type>
Foam::TableFile<Type>::TableFile(const TableFile<Type>& tbl)
:
DataEntry<Type>(tbl),
TableBase<Type>(tbl),
fName_(tbl.fName_)
{}
......
......@@ -82,7 +82,6 @@ Ostream& operator<<
template<class Type>
class TableFile
:
public DataEntry<Type>,
public TableBase<Type>
{
// Private data
......@@ -122,38 +121,8 @@ public:
virtual ~TableFile();
// Member Functions
// Manipulation
//- Inherit convertTimeBase from TableBase
using TableBase<Type>::convertTimeBase;
// Evaluation
//- Inherit value from TableBase
using TableBase<Type>::value;
//- Inherit integrate from TableBase
using TableBase<Type>::integrate;
//- Inherit dimValue from TableBase
using TableBase<Type>::dimValue;
//- Inherit dimIntegrate from TableBase
using TableBase<Type>::dimIntegrate;
// I/O
//- Ostream Operator
friend Ostream& operator<< <Type>
(
Ostream& os,
const TableFile<Type>& tbl
);
//- Write in dictionary format
virtual void writeData(Ostream& os) const;
};
......
......@@ -27,26 +27,6 @@ License
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const TableFile<Type>& tbl
)
{
os << static_cast<const DataEntry<Type>&>(tbl)
<< static_cast<const TableBase<Type>&>(tbl);
// Check state of Ostream
os.check
(
"Ostream& operator<<(Ostream&, const TableFile<Type>&)"
);
return os;
}
template<class Type>
void Foam::TableFile<Type>::writeData(Ostream& os) const
{
......
Supports Markdown
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