OGS
|
Wrapper around a Boost Property Tree with some basic error reporting features.
Features. This class:
The purpose of this class is to reduce or completely avoid the amount of error-handling code in routines that take configuration parameters.
Most methods of this class check that they have not been called before for the same ConfigTree
and the same parameter. This behaviour helps to enforce that every parameter is read exactly once during parsing of the configuration settings.
The most notable restriction of this class when compared to plain tree traversal is, that one must know all the XML tags (i.e. configuration parameters) at compile time. It is not possible to read from this class, which configuration parameters are present in the tree. This restriction, however, is intended, because it provides the possibility to get all existing configuration parameters from the source code.
This class maintains a read counter for each parameter accessed through any of its methods. Read counters are increased with every read (the only exception being the peekConfigParameter() method). The destructor finally decreases the read counter for every tag/attribute it find on the current level of the XML tree. If the increases/decreases don't cancel each other, warning messages are generated. This check can also be enforced before destruction by using the BaseLib::checkAndInvalidate() functions.
The design of this class entails some limitations compared to traversing a plain tree, e.g., it is not possible to obtain a list of tags or attributes from the tree, but one has to explicitly query the specific tags/attributes one is interested in. That way it is possible to get all used configuration parameters directly from the source code where this class is used, and to maintain the quality of the configuration parameter documentation.
Instances of this class only keep a reference to the underlying boost::property_tree
. Therefore it is necessary that the underlying property tree stays intact as long as any instance—i.e. the top level ConfigTree and any of its children—reference it. In order to simplify the handling of this dependence, the class ConfigTreeTopLevel can be used.
The construction of a ConfigTree from the content of an XML file can be done with the function BaseLib::makeConfigTree(), which performs many error checks. For limitations of the used XML parser, please have a look at that function's documentation.
Definition at line 106 of file ConfigTree.h.
#include <ConfigTree.h>
Classes | |
struct | CountType |
class | ParameterIterator |
class | SubtreeIterator |
class | ValueIterator |
Public Types | |
using | PTree = boost::property_tree::ptree |
The tree being wrapped by this class. | |
using | Callback |
Public Member Functions | |
ConfigTree (PTree &&top_level_tree, std::string filename, Callback error_cb, Callback warning_cb) | |
ConfigTree (ConfigTree const &)=delete | |
copying is not compatible with the semantics of this class | |
ConfigTree (ConfigTree &&other) | |
ConfigTree & | operator= (ConfigTree const &)=delete |
copying is not compatible with the semantics of this class | |
ConfigTree & | operator= (ConfigTree &&other) |
std::string const & | getProjectFileName () const |
Used to get the project file name. | |
~ConfigTree () | |
Methods for directly accessing parameter values | |
template<typename T > | |
T | getConfigParameter (std::string const ¶m) const |
template<typename T > | |
T | getConfigParameter (std::string const ¶m, T const &default_value) const |
template<typename T > | |
std::optional< T > | getConfigParameterOptional (std::string const ¶m) const |
template<typename T > | |
Range< ValueIterator< T > > | getConfigParameterList (std::string const ¶m) const |
Methods for accessing parameters that have attributes | |
The The support for parameters with attributes is limited in the sense that it is not possible to peek/check them. However, such functionality can easily be added on demand. | |
ConfigTree | getConfigParameter (std::string const &root) const |
std::optional< ConfigTree > | getConfigParameterOptional (std::string const ¶m) const |
Range< ParameterIterator > | getConfigParameterList (std::string const ¶m) const |
template<typename T > | |
T | getValue () const |
template<typename T > | |
T | getConfigAttribute (std::string const &attr) const |
template<typename T > | |
T | getConfigAttribute (std::string const &attr, T const &default_value) const |
template<typename T > | |
std::optional< T > | getConfigAttributeOptional (std::string const &attr) const |
Methods for peeking and checking parameters | |
To be used in builder/factory functions: E.g., one can peek a parameter denoting the type of an object to generate in the builder, and check the type parameter in the constructor of the generated object. | |
template<typename T > | |
T | peekConfigParameter (std::string const ¶m) const |
void | checkConfigParameter (std::string const ¶m, std::string_view const value) const |
Methods for accessing subtrees | |
ConfigTree | getConfigSubtree (std::string const &root) const |
std::optional< ConfigTree > | getConfigSubtreeOptional (std::string const &root) const |
Range< SubtreeIterator > | getConfigSubtreeList (std::string const &root) const |
Methods for ignoring parameters | |
void | ignoreConfigParameter (std::string const ¶m) const |
void | ignoreConfigParameterAll (std::string const ¶m) const |
void | ignoreConfigAttribute (std::string const &attr) const |
Static Public Member Functions | |
static void | onerror (std::string const &filename, std::string const &path, std::string const &message) |
static void | onwarning (std::string const &filename, std::string const &path, std::string const &message) |
static void | assertNoSwallowedErrors () |
Asserts that there have not been any errors reported in the destructor. | |
Private Types | |
enum class | Attr : bool { TAG = false , ATTR = true } |
Used to indicate if dealing with XML tags or XML attributes. More... | |
using | KeyType = std::pair<Attr, std::string> |
A pair (is attribute, tag/attribute name). | |
Private Member Functions | |
template<typename T > | |
std::optional< T > | getConfigParameterOptionalImpl (std::string const ¶m, T *) const |
Default implementation of reading a value of type T. | |
template<typename T > | |
std::optional< std::vector< T > > | getConfigParameterOptionalImpl (std::string const ¶m, std::vector< T > *) const |
Implementation of reading a vector of values of type T. | |
ConfigTree (PTree const &tree, ConfigTree const &parent, std::string const &root) | |
Used for wrapping a subtree. | |
void | error (std::string const &message) const |
void | warning (std::string const &message) const |
void | checkKeyname (std::string const &key) const |
Checks if key complies with the rules [a-z0-9_]. | |
std::string | joinPaths (std::string const &p1, std::string const &p2) const |
Used to generate the path of a subtree. | |
void | checkUnique (std::string const &key) const |
Asserts that the key has not been read yet. | |
void | checkUniqueAttr (std::string const &attr) const |
Asserts that the attribute attr has not been read yet. | |
template<typename T > | |
CountType & | markVisited (std::string const &key, Attr const is_attr, bool peek_only) const |
CountType & | markVisited (std::string const &key, Attr const is_attr, bool const peek_only) const |
void | markVisitedDecrement (Attr const is_attr, std::string const &key) const |
bool | hasChildren () const |
Checks if this tree has any children. | |
void | checkAndInvalidate () |
Static Private Member Functions | |
static std::string | shortString (std::string const &s) |
returns a short string at suitable for error/warning messages | |
Private Attributes | |
std::shared_ptr< PTree const > | top_level_tree_ |
PTree const * | tree_ |
The wrapped tree. | |
std::string | path_ |
A path printed in error/warning messages. | |
std::string | filename_ |
The path of the file from which this tree has been read. | |
std::map< KeyType, CountType > | visited_params_ |
bool | have_read_data_ = false |
Callback | onerror_ |
Custom error callback. | |
Callback | onwarning_ |
Custom warning callback. | |
Static Private Attributes | |
static const char | pathseparator = '/' |
Character separating two path components. | |
static const std::string | key_chars_start = "abcdefghijklmnopqrstuvwxyz" |
Set of allowed characters as the first letter of a key name. | |
static const std::string | key_chars = key_chars_start + "_0123456789" |
Set of allowed characters in a key name. | |
Friends | |
void | checkAndInvalidate (ConfigTree *const conf) |
void | checkAndInvalidate (ConfigTree &conf) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | checkAndInvalidate (std::unique_ptr< ConfigTree > const &conf) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Type of the function objects used as callbacks.
Arguments of the callback:
filename
the file being from which this ConfigTree has been read. path
the path in the tree where the message was generated. message
the message to be printed. Definition at line 264 of file ConfigTree.h.
|
private |
A pair (is attribute, tag/attribute name).
Definition at line 657 of file ConfigTree.h.
using BaseLib::ConfigTree::PTree = boost::property_tree::ptree |
The tree being wrapped by this class.
Definition at line 255 of file ConfigTree.h.
|
strongprivate |
Used to indicate if dealing with XML tags or XML attributes.
Enumerator | |
---|---|
TAG | |
ATTR |
Definition at line 571 of file ConfigTree.h.
|
explicit |
Creates a new instance wrapping the given Boost Property Tree.
top_level_tree | the top level Boost Property Tree |
filename | the file from which the tree has been read |
error_cb | callback function to be called on error. |
warning_cb | callback function to be called on warning. |
The callback functions must be valid callable functions, i.e. not nullptr's. They are configurable in order to make unit tests of this class easier. They should not be provided in production code!
Defaults are strict: By default, both callbacks are set to the same function, i.e., warnings will also result in program abortion!
Definition at line 35 of file ConfigTree.cpp.
References OGS_FATAL, onerror_, and onwarning_.
Referenced by getConfigSubtreeOptional(), BaseLib::ConfigTree::SubtreeIterator::operator*(), and BaseLib::ConfigTree::ValueIterator< ValueType >::operator*().
|
delete |
copying is not compatible with the semantics of this class
BaseLib::ConfigTree::ConfigTree | ( | ConfigTree && | other | ) |
After being moved from, other
is in an undefined state and must not be used anymore!
Definition at line 67 of file ConfigTree.cpp.
BaseLib::ConfigTree::~ConfigTree | ( | ) |
The destructor performs the check if all nodes at the current level of the tree have been read. Errors raised by the check are swallowed. Use assertNoSwallowedErrors() manually to check for those.
Definition at line 80 of file ConfigTree.cpp.
References checkAndInvalidate(), configtree_destructor_error_messages, and ERR().
|
explicitprivate |
Used for wrapping a subtree.
Definition at line 55 of file ConfigTree.cpp.
References checkKeyname().
|
static |
Asserts that there have not been any errors reported in the destructor.
Definition at line 255 of file ConfigTree.cpp.
References configtree_destructor_error_messages, ERR(), and OGS_FATAL.
Referenced by Simulation::initializeDataStructures().
|
private |
Checks if the top level of this tree has been read entirely (and not too often).
Definition at line 406 of file ConfigTree.cpp.
References ATTR, have_read_data_, markVisitedDecrement(), shortString(), TAG, tree_, visited_params_, and warning().
Referenced by ~ConfigTree(), and operator=().
void BaseLib::ConfigTree::checkConfigParameter | ( | std::string const & | param, |
std::string_view const | value ) const |
Assert that param
has the given value
.
Convenience method combining getConfigParameter(std::string const&) with a check.
Definition at line 151 of file ConfigTree.cpp.
References error().
Referenced by MaterialPropertyLib::createAverageMolarMass(), MaterialPropertyLib::createBishopsPowerLaw(), MaterialPropertyLib::createBishopsSaturationCutoff(), MaterialLib::PorousMedium::createBrooksCorey(), MaterialLib::PorousMedium::createCapillaryPressureModel(), MaterialPropertyLib::createCapillaryPressureRegularizedVanGenuchten(), MaterialPropertyLib::createCapillaryPressureVanGenuchten(), ProcessLib::createCentralDifferencesJacobianAssembler(), MaterialPropertyLib::createClausiusClapeyron(), MaterialLib::Fracture::CohesiveZoneModeI::createCohesiveZoneModeI(), ProcessLib::createCompareJacobiansJacobianAssembler(), ProcessLib::ComponentTransport::createComponentTransportProcess(), MaterialPropertyLib::createConstant(), ParameterLib::createConstantParameter(), MaterialLib::Fracture::Permeability::createConstantPermeability(), ProcessLib::createConstraintDirichletBoundaryCondition(), NumLib::createConvergenceCriterionDeltaX(), NumLib::createConvergenceCriterionPerComponentDeltaX(), NumLib::createConvergenceCriterionPerComponentResidual(), NumLib::createConvergenceCriterionResidual(), MaterialLib::Fracture::createCoulomb(), MaterialLib::Solids::Creep::createCreepBGRa(), MaterialLib::Fracture::Permeability::createCubicLaw(), MaterialPropertyLib::createCubicLawPermeability(), MaterialPropertyLib::createCurve(), ParameterLib::createCurveScaledParameter(), ProcessLib::createDirichletBoundaryCondition(), ProcessLib::createDirichletBoundaryConditionWithinTimeInterval(), MaterialPropertyLib::createDupuitPermeability(), MaterialPropertyLib::createEffectiveThermalConductivityPorosityMixing(), MaterialLib::Solids::Ehlers::createEhlers(), MaterialPropertyLib::createEmbeddedFracturePermeability(), NumLib::createEvolutionaryPIDcontroller(), MaterialPropertyLib::createExponential(), NumLib::createFixedTimeStepping(), MaterialLib::Fluid::createFluidDensityModel(), ProcessLib::createForwardDifferencesJacobianAssembler(), MaterialPropertyLib::createFunction(), ParameterLib::createFunctionParameter(), MaterialPropertyLib::createGasPressureDependentPermeability(), ParameterLib::createGroupBasedParameter(), ProcessLib::createHCNonAdvectiveFreeComponentFlowBoundaryCondition(), ProcessLib::HeatConduction::createHeatConductionProcess(), ProcessLib::HeatTransportBHE::createHeatTransportBHEProcess(), ProcessLib::HT::createHTProcess(), ProcessLib::LIE::HydroMechanics::createHydroMechanicsProcess(), ProcessLib::HydroMechanics::createHydroMechanicsProcess(), MaterialPropertyLib::createIdealGasLaw(), MaterialPropertyLib::createIdealGasLawBinaryMixture(), NumLib::createIterationNumberBasedTimeStepping(), MaterialPropertyLib::createKozenyCarmanModel(), ProcessLib::LargeDeformation::createLargeDeformationProcess(), MaterialPropertyLib::createLinear(), MaterialLib::Fluid::createLinearConcentrationAndPressureDependentDensity(), MaterialLib::Fluid::createLinearConcentrationDependentDensity(), MaterialLib::Fracture::createLinearElasticIsotropic(), MaterialLib::Solids::createLinearElasticIsotropic(), MaterialLib::Solids::createLinearElasticOrthotropic(), MaterialLib::Solids::createLinearElasticTransverseIsotropic(), MaterialLib::Fluid::createLinearPressureDependentViscosity(), MaterialPropertyLib::createLinearSaturationSwellingStress(), MaterialLib::Fluid::createLinearTemperatureDependentDensity(), MaterialPropertyLib::createLinearWaterVapourLatentHeat(), MaterialLib::Fluid::createLiquidDensity(), ProcessLib::LiquidFlow::createLiquidFlowProcess(), MaterialPropertyLib::createLiquidViscosityVogels(), MaterialLib::Solids::Lubby2::createLubby2(), ParameterLib::createMeshElementParameter(), ParameterLib::createMeshNodeParameter(), MaterialLib::Solids::MFront::createMFrontConfig(), ProcessLib::createNeumannBoundaryCondition(), ProcessLib::createNodalSourceTerm(), MaterialLib::PorousMedium::createNonWettingPhaseBrooksCoreyOilGas(), MaterialLib::PorousMedium::createNonWettingPhaseVanGenuchten(), ProcessLib::NormalTractionBoundaryCondition::createNormalTractionBoundaryCondition(), MaterialPropertyLib::createOrthotropicEmbeddedFracturePermeability(), MaterialPropertyLib::createParameterProperty(), MaterialPropertyLib::createPermeabilityMohrCoulombFailureIndexModel(), MaterialPropertyLib::createPermeabilityOrthotropicPowerLaw(), ProcessLib::createPhaseFieldIrreversibleDamageOracleBoundaryCondition(), ProcessLib::PhaseField::createPhaseFieldProcess(), MaterialPropertyLib::createPorosityFromMassBalance(), ProcessLib::createPrimaryVariableConstraintDirichletBoundaryCondition(), ProcessLib::createPythonBoundaryCondition(), ProcessLib::createPythonSourceTerm(), ParameterLib::createRandomFieldMeshElementParameter(), ParameterLib::createRasterParameter(), MaterialLib::PorousMedium::createRelativePermeabilityModel(), MaterialPropertyLib::createRelPermBrooksCorey(), MaterialPropertyLib::createRelPermBrooksCoreyNonwettingPhase(), MaterialPropertyLib::createRelPermGeneralizedPower(), MaterialPropertyLib::createRelPermGeneralizedPowerNonwettingPhase(), MaterialPropertyLib::createRelPermLiakopoulos(), MaterialPropertyLib::createRelPermNonWettingPhaseVanGenuchtenMualem(), MaterialPropertyLib::createRelPermUdell(), MaterialPropertyLib::createRelPermUdellNonwettingPhase(), MaterialPropertyLib::createRelPermVanGenuchten(), ProcessLib::RichardsComponentTransport::createRichardsComponentTransportProcess(), ProcessLib::RichardsFlow::createRichardsFlowProcess(), ProcessLib::RichardsMechanics::createRichardsMechanicsProcess(), ProcessLib::createRobinBoundaryCondition(), MaterialPropertyLib::createSaturationBrooksCorey(), MaterialPropertyLib::createSaturationDependentSwelling(), MaterialPropertyLib::createSaturationDependentThermalConductivity(), MaterialPropertyLib::createSaturationExponential(), MaterialPropertyLib::createSaturationLiakopoulos(), MaterialPropertyLib::createSaturationVanGenuchten(), MaterialPropertyLib::createSaturationVanGenuchtenWithVolumetricStrain(), MaterialPropertyLib::createSaturationWeightedThermalConductivity(), ProcessLib::SmallDeformationNonlocal::createSmallDeformationNonlocalProcess(), ProcessLib::LIE::SmallDeformation::createSmallDeformationProcess(), ProcessLib::SmallDeformation::createSmallDeformationProcess(), MaterialPropertyLib::createSoilThermalConductivitySomerton(), ProcessLib::createSolutionDependentDirichletBoundaryCondition(), MaterialPropertyLib::createSpecificHeatCapacityWithLatentHeat(), ProcessLib::SteadyStateDiffusion::createSteadyStateDiffusion(), ProcessLib::StokesFlow::createStokesFlowProcess(), MaterialPropertyLib::createStrainDependentPermeability(), MaterialPropertyLib::createTemperatureDependentDiffusion(), MaterialPropertyLib::createTemperatureDependentFraction(), MaterialLib::Fluid::createTemperatureDependentViscosity(), ProcessLib::TES::createTESProcess(), ProcessLib::TH2M::createTH2MProcess(), ProcessLib::ThermalTwoPhaseFlowWithPP::createThermalTwoPhaseFlowWithPPProcess(), ProcessLib::ThermoHydroMechanics::createThermoHydroMechanicsProcess(), ProcessLib::ThermoMechanicalPhaseField::createThermoMechanicalPhaseFieldProcess(), ProcessLib::ThermoMechanics::createThermoMechanicsProcess(), ProcessLib::ThermoRichardsFlow::createThermoRichardsFlowProcess(), ProcessLib::ThermoRichardsMechanics::createThermoRichardsMechanicsProcess(), ParameterLib::createTimeDependentHeterogeneousParameter(), MaterialPropertyLib::createTransportPorosityFromMassBalance(), ProcessLib::TwoPhaseFlowWithPP::createTwoPhaseFlowWithPPProcess(), ProcessLib::TwoPhaseFlowWithPrho::createTwoPhaseFlowWithPrhoProcess(), MaterialLib::PorousMedium::createVanGenuchten(), MaterialPropertyLib::createVapourDiffusionDeVries(), MaterialPropertyLib::createVapourDiffusionFEBEX(), MaterialPropertyLib::createVapourDiffusionPMQ(), ProcessLib::createVariableDependentNeumannBoundaryCondition(), MaterialPropertyLib::createVermaPruessModel(), MaterialLib::Fluid::createViscosityModel(), MaterialPropertyLib::createVolumeFractionAverage(), ProcessLib::createVolumetricSourceTerm(), MaterialPropertyLib::createWaterDensityIAPWSIF97Region1(), MaterialPropertyLib::createWaterEnthalpyIAPWSIF97Region1(), MaterialPropertyLib::createWaterLiquidDensityIAPWSIF97Region4(), MaterialPropertyLib::createWaterLiquidEnthalpyIAPWSIF97Region4(), MaterialPropertyLib::createWaterSaturationTemperatureIAPWSIF97Region4(), MaterialPropertyLib::createWaterTemperatureIAPWSIF97Region1(), MaterialPropertyLib::createWaterThermalConductivityIAPWS(), MaterialPropertyLib::createWaterVapourDensity(), MaterialPropertyLib::createWaterVapourDensityIAPWSIF97Region4(), MaterialPropertyLib::createWaterVapourEnthalpyIAPWSIF97Region4(), MaterialPropertyLib::createWaterVapourLatentHeatWithCriticalTemperature(), MaterialPropertyLib::createWaterViscosityIAPWS(), ProcessLib::createWellboreCompensateNeumannBoundaryCondition(), ProcessLib::WellboreSimulator::createWellboreSimulatorProcess(), MaterialLib::PorousMedium::createWettingPhaseBrooksCoreyOilGas(), and MaterialLib::PorousMedium::createWettingPhaseVanGenuchten().
|
private |
Checks if key
complies with the rules [a-z0-9_].
Definition at line 285 of file ConfigTree.cpp.
References error(), key_chars, and key_chars_start.
Referenced by ConfigTree(), checkUnique(), checkUniqueAttr(), and peekConfigParameter().
|
private |
Asserts that the key
has not been read yet.
Definition at line 325 of file ConfigTree.cpp.
References checkKeyname(), error(), and visited_params_.
Referenced by getConfigParameterList(), getConfigParameterOptional(), getConfigSubtreeList(), getConfigSubtreeOptional(), ignoreConfigParameter(), and ignoreConfigParameterAll().
|
private |
Asserts that the attribute attr
has not been read yet.
Definition at line 335 of file ConfigTree.cpp.
References checkKeyname(), error(), and visited_params_.
Referenced by getConfigAttributeOptional(), and ignoreConfigAttribute().
|
private |
Called if an error occurs. Will call the error callback.
This method only acts as a helper method and throws std::runtime_error.
Definition at line 228 of file ConfigTree.cpp.
References filename_, OGS_FATAL, onerror_, and path_.
Referenced by checkConfigParameter(), checkKeyname(), checkUnique(), checkUniqueAttr(), getConfigAttribute(), getConfigAttributeOptional(), getConfigParameter(), getConfigParameter(), getConfigParameterOptional(), getConfigParameterOptionalImpl(), getConfigSubtree(), getValue(), joinPaths(), markVisited(), BaseLib::ConfigTree::ParameterIterator::operator*(), and peekConfigParameter().
T BaseLib::ConfigTree::getConfigAttribute | ( | std::string const & | attr | ) | const |
Get XML attribute attr
of type T
for the current parameter.
attr
must not have been read before from the current parameter. Definition at line 167 of file ConfigTree-impl.h.
References error().
Referenced by ParameterLib::confirmThirdBaseExplicit(), ChemistryLib::PhreeqcIOData::createAqueousSolution(), ParameterLib::createCoordinateSystemWithImplicitBase(), and MaterialLib::PorousMedium::createPorousMediaProperties().
T BaseLib::ConfigTree::getConfigAttribute | ( | std::string const & | attr, |
T const & | default_value ) const |
Get XML attribute attr
of type T
for the current parameter or the default_value
.
This method has a similar behaviour as getConfigAttribute(std::string
const&) except the default_value
is returned if the attribute has not been found.
attr
must not have been read before from the current parameter. Definition at line 178 of file ConfigTree-impl.h.
std::optional< T > BaseLib::ConfigTree::getConfigAttributeOptional | ( | std::string const & | attr | ) | const |
Get XML attribute attr
of type T
for the current parameter if present.
attr
must not have been read before from the current parameter. Definition at line 190 of file ConfigTree-impl.h.
References ATTR, checkUniqueAttr(), error(), shortString(), and tree_.
Referenced by ProcessLib::TwoPhaseFlowWithPrho::createTwoPhaseFlowPrhoMaterialProperties(), parseOutputMeshConfig(), and anonymous_namespace{ProjectData.cpp}::readSingleMesh().
T BaseLib::ConfigTree::getConfigParameter | ( | std::string const & | param | ) | const |
Get parameter param
of type T
from the configuration tree.
param
must not have been read before from this ConfigTree. Definition at line 41 of file ConfigTree-impl.h.
References error().
Referenced by ChemistryLib::PhreeqcIOData::createAqueousSolution(), ChemistryLib::PhreeqcKernelData::createAqueousSolution(), MaterialPropertyLib::createBishopsPowerLaw(), MaterialPropertyLib::createBishopsSaturationCutoff(), ProcessLib::HeatTransportBHE::BHE::createBoreholeGeometry(), MaterialLib::PorousMedium::createBrooksCorey(), MaterialPropertyLib::createCapillaryPressureRegularizedVanGenuchten(), MaterialPropertyLib::createCapillaryPressureVanGenuchten(), ChemistryLib::createChemicalSolverInterface< ChemicalSolver::Phreeqc >(), MaterialPropertyLib::createClausiusClapeyron(), MaterialLib::Fracture::CohesiveZoneModeI::createCohesiveZoneModeI(), ProcessLib::createCompareJacobiansJacobianAssembler(), anonymous_namespace{CreateComponent.cpp}::createComponent(), ProcessLib::ComponentTransport::createComponentTransportProcess(), MaterialPropertyLib::createConstant(), ParameterLib::createConstantParameter(), MaterialLib::Fracture::Permeability::createConstantPermeability(), ProcessLib::createConstraintDirichletBoundaryCondition(), NumLib::createConvergenceCriterionDeltaX(), NumLib::createConvergenceCriterionPerComponentDeltaX(), NumLib::createConvergenceCriterionPerComponentResidual(), NumLib::createConvergenceCriterionResidual(), MaterialLib::Fracture::createCoulomb(), MaterialPropertyLib::createCubicLawPermeability(), MaterialPropertyLib::createCurve(), ParameterLib::createCurveScaledParameter(), ProcessLib::createDeactivatedSubdomain(), ProcessLib::createDirichletBoundaryCondition(), ProcessLib::createDirichletBoundaryConditionWithinTimeInterval(), MaterialPropertyLib::createDupuitPermeability(), MaterialLib::Solids::Ehlers::createEhlers(), MaterialPropertyLib::createEmbeddedFracturePermeability(), NumLib::createEvolutionaryPIDcontroller(), MaterialPropertyLib::createExponential(), NumLib::createFixedTimeStepping(), ProcessLib::HeatTransportBHE::BHE::createFlowAndTemperatureControl(), MaterialLib::Fluid::createFluidDensityModel(), MaterialLib::Fluid::createFluidThermalConductivityModel(), MaterialPropertyLib::createGasPressureDependentPermeability(), ParameterLib::createGroupBasedParameter(), ProcessLib::HeatTransportBHE::BHE::createGroutParameters(), ProcessLib::createHCNonAdvectiveFreeComponentFlowBoundaryCondition(), ProcessLib::HeatConduction::createHeatConductionProcess(), ProcessLib::HeatTransportBHE::createHeatTransportBHEProcess(), ProcessLib::HT::createHTProcess(), ProcessLib::LIE::HydroMechanics::createHydroMechanicsProcess(), ProcessLib::HydroMechanics::createHydroMechanicsProcess(), NumLib::createIterationNumberBasedTimeStepping(), ChemistryLib::PhreeqcIOData::createKnobs(), MaterialPropertyLib::createKozenyCarmanModel(), ProcessLib::LargeDeformation::createLargeDeformationProcess(), MaterialPropertyLib::createLinear(), MaterialLib::Fluid::createLinearConcentrationAndPressureDependentDensity(), MaterialLib::Fluid::createLinearConcentrationDependentDensity(), MaterialLib::Fracture::createLinearElasticIsotropic(), MaterialLib::Fluid::createLinearPressureDependentViscosity(), MaterialPropertyLib::createLinearSaturationSwellingStress(), MaterialLib::Fluid::createLinearTemperatureDependentDensity(), MaterialLib::Fluid::createLiquidDensity(), ProcessLib::LiquidFlow::createLiquidFlowProcess(), ParameterLib::createMeshElementParameter(), ParameterLib::createMeshNodeParameter(), MaterialLib::Solids::MFront::createMFrontConfig(), ProcessLib::createNeumannBoundaryCondition(), NumLib::createNewtonRaphsonSolverParameters(), ProcessLib::createNodalSourceTerm(), NumLib::createNonlinearSolver(), MaterialLib::PorousMedium::createNonWettingPhaseBrooksCoreyOilGas(), MaterialLib::PorousMedium::createNonWettingPhaseVanGenuchten(), ProcessLib::NormalTractionBoundaryCondition::createNormalTractionBoundaryCondition(), MaterialPropertyLib::createOrthotropicEmbeddedFracturePermeability(), ProcessLib::createOutputConfig(), ParameterLib::createParameter(), MaterialPropertyLib::createParameterProperty(), MaterialLib::PorousMedium::createPermeabilityModel(), MaterialPropertyLib::createPermeabilityMohrCoulombFailureIndexModel(), MaterialPropertyLib::createPermeabilityOrthotropicPowerLaw(), anonymous_namespace{CreatePhase.cpp}::createPhase(), ProcessLib::PhaseField::createPhaseFieldProcess(), ProcessLib::HeatTransportBHE::BHE::createPipe(), MaterialPropertyLib::createPorosityFromMassBalance(), ProcessLib::createPrimaryVariableConstraintDirichletBoundaryCondition(), ProcessLib::createPythonBoundaryCondition(), ProcessLib::createPythonSourceTerm(), ParameterLib::createRandomFieldMeshElementParameter(), ProcessLib::HeatTransportBHE::BHE::createRefrigerantProperties(), MaterialPropertyLib::createRelPermBrooksCorey(), MaterialPropertyLib::createRelPermBrooksCoreyNonwettingPhase(), MaterialPropertyLib::createRelPermGeneralizedPower(), MaterialPropertyLib::createRelPermGeneralizedPowerNonwettingPhase(), MaterialPropertyLib::createRelPermNonWettingPhaseVanGenuchtenMualem(), MaterialPropertyLib::createRelPermUdell(), MaterialPropertyLib::createRelPermUdellNonwettingPhase(), MaterialPropertyLib::createRelPermVanGenuchten(), ProcessLib::WellboreSimulator::createReservoirProperties(), ProcessLib::RichardsComponentTransport::createRichardsComponentTransportProcess(), ProcessLib::RichardsFlow::createRichardsFlowProcess(), ProcessLib::RichardsMechanics::createRichardsMechanicsProcess(), ProcessLib::createRobinBoundaryCondition(), MaterialPropertyLib::createSaturationBrooksCorey(), MaterialPropertyLib::createSaturationDependentSwelling(), MaterialPropertyLib::createSaturationExponential(), MaterialPropertyLib::createSaturationVanGenuchten(), MaterialPropertyLib::createSaturationVanGenuchtenWithVolumetricStrain(), MaterialPropertyLib::createSaturationWeightedThermalConductivity(), ProcessLib::SmallDeformationNonlocal::createSmallDeformationNonlocalProcess(), ProcessLib::LIE::SmallDeformation::createSmallDeformationProcess(), ProcessLib::SmallDeformation::createSmallDeformationProcess(), ProcessLib::createSolutionDependentDirichletBoundaryCondition(), MaterialLib::Fluid::createSpecificFluidHeatCapacityModel(), MaterialPropertyLib::createSpecificHeatCapacityWithLatentHeat(), ProcessLib::StokesFlow::createStokesFlowProcess(), MaterialPropertyLib::createStrainDependentPermeability(), ProcessLib::SurfaceFluxData::createSurfaceFluxData(), MaterialPropertyLib::createTemperatureDependentDiffusion(), MaterialPropertyLib::createTemperatureDependentFraction(), MaterialLib::Fluid::createTemperatureDependentViscosity(), ProcessLib::TH2M::createTH2MProcess(), ProcessLib::ThermalTwoPhaseFlowWithPP::createThermalTwoPhaseFlowWithPPProcess(), ProcessLib::ThermoHydroMechanics::createThermoHydroMechanicsProcess(), ProcessLib::ThermoMechanicalPhaseField::createThermoMechanicalPhaseFieldProcess(), ProcessLib::ThermoMechanics::createThermoMechanicsProcess(), ProcessLib::ThermoRichardsFlow::createThermoRichardsFlowProcess(), ProcessLib::ThermoRichardsMechanics::createThermoRichardsMechanicsProcess(), ProcessLib::ThermoRichardsMechanics::createThermoRichardsMechanicsProcessStage2(), NumLib::createTimeDiscretization(), BaseLib::createTimeInterval(), MaterialPropertyLib::createTransportPorosityFromMassBalance(), ProcessLib::TwoPhaseFlowWithPP::createTwoPhaseFlowWithPPProcess(), ProcessLib::TwoPhaseFlowWithPrho::createTwoPhaseFlowWithPrhoProcess(), MaterialLib::PorousMedium::createVanGenuchten(), MaterialPropertyLib::createVapourDiffusionDeVries(), MaterialPropertyLib::createVapourDiffusionFEBEX(), MaterialPropertyLib::createVapourDiffusionPMQ(), ProcessLib::createVariableDependentNeumannBoundaryCondition(), MaterialPropertyLib::createVermaPruessModel(), MaterialLib::Fluid::createViscosityModel(), ProcessLib::createVolumetricSourceTerm(), ProcessLib::createWellboreCompensateNeumannBoundaryCondition(), ProcessLib::WellboreSimulator::createWellboreGeometry(), ProcessLib::WellboreSimulator::createWellboreSimulatorProcess(), MaterialLib::PorousMedium::createWettingPhaseBrooksCoreyOilGas(), MaterialLib::PorousMedium::createWettingPhaseVanGenuchten(), anonymous_namespace{ProcessVariable.cpp}::findMeshInConfig(), ParameterLib::findParameter(), ProcessLib::findProcessVariable(), Adsorption::Reaction::newInstance(), ProcessLib::HeatTransportBHE::BHE::parseBHE1PTypeConfig(), ProcessLib::HeatTransportBHE::BHE::parseBHECoaxialConfig(), ProcessLib::HeatTransportBHE::BHE::parseBHEUTypeConfig(), ProcessLib::parseLineSegment(), MathLib::parsePiecewiseLinearCurveConfig(), anonymous_namespace{ProjectData.cpp}::readMeshes(), and GeoLib::IO::readRaster().
T BaseLib::ConfigTree::getConfigParameter | ( | std::string const & | param, |
T const & | default_value ) const |
Get parameter param
of type T
from the configuration tree or the default_value
.
This method has a similar behaviour as getConfigParameter(std::string
const&) except the default_value
is returned if the attribute has not been found.
param
must not have been read before from this ConfigTree. Definition at line 52 of file ConfigTree-impl.h.
ConfigTree BaseLib::ConfigTree::getConfigParameter | ( | std::string const & | root | ) | const |
Get parameter param
from the configuration tree.
param
must not have been read before from this ConfigTree. Definition at line 118 of file ConfigTree.cpp.
References error(), and getConfigSubtree().
Range< ConfigTree::ValueIterator< T > > BaseLib::ConfigTree::getConfigParameterList | ( | std::string const & | param | ) | const |
Fetches all parameters with name param
from the current level of the tree.
The return value is suitable to be used with range-base for-loops.
param
must not have been read before from this ConfigTree. Definition at line 114 of file ConfigTree-impl.h.
References checkUnique(), TAG, and tree_.
Referenced by ProcessLib::HeatTransportBHE::createHeatTransportBHEProcess(), ProcessLib::LIE::HydroMechanics::createHydroMechanicsProcess(), ProcessLib::LIE::SmallDeformation::createSmallDeformationProcess(), ProcessLib::findProcessVariables(), and GeoLib::IO::BoostXmlGmlInterface::readPoints().
Range< ConfigTree::ParameterIterator > BaseLib::ConfigTree::getConfigParameterList | ( | std::string const & | param | ) | const |
Fetches all parameters with name param
from the current level of the tree.
The return value is suitable to be used with range-base for-loops.
param
must not have been read before from this ConfigTree. Definition at line 139 of file ConfigTree.cpp.
References checkUnique(), markVisited(), TAG, and tree_.
std::optional< T > BaseLib::ConfigTree::getConfigParameterOptional | ( | std::string const & | param | ) | const |
Get parameter param
of type T
from the configuration tree if present
This method has a similar behaviour as getConfigParameter(std::string const&) except no errors are raised. Rather it can be told from the return value if the parameter could be read.
param
must not have been read before from this ConfigTree. Definition at line 64 of file ConfigTree-impl.h.
References checkUnique(), and getConfigParameterOptionalImpl().
Referenced by MathLib::ODE::CVodeSolverImpl::CVodeSolverImpl(), ProjectData::ProjectData(), ProcessLib::TES::TESProcess::TESProcess(), MaterialLib::PorousMedium::createBrooksCorey(), ProcessLib::createCentralDifferencesJacobianAssembler(), ChemistryLib::createChargeBalance(), ProcessLib::ComponentTransport::createComponentTransportProcess(), ParameterLib::createConstantParameter(), NumLib::createConvergenceCriterionDeltaX(), NumLib::createConvergenceCriterionPerComponentDeltaX(), NumLib::createConvergenceCriterionPerComponentResidual(), NumLib::createConvergenceCriterionResidual(), ProcessLib::createDeactivatedSubdomain(), ProcessLib::ThermoRichardsFlow::createElasticityModel(), MaterialPropertyLib::createEmbeddedFracturePermeability(), ProcessLib::createForwardDifferencesJacobianAssembler(), ProcessLib::HT::createHTProcess(), ProcessLib::LIE::HydroMechanics::createHydroMechanicsProcess(), NumLib::createNewtonRaphsonSolverParameters(), ProcessLib::PhaseField::createPhaseFieldProcess(), ProcessLib::RichardsComponentTransport::createRichardsComponentTransportProcess(), ProcessLib::RichardsMechanics::createRichardsMechanicsProcess(), MaterialPropertyLib::createSaturationVanGenuchten(), ProcessLib::SmallDeformation::createSmallDeformationProcess(), ProcessLib::TH2M::createTH2MProcess(), ProcessLib::ThermoHydroMechanics::createThermoHydroMechanicsProcess(), ProcessLib::ThermoMechanics::createThermoMechanicsProcess(), ProcessLib::ThermoRichardsFlow::createThermoRichardsFlowProcess(), ProcessLib::ThermoRichardsMechanics::createThermoRichardsMechanicsProcessStage2(), MaterialLib::PorousMedium::createVanGenuchten(), anonymous_namespace{ProcessVariable.cpp}::findMeshInConfig(), ParameterLib::findOptionalTagParameter(), MathLib::LinearSolverOptionsParser< EigenLisLinearSolver >::parseNameAndOptions(), and anonymous_namespace{ProjectData.cpp}::readMeshes().
std::optional< ConfigTree > BaseLib::ConfigTree::getConfigParameterOptional | ( | std::string const & | param | ) | const |
Get parameter param
from the configuration tree if present.
param
must not have been read before from this ConfigTree. Definition at line 128 of file ConfigTree.cpp.
References error(), and getConfigSubtreeOptional().
|
private |
Implementation of reading a vector of values of type T.
Definition at line 85 of file ConfigTree-impl.h.
References error(), getConfigSubtreeOptional(), and shortString().
|
private |
Default implementation of reading a value of type T.
Definition at line 73 of file ConfigTree-impl.h.
References getConfigSubtreeOptional().
Referenced by getConfigParameterOptional().
ConfigTree BaseLib::ConfigTree::getConfigSubtree | ( | std::string const & | root | ) | const |
Get the subtree rooted at root
If root
is not found error() is called.
root
must not have been read before from this ConfigTree. Definition at line 162 of file ConfigTree.cpp.
References error(), and getConfigSubtreeOptional().
Referenced by ProjectData::ProjectData(), ProcessLib::TES::TESProcess::TESProcess(), MaterialLib::PorousMedium::createCapillaryPressureModel(), ChemistryLib::PhreeqcIOData::createChemicalSystem(), ProcessLib::createCompareJacobiansJacobianAssembler(), ProcessLib::ComponentTransport::createComponentTransportProcess(), ParameterLib::createCoordinateSystemWithImplicitBase(), MaterialLib::Fracture::createCoulomb(), MaterialLib::Solids::Creep::createCreepBGRa(), MaterialLib::Solids::Ehlers::createEhlers(), MaterialPropertyLib::createExponential(), NumLib::createFixedTimeStepping(), MaterialLib::Fluid::createFluidProperties(), MaterialPropertyLib::createFunction(), ProcessLib::HeatConduction::createHeatConductionProcess(), ProcessLib::HeatTransportBHE::createHeatTransportBHEProcess(), ProcessLib::HT::createHTProcess(), ProcessLib::LIE::HydroMechanics::createHydroMechanicsProcess(), ProcessLib::HydroMechanics::createHydroMechanicsProcess(), ChemistryLib::PhreeqcKernelData::createInitialAqueousSolution(), ProcessLib::LargeDeformation::createLargeDeformationProcess(), ProcessLib::LiquidFlow::createLiquidFlowProcess(), MaterialLib::Solids::Lubby2::createLubby2(), ProcessLib::createOutputConfig(), ProcessLib::PhaseField::createPhaseFieldProcess(), MaterialLib::PorousMedium::createPorousMediaProperties(), MaterialLib::PorousMedium::createRelativePermeabilityModel(), ProcessLib::RichardsComponentTransport::createRichardsComponentTransportProcess(), ProcessLib::RichardsFlow::createRichardsFlowProcess(), ProcessLib::RichardsMechanics::createRichardsMechanicsProcess(), ProcessLib::SmallDeformationNonlocal::createSmallDeformationNonlocalProcess(), ProcessLib::LIE::SmallDeformation::createSmallDeformationProcess(), ProcessLib::SmallDeformation::createSmallDeformationProcess(), ChemistryLib::PhreeqcIOData::createSolutionComponents(), ProcessLib::SteadyStateDiffusion::createSteadyStateDiffusion(), ProcessLib::StokesFlow::createStokesFlowProcess(), ProcessLib::TES::createTESProcess(), ProcessLib::TH2M::createTH2MProcess(), ProcessLib::ThermalTwoPhaseFlowWithPP::createThermalTwoPhaseFlowWithPPProcess(), ProcessLib::ThermoHydroMechanics::createThermoHydroMechanicsProcess(), ProcessLib::ThermoMechanicalPhaseField::createThermoMechanicalPhaseFieldProcess(), ProcessLib::ThermoMechanics::createThermoMechanicsProcess(), ProcessLib::ThermoRichardsFlow::createThermoRichardsFlowProcess(), ProcessLib::ThermoRichardsMechanics::createThermoRichardsMechanicsProcessStage2(), ParameterLib::createTimeDependentHeterogeneousParameter(), BaseLib::createTimeInterval(), ProcessLib::createTimeLoop(), ProcessLib::TwoPhaseFlowWithPrho::createTwoPhaseFlowPrhoMaterialProperties(), ProcessLib::TwoPhaseFlowWithPP::createTwoPhaseFlowWithPPProcess(), ProcessLib::TwoPhaseFlowWithPrho::createTwoPhaseFlowWithPrhoProcess(), ProcessLib::WellboreSimulator::createWellboreSimulatorProcess(), getConfigParameter(), ProcessLib::HeatTransportBHE::BHE::parseBHE1PTypeConfig(), ProcessLib::HeatTransportBHE::BHE::parseBHECoaxialConfig(), ProcessLib::HeatTransportBHE::BHE::parseBHEUTypeConfig(), and anonymous_namespace{CreateMFrontGeneric.cpp}::readMaterialProperties().
Range< ConfigTree::SubtreeIterator > BaseLib::ConfigTree::getConfigSubtreeList | ( | std::string const & | root | ) | const |
Get all subtrees that have a root root
from the current level of the tree.
The return value is suitable to be used with range-base for-loops.
root
must not have been read before from this ConfigTree. Definition at line 185 of file ConfigTree.cpp.
References checkUnique(), markVisited(), TAG, and tree_.
Referenced by ApplicationsLib::TestDefinition::TestDefinition(), ChemistryLib::SelfContainedSolverData::createChemicalReactionData(), MaterialLib::Solids::createConstitutiveRelationsGeneric(), NumLib::createFixedTimeStepping(), MaterialPropertyLib::createFunction(), ParameterLib::createFunctionParameter(), ParameterLib::createGroupBasedParameter(), MaterialPropertyLib::createLinear(), ProcessLib::createOutputs(), ProcessLib::createPerProcessData(), ProcessLib::LIE::SmallDeformation::createSmallDeformationProcess(), InSituLib::Initialize(), ProjectData::parseLinearSolvers(), NumLib::parseLocalCoupling(), ProjectData::parseNonlinearSolvers(), ProjectData::parseParameters(), ProjectData::parseProcesses(), ProjectData::parseProcessVariables(), GeoLib::IO::BoostXmlGmlInterface::readPolylines(), and GeoLib::IO::BoostXmlGmlInterface::readSurfaces().
std::optional< ConfigTree > BaseLib::ConfigTree::getConfigSubtreeOptional | ( | std::string const & | root | ) | const |
Get the subtree rooted at root
if present
root
must not have been read before from this ConfigTree. Definition at line 171 of file ConfigTree.cpp.
References ConfigTree(), checkUnique(), markVisited(), TAG, and tree_.
Referenced by ProcessLib::ProcessVariable::ProcessVariable(), ProjectData::ProjectData(), ParameterLib::checkThirdBaseExistanceFor2D(), ChemistryLib::PhreeqcIOData::createChemicalSystem(), anonymous_namespace{CreateComponent.cpp}::createComponent(), ProcessLib::ComponentTransport::createComponentTransportProcess(), MaterialLib::Solids::createConstitutiveRelationIce(), ParameterLib::createCoordinateSystemWithImplicitBase(), ProcessLib::createDeactivatedSubdomain(), ProcessLib::createDeactivatedSubdomains(), MaterialLib::Solids::Ehlers::createEhlers(), MaterialLib::Fluid::createFluidProperties(), ProcessLib::HT::createHTProcess(), ProcessLib::LIE::HydroMechanics::createHydroMechanicsProcess(), ProcessLib::HydroMechanics::createHydroMechanicsProcess(), ProcessLib::createInitialStress(), ProcessLib::LiquidFlow::createLiquidFlowProcess(), MaterialPropertyLib::createMedium(), MaterialLib::Solids::MFront::createMFrontConfig(), NumLib::createNumericalStabilization(), ProcessLib::createOutputConfig(), anonymous_namespace{CreatePhase.cpp}::createPhase(), ProcessLib::RichardsMechanics::createRichardsMechanicsProcess(), MeshGeoToolsLib::createSearchLengthAlgorithm(), ProcessLib::createSecondaryVariables(), ProcessLib::SteadyStateDiffusion::createSteadyStateDiffusion(), ProcessLib::createTimeLoop(), getConfigParameterOptional(), getConfigParameterOptionalImpl(), getConfigParameterOptionalImpl(), getConfigSubtree(), NumLib::parseCoupling(), MathLib::LinearSolverOptionsParser< EigenLinearSolver >::parseNameAndOptions(), MathLib::LinearSolverOptionsParser< PETScLinearSolver >::parseNameAndOptions(), anonymous_namespace{ProjectData.cpp}::readMeshes(), anonymous_namespace{ProjectData.cpp}::readRasters(), and anonymous_namespace{CreateMFrontGeneric.cpp}::readStateVariablesInitialValueProperties().
|
inline |
Used to get the project file name.
Definition at line 303 of file ConfigTree.h.
References filename_.
T BaseLib::ConfigTree::getValue | ( | ) | const |
Get the plain data contained in the current level of the tree.
T
Definition at line 149 of file ConfigTree-impl.h.
References error(), have_read_data_, shortString(), and tree_.
Referenced by ChemistryLib::PhreeqcKernelData::createInitialAqueousSolution(), ChemistryLib::PhreeqcIOData::createSolutionComponents(), ParameterLib::parseBase1OrBase2(), parseOutputMeshConfig(), and anonymous_namespace{ProjectData.cpp}::readSingleMesh().
|
private |
Checks if this tree has any children.
Definition at line 391 of file ConfigTree.cpp.
References tree_.
void BaseLib::ConfigTree::ignoreConfigAttribute | ( | std::string const & | attr | ) | const |
Tell this instance to ignore the XML attribute attr
.
This method is used to avoid warning messages.
attr
must not have been read before from this ConfigTree. Definition at line 205 of file ConfigTree.cpp.
References ATTR, checkUniqueAttr(), markVisited(), and tree_.
void BaseLib::ConfigTree::ignoreConfigParameter | ( | std::string const & | param | ) | const |
Tell this instance to ignore parameter param
.
This method is used to avoid warning messages.
param
must not have been read before from this ConfigTree. Definition at line 197 of file ConfigTree.cpp.
References checkUnique(), markVisited(), TAG, and tree_.
Referenced by NumLib::createTimeStepper(), and MathLib::ignoreOtherLinearSolvers().
void BaseLib::ConfigTree::ignoreConfigParameterAll | ( | std::string const & | param | ) | const |
Tell this instance to ignore all parameters param
on the current level of the tree.
This method is used to avoid warning messages.
param
must not have been read before from this ConfigTree. Definition at line 216 of file ConfigTree.cpp.
References checkUnique(), markVisited(), TAG, and tree_.
|
private |
Used to generate the path of a subtree.
Definition at line 309 of file ConfigTree.cpp.
References error(), and pathseparator.
|
private |
Keeps track of the key key
and its value type ConfigTree.
This method asserts that a key is read always with the same type.
param
peek_only if true, do not change the read-count of the given key.
Definition at line 369 of file ConfigTree.cpp.
|
private |
Keeps track of the key key
and its value type T
.
This method asserts that a key is read always with the same type.
param
peek_only if true, do not change the read-count of the given key.
Definition at line 215 of file ConfigTree-impl.h.
References error(), and visited_params_.
Referenced by getConfigParameterList(), getConfigSubtreeList(), getConfigSubtreeOptional(), ignoreConfigAttribute(), ignoreConfigParameter(), ignoreConfigParameterAll(), BaseLib::ConfigTree::SubtreeIterator::operator*(), and BaseLib::ConfigTree::ValueIterator< ValueType >::operator*().
|
private |
Used in the destructor to compute the difference between number of reads of a parameter and the number of times it exists in the ConfigTree
Definition at line 376 of file ConfigTree.cpp.
References visited_params_.
Referenced by checkAndInvalidate().
|
static |
Default error callback function Will throw std::runtime_error
Definition at line 241 of file ConfigTree.cpp.
References OGS_FATAL.
Referenced by BaseLib::makeConfigTree().
|
static |
Default warning callback function Will print a warning message
Definition at line 248 of file ConfigTree.cpp.
References WARN().
Referenced by BaseLib::makeConfigTree().
ConfigTree & BaseLib::ConfigTree::operator= | ( | ConfigTree && | other | ) |
After being moved from, other
is in an undefined state and must not be used anymore!
Definition at line 101 of file ConfigTree.cpp.
References checkAndInvalidate(), filename_, have_read_data_, onerror_, onwarning_, path_, top_level_tree_, tree_, and visited_params_.
|
delete |
copying is not compatible with the semantics of this class
T BaseLib::ConfigTree::peekConfigParameter | ( | std::string const & | param | ) | const |
Peek at a parameter param
of type T
from the configuration tree.
This method is an exception to the single-read rule. It is meant to be used to tell from a ConfigTree instance where to pass that instance on for further processing.
But in order that the requested parameter counts as "completely parsed", it has to be read through some other method, too.
Return value and error behaviour are the same as for getConfigParameter<T>(std::string const&).
Definition at line 126 of file ConfigTree-impl.h.
References checkKeyname(), error(), shortString(), and tree_.
Referenced by MaterialPropertyLib::createAverageMolarMass(), MaterialPropertyLib::createBishopsPowerLaw(), MaterialPropertyLib::createBishopsSaturationCutoff(), ProcessLib::createBoundaryCondition(), MaterialLib::PorousMedium::createCapillaryPressureModel(), MaterialPropertyLib::createCapillaryPressureVanGenuchten(), MaterialPropertyLib::createClausiusClapeyron(), MaterialPropertyLib::createConstant(), MaterialLib::Solids::createConstitutiveRelation(), NumLib::createConvergenceCriterion(), MaterialPropertyLib::createCubicLawPermeability(), MaterialPropertyLib::createCurve(), ProcessLib::createDirichletBoundaryConditionWithinTimeInterval(), MaterialPropertyLib::createDupuitPermeability(), MaterialPropertyLib::createEffectiveThermalConductivityPorosityMixing(), MaterialPropertyLib::createEmbeddedFracturePermeability(), MaterialPropertyLib::createExponential(), MaterialLib::Fluid::createFluidDensityModel(), MaterialPropertyLib::createFunction(), MaterialPropertyLib::createGasPressureDependentPermeability(), MaterialPropertyLib::createIdealGasLaw(), MaterialPropertyLib::createIdealGasLawBinaryMixture(), MaterialPropertyLib::createLinear(), MaterialPropertyLib::createLinearSaturationSwellingStress(), MaterialPropertyLib::createLinearWaterVapourLatentHeat(), MaterialPropertyLib::createLiquidViscosityVogels(), MaterialPropertyLib::createOrthotropicEmbeddedFracturePermeability(), ParameterLib::createParameter(), MaterialPropertyLib::createParameterProperty(), MaterialLib::Fracture::Permeability::createPermeabilityModel(), MaterialPropertyLib::createPermeabilityMohrCoulombFailureIndexModel(), MaterialPropertyLib::createPermeabilityOrthotropicPowerLaw(), MaterialPropertyLib::createPorosityFromMassBalance(), anonymous_namespace{CreateProperty.cpp}::createProperty(), MaterialLib::PorousMedium::createRelativePermeabilityModel(), MaterialPropertyLib::createRelPermBrooksCorey(), MaterialPropertyLib::createRelPermBrooksCoreyNonwettingPhase(), MaterialPropertyLib::createRelPermGeneralizedPower(), MaterialPropertyLib::createRelPermGeneralizedPowerNonwettingPhase(), MaterialPropertyLib::createRelPermLiakopoulos(), MaterialPropertyLib::createRelPermNonWettingPhaseVanGenuchtenMualem(), MaterialPropertyLib::createRelPermUdell(), MaterialPropertyLib::createRelPermUdellNonwettingPhase(), MaterialPropertyLib::createRelPermVanGenuchten(), MaterialPropertyLib::createSaturationBrooksCorey(), MaterialPropertyLib::createSaturationDependentSwelling(), MaterialPropertyLib::createSaturationExponential(), MaterialPropertyLib::createSaturationLiakopoulos(), MaterialPropertyLib::createSaturationVanGenuchten(), MaterialPropertyLib::createSaturationVanGenuchtenWithVolumetricStrain(), MaterialPropertyLib::createSaturationWeightedThermalConductivity(), ProcessLib::LIE::SmallDeformation::createSmallDeformationProcess(), ProcessLib::createSourceTerm(), MaterialPropertyLib::createSpecificHeatCapacityWithLatentHeat(), MaterialPropertyLib::createStrainDependentPermeability(), MaterialPropertyLib::createTemperatureDependentFraction(), ProcessLib::ThermoMechanics::createThermoMechanicsProcess(), NumLib::createTimeStepper(), MaterialPropertyLib::createTransportPorosityFromMassBalance(), MaterialPropertyLib::createVapourDiffusionDeVries(), MaterialPropertyLib::createVapourDiffusionFEBEX(), MaterialPropertyLib::createVapourDiffusionPMQ(), MaterialLib::Fluid::createViscosityModel(), MaterialPropertyLib::createVolumeFractionAverage(), ProcessLib::createVolumetricSourceTerm(), MaterialPropertyLib::createWaterDensityIAPWSIF97Region1(), MaterialPropertyLib::createWaterEnthalpyIAPWSIF97Region1(), MaterialPropertyLib::createWaterLiquidDensityIAPWSIF97Region4(), MaterialPropertyLib::createWaterLiquidEnthalpyIAPWSIF97Region4(), MaterialPropertyLib::createWaterSaturationTemperatureIAPWSIF97Region4(), MaterialPropertyLib::createWaterTemperatureIAPWSIF97Region1(), MaterialPropertyLib::createWaterThermalConductivityIAPWS(), MaterialPropertyLib::createWaterVapourDensity(), MaterialPropertyLib::createWaterVapourDensityIAPWSIF97Region4(), MaterialPropertyLib::createWaterVapourEnthalpyIAPWSIF97Region4(), MaterialPropertyLib::createWaterVapourLatentHeatWithCriticalTemperature(), and MaterialPropertyLib::createWaterViscosityIAPWS().
|
staticprivate |
returns a short string at suitable for error/warning messages
Definition at line 273 of file ConfigTree.cpp.
Referenced by checkAndInvalidate(), getConfigAttributeOptional(), getConfigParameterOptionalImpl(), getValue(), and peekConfigParameter().
|
private |
Called for printing warning messages. Will call the warning callback. This method only acts as a helper method.
Definition at line 236 of file ConfigTree.cpp.
References filename_, onwarning_, and path_.
Referenced by checkAndInvalidate().
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 486 of file ConfigTree.cpp.
|
friend |
Check if conf
has been read entirely and invalidate it.
This method can safely be called on nullptr's
.
Definition at line 491 of file ConfigTree.cpp.
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 499 of file ConfigTree.cpp.
|
private |
The path of the file from which this tree has been read.
Definition at line 654 of file ConfigTree.h.
Referenced by error(), getProjectFileName(), operator=(), and warning().
|
mutableprivate |
Indicates if the plain data contained in this tree has already been read.
Definition at line 670 of file ConfigTree.h.
Referenced by checkAndInvalidate(), getValue(), and operator=().
|
staticprivate |
Set of allowed characters in a key name.
Definition at line 682 of file ConfigTree.h.
Referenced by checkKeyname().
|
staticprivate |
Set of allowed characters as the first letter of a key name.
Definition at line 679 of file ConfigTree.h.
Referenced by checkKeyname().
|
private |
Custom error callback.
Definition at line 672 of file ConfigTree.h.
Referenced by ConfigTree(), error(), and operator=().
|
private |
Custom warning callback.
Definition at line 673 of file ConfigTree.h.
Referenced by ConfigTree(), operator=(), and warning().
|
private |
A path printed in error/warning messages.
Definition at line 651 of file ConfigTree.h.
Referenced by error(), operator=(), and warning().
|
staticprivate |
Character separating two path components.
Definition at line 676 of file ConfigTree.h.
Referenced by joinPaths().
|
private |
Root of the tree.
Owned by all ConfigTree instances that might access any part of it.
Definition at line 645 of file ConfigTree.h.
Referenced by operator=().
|
private |
The wrapped tree.
Definition at line 648 of file ConfigTree.h.
Referenced by checkAndInvalidate(), getConfigAttributeOptional(), getConfigParameterList(), getConfigSubtreeList(), getConfigSubtreeOptional(), getValue(), hasChildren(), ignoreConfigAttribute(), ignoreConfigParameter(), ignoreConfigParameterAll(), operator=(), and peekConfigParameter().
A map KeyType -> (count, type) keeping track which parameters have been read how often and which datatype they have.
This member will be written to when reading from the config tree. Therefore it has to be mutable in order to be able to read from constant instances, e.g., those passed as constant references to temporaries.
Definition at line 666 of file ConfigTree.h.
Referenced by checkAndInvalidate(), checkUnique(), checkUniqueAttr(), markVisited(), markVisitedDecrement(), and operator=().