OOFEM 3.0
Loading...
Searching...
No Matches
oofem::XMLInputRecord Class Reference

#include <xmlinputrecord.h>

Inheritance diagram for oofem::XMLInputRecord:
Collaboration diagram for oofem::XMLInputRecord:

Public Member Functions

std::string _attr_traced_read (const char *name)
std::tuple< std::string, pugi::xml_node > _attr_traced_read_with_node (const char *name)
 XMLInputRecord (XMLDataReader *reader_, const pugi::xml_node &node_)
std::shared_ptr< InputRecordclone () const override
void finish (bool wrn=true) override
 Terminates the current record session and if the flag is true, warning is printed for unscanned tokens.
std::string loc () const
std::string loc (const pugi::xml_node &node) const
int setRecId (int lastRecId)
void giveRecordKeywordField (std ::string &answer, int &value) override
 Reads the record id field (type of record) and its corresponding number.
void giveRecordKeywordField (std ::string &answer) override
 Reads the record id field (type of record).
void giveField (int &answer, InputFieldType id) override
 Reads the integer field value.
void giveField (double &answer, InputFieldType id) override
 Reads the double field value.
void giveField (bool &answer, InputFieldType id) override
 Reads the bool field value.
void giveField (std ::string &answer, InputFieldType id) override
 Reads the string field value.
void giveField (FloatArray &answer, InputFieldType id) override
 Reads the FloatArray field value.
void giveField (IntArray &answer, InputFieldType id) override
 Reads the IntArray field value.
void giveField (FloatMatrix &answer, InputFieldType id) override
 Reads the FloatMatrix field value.
void giveField (std ::vector< std ::string > &answer, InputFieldType id) override
 Reads the vector of strings.
void giveField (Dictionary &answer, InputFieldType id) override
 Reads the Dictionary field value.
void giveField (std ::list< Range > &answer, InputFieldType id) override
 Reads the std::list<Range> field value.
void giveField (ScalarFunction &answer, InputFieldType id) override
 Reads the ScalarFunction field value.
int giveGroupCount (InputFieldType id, const std::string &name, bool optional) override
bool hasChild (InputFieldType id, const std::string &name, bool optional) override
bool hasField (InputFieldType id) override
 Returns true if record contains field identified by idString keyword.
void printYourself () override
 Print input record.
std::string giveRecordAsString () const override
 Returns string representation of record in OOFEMs text format.
std::string giveRecordInTXTFormat () const override
std::string giveLocation () const override
Public Member Functions inherited from oofem::InputRecord
 InputRecord ()
 InputRecord (DataReader *reader_)
virtual ~InputRecord ()=default
 Destructor.
std::shared_ptr< InputRecordptr ()
template<typename T>
void giveOptionalField (T &answer, InputFieldType id)
DataReadergiveReader () const
template<typename AnEnum>
void giveField (AnEnum &answer, InputFieldType id)
 Reads enumeration (must be defined via enum-impl.hpp) directly.
void traceField (InputFieldType id, const char *type) const

Static Public Member Functions

static bool node_seen_get (const pugi::xml_node &n)
static void node_seen_set (pugi::xml_node &n, bool seen)
static std::string error_msg_with_hints (const std::string &val, const std::map< int, std::vector< std::string > > &v2nn)
static int giveLevenshteinDist (const std::string &word1, const std::string &word2)

Static Public Attributes

static constexpr char SeenMark [] ="__seen"

Private Member Functions

XMLDataReader_reader () const

Static Private Member Functions

static std::string xmlizeAttrName (const std::string &s)

Private Attributes

pugi::xml_node node
friend XMLDataReader
std::set< std::string > attrQueried
std::set< std::string > attrRead
int recId =-1

Detailed Description

Class representing the Input Record for OOFEM XML input file format. It is represented as XML node with attributes, nested nodes, but without text.

Definition at line 55 of file xmlinputrecord.h.

Constructor & Destructor Documentation

◆ XMLInputRecord()

oofem::XMLInputRecord::XMLInputRecord ( XMLDataReader * reader_,
const pugi::xml_node & node_ )

Member Function Documentation

◆ _attr_traced_read()

std::string oofem::XMLInputRecord::_attr_traced_read ( const char * name)
inline

Definition at line 65 of file xmlinputrecord.h.

References _attr_traced_read_with_node().

Referenced by giveRecordKeywordField().

◆ _attr_traced_read_with_node()

std::tuple< std::string, pugi::xml_node > oofem::XMLInputRecord::_attr_traced_read_with_node ( const char * name)

◆ _reader()

XMLDataReader * oofem::XMLInputRecord::_reader ( ) const
inlineprivate

Definition at line 62 of file xmlinputrecord.h.

References oofem::InputRecord::giveReader(), and XMLDataReader.

Referenced by giveGroupCount(), hasChild(), and loc().

◆ clone()

std::shared_ptr< InputRecord > oofem::XMLInputRecord::clone ( ) const
inlineoverridevirtual

Creates a newly allocated copy of the receiver

Implements oofem::InputRecord.

Definition at line 69 of file xmlinputrecord.h.

◆ finish()

void oofem::XMLInputRecord::finish ( bool wrn = true)
overridevirtual

Terminates the current record session and if the flag is true, warning is printed for unscanned tokens.

Implements oofem::InputRecord.

Definition at line 229 of file xmlinputrecord.C.

References _XML_DEBUG, attrQueried, attrRead, loc(), node, OOFEM_WARNING, and SeenMark.

◆ giveField() [1/11]

void oofem::XMLInputRecord::giveField ( bool & answer,
InputFieldType id )
overridevirtual

Reads the bool field value.

Implements oofem::InputRecord.

Definition at line 303 of file xmlinputrecord.C.

References _attr_traced_read_with_node(), hasField(), loc(), and oofem::string_to().

◆ giveField() [2/11]

void oofem::XMLInputRecord::giveField ( Dictionary & answer,
InputFieldType id )
overridevirtual

◆ giveField() [3/11]

void oofem::XMLInputRecord::giveField ( double & answer,
InputFieldType id )
overridevirtual

Reads the double field value.

Implements oofem::InputRecord.

Definition at line 293 of file xmlinputrecord.C.

References _attr_traced_read_with_node(), loc(), and oofem::string_to().

◆ giveField() [4/11]

void oofem::XMLInputRecord::giveField ( FloatArray & answer,
InputFieldType id )
overridevirtual

◆ giveField() [5/11]

void oofem::XMLInputRecord::giveField ( FloatMatrix & answer,
InputFieldType id )
overridevirtual

◆ giveField() [6/11]

void oofem::XMLInputRecord::giveField ( int & answer,
InputFieldType id )
overridevirtual

Reads the integer field value.

Implements oofem::InputRecord.

Definition at line 298 of file xmlinputrecord.C.

References _attr_traced_read_with_node(), loc(), and oofem::string_to().

Referenced by giveField(), giveField(), and giveRecordKeywordField().

◆ giveField() [7/11]

void oofem::XMLInputRecord::giveField ( IntArray & answer,
InputFieldType id )
overridevirtual

Reads the IntArray field value.

Implements oofem::InputRecord.

Definition at line 286 of file xmlinputrecord.C.

References _XML_DEBUG, oofem::Tokens::as(), oofem::Tokens::loc, oofem::IntArray::resize(), and oofem::Tokens::size().

◆ giveField() [8/11]

void oofem::XMLInputRecord::giveField ( ScalarFunction & function,
InputFieldType id )
overridevirtual

◆ giveField() [9/11]

void oofem::XMLInputRecord::giveField ( std ::list< Range > & answer,
InputFieldType id )
overridevirtual

Reads the std::list<Range> field value.

Implements oofem::InputRecord.

References giveField(), giveGroupCount(), hasChild(), and hasField().

◆ giveField() [10/11]

void oofem::XMLInputRecord::giveField ( std ::string & answer,
InputFieldType id )
overridevirtual

Reads the string field value.

Implements oofem::InputRecord.

References giveField().

◆ giveField() [11/11]

void oofem::XMLInputRecord::giveField ( std ::vector< std ::string > & answer,
InputFieldType id )
inlineoverridevirtual

Reads the vector of strings.

Implements oofem::InputRecord.

Definition at line 87 of file xmlinputrecord.h.

References _XML_NI.

◆ giveGroupCount()

int oofem::XMLInputRecord::giveGroupCount ( InputFieldType id,
const std::string & name,
bool optional )
overridevirtual

◆ giveLocation()

std::string oofem::XMLInputRecord::giveLocation ( ) const
inlineoverridevirtual

Implements oofem::InputRecord.

Definition at line 100 of file xmlinputrecord.h.

References loc().

◆ giveRecordAsString()

std::string oofem::XMLInputRecord::giveRecordAsString ( ) const
overridevirtual

Returns string representation of record in OOFEMs text format.

Implements oofem::InputRecord.

Definition at line 249 of file xmlinputrecord.C.

References node, and SeenMark.

◆ giveRecordInTXTFormat()

std::string oofem::XMLInputRecord::giveRecordInTXTFormat ( ) const
overridevirtual

Implements oofem::InputRecord.

Definition at line 259 of file xmlinputrecord.C.

References OOFEM_ERROR.

◆ giveRecordKeywordField() [1/2]

void oofem::XMLInputRecord::giveRecordKeywordField ( std ::string & answer)
overridevirtual

Reads the record id field (type of record).

Implements oofem::InputRecord.

Definition at line 177 of file xmlinputrecord.C.

References _attr_traced_read(), _XML_DEBUG, and node.

◆ giveRecordKeywordField() [2/2]

void oofem::XMLInputRecord::giveRecordKeywordField ( std ::string & answer,
int & value )
overridevirtual

Reads the record id field (type of record) and its corresponding number.

Implements oofem::InputRecord.

References giveField(), and giveRecordKeywordField().

Referenced by giveRecordKeywordField().

◆ hasChild()

bool oofem::XMLInputRecord::hasChild ( InputFieldType id,
const std::string & name,
bool optional )
overridevirtual

Implements oofem::InputRecord.

Definition at line 170 of file xmlinputrecord.C.

References _reader(), oofem::XMLDataReader::giveNamedChild(), loc(), node, and OOFEM_ERROR.

Referenced by giveField().

◆ hasField()

bool oofem::XMLInputRecord::hasField ( InputFieldType id)
overridevirtual

Returns true if record contains field identified by idString keyword.

Implements oofem::InputRecord.

Definition at line 188 of file xmlinputrecord.C.

References attrQueried, node, and xmlizeAttrName().

Referenced by giveField(), and giveField().

◆ loc() [1/2]

std::string oofem::XMLInputRecord::loc ( ) const
inline

◆ loc() [2/2]

std::string oofem::XMLInputRecord::loc ( const pugi::xml_node & node) const

Definition at line 74 of file xmlinputrecord.C.

References _reader(), oofem::XMLDataReader::loc(), and node.

◆ node_seen_get()

bool oofem::XMLInputRecord::node_seen_get ( const pugi::xml_node & n)
static

Definition at line 67 of file xmlinputrecord.C.

References SeenMark.

Referenced by oofem::XMLDataReader::finish(), and oofem::XMLDataReader::giveInputRecord().

◆ node_seen_set()

void oofem::XMLInputRecord::node_seen_set ( pugi::xml_node & n,
bool seen )
static

◆ printYourself()

void oofem::XMLInputRecord::printYourself ( )
inlineoverridevirtual

Print input record.

Implements oofem::InputRecord.

Definition at line 96 of file xmlinputrecord.h.

References _XML_NI.

◆ setRecId()

int oofem::XMLInputRecord::setRecId ( int lastRecId)

Definition at line 149 of file xmlinputrecord.C.

References oofem::InputRecord::giveOptionalField(), loc(), OOFEM_WARNING, and recId.

◆ xmlizeAttrName()

std::string oofem::XMLInputRecord::xmlizeAttrName ( const std::string & s)
staticprivate

Definition at line 202 of file xmlinputrecord.C.

Referenced by _attr_traced_read_with_node(), and hasField().

Member Data Documentation

◆ attrQueried

std::set<std::string> oofem::XMLInputRecord::attrQueried
private

Definition at line 59 of file xmlinputrecord.h.

Referenced by finish(), and hasField().

◆ attrRead

std::set<std::string> oofem::XMLInputRecord::attrRead
private

Definition at line 60 of file xmlinputrecord.h.

Referenced by _attr_traced_read_with_node(), and finish().

◆ node

◆ recId

int oofem::XMLInputRecord::recId =-1
private

Definition at line 61 of file xmlinputrecord.h.

Referenced by setRecId().

◆ SeenMark

char oofem::XMLInputRecord::SeenMark[] ="__seen"
staticconstexpr

Definition at line 105 of file xmlinputrecord.h.

Referenced by finish(), giveRecordAsString(), node_seen_get(), and node_seen_set().

◆ XMLDataReader

friend oofem::XMLInputRecord::XMLDataReader
private

Definition at line 58 of file xmlinputrecord.h.

Referenced by _reader(), and XMLInputRecord().


The documentation for this class was generated from the following files:

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011