当前位置: 首页>>代码示例>>C++>>正文


C++ ConfigTree::checkConfigParameter方法代码示例

本文整理汇总了C++中baselib::ConfigTree::checkConfigParameter方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigTree::checkConfigParameter方法的具体用法?C++ ConfigTree::checkConfigParameter怎么用?C++ ConfigTree::checkConfigParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在baselib::ConfigTree的用法示例。


在下文中一共展示了ConfigTree::checkConfigParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例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: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: createRobinBoundaryCondition

std::unique_ptr<RobinBoundaryCondition> createRobinBoundaryCondition(
    BaseLib::ConfigTree const& config, MeshLib::Mesh const& bc_mesh,
    NumLib::LocalToGlobalIndexMap const& dof_table, int const variable_id,
    int const component_id, unsigned const integration_order,
    unsigned const shapefunction_order, unsigned const global_dim,
    std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters)
{
    DBUG("Constructing RobinBcConfig from config.");
    //! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__type}
    config.checkConfigParameter("type", "Robin");

    //! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__Robin__alpha}
    auto const alpha_name = config.getConfigParameter<std::string>("alpha");
    //! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__Robin__u_0}
    auto const u_0_name = config.getConfigParameter<std::string>("u_0");

    auto const& alpha =
        ParameterLib::findParameter<double>(alpha_name, parameters, 1);
    auto const& u_0 =
        ParameterLib::findParameter<double>(u_0_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<RobinBoundaryCondition>(
        integration_order, shapefunction_order, dof_table, variable_id,
        component_id, global_dim, bc_mesh,
        RobinBoundaryConditionData{alpha, u_0});
}
开发者ID:TomFischer,项目名称:ogs,代码行数:40,代码来源:RobinBoundaryCondition.cpp

示例14: DBUG

std::unique_ptr<LinearElasticOrthotropic<DisplacementDim>>
createLinearElasticOrthotropic(
    std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
    boost::optional<ParameterLib::CoordinateSystem> const&
        local_coordinate_system,
    BaseLib::ConfigTree const& config, const bool skip_type_checking)
{
    if (!skip_type_checking)
    {
        //! \ogs_file_param{material__solid__constitutive_relation__type}
        config.checkConfigParameter("type", "LinearElasticOrthotropic");
        DBUG("Create LinearElasticOrthotropic material");
    }

    // The three Youngs moduli are required even in two-dimensional case. Same
    // for the shear moduli and the Poissons ratios.
    auto& youngs_moduli = ParameterLib::findParameter<double>(
        //! \ogs_file_param_special{material__solid__constitutive_relation__LinearElasticOrthotropic__youngs_moduli}
        config, "youngs_moduli", parameters, 3);
    DBUG("Use '%s' as youngs_moduli parameter.", youngs_moduli.name.c_str());

    // Shear moduli
    auto& shear_moduli = ParameterLib::findParameter<double>(
        //! \ogs_file_param_special{material__solid__constitutive_relation__LinearElasticOrthotropic__shear_moduli}
        config, "shear_moduli", parameters, 3);
    DBUG("Use '%s' as shear_moduli parameter.", shear_moduli.name.c_str());

    // Poissons ratios
    auto& poissons_ratios = ParameterLib::findParameter<double>(
        //! \ogs_file_param_special{material__solid__constitutive_relation__LinearElasticOrthotropic__poissons_ratios}
        config, "poissons_ratios", parameters, 3);
    DBUG("Use '%s' as poissons_ratios parameter.",
         poissons_ratios.name.c_str());

    typename LinearElasticOrthotropic<DisplacementDim>::MaterialProperties mp{
        youngs_moduli, shear_moduli, poissons_ratios};

    return std::make_unique<LinearElasticOrthotropic<DisplacementDim>>(
        mp, local_coordinate_system);
}
开发者ID:TomFischer,项目名称:ogs,代码行数:40,代码来源:CreateLinearElasticOrthotropic.cpp

示例15: createConstantParameter

std::unique_ptr<ParameterBase> createConstantParameter(
    std::string const& name, BaseLib::ConfigTree const& config)
{
    //! \ogs_file_param{prj__parameters__parameter__type}
    config.checkConfigParameter("type", "Constant");

    // Optional case for single-component variables where the value can be used.
    // If the 'value' tag is found, use it and return. Otherwise continue with
    // then required tag 'values'.
    {
        //! \ogs_file_param{prj__parameters__parameter__Constant__value}
        auto const value = config.getConfigParameterOptional<double>("value");

        if (value)
        {
            DBUG("Using value %g for constant parameter.", *value);
            return std::make_unique<ConstantParameter<double>>(name, *value);
        }
    }

    // Value tag not available; continue with required values tag.
    std::vector<double> const values =
        //! \ogs_file_param{prj__parameters__parameter__Constant__values}
        config.getConfigParameter<std::vector<double>>("values");

    if (values.empty())
        OGS_FATAL("No value available for constant parameter.");

    DBUG("Using following values for the constant parameter:");
    for (double const v : values)
    {
        (void)v;  // unused value if building w/o DBUG output.
        DBUG("\t%g", v);
    }

    return std::make_unique<ConstantParameter<double>>(name, values);
}
开发者ID:OlafKolditz,项目名称:ogs,代码行数:37,代码来源:ConstantParameter.cpp


注:本文中的baselib::ConfigTree::checkConfigParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。