40 std::initializer_list<std::pair<const char*,int>> compat,
41 const dictionary&
dict 49 ITstream& is =
dict.lookupCompat(
name, compat);
50 is.format(IOstreamOption::ASCII);
57 <<
name <<
" with " << cols
58 <<
" does not have the expected length " 72 const UList<string>& strings
77 if (std::is_integral<Type>::value)
87 readScalar(strings[componentColumns_[cmpt]]);
101 headerLine_(
dict.
get<bool>(
"hasHeaderLine")),
102 refColumn_(
dict.getCompat<label>(
"refColumn", {{
"timeColumn", 1912}})),
105 getComponentColumns(
"componentColumns", {{
"valueColumns", 1912}},
dict)
123 const label maxEntry =
124 max(refColumn_, componentColumns_[
findMax(componentColumns_)]);
136 DynamicList<Tuple2<scalar, Type>>
values;
137 DynamicList<string> strings(maxEntry+1);
151 (
pos != std::string::npos) && (
n <= maxEntry);
155 const auto nPos = line.find(separator_,
pos);
157 if (nPos == std::string::npos)
159 strings.push_back(line.substr(
pos));
164 strings.push_back(line.substr(
pos, nPos-
pos));
169 if (strings.size() <= 1)
174 if (strings.size() <= maxEntry)
177 <<
"Not enough columns near line " << lineNo
178 <<
". Require " << (maxEntry+1) <<
" but found " 183 scalar
x = readScalar(strings[refColumn_]);
184 Type value = readValue(strings);
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
Reads an interpolation table from a file - CSV-format.
label findMax(const ListType &input, label start=0)
Linear search for the index of the max element, similar to std::max_element but for lists and returns...
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
refPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler - forwards to fileOperation::handler()
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
virtual void write(Ostream &os) const
Write additional information.
Base class to read table data for the interpolationTable.
Various functions to operate on Lists.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
dimensionedScalar pos(const dimensionedScalar &ds)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
ISstream & getLine(std::string &str, char delim='\n')
Raw, low-level getline (until delimiter) into a string.
OBJstream os(runTime.globalPath()/outputName)
csvTableReader(const dictionary &dict)
Construct from dictionary.
Generic input stream using a standard (STL) stream.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
bool good() const noexcept
True if next operation might succeed.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
List< label > labelList
A List of labels.
virtual void write(Ostream &os) const
Write the remaining parameters.
label & setComponent(label &val, const direction) noexcept
Non-const access to integer-type (has no components)
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
streamFormat format() const noexcept
Get the current stream format.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...