From dc4ede7aa4994620f32521c37f801493c6101aa0 Mon Sep 17 00:00:00 2001 From: Norihiro Watanabe <norihiro.watanabe@ufz.de> Date: Tue, 28 Jun 2016 12:13:42 +0200 Subject: [PATCH] mv createGroundwaterFlowProcess() to CreateGroundwaterFlowProcess.* to speedup compilation --- Applications/ApplicationsLib/ProjectData.cpp | 2 +- .../CreateGroundwaterFlowProcess.cpp | 73 +++++++++++++++++++ .../CreateGroundwaterFlowProcess.h | 34 +++++++++ .../GroundwaterFlowProcess.cpp | 57 +-------------- .../GroundwaterFlow/GroundwaterFlowProcess.h | 12 +-- 5 files changed, 112 insertions(+), 66 deletions(-) create mode 100644 ProcessLib/GroundwaterFlow/CreateGroundwaterFlowProcess.cpp create mode 100644 ProcessLib/GroundwaterFlow/CreateGroundwaterFlowProcess.h diff --git a/Applications/ApplicationsLib/ProjectData.cpp b/Applications/ApplicationsLib/ProjectData.cpp index 174b8a3e052..ce3f4abc772 100644 --- a/Applications/ApplicationsLib/ProjectData.cpp +++ b/Applications/ApplicationsLib/ProjectData.cpp @@ -33,7 +33,7 @@ #include "UncoupledProcessesTimeLoop.h" -#include "ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.h" +#include "ProcessLib/GroundwaterFlow/CreateGroundwaterFlowProcess.h" #include "ProcessLib/TES/TESProcess.h" namespace detail diff --git a/ProcessLib/GroundwaterFlow/CreateGroundwaterFlowProcess.cpp b/ProcessLib/GroundwaterFlow/CreateGroundwaterFlowProcess.cpp new file mode 100644 index 00000000000..599cb76eb09 --- /dev/null +++ b/ProcessLib/GroundwaterFlow/CreateGroundwaterFlowProcess.cpp @@ -0,0 +1,73 @@ +/** + * \copyright + * Copyright (c) 2012-2016, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#include "CreateGroundwaterFlowProcess.h" + +#include "GroundwaterFlowProcess.h" +#include "GroundwaterFlowProcessData.h" + +namespace ProcessLib +{ +namespace GroundwaterFlow +{ +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)}}; +} + +} // namespace GroundwaterFlow +} // namespace ProcessLib diff --git a/ProcessLib/GroundwaterFlow/CreateGroundwaterFlowProcess.h b/ProcessLib/GroundwaterFlow/CreateGroundwaterFlowProcess.h new file mode 100644 index 00000000000..0434c1e3537 --- /dev/null +++ b/ProcessLib/GroundwaterFlow/CreateGroundwaterFlowProcess.h @@ -0,0 +1,34 @@ +/** + * \copyright + * Copyright (c) 2012-2016, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#ifndef PROCESS_LIB_CREATE_GROUNDWATERFLOWPROCESS_H_ +#define PROCESS_LIB_CREATE_GROUNDWATERFLOWPROCESS_H_ + +#include <memory> +#include "ProcessLib/Process.h" + + +namespace ProcessLib +{ +namespace GroundwaterFlow +{ + +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); + +} // namespace GroundwaterFlow +} // namespace ProcessLib + +#endif // PROCESS_LIB_CREATE_GROUNDWATERFLOWPROCESS_H_ diff --git a/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.cpp b/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.cpp index d4b67a6628a..71448c9c25d 100644 --- a/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.cpp +++ b/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.cpp @@ -96,58 +96,5 @@ void GroundwaterFlowProcess::assembleConcreteProcess(const double t, _local_assemblers, t, x, M, K, b); } -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)}}; -} - -} // namespace GroundwaterFlow -} // namespace ProcessLib +} // namespace GroundwaterFlow +} // namespace ProcessLib diff --git a/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.h b/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.h index 10171019bed..d4b84bac2b6 100644 --- a/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.h +++ b/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.h @@ -71,15 +71,7 @@ private: std::unique_ptr<ExtrapolatorInterface> _extrapolator; }; -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); - -} // namespace GroundwaterFlow -} // namespace ProcessLib +} // namespace GroundwaterFlow +} // namespace ProcessLib #endif // PROCESS_LIB_GROUNDWATERFLOWPROCESS_H_ -- GitLab