|
OOFEM 3.0
|
#include <xmldatareader.h>
Classes | |
| struct | StackItem |
Public Member Functions | |
| XMLDataReader (const std::string &xmlFile) | |
| virtual | ~XMLDataReader () |
| bool | hasFlattenedStructure () override |
| InputRecord & | giveInputRecord (InputRecordType, int recordId) override |
| InputRecord * | giveTopInputRecord () override |
| bool | peekNext (const std ::string &keyword) override |
| void | finish () override |
| std::string | giveReferenceName () const override |
| Gives the reference file name (e.g. file name). | |
| void | enterGroup (const std::string &name) override |
| void | leaveGroup (const std::string &name) override |
| void | enterRecord (InputRecord *) override |
| void | leaveRecord (InputRecord *) override |
| int | giveGroupCount (const std::string &name) override |
| int | giveCurrentGroupCount () |
| Public Member Functions inherited from oofem::DataReader | |
| DataReader () | |
| virtual | ~DataReader () |
| std::string | giveOutputFileName () |
| Gives the output file name. | |
| std::string | giveDescription () |
| Gives the problem description. | |
| 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 Member Functions | |
| static bool | canRead (const std::string &xmlFile) |
| guess whether given file is XML | |
Protected Member Functions | |
| std::string | giveStackPath () |
| pugi::xml_document & | loadXml (pugi::xml_node parent, const std::string &xml) |
| pugi::xml_node | resolveXiInclude (const pugi::xml_node &n) |
| std::tuple< size_t, size_t > | offset2lc (const std::vector< size_t > &nl, size_t offset) const |
| std::string | loc () const |
| std::string | loc (const pugi::xml_node &) const |
| pugi::xml_node | giveNamedChild (const pugi::xml_node &parent, const std::string &name) |
| int | setRecId (int lastRecId) |
Protected Attributes | |
| friend | XMLInputRecord |
| std::string | topXmlFile |
| std::map< pugi::xml_node, std::string > | xmlFiles |
| std::map< pugi::xml_node, std::vector< size_t > > | newlines |
| std::map< pugi::xml_node, pugi::xml_document > | docs |
| std::vector< StackItem > | stack |
| std::shared_ptr< InputRecord > | topRecord |
| const std::string | XiIncludeTag ="xi:include" |
| Protected Attributes inherited from oofem::DataReader | |
| std::string | outputFileName |
| Output file name (first line in OOFEM input files). | |
| std::string | description |
| Description line (second line in OOFEM input files). | |
Additional Inherited Members | |
| Public Types inherited from oofem::DataReader | |
| 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... | |
| Static Public Attributes inherited from oofem::DataReader | |
| static constexpr const char * | InputRecordTags [] |
| static const int | NoSuchGroup =-1 |
Class representing the implementation of XML reader. It reads a sequence of input records from data file and creates the corresponding input records.
Definition at line 52 of file xmldatareader.h.
| oofem::XMLDataReader::XMLDataReader | ( | const std::string & | xmlFile | ) |
Definition at line 126 of file xmldatareader.C.
References oofem::DataReader::description, enterGroup(), loadXml(), oofem::XMLInputRecord::node_seen_set(), OOFEM_ERROR, oofem::DataReader::outputFileName, stack, topRecord, topXmlFile, and XMLInputRecord.
Referenced by setRecId().
|
inlinevirtual |
Definition at line 83 of file xmldatareader.h.
|
static |
guess whether given file is XML
Definition at line 141 of file xmldatareader.C.
|
overridevirtual |
Reimplemented from oofem::DataReader.
Definition at line 180 of file xmldatareader.C.
References _XML_DEBUG, giveNamedChild(), giveStackPath(), loc(), oofem::XMLInputRecord::node_seen_set(), OOFEM_ERROR, and stack.
Referenced by giveGroupCount(), and XMLDataReader().
|
overridevirtual |
Reimplemented from oofem::DataReader.
Definition at line 198 of file xmldatareader.C.
References _XML_DEBUG, giveStackPath(), loc(), oofem::XMLInputRecord::node, OOFEM_ERROR, stack, and XMLInputRecord.
|
overridevirtual |
Allows to detach all data connections.
Implements oofem::DataReader.
Definition at line 218 of file xmldatareader.C.
References docs, leaveGroup(), loc(), oofem::XMLInputRecord::node_seen_get(), OOFEM_WARNING, and stack.
| int oofem::XMLDataReader::giveCurrentGroupCount | ( | ) |
Definition at line 168 of file xmldatareader.C.
References _XML_DEBUG, giveStackPath(), and stack.
Referenced by giveGroupCount().
|
overridevirtual |
Return number of items in a named group
| name | name of the group; if empty, current group is used |
Reimplemented from oofem::DataReader.
Definition at line 159 of file xmldatareader.C.
References _XML_DEBUG, enterGroup(), giveCurrentGroupCount(), giveStackPath(), and leaveGroup().
|
overridevirtual |
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. |
Implements oofem::DataReader.
Definition at line 237 of file xmldatareader.C.
References _XML_DEBUG, oofem::XMLDataReader::StackItem::curr, giveStackPath(), oofem::DataReader::InputRecordTags, oofem::XMLDataReader::StackItem::lastRecId, oofem::XMLDataReader::StackItem::lastRecord, loc(), oofem::XMLInputRecord::node_seen_get(), OOFEM_ERROR, oofem::XMLDataReader::StackItem::parent, resolveXiInclude(), oofem::XMLDataReader::StackItem::seen, stack, and XiIncludeTag.
|
protected |
Definition at line 104 of file xmldatareader.C.
References _XML_DEBUG, loc(), resolveXiInclude(), and XiIncludeTag.
Referenced by enterGroup(), oofem::XMLInputRecord::giveGroupCount(), and oofem::XMLInputRecord::hasChild().
|
inlineoverridevirtual |
Gives the reference file name (e.g. file name).
Implements oofem::DataReader.
Definition at line 92 of file xmldatareader.h.
References topXmlFile.
|
protected |
Definition at line 175 of file xmldatareader.C.
References stack.
Referenced by enterGroup(), enterRecord(), giveCurrentGroupCount(), giveGroupCount(), giveInputRecord(), leaveGroup(), leaveRecord(), and resolveXiInclude().
|
inlineoverridevirtual |
Returns top input record, for readers which support it; others return empty pointer
Reimplemented from oofem::DataReader.
Definition at line 89 of file xmldatareader.h.
References topRecord.
|
inlineoverridevirtual |
Reimplemented from oofem::DataReader.
Definition at line 84 of file xmldatareader.h.
|
overridevirtual |
Reimplemented from oofem::DataReader.
Definition at line 190 of file xmldatareader.C.
References _XML_DEBUG, giveStackPath(), loc(), OOFEM_ERROR, and stack.
Referenced by finish(), and giveGroupCount().
|
overridevirtual |
Reimplemented from oofem::DataReader.
Definition at line 205 of file xmldatareader.C.
References _XML_DEBUG, giveStackPath(), loc(), oofem::XMLInputRecord::node, OOFEM_ERROR, stack, and XMLInputRecord.
|
protected |
Definition at line 59 of file xmldatareader.C.
References _XML_DEBUG, docs, newlines, oofem::XMLInputRecord::node_seen_set(), offset2lc(), OOFEM_ERROR, and xmlFiles.
Referenced by resolveXiInclude(), and XMLDataReader().
|
protected |
Definition at line 151 of file xmldatareader.C.
Referenced by enterGroup(), enterRecord(), finish(), giveInputRecord(), giveNamedChild(), leaveGroup(), leaveRecord(), loc(), oofem::XMLInputRecord::loc(), and resolveXiInclude().
|
protected |
Definition at line 152 of file xmldatareader.C.
References newlines, offset2lc(), and xmlFiles.
|
protected |
Definition at line 145 of file xmldatareader.C.
|
inlineoverridevirtual |
Peak in advance into the record list.
Reimplemented from oofem::DataReader.
Definition at line 90 of file xmldatareader.h.
|
protected |
Definition at line 95 of file xmldatareader.C.
References _XML_DEBUG, docs, giveStackPath(), loadXml(), loc(), OOFEM_ERROR, and XiIncludeTag.
Referenced by giveInputRecord(), and giveNamedChild().
|
protected |
References XMLDataReader().
|
protected |
Definition at line 62 of file xmldatareader.h.
Referenced by finish(), loadXml(), and resolveXiInclude().
|
protected |
Definition at line 60 of file xmldatareader.h.
|
protected |
Definition at line 70 of file xmldatareader.h.
Referenced by enterGroup(), enterRecord(), finish(), giveCurrentGroupCount(), giveInputRecord(), giveStackPath(), leaveGroup(), leaveRecord(), loc(), and XMLDataReader().
|
protected |
Definition at line 77 of file xmldatareader.h.
Referenced by giveTopInputRecord(), and XMLDataReader().
|
protected |
Definition at line 56 of file xmldatareader.h.
Referenced by giveReferenceName(), and XMLDataReader().
|
protected |
Definition at line 79 of file xmldatareader.h.
Referenced by giveInputRecord(), giveNamedChild(), and resolveXiInclude().
|
protected |
Definition at line 58 of file xmldatareader.h.
|
protected |
Definition at line 55 of file xmldatareader.h.
Referenced by enterRecord(), leaveRecord(), and XMLDataReader().