PeriDEM 0.3.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
inp::Field< Deck > Struct Template Reference

One field of a deck, declared once. More...

#include <deckField.h>

Collaboration diagram for inp::Field< Deck >:

Data Fields

std::string key
 Key in the JSON block.
 
std::string doc
 One line describing the field, reported by the schema.
 
std::string type
 Name of the type, reported by the schema.
 
std::function< void(Deck &, const json &)> read
 Reads the key into the member, or leaves the default in place.
 
std::function< void(const Deck &, json &)> write
 Writes the member under the key, if it is to be written.
 
std::function< void(json &)> writeDefault
 Writes the default under the key, if it is to be written.
 
std::function< void(const Deck &, std::ostringstream &, const std::string &)> print
 Appends the key and its value to a stream, after a tab prefix.
 
std::function< void(const json &)> check
 Throws if the value is one the field does not accept.
 
std::function< bool(const json &)> emit
 Whether a value is written rather than left out of the block.
 

Detailed Description

template<class Deck>
struct inp::Field< Deck >

One field of a deck, declared once.

A deck class states its fields in a table of these. Reading a block, writing one, printing the deck and reporting its schema are generated from the table, so the reader and the writer cannot name different keys or carry different defaults. Three defects of that kind were found in this code before the tables existed.

A field that does not map to one key stays in the deck's own readDerived and writeDerived. Nested blocks such as Discretization_Type, values computed from other fields such as the time step, and keys that exclude one another such as Kn and V_Max are of that kind.

Definition at line 43 of file deckField.h.

Field Documentation

◆ check

template<class Deck >
std::function<void(const json &)> inp::Field< Deck >::check

Throws if the value is one the field does not accept.

Definition at line 68 of file deckField.h.

◆ doc

template<class Deck >
std::string inp::Field< Deck >::doc

One line describing the field, reported by the schema.

Definition at line 49 of file deckField.h.

◆ emit

template<class Deck >
std::function<bool(const json &)> inp::Field< Deck >::emit

Whether a value is written rather than left out of the block.

Definition at line 71 of file deckField.h.

◆ key

template<class Deck >
std::string inp::Field< Deck >::key

Key in the JSON block.

Definition at line 46 of file deckField.h.

◆ print

template<class Deck >
std::function<void(const Deck &, std::ostringstream &, const std::string &)> inp::Field< Deck >::print

Appends the key and its value to a stream, after a tab prefix.

Definition at line 65 of file deckField.h.

◆ read

template<class Deck >
std::function<void(Deck &, const json &)> inp::Field< Deck >::read

Reads the key into the member, or leaves the default in place.

Definition at line 55 of file deckField.h.

◆ type

template<class Deck >
std::string inp::Field< Deck >::type

Name of the type, reported by the schema.

Definition at line 52 of file deckField.h.

◆ write

template<class Deck >
std::function<void(const Deck &, json &)> inp::Field< Deck >::write

Writes the member under the key, if it is to be written.

Definition at line 58 of file deckField.h.

◆ writeDefault

template<class Deck >
std::function<void(json &)> inp::Field< Deck >::writeDefault

Writes the default under the key, if it is to be written.

Definition at line 61 of file deckField.h.


The documentation for this struct was generated from the following file: