42 dataSourceName(
std :: move(inputfilename)), recordList()
44 std :: list< std :: pair< int, std :: string > >lines;
48 if ( !inputStream.is_open() ) {
59 lines.emplace_back(make_pair(lineNumber, line));
63 for (
auto it = lines.begin();
it != lines.end(); ++
it ) {
64 if (
it->second.compare(0, 8,
"@include") == 0 ) {
65 std :: string fname =
it->second.substr(10,
it->second.length()-11);
73 std :: ifstream includedStream(fname);
74 if ( !includedStream.is_open() ) {
75 OOFEM_ERROR(
"Can't open input stream (%s)", fname.c_str());
78 lines.emplace(
it, make_pair(includedLine, line));
84 for (
auto &line: lines ) {
86 this->
recordList.emplace_back(line.first, line.second);
101 OOFEM_ERROR(
"Out of input records, file contents must be missing");
103 return &(*this->
it++);
109 std :: string nextKey;
110 this->
it->giveRecordKeywordField(nextKey);
111 return keyword.compare( nextKey ) == 0;
119 "The most common cause are missing entries in the domain record, e.g. 'nset'");
134 for (
auto &c: line ) {
140 c = (char)tolower(c);
151 std :: getline(stream, line);
154 }
if ( line.length() > 0 ) {
155 if ( line.back() ==
'\\' ) {
156 std :: string continuedLine;
159 std :: getline(stream, continuedLine);
164 line += continuedLine;
165 }
while ( continuedLine.back() ==
'\\' );
168 }
while ( line.length() == 0 || line [ 0 ] ==
'#' );
bool giveRawLineFromInput(std::ifstream &stream, int &lineNum, std::string &line)
Reads one line from stream.
virtual bool peakNext(const std::string &keyword)
Peak in advance into the record list.
virtual ~OOFEMTXTDataReader()
std::string dataSourceName
OOFEMTXTDataReader(std::string inputfilename)
Constructor.
virtual void finish()
Allows to detach all data connections.
Class representing the abstraction for input data source.
std::list< OOFEMTXTInputRecord >::iterator it
Keeps track of the current position in the list.
#define OOFEM_LOG_INFO(...)
bool giveLineFromInput(std::ifstream &stream, int &lineNum, std::string &line)
Reads one line from inputStream Parts within quotations have case preserved.
std::string description
Description line (second line in OOFEM input files).
std::list< OOFEMTXTInputRecord > recordList
InputRecordType
Determines the type of input record.
std::string outputFileName
Output file name (first line in OOFEM input files).
Class representing the implementation of plain text date reader.
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual InputRecord * giveInputRecord(InputRecordType, int recordId)
Returns input record corresponding to given InputRecordType value and its record_id.
#define OOFEM_WARNING(...)