OOFEM
2.4
OOFEM.org - Object Oriented Finite Element Solver
|
Class representing the Input Record for OOFEM txt input file format. More...
#include <oofemtxtinputrecord.h>
Public Member Functions | |
OOFEMTXTInputRecord () | |
Constructor. Creates an empty input record. More... | |
OOFEMTXTInputRecord (int linenumber, std::string source) | |
Constructor. Creates the input record corresponding to given string. More... | |
OOFEMTXTInputRecord (const OOFEMTXTInputRecord &) | |
Copy constructor. More... | |
virtual | ~OOFEMTXTInputRecord () |
Destructor. More... | |
OOFEMTXTInputRecord & | operator= (const OOFEMTXTInputRecord &) |
Assignment operator. More... | |
virtual InputRecord * | GiveCopy () |
Creates a newly allocated copy of the receiver. More... | |
void | setRecordString (std::string newStr) |
Sets the record string. More... | |
virtual std::string | giveRecordAsString () const |
Returns record string. More... | |
void | finish (bool wrn=true) |
Terminates the current record session and if the flag is true, warning is printed for unscanned tokens. More... | |
virtual IRResultType | giveRecordKeywordField (std::string &answer, int &value) |
Reads the record id field (type of record) and its corresponding number. More... | |
virtual IRResultType | giveRecordKeywordField (std::string &answer) |
Reads the record id field (type of record). More... | |
virtual IRResultType | giveField (int &answer, InputFieldType id) |
Reads the integer field value. More... | |
virtual IRResultType | giveField (double &answer, InputFieldType id) |
Reads the double field value. More... | |
virtual IRResultType | giveField (bool &answer, InputFieldType id) |
Reads the bool field value. More... | |
virtual IRResultType | giveField (std::string &answer, InputFieldType id) |
Reads the string field value. More... | |
virtual IRResultType | giveField (FloatArray &answer, InputFieldType id) |
Reads the FloatArray field value. More... | |
virtual IRResultType | giveField (IntArray &answer, InputFieldType id) |
Reads the IntArray field value. More... | |
virtual IRResultType | giveField (FloatMatrix &answer, InputFieldType id) |
Reads the FloatMatrix field value. More... | |
virtual IRResultType | giveField (std::vector< std::string > &answer, InputFieldType id) |
Reads the vector of strings. More... | |
virtual IRResultType | giveField (Dictionary &answer, InputFieldType id) |
Reads the Dictionary field value. More... | |
virtual IRResultType | giveField (std::list< Range > &answer, InputFieldType id) |
Reads the std::list<Range> field value. More... | |
virtual IRResultType | giveField (ScalarFunction &answer, InputFieldType id) |
Reads the ScalarFunction field value. More... | |
virtual bool | hasField (InputFieldType id) |
Returns true if record contains field identified by idString keyword. More... | |
virtual void | printYourself () |
Print input record. More... | |
virtual void | report_error (const char *_class, const char *proc, InputFieldType id, IRResultType result, const char *file, int line) |
Prints the error message. More... | |
void | setLineNumber (int lineNumber) |
Public Member Functions inherited from oofem::InputRecord | |
InputRecord () | |
Constructor. Creates an empty input record. More... | |
InputRecord (const InputRecord &) | |
Copy constructor. More... | |
virtual | ~InputRecord () |
Destructor. More... | |
InputRecord & | operator= (const InputRecord &) |
Assignment operator. More... | |
const char * | strerror (IRResultType) |
Returns error string corresponding to given value of IRResultType type. More... | |
IRResultType | giveOptionalField (int &answer, InputFieldType id) |
Reads the integer field value. More... | |
IRResultType | giveOptionalField (double &answer, InputFieldType id) |
Reads the double field value. More... | |
IRResultType | giveOptionalField (bool &answer, InputFieldType id) |
Reads the bool field value. More... | |
IRResultType | giveOptionalField (std::string &answer, InputFieldType id) |
Reads the string field value. More... | |
IRResultType | giveOptionalField (FloatArray &answer, InputFieldType id) |
Reads the FloatArray field value. More... | |
IRResultType | giveOptionalField (IntArray &answer, InputFieldType id) |
Reads the IntArray field value. More... | |
IRResultType | giveOptionalField (FloatMatrix &answer, InputFieldType id) |
Reads the FloatMatrix field value. More... | |
IRResultType | giveOptionalField (std::vector< std::string > &answer, InputFieldType id) |
Reads the vector of strings. More... | |
IRResultType | giveOptionalField (Dictionary &answer, InputFieldType id) |
Reads the Dictionary field value. More... | |
IRResultType | giveOptionalField (std::list< Range > &answer, InputFieldType id) |
Reads the std::list<Range> field value. More... | |
IRResultType | giveOptionalField (ScalarFunction &function, InputFieldType id) |
Reads the ScalarFunction field value. More... | |
Protected Member Functions | |
int | giveKeywordIndx (const char *kwd) |
const char * | scanInteger (const char *source, int &value) |
const char * | scanDouble (const char *source, double &value) |
void | setReadFlag (int itok) |
int | readRange (const char **helpSource, int &li, int &hi) |
Reads single range record from input record represented by *helpSource string. More... | |
int | readMatrix (const char *helpSource, int r, int c, FloatMatrix &ans) |
Reads single matrix record from input record represented by *helpSource string. More... | |
Protected Attributes | |
Tokenizer | tokenizer |
Tokenizer is used to parse records. More... | |
std::vector< bool > | readFlag |
std::string | record |
Record representation. More... | |
int | lineNumber |
Class representing the Input Record for OOFEM txt input file format.
The input record is represented as string consisting of several fields.
Definition at line 49 of file oofemtxtinputrecord.h.
oofem::OOFEMTXTInputRecord::OOFEMTXTInputRecord | ( | ) |
Constructor. Creates an empty input record.
Definition at line 51 of file oofemtxtinputrecord.C.
oofem::OOFEMTXTInputRecord::OOFEMTXTInputRecord | ( | int | linenumber, |
std::string | source | ||
) |
Constructor. Creates the input record corresponding to given string.
Definition at line 65 of file oofemtxtinputrecord.C.
References oofem::Tokenizer::giveNumberOfTokens(), readFlag, record, oofem::Tokenizer::tokenizeLine(), and tokenizer.
oofem::OOFEMTXTInputRecord::OOFEMTXTInputRecord | ( | const OOFEMTXTInputRecord & | src | ) |
Copy constructor.
Definition at line 54 of file oofemtxtinputrecord.C.
References oofem::Tokenizer::giveNumberOfTokens(), readFlag, record, oofem::Tokenizer::tokenizeLine(), and tokenizer.
|
inlinevirtual |
Destructor.
Definition at line 73 of file oofemtxtinputrecord.h.
|
virtual |
Terminates the current record session and if the flag is true, warning is printed for unscanned tokens.
Implements oofem::InputRecord.
Definition at line 520 of file oofemtxtinputrecord.C.
References oofem::Tokenizer::giveNumberOfTokens(), oofem::Tokenizer::giveToken(), OOFEM_WARNING, readFlag, record, and tokenizer.
|
inlinevirtual |
Creates a newly allocated copy of the receiver.
Implements oofem::InputRecord.
Definition at line 77 of file oofemtxtinputrecord.h.
|
virtual |
Reads the integer field value.
Implements oofem::InputRecord.
Definition at line 134 of file oofemtxtinputrecord.C.
References giveKeywordIndx(), oofem::Tokenizer::giveToken(), oofem::IRRT_BAD_FORMAT, oofem::IRRT_NOTFOUND, oofem::IRRT_OK, scanInteger(), setReadFlag(), and tokenizer.
Referenced by oofem::oofegGraphicContext::setElementFilterState().
|
virtual |
Reads the double field value.
Implements oofem::InputRecord.
Definition at line 152 of file oofemtxtinputrecord.C.
References giveKeywordIndx(), oofem::Tokenizer::giveToken(), oofem::IRRT_BAD_FORMAT, oofem::IRRT_NOTFOUND, oofem::IRRT_OK, scanDouble(), setReadFlag(), and tokenizer.
|
virtual |
Reads the bool field value.
Implements oofem::InputRecord.
Definition at line 170 of file oofemtxtinputrecord.C.
References giveKeywordIndx(), oofem::Tokenizer::giveToken(), oofem::IRRT_BAD_FORMAT, oofem::IRRT_NOTFOUND, oofem::IRRT_OK, scanInteger(), setReadFlag(), and tokenizer.
|
virtual |
Reads the string field value.
Implements oofem::InputRecord.
Definition at line 190 of file oofemtxtinputrecord.C.
References giveKeywordIndx(), oofem::Tokenizer::giveToken(), oofem::IRRT_NOTFOUND, oofem::IRRT_OK, setReadFlag(), and tokenizer.
|
virtual |
Reads the FloatArray field value.
Implements oofem::InputRecord.
Definition at line 247 of file oofemtxtinputrecord.C.
References oofem::FloatArray::at(), giveKeywordIndx(), oofem::Tokenizer::giveToken(), oofem::IRRT_BAD_FORMAT, oofem::IRRT_NOTFOUND, oofem::IRRT_OK, oofem::FloatArray::resize(), scanDouble(), scanInteger(), setReadFlag(), and tokenizer.
|
virtual |
Reads the IntArray field value.
Implements oofem::InputRecord.
Definition at line 216 of file oofemtxtinputrecord.C.
References oofem::IntArray::at(), giveKeywordIndx(), oofem::Tokenizer::giveToken(), oofem::IRRT_BAD_FORMAT, oofem::IRRT_NOTFOUND, oofem::IRRT_OK, oofem::IntArray::resize(), scanInteger(), setReadFlag(), and tokenizer.
|
virtual |
Reads the FloatMatrix field value.
Implements oofem::InputRecord.
Definition at line 279 of file oofemtxtinputrecord.C.
References giveKeywordIndx(), oofem::Tokenizer::giveToken(), oofem::IRRT_BAD_FORMAT, oofem::IRRT_NOTFOUND, oofem::IRRT_OK, readMatrix(), scanInteger(), setReadFlag(), and tokenizer.
|
virtual |
Reads the vector of strings.
Implements oofem::InputRecord.
Definition at line 311 of file oofemtxtinputrecord.C.
References giveKeywordIndx(), oofem::Tokenizer::giveToken(), oofem::IRRT_BAD_FORMAT, oofem::IRRT_NOTFOUND, oofem::IRRT_OK, scanInteger(), setReadFlag(), and tokenizer.
|
virtual |
Reads the Dictionary field value.
Implements oofem::InputRecord.
Definition at line 335 of file oofemtxtinputrecord.C.
References oofem::Dictionary::add(), oofem::Dictionary::clear(), giveKeywordIndx(), oofem::Tokenizer::giveToken(), oofem::IRRT_BAD_FORMAT, oofem::IRRT_NOTFOUND, oofem::IRRT_OK, scanDouble(), scanInteger(), setReadFlag(), and tokenizer.
|
virtual |
Reads the std::list<Range> field value.
Implements oofem::InputRecord.
Definition at line 370 of file oofemtxtinputrecord.C.
References giveKeywordIndx(), oofem::Tokenizer::giveToken(), oofem::IRRT_BAD_FORMAT, oofem::IRRT_NOTFOUND, oofem::IRRT_OK, OOFEM_WARNING, readRange(), setReadFlag(), and tokenizer.
|
virtual |
Reads the ScalarFunction field value.
Implements oofem::InputRecord.
Definition at line 411 of file oofemtxtinputrecord.C.
References giveKeywordIndx(), oofem::Tokenizer::giveToken(), oofem::IRRT_BAD_FORMAT, oofem::IRRT_NOTFOUND, oofem::IRRT_OK, scanDouble(), scanInteger(), setReadFlag(), oofem::ScalarFunction::setReference(), oofem::ScalarFunction::setSimpleExpression(), oofem::ScalarFunction::setValue(), and tokenizer.
|
protected |
Definition at line 507 of file oofemtxtinputrecord.C.
References oofem::Tokenizer::giveNumberOfTokens(), oofem::Tokenizer::giveToken(), and tokenizer.
Referenced by giveField(), and hasField().
|
inlinevirtual |
Returns record string.
Implements oofem::InputRecord.
Definition at line 83 of file oofemtxtinputrecord.h.
Referenced by report_error().
|
virtual |
Reads the record id field (type of record) and its corresponding number.
Implements oofem::InputRecord.
Definition at line 103 of file oofemtxtinputrecord.C.
References oofem::Tokenizer::giveNumberOfTokens(), oofem::Tokenizer::giveToken(), oofem::IRRT_BAD_FORMAT, oofem::IRRT_OK, scanInteger(), setReadFlag(), and tokenizer.
|
virtual |
Reads the record id field (type of record).
Implements oofem::InputRecord.
Definition at line 121 of file oofemtxtinputrecord.C.
References oofem::Tokenizer::giveNumberOfTokens(), oofem::Tokenizer::giveToken(), oofem::IRRT_BAD_FORMAT, oofem::IRRT_OK, setReadFlag(), and tokenizer.
|
virtual |
Returns true if record contains field identified by idString keyword.
Implements oofem::InputRecord.
Definition at line 455 of file oofemtxtinputrecord.C.
References giveKeywordIndx(), and setReadFlag().
OOFEMTXTInputRecord & oofem::OOFEMTXTInputRecord::operator= | ( | const OOFEMTXTInputRecord & | src | ) |
Assignment operator.
Definition at line 77 of file oofemtxtinputrecord.C.
References oofem::Tokenizer::giveNumberOfTokens(), readFlag, record, oofem::Tokenizer::tokenizeLine(), and tokenizer.
|
virtual |
Print input record.
Implements oofem::InputRecord.
Definition at line 467 of file oofemtxtinputrecord.C.
References record.
|
protected |
Reads single matrix record from input record represented by *helpSource string.
helpSource | Pointer to current string position, on return helpSource points to next character after reading range record. |
r | Matrix rows. |
c | Matrix columns. |
ans | Float matrix. |
Definition at line 608 of file oofemtxtinputrecord.C.
References oofem::FloatMatrix::at(), oofem::FloatMatrix::clear(), OOFEM_WARNING, oofem::FloatMatrix::resize(), and scanDouble().
Referenced by giveField().
|
protected |
Reads single range record from input record represented by *helpSource string.
helpSource | Pointer to current string position, on return helpSource points to next character after reading range record. |
li | Starting range index. |
hi | End range index. |
Definition at line 560 of file oofemtxtinputrecord.C.
References OOFEM_WARNING.
Referenced by giveField().
|
virtual |
Prints the error message.
Implements oofem::InputRecord.
Definition at line 668 of file oofemtxtinputrecord.C.
References giveRecordAsString(), lineNumber, oofem::Logger::LOG_LEVEL_ERROR, OOFEM_EXIT, oofem::oofem_logger, oofem::InputRecord::strerror(), and oofem::Logger::writeELogMsg().
|
protected |
Definition at line 490 of file oofemtxtinputrecord.C.
Referenced by giveField(), and readMatrix().
|
protected |
Definition at line 473 of file oofemtxtinputrecord.C.
Referenced by giveField(), and giveRecordKeywordField().
|
inline |
Definition at line 107 of file oofemtxtinputrecord.h.
|
inlineprotected |
Definition at line 113 of file oofemtxtinputrecord.h.
Referenced by giveField(), giveRecordKeywordField(), and hasField().
void oofem::OOFEMTXTInputRecord::setRecordString | ( | std::string | newStr | ) |
Sets the record string.
Definition at line 91 of file oofemtxtinputrecord.C.
References oofem::Tokenizer::giveNumberOfTokens(), readFlag, record, oofem::Tokenizer::tokenizeLine(), and tokenizer.
|
protected |
Definition at line 63 of file oofemtxtinputrecord.h.
Referenced by report_error().
|
protected |
Definition at line 58 of file oofemtxtinputrecord.h.
Referenced by finish(), OOFEMTXTInputRecord(), operator=(), and setRecordString().
|
protected |
Record representation.
Definition at line 61 of file oofemtxtinputrecord.h.
Referenced by finish(), OOFEMTXTInputRecord(), operator=(), printYourself(), and setRecordString().
|
protected |
Tokenizer is used to parse records.
This also enables to perform additional check for input records, since unread fields can be detected
Definition at line 57 of file oofemtxtinputrecord.h.
Referenced by finish(), giveField(), giveKeywordIndx(), giveRecordKeywordField(), OOFEMTXTInputRecord(), operator=(), and setRecordString().