DataEntry: Base the name of the coefficients sub-dicts on the entry name rather than the type name
This allows for more than one of these data types to be specified in a dictionary Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1652 e.g. <entryName> csvFile; <entryName>Coeffs { nHeaderLine 4; refColumn 0; // reference column index componentColumns (1 2 3); // component column indices separator ","; // optional (defaults to ",") mergeSeparators no; // merge multiple separators fileName "fileXYZ"; // name of csv data file outOfBounds clamp; // optional out-of-bounds handling interpolationScheme linear; // optional interpolation scheme }
This commit is contained in:
parent
5d4398371e
commit
559ca6d585
7 changed files with 30 additions and 18 deletions
|
|
@ -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
|
||||
|
|
@ -31,7 +31,20 @@ License
|
|||
|
||||
namespace Foam
|
||||
{
|
||||
// doesn't recognize specialization otherwise
|
||||
template<>
|
||||
label CSV<label>::readValue(const List<string>& splitted)
|
||||
{
|
||||
if (componentColumns_[0] >= splitted.size())
|
||||
{
|
||||
FatalErrorIn("CSV<label>::readValue(const List<string>&)")
|
||||
<< "No column " << componentColumns_[0] << " in "
|
||||
<< splitted << endl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return readLabel(IStringStream(splitted[componentColumns_[0]])());
|
||||
}
|
||||
|
||||
template<>
|
||||
scalar CSV<scalar>::readValue(const List<string>& splitted)
|
||||
{
|
||||
|
|
@ -191,8 +204,8 @@ Foam::CSV<Type>::CSV
|
|||
)
|
||||
:
|
||||
DataEntry<Type>(entryName),
|
||||
TableBase<Type>(entryName, dict.subDict(type() + ext)),
|
||||
coeffs_(dict.subDict(type() + ext)),
|
||||
TableBase<Type>(entryName, dict.subDict(entryName + ext)),
|
||||
coeffs_(dict.subDict(entryName + ext)),
|
||||
nHeaderLine_(readLabel(coeffs_.lookup("nHeaderLine"))),
|
||||
refColumn_(readLabel(coeffs_.lookup("refColumn"))),
|
||||
componentColumns_(coeffs_.lookup("componentColumns")),
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -29,8 +29,8 @@ Description
|
|||
e.g. time
|
||||
|
||||
\verbatim
|
||||
<entryName> csvFile;
|
||||
csvFileCoeffs
|
||||
<entryName> csvFile;
|
||||
<entryName>Coeffs
|
||||
{
|
||||
nHeaderLine 4;
|
||||
refColumn 0; // reference column index
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -61,7 +61,7 @@ void Foam::CSV<Type>::writeData(Ostream& os) const
|
|||
{
|
||||
DataEntry<Type>::writeData(os);
|
||||
os << token::END_STATEMENT << nl;
|
||||
os << indent << word(type() + "Coeffs") << nl;
|
||||
os << indent << word(this->name() + "Coeffs") << nl;
|
||||
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||
|
||||
// Note: for TableBase write the dictionary entries it needs but not
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
|
@ -215,5 +215,4 @@ Foam::DataEntry<Type>::dimIntegrate
|
|||
|
||||
#include "DataEntryIO.C"
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -31,10 +31,10 @@ template<class Type>
|
|||
Foam::TableFile<Type>::TableFile(const word& entryName, const dictionary& dict)
|
||||
:
|
||||
DataEntry<Type>(entryName),
|
||||
TableBase<Type>(entryName, dict.subDict(type() + "Coeffs")),
|
||||
TableBase<Type>(entryName, dict.subDict(entryName + "Coeffs")),
|
||||
fName_("none")
|
||||
{
|
||||
const dictionary coeffs(dict.subDict(type() + "Coeffs"));
|
||||
const dictionary coeffs(dict.subDict(entryName + "Coeffs"));
|
||||
coeffs.lookup("fileName") >> fName_;
|
||||
|
||||
if (coeffs.found("dimensions"))
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ Description
|
|||
Templated table container data entry where data is read from file.
|
||||
|
||||
\verbatim
|
||||
<entryName> tableFile;
|
||||
tableFileCoeffs
|
||||
<entryName> tableFile;
|
||||
<entryName>Coeffs
|
||||
{
|
||||
dimensions [0 0 1 0 0]; // optional dimensions
|
||||
fileName dataFile; // name of data file
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -53,7 +53,7 @@ void Foam::TableFile<Type>::writeData(Ostream& os) const
|
|||
DataEntry<Type>::writeData(os);
|
||||
|
||||
os << token::END_STATEMENT << nl
|
||||
<< indent << word(type() + "Coeffs") << nl
|
||||
<< indent << word(this->name() + "Coeffs") << nl
|
||||
<< indent << token::BEGIN_BLOCK << nl << incrIndent;
|
||||
|
||||
// Note: for TableBase write the dictionary entries it needs but not
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue