From d79abdaa178422b47d78020d83dd253ffa94e909 Mon Sep 17 00:00:00 2001 From: Henry <Henry> Date: Wed, 8 Apr 2015 21:22:23 +0100 Subject: [PATCH] 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 } --- src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.C | 4 ++-- src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H | 6 +++--- src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.C | 4 ++-- .../primitives/functions/DataEntry/DataEntry/DataEntry.C | 3 +-- .../primitives/functions/DataEntry/TableFile/TableFile.C | 6 +++--- .../primitives/functions/DataEntry/TableFile/TableFile.H | 4 ++-- .../primitives/functions/DataEntry/TableFile/TableFileIO.C | 2 +- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.C b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.C index ad7e75b70b7..15aebc08b84 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.C @@ -204,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")), diff --git a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H index 8adbc4b2042..78476adc80a 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H @@ -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 diff --git a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.C b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.C index 778de9a92fe..72a120f4cef 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.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 @@ -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 diff --git a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C index 985a0500215..2674a04c349 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C @@ -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" - // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.C b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.C index a30251be3e6..9119148a178 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.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")) diff --git a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H index 8cca0b05cca..23cb53f4e89 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H @@ -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 diff --git a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFileIO.C b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFileIO.C index cbfa4585e6a..7178a33392f 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFileIO.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFileIO.C @@ -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 -- GitLab