本文整理汇总了C++中baselib::ConfigTree类的典型用法代码示例。如果您正苦于以下问题:C++ ConfigTree类的具体用法?C++ ConfigTree怎么用?C++ ConfigTree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigTree类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: createFluidProperties
std::unique_ptr<FluidProperties> createFluidProperties(
BaseLib::ConfigTree const& config)
{
//! \ogs_file_param{material__fluid__density}
auto const& rho_conf = config.getConfigSubtree("density");
auto liquid_density = MaterialLib::Fluid::createFluidDensityModel(rho_conf);
//! \ogs_file_param{material__fluid__viscosity}
auto const& mu_conf = config.getConfigSubtree("viscosity");
auto viscosity = MaterialLib::Fluid::createViscosityModel(mu_conf);
const bool is_mu_density_dependent =
(viscosity->getName().find("density dependent") != std::string::npos);
bool is_cp_density_dependent = false;
std::unique_ptr<MaterialLib::Fluid::FluidProperty> specific_heat_capacity =
nullptr;
auto heat_capacity__opt_conf =
//! \ogs_file_param{material__fluid__specific_heat_capacity}
config.getConfigSubtreeOptional("specific_heat_capacity");
if (heat_capacity__opt_conf)
{
const auto& heat_capacity_conf = *heat_capacity__opt_conf;
specific_heat_capacity =
createSpecificFluidHeatCapacityModel(heat_capacity_conf);
is_cp_density_dependent =
(specific_heat_capacity->getName().find("density dependent") !=
std::string::npos);
}
bool is_KT_density_dependent = false;
std::unique_ptr<MaterialLib::Fluid::FluidProperty> thermal_conductivity =
nullptr;
auto const& thermal_conductivity_opt_conf =
//! \ogs_file_param{material__fluid__thermal_conductivity}
config.getConfigSubtreeOptional("thermal_conductivity");
if (thermal_conductivity_opt_conf)
{
auto const& thermal_conductivity_conf = *thermal_conductivity_opt_conf;
thermal_conductivity =
MaterialLib::Fluid::createFluidThermalConductivityModel(
thermal_conductivity_conf);
is_KT_density_dependent =
(specific_heat_capacity->getName().find("density dependent") !=
std::string::npos);
}
if (is_mu_density_dependent || is_cp_density_dependent ||
is_KT_density_dependent)
return std::make_unique<
MaterialLib::Fluid::FluidPropertiesWithDensityDependentModels>(
std::move(liquid_density), std::move(viscosity),
std::move(specific_heat_capacity), std::move(thermal_conductivity),
is_mu_density_dependent, is_cp_density_dependent,
is_KT_density_dependent);
return std::make_unique<
MaterialLib::Fluid::PrimaryVariableDependentFluidProperties>(
std::move(liquid_density), std::move(viscosity),
std::move(specific_heat_capacity), std::move(thermal_conductivity));
}
开发者ID:wenqing,项目名称:ogs,代码行数:60,代码来源:CreateFluidProperties.cpp
示例2: createPythonBoundaryCondition
std::unique_ptr<PythonBoundaryCondition> createPythonBoundaryCondition(
BaseLib::ConfigTree const& config, MeshLib::Mesh const& boundary_mesh,
NumLib::LocalToGlobalIndexMap const& dof_table, std::size_t bulk_mesh_id,
int const variable_id, int const component_id,
unsigned const integration_order, unsigned const shapefunction_order,
unsigned const global_dim)
{
//! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__type}
config.checkConfigParameter("type", "Python");
//! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__Python__bc_object}
auto const bc_object = config.getConfigParameter<std::string>("bc_object");
//! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__Python__flush_stdout}
auto const flush_stdout = config.getConfigParameter("flush_stdout", false);
// Evaluate Python code in scope of main module
pybind11::object scope =
pybind11::module::import("__main__").attr("__dict__");
if (!scope.contains(bc_object))
OGS_FATAL(
"Function `%s' is not defined in the python script file, or there "
"was no python script file specified.",
bc_object.c_str());
auto* bc = scope[bc_object.c_str()]
.cast<PythonBoundaryConditionPythonSideInterface*>();
if (variable_id >= static_cast<int>(dof_table.getNumberOfVariables()) ||
component_id >= dof_table.getNumberOfVariableComponents(variable_id))
{
OGS_FATAL(
"Variable id or component id too high. Actual values: (%d, %d), "
"maximum values: (%d, %d).",
variable_id, component_id, dof_table.getNumberOfVariables(),
dof_table.getNumberOfVariableComponents(variable_id));
}
// In case of partitioned mesh the boundary could be empty, i.e. there is no
// boundary condition.
#ifdef USE_PETSC
// This can be extracted to createBoundaryCondition() but then the config
// parameters are not read and will cause an error.
// TODO (naumov): Add a function to ConfigTree for skipping the tags of the
// subtree and move the code up in createBoundaryCondition().
if (boundary_mesh.getDimension() == 0 &&
boundary_mesh.getNumberOfNodes() == 0 &&
boundary_mesh.getNumberOfElements() == 0)
{
return nullptr;
}
#endif // USE_PETSC
return std::make_unique<PythonBoundaryCondition>(
PythonBoundaryConditionData{
bc, dof_table, bulk_mesh_id,
dof_table.getGlobalComponent(variable_id, component_id),
boundary_mesh},
integration_order, shapefunction_order, global_dim, flush_stdout);
}
开发者ID:OlafKolditz,项目名称:ogs,代码行数:60,代码来源:PythonBoundaryCondition.cpp
示例3: createGroundwaterFlowProcess
std::unique_ptr<Process> createGroundwaterFlowProcess(
MeshLib::Mesh& mesh,
Process::NonlinearSolver& nonlinear_solver,
std::unique_ptr<Process::TimeDiscretization>&& time_discretization,
std::vector<ProcessVariable> const& variables,
std::vector<std::unique_ptr<ParameterBase>> const& parameters,
BaseLib::ConfigTree const& config)
{
//! \ogs_file_param{process__type}
config.checkConfigParameter("type", "GROUNDWATER_FLOW");
DBUG("Create GroundwaterFlowProcess.");
// Process variable.
auto process_variables = findProcessVariables(
variables, config,
{//! \ogs_file_param_special{process__GROUNDWATER_FLOW__process_variables__process_variable}
"process_variable"});
// Hydraulic conductivity parameter.
auto& hydraulic_conductivity = findParameter<double,
MeshLib::Element const&>(
config,
//! \ogs_file_param_special{process__GROUNDWATER_FLOW__hydraulic_conductivity}
"hydraulic_conductivity",
parameters);
DBUG("Use \'%s\' as hydraulic conductivity parameter.",
hydraulic_conductivity.name.c_str());
GroundwaterFlowProcessData process_data{hydraulic_conductivity};
SecondaryVariableCollection secondary_variables{
//! \ogs_file_param{process__secondary_variables}
config.getConfigSubtreeOptional("secondary_variables"),
{//! \ogs_file_param_special{process__GROUNDWATER_FLOW__secondary_variables__darcy_velocity_x}
"darcy_velocity_x",
//! \ogs_file_param_special{process__GROUNDWATER_FLOW__secondary_variables__darcy_velocity_y}
"darcy_velocity_y",
//! \ogs_file_param_special{process__GROUNDWATER_FLOW__secondary_variables__darcy_velocity_z}
"darcy_velocity_z"}};
ProcessOutput
//! \ogs_file_param{process__output}
process_output{config.getConfigSubtree("output"), process_variables,
secondary_variables};
return std::unique_ptr<Process>{new GroundwaterFlowProcess{
mesh, nonlinear_solver, std::move(time_discretization),
std::move(process_variables), std::move(process_data),
std::move(secondary_variables), std::move(process_output)}};
}
开发者ID:Doublle,项目名称:ogs,代码行数:52,代码来源:CreateGroundwaterFlowProcess.cpp
示例4: 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());
}
}
开发者ID:TomFischer,项目名称:ogs,代码行数:25,代码来源:Adaptor.cpp
示例5: createMeshElementParameter
std::unique_ptr<ParameterBase> createMeshElementParameter(
BaseLib::ConfigTree const& config, MeshLib::Mesh const& mesh)
{
//! \ogs_file_param{parameter__type}
config.checkConfigParameter("type", "MeshElement");
//! \ogs_file_param{parameter__MeshElement__field_name}
auto const field_name = config.getConfigParameter<std::string>("field_name");
DBUG("Using field_name %s", field_name.c_str());
if (!mesh.getProperties().hasPropertyVector(field_name)) {
OGS_FATAL("The required property %s does not exists in the mesh.",
field_name.c_str());
}
// TODO other data types than only double
auto const& property =
mesh.getProperties().getPropertyVector<double>(field_name);
if (!property) {
OGS_FATAL("The mesh property `%s' is not of the requested type.",
field_name.c_str());
}
if (property->getMeshItemType() != MeshLib::MeshItemType::Cell) {
OGS_FATAL("The mesh property `%s' is not an element property.",
field_name.c_str());
}
return std::unique_ptr<ParameterBase>(
new MeshElementParameter<double>(*property));
}
开发者ID:Yonghui56,项目名称:ogs,代码行数:30,代码来源:MeshElementParameter.cpp
示例6: createNonWettingPhaseBrooksCoreyOilGas
/**
\param config ConfigTree object which contains the input data
including `<type>NonWettingPhaseBrooksCoreyOilGas</type>`
and it has a tag of `<relative_permeability>`
*/
std::unique_ptr<RelativePermeability> createNonWettingPhaseBrooksCoreyOilGas(
BaseLib::ConfigTree const& config)
{
//! \ogs_file_param{material__porous_medium__relative_permeability__type}
config.checkConfigParameter("type", "NonWettingPhaseBrooksCoreyOilGas");
//! \ogs_file_param{material__porous_medium__relative_permeability__NonWettingPhaseBrooksCoreyOilGas__sr}
const auto Sr = config.getConfigParameter<double>("sr");
//! \ogs_file_param{material__porous_medium__relative_permeability__NonWettingPhaseBrooksCoreyOilGas__smax}
const auto Smax = config.getConfigParameter<double>("smax");
//! \ogs_file_param{material__porous_medium__relative_permeability__NonWettingPhaseBrooksCoreyOilGas__m}
const auto m = config.getConfigParameter<double>("m");
if (m < 1.0) // m >= 1
{
OGS_FATAL(
"The exponent parameter of NonWettingPhaseBrooksCoreyOilGas\n"
"relative permeability model, m, must not be smaller than 1");
}
//! \ogs_file_param{material__porous_medium__relative_permeability__NonWettingPhaseBrooksCoreyOilGas__krel_min}
const auto krel_min = config.getConfigParameter<double>("krel_min");
return std::make_unique<NonWettingPhaseBrooksCoreyOilGas>(
Sr, Smax, m, krel_min);
}
开发者ID:OlafKolditz,项目名称:ogs,代码行数:32,代码来源:CreateRelativePermeabilityModel.cpp
示例7: if
std::unique_ptr<TimeStepAlgorithm> createTimeStepper(
BaseLib::ConfigTree const& config)
{
//! \ogs_file_param{prj__time_loop__processes__process__time_stepping__type}
auto const type = config.peekConfigParameter<std::string>("type");
std::unique_ptr<NumLib::TimeStepAlgorithm> timestepper;
if (type == "SingleStep")
{
//! \ogs_file_param_special{prj__time_loop__processes__process__time_stepping__SingleStep}
config.ignoreConfigParameter("type");
timestepper =
std::make_unique<NumLib::FixedTimeStepping>(0.0, 1.0, 1.0);
}
else if (type == "FixedTimeStepping")
{
timestepper = NumLib::createFixedTimeStepping(config);
}
else if (type == "EvolutionaryPIDcontroller")
{
timestepper = NumLib::createEvolutionaryPIDcontroller(config);
}
else
{
OGS_FATAL(
"Unknown time stepping type: `%s'. "
"The available types are \n\tSingleStep, \n\tFixedTimeStepping"
"\n\tEvolutionaryPIDcontroller\n",
type.data());
}
return timestepper;
}
开发者ID:OlafKolditz,项目名称:ogs,代码行数:34,代码来源:CreateTimeStepper.cpp
示例8: createNonWettingPhaseVanGenuchten
/**
\param config ConfigTree object which contains the input data
including `<type>NonWettingPhaseVanGenuchten</type>`
and it has a tag of `<relative_permeability>`
*/
std::unique_ptr<RelativePermeability> createNonWettingPhaseVanGenuchten(
BaseLib::ConfigTree const& config)
{
//! \ogs_file_param{material__porous_medium__relative_permeability__type}
config.checkConfigParameter("type", "NonWettingPhaseVanGenuchten");
//! \ogs_file_param{material__porous_medium__relative_permeability__NonWettingPhaseVanGenuchten__sr}
const auto Sr = config.getConfigParameter<double>("sr");
//! \ogs_file_param{material__porous_medium__relative_permeability__NonWettingPhaseVanGenuchten__smax}
const auto Smax = config.getConfigParameter<double>("smax");
//! \ogs_file_param{material__porous_medium__relative_permeability__NonWettingPhaseVanGenuchten__m}
const auto m = config.getConfigParameter<double>("m");
if (m < 0. || m > 1.0)
{
OGS_FATAL(
"The exponent parameter of NonWettingPhaseVanGenuchten relative\n"
" permeability model, m, must be in an interval of [0, 1]");
}
//! \ogs_file_param{material__porous_medium__relative_permeability__NonWettingPhaseVanGenuchten__krel_min}
const auto krel_min = config.getConfigParameter<double>("krel_min");
return std::make_unique<NonWettingPhaseVanGenuchten>(Sr, Smax, m, krel_min);
}
开发者ID:OlafKolditz,项目名称:ogs,代码行数:31,代码来源:CreateRelativePermeabilityModel.cpp
示例9: createCurveScaledParameter
std::unique_ptr<ParameterBase> createCurveScaledParameter(
std::string const& name,
BaseLib::ConfigTree const& config,
std::map<std::string,
std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const&
curves)
{
//! \ogs_file_param{prj__parameters__parameter__type}
config.checkConfigParameter("type", "CurveScaled");
//! \ogs_file_param{prj__parameters__parameter__CurveScaled__curve}
auto curve_name = config.getConfigParameter<std::string>("curve");
DBUG("Using curve %s", curve_name.c_str());
auto const curve_it = curves.find(curve_name);
if (curve_it == curves.end())
OGS_FATAL("Curve `%s' does not exists.", curve_name.c_str());
auto referenced_parameter_name =
//! \ogs_file_param{prj__parameters__parameter__CurveScaled__parameter}
config.getConfigParameter<std::string>("parameter");
DBUG("Using parameter %s", referenced_parameter_name.c_str());
// TODO other data types than only double
return std::make_unique<CurveScaledParameter<double>>(
name, *curve_it->second, referenced_parameter_name);
}
开发者ID:OlafKolditz,项目名称:ogs,代码行数:27,代码来源:CurveScaledParameter.cpp
示例10: createDirichletBoundaryCondition
std::unique_ptr<DirichletBoundaryCondition> createDirichletBoundaryCondition(
BaseLib::ConfigTree const& config, MeshLib::Mesh const& bc_mesh,
NumLib::LocalToGlobalIndexMap const& dof_table_bulk, int const variable_id,
int const component_id,
const std::vector<std::unique_ptr<ProcessLib::ParameterBase>>& parameters)
{
DBUG("Constructing DirichletBoundaryCondition from config.");
//! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__type}
config.checkConfigParameter("type", "Dirichlet");
//! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__Dirichlet__parameter}
auto const param_name = config.getConfigParameter<std::string>("parameter");
DBUG("Using parameter %s", param_name.c_str());
auto& param = findParameter<double>(param_name, parameters, 1);
// In case of partitioned mesh the boundary could be empty, i.e. there is no
// boundary condition.
#ifdef USE_PETSC
// This can be extracted to createBoundaryCondition() but then the config
// parameters are not read and will cause an error.
// TODO (naumov): Add a function to ConfigTree for skipping the tags of the
// subtree and move the code up in createBoundaryCondition().
if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
bc_mesh.getNumberOfElements() == 0)
{
return nullptr;
}
#endif // USE_PETSC
return std::make_unique<DirichletBoundaryCondition>(
param, bc_mesh, dof_table_bulk, variable_id, component_id);
}
开发者ID:OlafKolditz,项目名称:ogs,代码行数:33,代码来源:DirichletBoundaryCondition.cpp
示例11:
void
ignoreOtherLinearSolvers(const BaseLib::ConfigTree &config,
const std::string &solver_name)
{
for (auto const& s : known_linear_solvers) {
if (s!=solver_name) config.ignoreConfigParameter(s);
}
}
开发者ID:Doublle,项目名称:ogs,代码行数:8,代码来源:LinearSolverOptions.cpp
示例12: createWettingPhaseVanGenuchten
std::unique_ptr<RelativePermeability> createRelativePermeabilityModel(
BaseLib::ConfigTree const& config)
{
//! \ogs_file_param{material__porous_medium__relative_permeability__type}
auto const type = config.peekConfigParameter<std::string>("type");
if (type == "WettingPhaseVanGenuchten")
{
return createWettingPhaseVanGenuchten(config);
}
if (type == "NonWettingPhaseVanGenuchten")
{
return createNonWettingPhaseVanGenuchten(config);
}
if (type == "WettingPhaseBrooksCoreyOilGas")
{
return createWettingPhaseBrooksCoreyOilGas(config);
}
if (type == "NonWettingPhaseBrooksCoreyOilGas")
{
return createNonWettingPhaseBrooksCoreyOilGas(config);
}
if (type == "Curve")
{
//! \ogs_file_param{material__porous_medium__relative_permeability__type}
config.checkConfigParameter("type", "Curve");
//! \ogs_file_param{material__porous_medium__relative_permeability__Curve__curve}
auto const& curve_config = config.getConfigSubtree("curve");
auto curve = MathLib::createPiecewiseLinearCurve<MathLib
::PiecewiseLinearInterpolation>(curve_config);
return std::make_unique<RelativePermeabilityCurve>(std::move(curve));
}
OGS_FATAL(
"The relative permeability model %s is unavailable.\n"
"The available models are:"
"\n\tWettingPhaseVanGenuchten,"
"\n\tNonWettingPhaseVanGenuchten,"
"\n\tWettingPhaseBrooksCoreyOilGas,"
"\n\tNonWettingPhaseBrooksCoreyOilGas,",
"\n\tCurve.\n",
type.data());
}
开发者ID:OlafKolditz,项目名称:ogs,代码行数:45,代码来源:CreateRelativePermeabilityModel.cpp
示例13: createBoreholeGeometry
static std::tuple<BoreholeGeometry,
RefrigerantProperties,
GroutParameters,
FlowAndTemperatureControl,
PipeConfigurationCoaxial>
parseBHECoaxialConfig(
BaseLib::ConfigTree const& config,
std::map<std::string,
std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const&
curves)
{
auto const borehole_geometry =
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__borehole}
createBoreholeGeometry(config.getConfigSubtree("borehole"));
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__pipes}
auto const& pipes_config = config.getConfigSubtree("pipes");
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__pipes__outer}
Pipe const outer_pipe = createPipe(pipes_config.getConfigSubtree("outer"));
Pipe const inner_pipe =
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__pipes__inner}
createPipe(pipes_config.getConfigSubtree("inner"));
const auto pipe_longitudinal_dispersion_length =
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__pipes__longitudinal_dispersion_length}
pipes_config.getConfigParameter<double>(
"longitudinal_dispersion_length");
PipeConfigurationCoaxial const pipes{inner_pipe, outer_pipe,
pipe_longitudinal_dispersion_length};
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout}
auto const grout = createGroutParameters(config.getConfigSubtree("grout"));
auto const refrigerant =
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant}
createRefrigerantProperties(config.getConfigSubtree("refrigerant"));
auto const flowAndTemperatureControl = createFlowAndTemperatureControl(
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control}
config.getConfigSubtree("flow_and_temperature_control"),
curves,
refrigerant);
return {borehole_geometry, refrigerant, grout, flowAndTemperatureControl,
pipes};
}
开发者ID:TomFischer,项目名称:ogs,代码行数:45,代码来源:CreateBHECoaxial.cpp
示例14: named_function_caller
std::unique_ptr<Process> createTESProcess(
MeshLib::Mesh& mesh,
std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
std::vector<ProcessVariable> const& variables,
std::vector<std::unique_ptr<ParameterBase>> const& parameters,
unsigned const integration_order,
BaseLib::ConfigTree const& config)
{
//! \ogs_file_param{prj__processes__process__type}
config.checkConfigParameter("type", "TES");
DBUG("Create TESProcess.");
//! \ogs_file_param{prj__processes__process__TES__process_variables}
auto const pv_config = config.getConfigSubtree("process_variables");
auto per_process_variables = findProcessVariables(
variables, pv_config,
{
//! \ogs_file_param_special{prj__processes__process__TES__process_variables__fluid_pressure}
"fluid_pressure",
//! \ogs_file_param_special{prj__processes__process__TES__process_variables__temperature}
"temperature",
//! \ogs_file_param_special{prj__processes__process__TES__process_variables__vapour_mass_fraction}
"vapour_mass_fraction"});
std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
process_variables;
process_variables.push_back(std::move(per_process_variables));
SecondaryVariableCollection secondary_variables;
NumLib::NamedFunctionCaller named_function_caller(
{"TES_pressure", "TES_temperature", "TES_vapour_mass_fraction"});
ProcessLib::createSecondaryVariables(config, secondary_variables,
named_function_caller);
return std::make_unique<TESProcess>(
mesh, std::move(jacobian_assembler), parameters, integration_order,
std::move(process_variables), std::move(secondary_variables),
std::move(named_function_caller), config);
}
开发者ID:wenqing,项目名称:ogs,代码行数:42,代码来源:CreateTESProcess.cpp
示例15: UniformInitialCondition
std::unique_ptr<InitialCondition> createUniformInitialCondition(
BaseLib::ConfigTree const& config, int const /*n_components*/)
{
config.checkConfParam("type", "Uniform");
auto value = config.getConfParam<double>("value");
DBUG("Using value %g", value);
return std::unique_ptr<InitialCondition>(
new UniformInitialCondition(value));
}
开发者ID:Yonghuizz,项目名称:ogs,代码行数:11,代码来源:InitialCondition.cpp
示例16: createSecondaryVariables
void createSecondaryVariables(
BaseLib::ConfigTree const& config,
SecondaryVariableCollection& secondary_variables,
NumLib::NamedFunctionCaller& named_function_caller)
{
auto sec_vars_config =
//! \ogs_file_param{prj__processes__process__secondary_variables}
config.getConfigSubtreeOptional("secondary_variables");
if (!sec_vars_config)
return;
for (
auto sec_var_config :
//! \ogs_file_param{prj__processes__process__secondary_variables__secondary_variable}
sec_vars_config->getConfigSubtreeList("secondary_variable"))
{
auto const type =
//! \ogs_file_attr{prj__processes__process__secondary_variables__secondary_variable__type}
sec_var_config.getConfigAttribute<std::string>("type");
auto const internal_name =
//! \ogs_file_attr{prj__processes__process__secondary_variables__secondary_variable__internal_name}
sec_var_config.getConfigAttribute<std::string>("internal_name");
auto const output_name =
//! \ogs_file_attr{prj__processes__process__secondary_variables__secondary_variable__output_name}
sec_var_config.getConfigAttribute<std::string>("output_name");
secondary_variables.addNameMapping(internal_name, output_name);
if (type == "static")
{
// alright
}
else if (type == "dynamic")
{
auto const& sink_fct = internal_name;
for (
auto const plug :
//! \ogs_file_param{prj__processes__process__secondary_variables__secondary_variable__plug}
sec_var_config.getConfigParameterList("plug"))
{
auto const sink_arg =
//! \ogs_file_attr{prj__processes__process__secondary_variables__secondary_variable__plug__sink_arg}
plug.getConfigAttribute<std::string>("sink_arg");
auto const source_fct =
//! \ogs_file_attr{prj__processes__process__secondary_variables__secondary_variable__plug__source_fct}
plug.getConfigAttribute<std::string>("source_fct");
named_function_caller.plug(sink_fct, sink_arg, source_fct);
}
}
}
}
开发者ID:OlafKolditz,项目名称:ogs,代码行数:54,代码来源:CreateSecondaryVariables.cpp
示例17: DBUG
std::unique_ptr<PhaseFieldIrreversibleDamageOracleBoundaryCondition>
createPhaseFieldIrreversibleDamageOracleBoundaryCondition(
BaseLib::ConfigTree const& config,
NumLib::LocalToGlobalIndexMap const& dof_table, MeshLib::Mesh const& mesh,
int const variable_id, int const component_id)
{
DBUG(
"Constructing PhaseFieldIrreversibleDamageOracleBoundaryCondition from "
"config.");
//! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__type}
config.checkConfigParameter(
"type", "PhaseFieldIrreversibleDamageOracleBoundaryCondition");
return std::make_unique<
PhaseFieldIrreversibleDamageOracleBoundaryCondition>(
dof_table, mesh, variable_id, component_id);
}
开发者ID:TomFischer,项目名称:ogs,代码行数:17,代码来源:PhaseFieldIrreversibleDamageOracleBoundaryCondition.cpp
示例18:
std::vector<std::reference_wrapper<ProcessVariable>>
findProcessVariables(
std::vector<ProcessVariable> const& variables,
BaseLib::ConfigTree const& process_config,
std::initializer_list<std::string> tag_names)
{
std::vector<std::reference_wrapper<ProcessVariable>> vars;
vars.reserve(tag_names.size());
//! \ogs_file_param{process__process_variables}
auto const pv_conf = process_config.getConfigSubtree("process_variables");
for (auto const& tag : tag_names) {
vars.emplace_back(findProcessVariable(variables, pv_conf, tag));
}
return vars;
}
开发者ID:norihiro-w,项目名称:ogs,代码行数:18,代码来源:Process.cpp
示例19: DBUG
std::unique_ptr<FractureModelBase<DisplacementDim>>
createMohrCoulomb(
std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const& parameters,
BaseLib::ConfigTree const& config)
{
//! \ogs_file_param{material__fracture_model__type}
config.checkConfigParameter("type", "MohrCoulomb");
DBUG("Create MohrCoulomb material");
auto& Kn = ProcessLib::findParameter<double>(
//! \ogs_file_param_special{material__fracture_model__MohrCoulomb__normal_stiffness}
config, "normal_stiffness", parameters, 1);
auto& Ks = ProcessLib::findParameter<double>(
//! \ogs_file_param_special{material__fracture_model__MohrCoulomb__shear_stiffness}
config, "shear_stiffness", parameters, 1);
auto& friction_angle = ProcessLib::findParameter<double>(
//! \ogs_file_param_special{material__fracture_model__MohrCoulomb__friction_angle}
config, "friction_angle", parameters, 1);
auto& dilatancy_angle = ProcessLib::findParameter<double>(
//! \ogs_file_param_special{material__fracture_model__MohrCoulomb__dilatancy_angle}
config, "dilatancy_angle", parameters, 1);
auto& cohesion = ProcessLib::findParameter<double>(
//! \ogs_file_param_special{material__fracture_model__MohrCoulomb__cohesion}
config, "cohesion", parameters, 1);
auto const penalty_aperture_cutoff =
//! \ogs_file_param{material__fracture_model__MohrCoulomb__penalty_aperture_cutoff}
config.getConfigParameter<double>("penalty_aperture_cutoff");
auto const tension_cutoff =
//! \ogs_file_param{material__fracture_model__MohrCoulomb__tension_cutoff}
config.getConfigParameter<bool>("tension_cutoff");
typename MohrCoulomb<DisplacementDim>::MaterialProperties mp{
Kn, Ks, friction_angle, dilatancy_angle, cohesion};
return std::make_unique<MohrCoulomb<DisplacementDim>>(
penalty_aperture_cutoff, tension_cutoff, mp);
}
开发者ID:OlafKolditz,项目名称:ogs,代码行数:43,代码来源:CreateMohrCoulomb.cpp
示例20: createNodalSourceTerm
std::unique_ptr<NodalSourceTerm> createNodalSourceTerm(
BaseLib::ConfigTree const& config,
const NumLib::LocalToGlobalIndexMap& dof_table, std::size_t const mesh_id,
std::size_t const node_id, const int variable_id, const int component_id,
std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const& parameters)
{
DBUG("Constructing NodalSourceTerm from config.");
//! \ogs_file_param{prj__process_variables__process_variable__source_terms__source_term__type}
config.checkConfigParameter("type", "Nodal");
//! \ogs_file_param{prj__process_variables__process_variable__source_terms__source_term__Nodal__parameter}
auto const param_name = config.getConfigParameter<std::string>("parameter");
DBUG("Using parameter %s as nodal source term.", param_name.c_str());
auto& param = findParameter<double>(param_name, parameters, 1);
return std::make_unique<NodalSourceTerm>(
dof_table, mesh_id, node_id, variable_id, component_id, param);
}
开发者ID:Scinopode,项目名称:ogs,代码行数:19,代码来源:CreateNodalSourceTerm.cpp
注:本文中的baselib::ConfigTree类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论