DataEntry: Created the DataEntryTypes namespace for all the concrete DataEntry types

to avoid name conflicts with these primitive names in the OpenFOAM namespace
This commit is contained in:
Henry Weller
2016-02-07 13:32:38 +00:00
parent e9a2848232
commit d1387a8563
22 changed files with 231 additions and 159 deletions

View File

@ -135,7 +135,7 @@ int main(int argc, char *argv[])
#include "createFields.H"
Info<< "Reading data file" << endl;
CSV<scalar> pData("pressure", dict, "Data");
DataEntryTypes::CSV<scalar> pData("pressure", dict, "Data");
// time history data
const scalarField t(pData.x());

View File

@ -29,63 +29,67 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
namespace Foam
template<>
Foam::label Foam::DataEntryTypes::CSV<Foam::label>::readValue
(
const List<string>& splitted
)
{
template<>
label CSV<label>::readValue(const List<string>& splitted)
if (componentColumns_[0] >= splitted.size())
{
if (componentColumns_[0] >= splitted.size())
{
FatalErrorInFunction
<< "No column " << componentColumns_[0] << " in "
<< splitted << endl
<< exit(FatalError);
}
return readLabel(IStringStream(splitted[componentColumns_[0]])());
FatalErrorInFunction
<< "No column " << componentColumns_[0] << " in "
<< splitted << endl
<< exit(FatalError);
}
template<>
scalar CSV<scalar>::readValue(const List<string>& splitted)
{
if (componentColumns_[0] >= splitted.size())
{
FatalErrorInFunction
<< "No column " << componentColumns_[0] << " in "
<< splitted << endl
<< exit(FatalError);
}
return readLabel(IStringStream(splitted[componentColumns_[0]])());
}
return readScalar(IStringStream(splitted[componentColumns_[0]])());
template<>
Foam::scalar Foam::DataEntryTypes::CSV<Foam::scalar>::readValue
(
const List<string>& splitted
)
{
if (componentColumns_[0] >= splitted.size())
{
FatalErrorInFunction
<< "No column " << componentColumns_[0] << " in "
<< splitted << endl
<< exit(FatalError);
}
template<class Type>
Type CSV<Type>::readValue(const List<string>& splitted)
{
Type result;
for (label i = 0; i < pTraits<Type>::nComponents; i++)
{
if (componentColumns_[i] >= splitted.size())
{
FatalErrorInFunction
<< "No column " << componentColumns_[i] << " in "
<< splitted << endl
<< exit(FatalError);
}
result[i] =
readScalar(IStringStream(splitted[componentColumns_[i]])());
}
return result;
}
return readScalar(IStringStream(splitted[componentColumns_[0]])());
}
template<class Type>
void Foam::CSV<Type>::read()
Type Foam::DataEntryTypes::CSV<Type>::readValue(const List<string>& splitted)
{
Type result;
for (label i = 0; i < pTraits<Type>::nComponents; i++)
{
if (componentColumns_[i] >= splitted.size())
{
FatalErrorInFunction
<< "No column " << componentColumns_[i] << " in "
<< splitted << endl
<< exit(FatalError);
}
result[i] =
readScalar(IStringStream(splitted[componentColumns_[i]])());
}
return result;
}
template<class Type>
void Foam::DataEntryTypes::CSV<Type>::read()
{
fileName expandedFile(fName_);
IFstream is(expandedFile.expand());
@ -196,7 +200,7 @@ void Foam::CSV<Type>::read()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::CSV<Type>::CSV
Foam::DataEntryTypes::CSV<Type>::CSV
(
const word& entryName,
const dictionary& dict,
@ -227,7 +231,7 @@ Foam::CSV<Type>::CSV
template<class Type>
Foam::CSV<Type>::CSV(const CSV<Type>& tbl)
Foam::DataEntryTypes::CSV<Type>::CSV(const CSV<Type>& tbl)
:
TableBase<Type>(tbl),
nHeaderLine_(tbl.nHeaderLine_),
@ -242,14 +246,14 @@ Foam::CSV<Type>::CSV(const CSV<Type>& tbl)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::CSV<Type>::~CSV()
Foam::DataEntryTypes::CSV<Type>::~CSV()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
const Foam::fileName& Foam::CSV<Type>::fName() const
const Foam::fileName& Foam::DataEntryTypes::CSV<Type>::fName() const
{
return fName_;
}

View File

@ -62,15 +62,17 @@ SourceFiles
namespace Foam
{
template<class Type>
class CSV;
// Forward declaration of friend functions and operators
namespace DataEntryTypes
{
template<class Type> class CSV;
};
template<class Type>
Ostream& operator<<
(
Ostream&,
const CSV<Type>&
);
Ostream& operator<<(Ostream&, const DataEntryTypes::CSV<Type>&);
namespace DataEntryTypes
{
/*---------------------------------------------------------------------------*\
Class CSV Declaration
@ -169,8 +171,16 @@ public:
};
template<>
label CSV<label>::readValue(const List<string>& splitted);
template<>
Foam::scalar CSV<scalar>::readValue(const List<string>& splitted);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace DataEntryTypes
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -31,7 +31,7 @@ template<class Type>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const CSV<Type>& tbl
const DataEntryTypes::CSV<Type>& tbl
)
{
os << static_cast<const DataEntry<Type>& >(tbl)
@ -50,7 +50,7 @@ Foam::Ostream& Foam::operator<<
template<class Type>
void Foam::CSV<Type>::writeData(Ostream& os) const
void Foam::DataEntryTypes::CSV<Type>::writeData(Ostream& os) const
{
DataEntry<Type>::writeData(os);
os << token::END_STATEMENT << nl;

View File

@ -28,7 +28,11 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::Constant<Type>::Constant(const word& entryName, const dictionary& dict)
Foam::DataEntryTypes::Constant<Type>::Constant
(
const word& entryName,
const dictionary& dict
)
:
DataEntry<Type>(entryName),
value_(pTraits<Type>::zero)
@ -40,7 +44,11 @@ Foam::Constant<Type>::Constant(const word& entryName, const dictionary& dict)
template<class Type>
Foam::Constant<Type>::Constant(const word& entryName, Istream& is)
Foam::DataEntryTypes::Constant<Type>::Constant
(
const word& entryName,
Istream& is
)
:
DataEntry<Type>(entryName),
value_(pTraits<Type>(is))
@ -48,7 +56,7 @@ Foam::Constant<Type>::Constant(const word& entryName, Istream& is)
template<class Type>
Foam::Constant<Type>::Constant(const Constant<Type>& cnst)
Foam::DataEntryTypes::Constant<Type>::Constant(const Constant<Type>& cnst)
:
DataEntry<Type>(cnst),
value_(cnst.value_)
@ -58,21 +66,25 @@ Foam::Constant<Type>::Constant(const Constant<Type>& cnst)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::Constant<Type>::~Constant()
Foam::DataEntryTypes::Constant<Type>::~Constant()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Type Foam::Constant<Type>::value(const scalar x) const
Type Foam::DataEntryTypes::Constant<Type>::value(const scalar x) const
{
return value_;
}
template<class Type>
Type Foam::Constant<Type>::integrate(const scalar x1, const scalar x2) const
Type Foam::DataEntryTypes::Constant<Type>::integrate
(
const scalar x1,
const scalar x2
) const
{
return (x2 - x1)*value_;
}

View File

@ -48,8 +48,16 @@ namespace Foam
{
// Forward declaration of friend functions and operators
template<class Type> class Constant;
template<class Type> Ostream& operator<<(Ostream&, const Constant<Type>&);
namespace DataEntryTypes
{
template<class Type> class Constant;
};
template<class Type>
Ostream& operator<<(Ostream&, const DataEntryTypes::Constant<Type>&);
namespace DataEntryTypes
{
/*---------------------------------------------------------------------------*\
Class Constant Declaration
@ -127,6 +135,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace DataEntryTypes
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -31,7 +31,7 @@ template<class Type>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const Constant<Type>& cnst
const DataEntryTypes::Constant<Type>& cnst
)
{
os << static_cast<const DataEntry<Type>& >(cnst)
@ -48,7 +48,7 @@ Foam::Ostream& Foam::operator<<
template<class Type>
void Foam::Constant<Type>::writeData(Ostream& os) const
void Foam::DataEntryTypes::Constant<Type>::writeData(Ostream& os) const
{
DataEntry<Type>::writeData(os);

View File

@ -189,9 +189,9 @@ public:
#define makeDataEntryType(SS, Type) \
\
defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
defineNamedTemplateTypeNameAndDebug(DataEntryTypes::SS<Type>, 0); \
\
DataEntry<Type>::adddictionaryConstructorToTable<SS<Type>> \
DataEntry<Type>::adddictionaryConstructorToTable<DataEntryTypes::SS<Type>> \
add##SS##Type##ConstructorToTable_;

View File

@ -42,7 +42,10 @@ Foam::autoPtr<Foam::DataEntry<Type>> Foam::DataEntry<Type>::New
if (!firstToken.isWord())
{
is.putBack(firstToken);
return autoPtr<DataEntry<Type>>(new Constant<Type>(entryName, is));
return autoPtr<DataEntry<Type>>
(
new DataEntryTypes::Constant<Type>(entryName, is)
);
}
else
{

View File

@ -28,7 +28,7 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::PolynomialEntry<Type>::PolynomialEntry
Foam::DataEntryTypes::Polynomial<Type>::Polynomial
(
const word& entryName,
const dictionary& dict
@ -46,7 +46,7 @@ Foam::PolynomialEntry<Type>::PolynomialEntry
if (!coeffs_.size())
{
FatalErrorInFunction
<< "PolynomialEntry coefficients for entry " << this->name_
<< "Polynomial coefficients for entry " << this->name_
<< " are invalid (empty)" << nl << exit(FatalError);
}
@ -64,7 +64,7 @@ Foam::PolynomialEntry<Type>::PolynomialEntry
if (!canIntegrate_)
{
WarningInFunction
<< "PolynomialEntry " << this->name_ << " cannot be integrated"
<< "Polynomial " << this->name_ << " cannot be integrated"
<< endl;
}
}
@ -72,7 +72,7 @@ Foam::PolynomialEntry<Type>::PolynomialEntry
template<class Type>
Foam::PolynomialEntry<Type>::PolynomialEntry
Foam::DataEntryTypes::Polynomial<Type>::Polynomial
(
const word& entryName,
const List<Tuple2<Type, Type>>& coeffs
@ -85,7 +85,7 @@ Foam::PolynomialEntry<Type>::PolynomialEntry
if (!coeffs_.size())
{
FatalErrorInFunction
<< "PolynomialEntry coefficients for entry " << this->name_
<< "Polynomial coefficients for entry " << this->name_
<< " are invalid (empty)" << nl << exit(FatalError);
}
@ -103,7 +103,7 @@ Foam::PolynomialEntry<Type>::PolynomialEntry
if (!canIntegrate_)
{
WarningInFunction
<< "PolynomialEntry " << this->name_ << " cannot be integrated"
<< "Polynomial " << this->name_ << " cannot be integrated"
<< endl;
}
}
@ -111,7 +111,7 @@ Foam::PolynomialEntry<Type>::PolynomialEntry
template<class Type>
Foam::PolynomialEntry<Type>::PolynomialEntry(const PolynomialEntry& poly)
Foam::DataEntryTypes::Polynomial<Type>::Polynomial(const Polynomial& poly)
:
DataEntry<Type>(poly),
coeffs_(poly.coeffs_),
@ -122,14 +122,14 @@ Foam::PolynomialEntry<Type>::PolynomialEntry(const PolynomialEntry& poly)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::PolynomialEntry<Type>::~PolynomialEntry()
Foam::DataEntryTypes::Polynomial<Type>::~Polynomial()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::PolynomialEntry<Type>::convertTimeBase(const Time& t)
void Foam::DataEntryTypes::Polynomial<Type>::convertTimeBase(const Time& t)
{
forAll(coeffs_, i)
{
@ -144,7 +144,7 @@ void Foam::PolynomialEntry<Type>::convertTimeBase(const Time& t)
template<class Type>
Type Foam::PolynomialEntry<Type>::value(const scalar x) const
Type Foam::DataEntryTypes::Polynomial<Type>::value(const scalar x) const
{
Type y(pTraits<Type>::zero);
forAll(coeffs_, i)
@ -161,7 +161,7 @@ Type Foam::PolynomialEntry<Type>::value(const scalar x) const
template<class Type>
Type Foam::PolynomialEntry<Type>::integrate
Type Foam::DataEntryTypes::Polynomial<Type>::integrate
(
const scalar x1,
const scalar x2

View File

@ -55,22 +55,29 @@ namespace Foam
{
// Forward declaration of friend functions and operators
template<class Type> class PolynomialEntry;
namespace DataEntryTypes
{
template<class Type> class Polynomial;
};
template<class Type>
Ostream& operator<<(Ostream&, const PolynomialEntry<Type>&);
Ostream& operator<<(Ostream&, const DataEntryTypes::Polynomial<Type>&);
namespace DataEntryTypes
{
/*---------------------------------------------------------------------------*\
Class PolynomialEntry Declaration
Class Polynomial Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class PolynomialEntry
class Polynomial
:
public DataEntry<Type>
{
// Private data
//- PolynomialEntry coefficients - list of prefactor, exponent
//- Polynomial coefficients - list of prefactor, exponent
List<Tuple2<Type, Type>> coeffs_;
//- Flag to indicate whether poly can be integrated
@ -80,7 +87,7 @@ class PolynomialEntry
// Private Member Functions
//- Disallow default bitwise assignment
void operator=(const PolynomialEntry<Type>&);
void operator=(const Polynomial<Type>&);
public:
@ -91,27 +98,27 @@ public:
// Constructors
PolynomialEntry(const word& entryName, const dictionary& dict);
Polynomial(const word& entryName, const dictionary& dict);
//- Construct from components
PolynomialEntry
Polynomial
(
const word& entryName,
const List<Tuple2<Type, Type>>&
);
//- Copy constructor
PolynomialEntry(const PolynomialEntry& poly);
Polynomial(const Polynomial& poly);
//- Construct and return a clone
virtual tmp<DataEntry<Type>> clone() const
{
return tmp<DataEntry<Type>>(new PolynomialEntry(*this));
return tmp<DataEntry<Type>>(new Polynomial(*this));
}
//- Destructor
virtual ~PolynomialEntry();
virtual ~Polynomial();
// Member Functions
@ -124,7 +131,7 @@ public:
// Evaluation
//- Return PolynomialEntry value
//- Return Polynomial value
Type value(const scalar x) const;
//- Integrate between two (scalar) values
@ -137,7 +144,7 @@ public:
friend Ostream& operator<< <Type>
(
Ostream& os,
const PolynomialEntry<Type>& cnst
const Polynomial<Type>& cnst
);
//- Write in dictionary format
@ -147,6 +154,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace DataEntryTypes
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -31,7 +31,7 @@ template<class Type>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const PolynomialEntry<Type>& poly
const DataEntryTypes::Polynomial<Type>& poly
)
{
os << static_cast<const DataEntry<Type>& >(poly)
@ -40,7 +40,7 @@ Foam::Ostream& Foam::operator<<
// Check state of Ostream
os.check
(
"Ostream& operator<<(Ostream&, const PolynomialEntry&)"
"Ostream& operator<<(Ostream&, const Polynomial&)"
);
return os;
@ -48,7 +48,7 @@ Foam::Ostream& Foam::operator<<
template<class Type>
void Foam::PolynomialEntry<Type>::writeData(Ostream& os) const
void Foam::DataEntryTypes::Polynomial<Type>::writeData(Ostream& os) const
{
DataEntry<Type>::writeData(os);

View File

@ -28,7 +28,11 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::Table<Type>::Table(const word& entryName, const dictionary& dict)
Foam::DataEntryTypes::Table<Type>::Table
(
const word& entryName,
const dictionary& dict
)
:
TableBase<Type>(entryName, dict)
{
@ -40,7 +44,7 @@ Foam::Table<Type>::Table(const word& entryName, const dictionary& dict)
template<class Type>
Foam::Table<Type>::Table(const Table<Type>& tbl)
Foam::DataEntryTypes::Table<Type>::Table(const Table<Type>& tbl)
:
TableBase<Type>(tbl)
{}
@ -49,7 +53,7 @@ Foam::Table<Type>::Table(const Table<Type>& tbl)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::Table<Type>::~Table()
Foam::DataEntryTypes::Table<Type>::~Table()
{}

View File

@ -53,15 +53,17 @@ SourceFiles
namespace Foam
{
template<class Type>
class Table;
// Forward declaration of friend functions and operators
namespace DataEntryTypes
{
template<class Type> class Table;
};
template<class Type>
Ostream& operator<<
(
Ostream&,
const Table<Type>&
);
Ostream& operator<<(Ostream&, const DataEntryTypes::Table<Type>&);
namespace DataEntryTypes
{
/*---------------------------------------------------------------------------*\
Class Table Declaration
@ -106,6 +108,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace DataEntryTypes
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -30,7 +30,8 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
const Foam::interpolationWeights& Foam::TableBase<Type>::interpolator() const
const Foam::interpolationWeights&
Foam::DataEntryTypes::TableBase<Type>::interpolator() const
{
if (interpolatorPtr_.empty())
{
@ -55,7 +56,11 @@ const Foam::interpolationWeights& Foam::TableBase<Type>::interpolator() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::TableBase<Type>::TableBase(const word& name, const dictionary& dict)
Foam::DataEntryTypes::TableBase<Type>::TableBase
(
const word& name,
const dictionary& dict
)
:
DataEntry<Type>(name),
name_(name),
@ -75,7 +80,7 @@ Foam::TableBase<Type>::TableBase(const word& name, const dictionary& dict)
template<class Type>
Foam::TableBase<Type>::TableBase(const TableBase<Type>& tbl)
Foam::DataEntryTypes::TableBase<Type>::TableBase(const TableBase<Type>& tbl)
:
DataEntry<Type>(tbl),
name_(tbl.name_),
@ -90,14 +95,14 @@ Foam::TableBase<Type>::TableBase(const TableBase<Type>& tbl)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::TableBase<Type>::~TableBase()
Foam::DataEntryTypes::TableBase<Type>::~TableBase()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::word Foam::TableBase<Type>::boundsHandlingToWord
Foam::word Foam::DataEntryTypes::TableBase<Type>::boundsHandlingToWord
(
const boundsHandling& bound
) const
@ -133,8 +138,8 @@ Foam::word Foam::TableBase<Type>::boundsHandlingToWord
template<class Type>
typename Foam::TableBase<Type>::boundsHandling
Foam::TableBase<Type>::wordToBoundsHandling
typename Foam::DataEntryTypes::TableBase<Type>::boundsHandling
Foam::DataEntryTypes::TableBase<Type>::wordToBoundsHandling
(
const word& bound
) const
@ -167,8 +172,8 @@ Foam::TableBase<Type>::wordToBoundsHandling
template<class Type>
typename Foam::TableBase<Type>::boundsHandling
Foam::TableBase<Type>::outOfBounds
typename Foam::DataEntryTypes::TableBase<Type>::boundsHandling
Foam::DataEntryTypes::TableBase<Type>::outOfBounds
(
const boundsHandling& bound
)
@ -181,7 +186,7 @@ Foam::TableBase<Type>::outOfBounds
template<class Type>
void Foam::TableBase<Type>::check() const
void Foam::DataEntryTypes::TableBase<Type>::check() const
{
if (!table_.size())
{
@ -210,7 +215,7 @@ void Foam::TableBase<Type>::check() const
template<class Type>
bool Foam::TableBase<Type>::checkMinBounds
bool Foam::DataEntryTypes::TableBase<Type>::checkMinBounds
(
const scalar x,
scalar& xDash
@ -260,7 +265,7 @@ bool Foam::TableBase<Type>::checkMinBounds
template<class Type>
bool Foam::TableBase<Type>::checkMaxBounds
bool Foam::DataEntryTypes::TableBase<Type>::checkMaxBounds
(
const scalar x,
scalar& xDash
@ -310,7 +315,7 @@ bool Foam::TableBase<Type>::checkMaxBounds
template<class Type>
void Foam::TableBase<Type>::convertTimeBase(const Time& t)
void Foam::DataEntryTypes::TableBase<Type>::convertTimeBase(const Time& t)
{
forAll(table_, i)
{
@ -324,7 +329,7 @@ void Foam::TableBase<Type>::convertTimeBase(const Time& t)
template<class Type>
Type Foam::TableBase<Type>::value(const scalar x) const
Type Foam::DataEntryTypes::TableBase<Type>::value(const scalar x) const
{
scalar xDash = x;
@ -352,7 +357,11 @@ Type Foam::TableBase<Type>::value(const scalar x) const
template<class Type>
Type Foam::TableBase<Type>::integrate(const scalar x1, const scalar x2) const
Type Foam::DataEntryTypes::TableBase<Type>::integrate
(
const scalar x1,
const scalar x2
) const
{
// Use interpolator
interpolator().integrationWeights(x1, x2, currentIndices_, currentWeights_);
@ -368,7 +377,7 @@ Type Foam::TableBase<Type>::integrate(const scalar x1, const scalar x2) const
template<class Type>
Foam::tmp<Foam::scalarField> Foam::TableBase<Type>::x() const
Foam::tmp<Foam::scalarField> Foam::DataEntryTypes::TableBase<Type>::x() const
{
tmp<scalarField> tfld(new scalarField(table_.size(), 0.0));
scalarField& fld = tfld();
@ -383,7 +392,7 @@ Foam::tmp<Foam::scalarField> Foam::TableBase<Type>::x() const
template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::TableBase<Type>::y() const
Foam::tmp<Foam::Field<Type>> Foam::DataEntryTypes::TableBase<Type>::y() const
{
tmp<Field<Type>> tfld(new Field<Type>(table_.size(), pTraits<Type>::zero));
Field<Type>& fld = tfld();

View File

@ -43,18 +43,20 @@ SourceFiles
namespace Foam
{
template<class Type>
class TableBase;
template<class Type>
Ostream& operator<<
(
Ostream&,
const TableBase<Type>&
);
class interpolationWeights;
// Forward declaration of friend functions and operators
namespace DataEntryTypes
{
template<class Type> class TableBase;
};
template<class Type>
Ostream& operator<<(Ostream&, const DataEntryTypes::TableBase<Type>&);
namespace DataEntryTypes
{
/*---------------------------------------------------------------------------*\
Class TableBase Declaration
\*---------------------------------------------------------------------------*/
@ -186,6 +188,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace DataEntryTypes
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -31,7 +31,7 @@ template<class Type>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const TableBase<Type>& tbl
const DataEntryTypes::TableBase<Type>& tbl
)
{
os << static_cast<const DataEntry<Type>&>(tbl);
@ -48,7 +48,7 @@ Foam::Ostream& Foam::operator<<
template<class Type>
void Foam::TableBase<Type>::writeData(Ostream& os) const
void Foam::DataEntryTypes::TableBase<Type>::writeData(Ostream& os) const
{
DataEntry<Type>::writeData(os);
os << nl << indent << table_ << token::END_STATEMENT << nl;
@ -57,7 +57,7 @@ void Foam::TableBase<Type>::writeData(Ostream& os) const
template<class Type>
void Foam::TableBase<Type>::writeEntries(Ostream& os) const
void Foam::DataEntryTypes::TableBase<Type>::writeEntries(Ostream& os) const
{
if (boundsHandling_ != CLAMP)
{

View File

@ -28,7 +28,11 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::TableFile<Type>::TableFile(const word& entryName, const dictionary& dict)
Foam::DataEntryTypes::TableFile<Type>::TableFile
(
const word& entryName,
const dictionary& dict
)
:
TableBase<Type>(entryName, dict.subDict(entryName + "Coeffs")),
fName_("none")
@ -54,7 +58,7 @@ Foam::TableFile<Type>::TableFile(const word& entryName, const dictionary& dict)
template<class Type>
Foam::TableFile<Type>::TableFile(const TableFile<Type>& tbl)
Foam::DataEntryTypes::TableFile<Type>::TableFile(const TableFile<Type>& tbl)
:
TableBase<Type>(tbl),
fName_(tbl.fName_)
@ -64,7 +68,7 @@ Foam::TableFile<Type>::TableFile(const TableFile<Type>& tbl)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::TableFile<Type>::~TableFile()
Foam::DataEntryTypes::TableFile<Type>::~TableFile()
{}

View File

@ -64,15 +64,17 @@ SourceFiles
namespace Foam
{
template<class Type>
class TableFile;
// Forward declaration of friend functions and operators
namespace DataEntryTypes
{
template<class Type> class TableFile;
};
template<class Type>
Ostream& operator<<
(
Ostream&,
const TableFile<Type>&
);
Ostream& operator<<(Ostream&, const DataEntryTypes::TableFile<Type>&);
namespace DataEntryTypes
{
/*---------------------------------------------------------------------------*\
Class TableFile Declaration
@ -129,6 +131,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace DataEntryTypes
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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
@ -28,7 +28,7 @@ License
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
void Foam::TableFile<Type>::writeData(Ostream& os) const
void Foam::DataEntryTypes::TableFile<Type>::writeData(Ostream& os) const
{
DataEntry<Type>::writeData(os);

View File

@ -43,42 +43,42 @@ namespace Foam
// Polynomial functions and interpolation do evaluate to label
// Instead evaluate a scalar and convert to label as appropriate
// makeDataEntryType(PolynomialEntry, label);
// makeDataEntryType(Polynomial, label);
// makeDataEntryType(CSV, label);
// makeDataEntryType(Table, label);
// makeDataEntryType(TableFile, label);
makeDataEntry(scalar);
makeDataEntryType(Constant, scalar);
makeDataEntryType(PolynomialEntry, scalar);
makeDataEntryType(Polynomial, scalar);
makeDataEntryType(CSV, scalar);
makeDataEntryType(Table, scalar);
makeDataEntryType(TableFile, scalar);
makeDataEntry(vector);
makeDataEntryType(Constant, vector);
makeDataEntryType(PolynomialEntry, vector);
makeDataEntryType(Polynomial, vector);
makeDataEntryType(CSV, vector);
makeDataEntryType(Table, vector);
makeDataEntryType(TableFile, vector);
makeDataEntry(sphericalTensor);
makeDataEntryType(Constant, sphericalTensor);
makeDataEntryType(PolynomialEntry, sphericalTensor);
makeDataEntryType(Polynomial, sphericalTensor);
makeDataEntryType(CSV, sphericalTensor);
makeDataEntryType(Table, sphericalTensor);
makeDataEntryType(TableFile, sphericalTensor);
makeDataEntry(symmTensor);
makeDataEntryType(Constant, symmTensor);
makeDataEntryType(PolynomialEntry, symmTensor);
makeDataEntryType(Polynomial, symmTensor);
makeDataEntryType(CSV, symmTensor);
makeDataEntryType(Table, symmTensor);
makeDataEntryType(TableFile, symmTensor);
makeDataEntry(tensor);
makeDataEntryType(Constant, tensor);
makeDataEntryType(PolynomialEntry, tensor);
makeDataEntryType(Polynomial, tensor);
makeDataEntryType(CSV, tensor);
makeDataEntryType(Table, tensor);
makeDataEntryType(TableFile, tensor);

View File

@ -98,7 +98,7 @@ Foam::fanFvPatchField<Foam::scalar>::fanFvPatchField
this->jumpTable_.reset
(
new PolynomialEntry<scalar>("jumpTable", coeffs)
new DataEntryTypes::Polynomial<scalar>("jumpTable", coeffs)
);
}
else