本文整理汇总了C++中baselib::ConfigTree::getConfigSubtreeList方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigTree::getConfigSubtreeList方法的具体用法?C++ ConfigTree::getConfigSubtreeList怎么用?C++ ConfigTree::getConfigSubtreeList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类baselib::ConfigTree
的用法示例。
在下文中一共展示了ConfigTree::getConfigSubtreeList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialize
void Initialize(BaseLib::ConfigTree const& scripts_config,
std::string const& path)
{
if (Processor == nullptr)
{
Processor = vtkCPProcessor::New();
Processor->Initialize();
}
else
{
Processor->RemoveAllPipelines();
}
//! \ogs_file_param{prj__insitu__scripts__script}
for (auto script_config : scripts_config.getConfigSubtreeList("script"))
{
//! \ogs_file_param{prj__insitu__scripts__script__name}
auto scriptName = script_config.getConfigParameter<std::string>("name");
INFO("Initializing in-situ script: %s", scriptName.c_str());
std::stringstream ss;
ss << path << scriptName;
vtkNew<vtkCPPythonScriptPipeline> pipeline;
pipeline->Initialize(ss.str().c_str());
Processor->AddPipeline(pipeline.GetPointer());
}
}
示例2: createPerProcessData
std::vector<std::unique_ptr<ProcessData>> createPerProcessData(
BaseLib::ConfigTree const& config,
const std::map<std::string, std::unique_ptr<Process>>& processes,
std::map<std::string, std::unique_ptr<NumLib::NonlinearSolverBase>> const&
nonlinear_solvers)
{
std::vector<std::unique_ptr<ProcessData>> per_process_data;
//! \ogs_file_param{prj__time_loop__processes__process}
for (auto pcs_config : config.getConfigSubtreeList("process"))
{
//! \ogs_file_attr{prj__time_loop__processes__process__ref}
auto const pcs_name = pcs_config.getConfigAttribute<std::string>("ref");
auto& pcs = *BaseLib::getOrError(
processes, pcs_name,
"A process with the given name has not been defined.");
auto const nl_slv_name =
//! \ogs_file_param{prj__time_loop__processes__process__nonlinear_solver}
pcs_config.getConfigParameter<std::string>("nonlinear_solver");
auto& nl_slv = *BaseLib::getOrError(
nonlinear_solvers, nl_slv_name,
"A nonlinear solver with the given name has not been defined.");
auto time_disc = NumLib::createTimeDiscretization(
//! \ogs_file_param{prj__time_loop__processes__process__time_discretization}
pcs_config.getConfigSubtree("time_discretization"));
auto timestepper = NumLib::createTimeStepper(
//! \ogs_file_param{prj__time_loop__processes__process__time_stepping}
pcs_config.getConfigSubtree("time_stepping"));
auto conv_crit = NumLib::createConvergenceCriterion(
//! \ogs_file_param{prj__time_loop__processes__process__convergence_criterion}
pcs_config.getConfigSubtree("convergence_criterion"));
ProcessOutput process_output =
//! \ogs_file_param{prj__time_loop__processes__process__output}
createProcessOutput(pcs_config.getConfigSubtree("output"));
per_process_data.emplace_back(makeProcessData(
std::move(timestepper), nl_slv, pcs, std::move(time_disc),
std::move(conv_crit), std::move(process_output)));
}
if (per_process_data.size() != processes.size())
{
if (processes.size() > 1)
{
OGS_FATAL(
"Some processes have not been configured to be solved by this "
" time loop.");
}
else
{
INFO(
"The equations of the coupled processes will be solved by the "
"staggered scheme.");
}
}
return per_process_data;
}
示例3: if
//.........这里部分代码省略.........
OGS_FATAL(
"Number of components of the process variable '%s' is different "
"from the displacement dimension: got %d, expected %d",
per_process_variables.back().get().getName().c_str(),
per_process_variables.back().get().getNumberOfComponents(),
DisplacementDim);
}
std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
process_variables;
process_variables.push_back(std::move(per_process_variables));
auto solid_constitutive_relations =
MaterialLib::Solids::createConstitutiveRelations<DisplacementDim>(
parameters, local_coordinate_system, config);
// Fracture constitutive relation.
// read type;
auto const fracture_model_config =
//! \ogs_file_param{prj__processes__process__SMALL_DEFORMATION_WITH_LIE__fracture_model}
config.getConfigSubtree("fracture_model");
auto const frac_type =
//! \ogs_file_param{prj__processes__process__SMALL_DEFORMATION_WITH_LIE__fracture_model__type}
fracture_model_config.peekConfigParameter<std::string>("type");
std::unique_ptr<MaterialLib::Fracture::FractureModelBase<DisplacementDim>>
fracture_model = nullptr;
if (frac_type == "LinearElasticIsotropic")
{
fracture_model = MaterialLib::Fracture::createLinearElasticIsotropic<
DisplacementDim>(parameters, fracture_model_config);
}
else if (frac_type == "MohrCoulomb")
{
fracture_model =
MaterialLib::Fracture::createMohrCoulomb<DisplacementDim>(
parameters, fracture_model_config);
}
else if (frac_type == "CohesiveZoneModeI")
{
fracture_model =
MaterialLib::Fracture::CohesiveZoneModeI::createCohesiveZoneModeI<
DisplacementDim>(parameters, fracture_model_config);
}
else
{
OGS_FATAL(
"Cannot construct fracture constitutive relation of given type "
"'%s'.",
frac_type.c_str());
}
// Fracture properties
std::vector<FractureProperty> fracture_properties;
for (
auto fracture_properties_config :
//! \ogs_file_param{prj__processes__process__SMALL_DEFORMATION_WITH_LIE__fracture_properties}
config.getConfigSubtreeList("fracture_properties"))
{
fracture_properties.emplace_back(
fracture_properties.size(),
//! \ogs_file_param{prj__processes__process__SMALL_DEFORMATION_WITH_LIE__fracture_properties__material_id}
fracture_properties_config.getConfigParameter<int>("material_id"),
ParameterLib::findParameter<double>(
//! \ogs_file_param_special{prj__processes__process__SMALL_DEFORMATION_WITH_LIE__fracture_properties__initial_aperture}
fracture_properties_config, "initial_aperture", parameters, 1));
}
if (n_var_du < fracture_properties.size())
{
OGS_FATAL(
"The number of displacement jumps and the number of "
"<fracture_properties> "
"are not consistent");
}
// Reference temperature
const auto& reference_temperature =
//! \ogs_file_param{prj__processes__process__SMALL_DEFORMATION_WITH_LIE__reference_temperature}
config.getConfigParameter<double>(
"reference_temperature", std::numeric_limits<double>::quiet_NaN());
SmallDeformationProcessData<DisplacementDim> process_data(
materialIDs(mesh), std::move(solid_constitutive_relations),
std::move(fracture_model), std::move(fracture_properties),
reference_temperature);
SecondaryVariableCollection secondary_variables;
NumLib::NamedFunctionCaller named_function_caller(
{"SmallDeformation_displacement"});
ProcessLib::createSecondaryVariables(config, secondary_variables,
named_function_caller);
return std::make_unique<SmallDeformationProcess<DisplacementDim>>(
mesh, std::move(jacobian_assembler), parameters, integration_order,
std::move(process_variables), std::move(process_data),
std::move(secondary_variables), std::move(named_function_caller));
}