From 3280f04627cdcb998c31980dd62849788b8d52ec Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Wed, 4 Oct 2017 08:23:45 +0200 Subject: [PATCH] [MGTL] inline createSearchLengthAlgorithm. This avoids a linker error. --- MeshGeoToolsLib/CreateSearchLength.cpp | 49 ++++++++++++++++++++++++++ MeshGeoToolsLib/CreateSearchLength.h | 42 ++++++---------------- 2 files changed, 60 insertions(+), 31 deletions(-) create mode 100644 MeshGeoToolsLib/CreateSearchLength.cpp diff --git a/MeshGeoToolsLib/CreateSearchLength.cpp b/MeshGeoToolsLib/CreateSearchLength.cpp new file mode 100644 index 00000000000..b10264e8d0f --- /dev/null +++ b/MeshGeoToolsLib/CreateSearchLength.cpp @@ -0,0 +1,49 @@ +/** + * @file + * @copyright + * Copyright (c) 2012-2017, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/LICENSE.txt + */ + +#include "CreateSearchLength.h" + +#include "BaseLib/ConfigTree.h" +#include "BaseLib/Error.h" + +#include "MeshGeoToolsLib/HeuristicSearchLength.h" +#include "MeshGeoToolsLib/SearchLength.h" + +namespace MeshGeoToolsLib +{ +std::unique_ptr<MeshGeoToolsLib::SearchLength> createSearchLengthAlgorithm( + BaseLib::ConfigTree const& external_config, MeshLib::Mesh const& mesh) +{ + boost::optional<BaseLib::ConfigTree> config = + //! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__search_length_algorithm} + external_config.getConfigSubtreeOptional("search_length_algorithm"); + + if (!config) + return std::unique_ptr<MeshGeoToolsLib::SearchLength>{ + new MeshGeoToolsLib::SearchLength()}; + + //! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__search_length_algorithm__type} + std::string const type = config->getConfigParameter<std::string>("type"); + + if (type == "fixed") + { + //! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__search_length_algorithm__fixed__value} + double const length = config->getConfigParameter<double>("value"); + return std::unique_ptr<MeshGeoToolsLib::SearchLength>{ + new MeshGeoToolsLib::SearchLength(length)}; + } + if (type == "heuristic") + { + return std::unique_ptr<MeshGeoToolsLib::HeuristicSearchLength>{ + new MeshGeoToolsLib::HeuristicSearchLength(mesh)}; + } + OGS_FATAL("Unknown search length algorithm type '%s'.", type.c_str()); +} + +} // end namespace MeshGeoToolsLib diff --git a/MeshGeoToolsLib/CreateSearchLength.h b/MeshGeoToolsLib/CreateSearchLength.h index a46a01baa90..475f71b94be 100644 --- a/MeshGeoToolsLib/CreateSearchLength.h +++ b/MeshGeoToolsLib/CreateSearchLength.h @@ -13,40 +13,20 @@ #include <memory> -#include "BaseLib/ConfigTree.h" +namespace BaseLib +{ +class ConfigTree; +} -#include "MeshGeoToolsLib/HeuristicSearchLength.h" -#include "MeshGeoToolsLib/SearchLength.h" +namespace MeshLib +{ +class Mesh; +} namespace MeshGeoToolsLib { -std::unique_ptr<MeshGeoToolsLib::SearchLength> createSearchLengthAlgorithm( - BaseLib::ConfigTree const& external_config, MeshLib::Mesh const& mesh) -{ - boost::optional<BaseLib::ConfigTree> config = - //! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__search_length_algorithm} - external_config.getConfigSubtreeOptional("search_length_algorithm"); - - if (!config) - return std::unique_ptr<MeshGeoToolsLib::SearchLength>{ - new MeshGeoToolsLib::SearchLength()}; - - //! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__search_length_algorithm__type} - std::string const type = config->getConfigParameter<std::string>("type"); - - if (type == "fixed") - { - //! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__search_length_algorithm__fixed__value} - double const length = config->getConfigParameter<double>("value"); - return std::unique_ptr<MeshGeoToolsLib::SearchLength>{ - new MeshGeoToolsLib::SearchLength(length)}; - } - if (type == "heuristic") - { - return std::unique_ptr<MeshGeoToolsLib::HeuristicSearchLength>{ - new MeshGeoToolsLib::HeuristicSearchLength(mesh)}; - } - OGS_FATAL("Unknown search length algorithm type '%s'.", type.c_str()); -} +class SearchLength; +std::unique_ptr<MeshGeoToolsLib::SearchLength> createSearchLengthAlgorithm( + BaseLib::ConfigTree const& external_config, MeshLib::Mesh const& mesh); } // end namespace MeshGeoToolsLib -- GitLab