diff --git a/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.C b/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.C index a936bb6e7cada7976f1b3052140756e2904f5d9e..76739c02a2054fb2010f92d1fd3d4424748550c1 100644 --- a/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.C +++ b/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2017 OpenCFD Ltd. + Copyright (C) 2016-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -28,7 +28,6 @@ License #include "CSV.H" #include "DynamicList.H" -//#include "IFstream.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -36,7 +35,7 @@ template<> Foam::label Foam::Function1Types::CSV<Foam::label>::readValue ( const List<string>& splitted -) +) const { if (componentColumns_[0] >= splitted.size()) { @@ -54,7 +53,7 @@ template<> Foam::scalar Foam::Function1Types::CSV<Foam::scalar>::readValue ( const List<string>& splitted -) +) const { if (componentColumns_[0] >= splitted.size()) { @@ -69,7 +68,10 @@ Foam::scalar Foam::Function1Types::CSV<Foam::scalar>::readValue template<class Type> -Type Foam::Function1Types::CSV<Type>::readValue(const List<string>& splitted) +Type Foam::Function1Types::CSV<Type>::readValue +( + const List<string>& splitted +) const { Type result; @@ -94,7 +96,6 @@ template<class Type> void Foam::Function1Types::CSV<Type>::read() { fileName expandedFile(fName_); - //IFstream is(expandedFile.expand()); autoPtr<ISstream> isPtr(fileHandler().NewIFstream(expandedFile.expand())); ISstream& is = isPtr(); @@ -214,17 +215,24 @@ Foam::Function1Types::CSV<Type>::CSV TableBase<Type>(entryName, dict), nHeaderLine_(dict.get<label>("nHeaderLine")), refColumn_(dict.get<label>("refColumn")), - componentColumns_(dict.lookup("componentColumns")), - separator_(dict.lookupOrDefault<string>("separator", ",")[0]), + componentColumns_(), + separator_(dict.getOrDefault<string>("separator", ",")[0]), mergeSeparators_(dict.get<bool>("mergeSeparators")), fName_(fName.empty() ? dict.get<fileName>("file") : fName) { + // Writing of "componentColumns" was forced to be ASCII, + // do the same when reading + ITstream& is = dict.lookup("componentColumns"); + is.format(IOstream::ASCII); + is >> componentColumns_; + dict.checkITstream(is, "componentColumns"); + if (componentColumns_.size() != pTraits<Type>::nComponents) { - FatalErrorInFunction + FatalIOErrorInFunction(dict) << componentColumns_ << " does not have the expected length of " - << pTraits<Type>::nComponents << endl - << exit(FatalError); + << pTraits<Type>::nComponents << nl + << exit(FatalIOError); } read(); @@ -246,13 +254,6 @@ Foam::Function1Types::CSV<Type>::CSV(const CSV<Type>& csv) {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::Function1Types::CSV<Type>::~CSV() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> diff --git a/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.H b/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.H index cce7ead5f754bb7509e64c1d3362223fd409735a..19d93e036f373518533e94824c5331e3517cfaeb 100644 --- a/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.H +++ b/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2017 OpenCFD Ltd. + Copyright (C) 2017-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -105,7 +105,7 @@ class CSV void read(); //- Read the next value from the splitted string - Type readValue(const List<string>&); + Type readValue(const List<string>& splitted) const; //- No copy assignment void operator=(const CSV<Type>&) = delete; @@ -138,7 +138,7 @@ public: //- Destructor - virtual ~CSV(); + virtual ~CSV() = default; // Member Functions @@ -151,13 +151,6 @@ public: }; -template<> -label CSV<label>::readValue(const List<string>& splitted); - -template<> -Foam::scalar CSV<scalar>::readValue(const List<string>& splitted); - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Function1Types diff --git a/tutorials/combustion/reactingFoam/RAS/chokedNozzle/system/controlDict b/tutorials/combustion/reactingFoam/RAS/chokedNozzle/system/controlDict index 26758a3ee36c4845c285614713fcaa188fa4510c..8fb9c2375925fb41cbde928d88f8f87cb7848712 100644 --- a/tutorials/combustion/reactingFoam/RAS/chokedNozzle/system/controlDict +++ b/tutorials/combustion/reactingFoam/RAS/chokedNozzle/system/controlDict @@ -33,7 +33,7 @@ writeInterval 0.02; purgeWrite 0; -writeFormat ascii; +writeFormat binary; writePrecision 10;