34 namespace TableReaders
48 for (
label i = 0; i < pTraits<Type>::nComponents; i++)
53 <<
"No column " <<
component(columns, i) <<
" in "
78 <<
"No column " <<
component(columns, 0) <<
" in "
96 <<
"No column " <<
component(columns, 0) <<
" in "
112 template<
class Coordinate,
class Value>
116 List<Tuple2<Coordinate, Value>>& data
119 DynamicList<Tuple2<Coordinate, Value>> values;
122 for (
label i = 0; i < nHeaderLine_; i++)
128 const label nEntries =
139 DynamicList<string> split;
141 if (mergeSeparators_)
143 std::size_t nPos = 0;
145 while ((
pos != std::string::npos) && (
n <= nEntries))
150 nPos = line.find(separator_,
pos);
152 if ((nPos != std::string::npos) && (nPos -
pos == 0))
162 nPos = line.find(separator_,
pos);
164 if (nPos == std::string::npos)
166 split.append(line.substr(
pos));
172 split.append(line.substr(
pos, nPos -
pos));
180 while ((
pos != std::string::npos) && (
n <= nEntries))
182 std::size_t nPos = line.find(separator_,
pos);
184 if (nPos == std::string::npos)
186 split.append(line.substr(
pos));
192 split.append(line.substr(
pos, nPos -
pos));
199 if (split.size() <= 1)
206 Tuple2<Coordinate , Value>
208 CsvReadValue<Coordinate>(columns_.first(), split),
209 CsvReadValue<Value>(columns_.second(), split)
214 data.transfer(values);
220 template<
class Coordinate,
class Value>
261 template<
class Coordinate,
class Value>
268 template<
class Coordinate,
class Value>
281 writeEntry(os,
"separator",
string(separator_));
282 writeEntry(os,
"mergeSeparators", mergeSeparators_);
Input from memory buffer stream.
void size(const label)
Override size to be inconsistent with allocated storage.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Base class to read table data for tables.
virtual void write(Ostream &os, const Function1s::unitSets &units, const List< Tuple2< Coordinate, Value >> &table, const word &valuesKeyword=word::null) const
Write additional information.
Reads an interpolation table from a file in CSV-format. Entries govern the layout of the CSV file....
virtual ~Csv()
Destructor.
virtual void write(Ostream &os, const Function1s::unitSets &units, const List< Tuple2< Coordinate, Value >> &table, const word &valuesKeyword=word::null) const
Write settings and values.
Csv(const word &name, const Function1s::unitSets &units, const dictionary &dict)
Construct from name and dictionary.
A 2-tuple for storing two objects of different types.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Motion of the mesh specified as a list of pointMeshMovers.
A class for handling character strings derived from std::string.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
scalar CsvReadValue< scalar >(const typename CsvLabelType< scalar >::type &columns, const List< string > &split)
label CsvReadValue< label >(const typename CsvLabelType< scalar >::type &columns, const List< string > &split)
Type CsvReadValue(const typename CsvLabelType< Type >::type &columns, const List< string > &split)
const HashTable< dimensionSet > table
Table of dimensions.
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensionedScalar pos(const dimensionedScalar &ds)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void cmptMax(Field< typename Field< Type >::cmptType > &res, const UList< Type > &f)
void component(GeometricField< typename GeometricField< Type, GeoMesh, PrimitiveField1 >::cmptType, GeoMesh, PrimitiveField1 > &gcf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf, const direction d)
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
label readLabel(Istream &is)
void writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Struct containing two unitSets for use in converting both the argument and the value of a Function1.