34 namespace TableReaders
42 if (componentColumns_[0] >= split.
size())
45 <<
"No column " << componentColumns_[0] <<
" in " 57 if (componentColumns_[0] >= split.
size())
60 <<
"No column " << componentColumns_[0] <<
" in " 74 for(
label i = 0;i < pTraits<Type>::nComponents; i++)
76 if (componentColumns_[i] >= split.
size())
79 <<
"No column " << componentColumns_[i] <<
" in " 110 for (
label i = 0; i < nHeaderLine_; i++)
116 const label nEntries =
max(refColumn_,
max(componentColumns_));
128 if (mergeSeparators_)
130 std::size_t nPos = 0;
132 while ((pos != std::string::npos) && (n <= nEntries))
137 nPos = line.find(separator_, pos);
139 if ((nPos != std::string::npos) && (nPos - pos == 0))
149 nPos = line.find(separator_, pos);
151 if (nPos == std::string::npos)
153 split.
append(line.substr(pos));
159 split.
append(line.substr(pos, nPos - pos));
167 while ((pos != std::string::npos) && (n <= nEntries))
169 std::size_t nPos = line.find(separator_, pos);
171 if (nPos == std::string::npos)
173 split.
append(line.substr(pos));
179 split.
append(line.substr(pos, nPos - pos));
186 if (split.
size() <= 1)
192 Type value = readValue(split);
214 componentColumns_(dict.
lookup(
"componentColumns")),
221 << componentColumns_ <<
" does not have the expected length " 250 writeEntry(os,
"componentColumns", componentColumns_);
251 writeEntry(os,
"separator",
string(separator_));
252 writeEntry(os,
"mergeSeparators", mergeSeparators_);
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 2-tuple for storing two objects of different types.
virtual void write(Ostream &os, const List< Tuple2< scalar, Type >> &table) const
Write the CSV parameters.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Traits class for primitives.
Base class to read table data for tables.
void transfer(dictionary &)
Transfer the contents of the argument and annul the argument.
bool good() const
Return true if next operation might succeed.
Reads an interpolation table from a file in CSV-format. Entries govern the layout of the CSV file...
virtual void write(Ostream &os, const List< Tuple2< scalar, Type >> &table) const
Write additional information.
virtual ~Csv()
Destructor.
dimensionedScalar pos(const dimensionedScalar &ds)
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
A class for handling words, derived from string.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
label readLabel(Istream &is)
Csv(const word &name, const dictionary &dict, List< Tuple2< scalar, Type >> &table)
Construct from dictionary.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Database for solution and other reduced data.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
ISstream & getLine(string &, const bool continuation=true)
Read line into a string.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
Input from memory buffer stream.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.