|
OOFEM 3.0
|
#include <datareader.h>
Classes | |
| class | RecordGuard |
| RAII guard for DataReader::enterRecord and DataReader::leaveRecord. More... | |
| class | GroupRecords |
| Internal range-like class, return type for giveGroupRecords methods. More... | |
Public Types | |
| enum | InputRecordType { IR_domainRec , IR_outManRec , IR_domainCompRec , IR_geometryRec , IR_gbpmRec , IR_emodelRec , IR_mstepRec , IR_expModuleRec , IR_dofmanRec , IR_elemRec , IR_crosssectRec , IR_matRec , IR_nlocBarRec , IR_bcRec , IR_icRec , IR_funcRec , IR_setRec , IR_xfemManRec , IR_enrichFuncRec , IR_geoRec , IR_enrichItemRec , IR_enrichFrontRec , IR_propagationLawRec , IR_crackNucleationRec , IR_fracManRec , IR_failCritRec , IR_contactSurfaceRec , IR_fieldRec , IR_mpmVarRec , IR_mpmTermRec , IR_mpmIntegralRec , IR_unspecified } |
| Determines the type of input record. More... | |
Public Member Functions | |
| DataReader () | |
| virtual | ~DataReader () |
| virtual InputRecord & | giveInputRecord (InputRecordType irType, int recordId)=0 |
| virtual InputRecord * | giveTopInputRecord () |
| virtual bool | peekNext (const std ::string &keyword) |
| virtual void | finish ()=0 |
| virtual std::string | giveReferenceName () const =0 |
| Gives the reference file name (e.g. file name). | |
| std::string | giveOutputFileName () |
| Gives the output file name. | |
| std::string | giveDescription () |
| Gives the problem description. | |
| virtual bool | hasFlattenedStructure () |
| virtual void | enterGroup (const std::string &name) |
| virtual void | leaveGroup (const std::string &name) |
| virtual void | enterRecord (InputRecord *rec) |
| virtual void | leaveRecord (InputRecord *rec) |
| virtual int | giveGroupCount (const std::string &name) |
| bool | hasGroup (const std::string &name) |
| Predicate whether a named group exists (it can still be empty). | |
| GroupRecords | giveGroupRecords (const std::shared_ptr< InputRecord > &ir, InputFieldType ift, const std::string &name, InputRecordType irType, bool optional) |
| GroupRecords | giveGroupRecords (const std::string &name, InputRecordType irType, int numRequired=-1) |
| InputRecord * | giveChildRecord (const std::shared_ptr< InputRecord > &ir, InputFieldType ift, const std::string &name, InputRecordType irType, bool optional) |
| Return pointer to subrecord of given type (must be exactly one); if not present, returns nullptr. | |
Static Public Attributes | |
| static constexpr const char * | InputRecordTags [] |
| static const int | NoSuchGroup =-1 |
Protected Attributes | |
| std::string | outputFileName |
| Output file name (first line in OOFEM input files). | |
| std::string | description |
| Description line (second line in OOFEM input files). | |
Class representing the abstraction for input data source. Its role is to provide input records for particular components. The input records are identified by record type and component number. The order of input records is in fact determined by the coded sequence of component initialization. The input record identification facilitates the implementation of database readers with direct or random access.
Definition at line 54 of file datareader.h.
Determines the type of input record.
Definition at line 64 of file datareader.h.
|
inline |
Definition at line 87 of file datareader.h.
Referenced by oofem::DynamicDataReader::DynamicDataReader(), oofem::DataReader::GroupRecords::GroupRecords(), oofem::DataReader::GroupRecords::Iterator::Iterator(), oofem::OOFEMTXTDataReader::OOFEMTXTDataReader(), and oofem::DataReader::RecordGuard::RecordGuard().
|
inlinevirtual |
Definition at line 88 of file datareader.h.
|
inlinevirtual |
Reimplemented in oofem::XMLDataReader.
Definition at line 122 of file datareader.h.
|
inlinevirtual |
Reimplemented in oofem::XMLDataReader.
Definition at line 124 of file datareader.h.
|
pure virtual |
Allows to detach all data connections.
Implemented in oofem::DynamicDataReader, oofem::OOFEMTXTDataReader, and oofem::XMLDataReader.
| InputRecord * oofem::DataReader::giveChildRecord | ( | const std::shared_ptr< InputRecord > & | ir, |
| InputFieldType | ift, | ||
| const std::string & | name, | ||
| InputRecordType | irType, | ||
| bool | optional ) |
Return pointer to subrecord of given type (must be exactly one); if not present, returns nullptr.
Definition at line 40 of file datareader.C.
References giveInputRecord().
Referenced by oofem::Delamination::instanciateYourself(), oofem::Domain::instanciateYourself(), and oofem::GeometryBasedEI::instanciateYourself().
|
inline |
Gives the problem description.
Definition at line 118 of file datareader.h.
Referenced by oofem::InstanciateProblem().
|
inlinevirtual |
Return number of items in a named group
| name | name of the group; if empty, current group is used |
Reimplemented in oofem::XMLDataReader.
Definition at line 170 of file datareader.h.
References NoSuchGroup.
Referenced by giveGroupRecords(), and hasGroup().
| DataReader::GroupRecords oofem::DataReader::giveGroupRecords | ( | const std::shared_ptr< InputRecord > & | ir, |
| InputFieldType | ift, | ||
| const std::string & | name, | ||
| InputRecordType | irType, | ||
| bool | optional ) |
Give range (provides begin(), end(), size()) to iterate over records. Some readers (text) specify the number of records in the InputRecord with the given input field type. Other readers (XML) find the number of records as number of elements in the subgroup enclosed with name tag.
| ir | Input record which may hold the number of subsequent entries to be read from the stream |
| ift | Field type in ir record specifying the number of records. |
| name | Subgroup name for tag-based readers. |
| irType | Expected input record type for all records to be read. |
| optional | If not optional and the number of records is not given, fail with error. Otherwise assume 0-sized subgroup. |
Definition at line 46 of file datareader.C.
Referenced by oofem::EngngModel::initializeFrom(), oofem::TimeStepController::initializeFrom(), oofem::EngngModel::instanciateMetaSteps(), oofem::TimeStepController::instanciateMetaSteps(), oofem::Delamination::instanciateYourself(), oofem::Domain::instanciateYourself(), oofem::FieldManager::instanciateYourself(), oofem::GeometryBasedEI::instanciateYourself(), oofem::ModuleManager< M >::instanciateYourself(), oofem::XfemManager::instanciateYourself(), and oofem::ErrorCheckingExportModule::readRulesFromRecords().
| DataReader::GroupRecords oofem::DataReader::giveGroupRecords | ( | const std::string & | name, |
| InputRecordType | irType, | ||
| int | numRequired = -1 ) |
Give range to iterate over records within a named group
| name | Subgroup name; if not given, give records within the current group |
| irType | Input record type for records to be read |
| numRequired | if non-negative, this number is checked against number of records present (for readers which can determine that), and mismatch error is thrown when they are different |
Definition at line 51 of file datareader.C.
References giveGroupCount(), giveReferenceName(), and OOFEM_ERROR.
|
pure virtual |
Returns input record corresponding to given InputRecordType value and its record_id. The returned InputRecord reference is valid only until the next call.
| irType | Determines type of record to be returned. |
| recordId | Determines the record number corresponding to component number. |
Implemented in oofem::DynamicDataReader, oofem::OOFEMTXTDataReader, and oofem::XMLDataReader.
Referenced by giveChildRecord(), oofem::EngngModel::instanciateDomains(), oofem::InstanciateProblem(), oofem::Delamination::instanciateYourself(), oofem::Domain::instanciateYourself(), oofem::Domain::instanciateYourself(), oofem::FractureManager::instanciateYourself(), and oofem::NucleationCriterion::instanciateYourself().
|
inline |
Gives the output file name.
Definition at line 116 of file datareader.h.
Referenced by oofem::InstanciateProblem().
|
pure virtual |
Gives the reference file name (e.g. file name).
Implemented in oofem::DynamicDataReader, oofem::OOFEMTXTDataReader, and oofem::XMLDataReader.
Referenced by giveGroupRecords(), and oofem::EngngModel::instanciateYourself().
|
inlinevirtual |
Returns top input record, for readers which support it; others return empty pointer
Reimplemented in oofem::XMLDataReader.
Definition at line 100 of file datareader.h.
Referenced by oofem::EngngModel::instanciateYourself().
|
inlinevirtual |
Reimplemented in oofem::XMLDataReader.
Definition at line 120 of file datareader.h.
Referenced by oofem::Domain::instanciateYourself(), and oofem::EngngModel::instanciateYourself().
|
inline |
Predicate whether a named group exists (it can still be empty).
Definition at line 172 of file datareader.h.
References giveGroupCount().
|
inlinevirtual |
Reimplemented in oofem::XMLDataReader.
Definition at line 123 of file datareader.h.
|
inlinevirtual |
Reimplemented in oofem::XMLDataReader.
Definition at line 125 of file datareader.h.
|
inlinevirtual |
Peak in advance into the record list.
Reimplemented in oofem::DynamicDataReader, oofem::OOFEMTXTDataReader, and oofem::XMLDataReader.
Definition at line 106 of file datareader.h.
Referenced by oofem::Domain::instanciateYourself().
|
protected |
Description line (second line in OOFEM input files).
Definition at line 60 of file datareader.h.
Referenced by oofem::OOFEMTXTDataReader::OOFEMTXTDataReader(), oofem::DynamicDataReader::setDescription(), oofem::DynamicDataReader::writeToFile(), and oofem::XMLDataReader::XMLDataReader().
|
staticconstexpr |
Definition at line 76 of file datareader.h.
Referenced by oofem::XMLDataReader::giveInputRecord(), oofem::Delamination::instanciateYourself(), oofem::Domain::instanciateYourself(), and oofem::GeometryBasedEI::instanciateYourself().
|
static |
Definition at line 164 of file datareader.h.
Referenced by giveGroupCount().
|
protected |
Output file name (first line in OOFEM input files).
Definition at line 58 of file datareader.h.
Referenced by oofem::OOFEMTXTDataReader::OOFEMTXTDataReader(), oofem::DynamicDataReader::setOutputFileName(), oofem::DynamicDataReader::writeToFile(), and oofem::XMLDataReader::XMLDataReader().