Go to the documentation of this file.
37 if (componentColumns_[0] >= splitted.
size())
40 <<
"No column " << componentColumns_[0] <<
" in "
51 if (componentColumns_[0] >= splitted.
size())
54 <<
"No column " << componentColumns_[0] <<
" in "
68 for (
label i = 0; i < pTraits<Type>::nComponents; i++)
70 if (componentColumns_[i] >= splitted.
size())
73 <<
"No column " << componentColumns_[i] <<
" in "
79 readScalar(IStringStream(splitted[componentColumns_[i]])());
96 <<
"Cannot open CSV file for reading."
103 for (
label i = 0; i < nHeaderLine_; i++)
109 label nEntries =
max(componentColumns_);
122 if (mergeSeparators_)
124 std::size_t nPos = 0;
126 while ((
pos != std::string::npos) && (
n <= nEntries))
131 nPos =
line.find(separator_,
pos);
133 if ((nPos != std::string::npos) && (nPos -
pos == 0))
143 nPos =
line.find(separator_,
pos);
145 if (nPos == std::string::npos)
161 while ((
pos != std::string::npos) && (
n <= nEntries))
163 std::size_t nPos =
line.find(separator_,
pos);
165 if (nPos == std::string::npos)
181 if (splitted.size() <= 1)
187 Type value = readValue(splitted);
192 this->table_.transfer(values);
201 const word& entryName,
207 coeffs_(
dict.subDict(entryName + ext)),
210 componentColumns_(coeffs_.
lookup(
"componentColumns")),
211 separator_(coeffs_.lookupOrDefault<
string>(
"separator",
string(
","))[0]),
213 fName_(coeffs_.
lookup(
"fileName"))
233 nHeaderLine_(tbl.nHeaderLine_),
234 refColumn_(tbl.refColumn_),
235 componentColumns_(tbl.componentColumns_),
236 separator_(tbl.separator_),
237 mergeSeparators_(tbl.mergeSeparators_),
virtual ~CSV()
Destructor.
A class for handling words, derived from string.
A class for handling file names.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A class for handling character strings derived from std::string.
CSV(const word &entryName, const dictionary &dict, const word &ext="Coeffs")
Construct from entry name and dictionary.
Templated CSV container data entry. Reference column is always a scalar, e.g. time.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
ISstream & getLine(string &)
Raw, low-level getline into a string function.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Input from memory buffer stream.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
virtual const fileName & fName() const
Return const access to the file name.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void read()
Read csv data table.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
labelList componentColumns_
Labels of the components.
Traits class for primitives.
string & expand(const bool allowEmpty=false)
Expand initial tildes and all occurences of environment variables.
void check() const
Check the table for size and consistency.
label readLabel(Istream &is)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
void size(const label)
Override size to be inconsistent with allocated storage.
A 2-tuple for storing two objects of different types.
bool good() const
Return true if next operation might succeed.
Type readValue(const List< string > &)
Read the next value from the splitted string.
Base class for table with bounds handling, interpolation and integration.
stressControl lookup("compactNormalStress") >> compactNormalStress
dimensionedScalar pos(const dimensionedScalar &ds)