From 5e7fb64ff9c0d55005c1ec3593e5663ae6fe484d Mon Sep 17 00:00:00 2001 From: Wenqing Wang <wenqing.wang@ufz.de> Date: Tue, 24 Jan 2017 12:05:37 +0100 Subject: [PATCH] [Coupling] Dropped the changes in uniqueInsert.h --- BaseLib/uniqueInsert.h | 14 -------------- ProcessLib/ProcessType.h | 9 ++++----- ProcessLib/UncoupledProcessesTimeLoop.cpp | 2 +- ProcessLib/VectorMatrixAssembler.cpp | 14 +++++++------- 4 files changed, 12 insertions(+), 27 deletions(-) diff --git a/BaseLib/uniqueInsert.h b/BaseLib/uniqueInsert.h index de6b3488dc3..25aa7e28479 100644 --- a/BaseLib/uniqueInsert.h +++ b/BaseLib/uniqueInsert.h @@ -27,20 +27,6 @@ void uniquePushBack(Container& container, typename Container::value_type const& container.push_back(element); } -//! Inserts the given \c key with the given \c value into the \c map if an entry with the -//! given \c key does not yet exist; otherwise an \c error_message is printed and the -//! program is aborted. -template<typename Map, typename Key, typename Value> -void insertMapIfKeyUniqueElseError( - Map& map, Key const& key, Value&& value, - std::string const& error_message) -{ - auto const inserted = map.emplace(key, std::forward<Value>(value)); - if (!inserted.second) { // insertion failed, i.e., key already exists - OGS_FATAL("Failed insert %s. Key already exists.", - error_message.c_str()); - } -} //! Inserts the given \c key with the given \c value into the \c map if an entry with the //! given \c key does not yet exist; otherwise an \c error_message is printed and the diff --git a/ProcessLib/ProcessType.h b/ProcessLib/ProcessType.h index 528d5d2ff09..2befa719d6c 100644 --- a/ProcessLib/ProcessType.h +++ b/ProcessLib/ProcessType.h @@ -1,6 +1,6 @@ /** * \copyright - * Copyright (c) 2012-2016, OpenGeoSys Community (http://www.opengeosys.org) + * 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/project/license @@ -10,12 +10,12 @@ * Created on December 14, 2016, 3:13 PM */ -#ifndef OGS_PROCESS_TYPE_H -#define OGS_PROCESS_TYPE_H + +#pragma once namespace ProcessLib { -enum class ProcessType +enum ProcessType { GroundwaterFlowProcess, LiquidFlowProcess, @@ -28,4 +28,3 @@ enum class ProcessType TESProcess }; } -#endif /* OGS_PROCESS_TYPE_H */ diff --git a/ProcessLib/UncoupledProcessesTimeLoop.cpp b/ProcessLib/UncoupledProcessesTimeLoop.cpp index da205e99c97..6b3fa5784a4 100644 --- a/ProcessLib/UncoupledProcessesTimeLoop.cpp +++ b/ProcessLib/UncoupledProcessesTimeLoop.cpp @@ -529,7 +529,7 @@ bool UncoupledProcessesTimeLoop::setCoupledSolutions() // Id of the coupled process: const std::size_t c_id = found_item - _per_process_data.begin(); - BaseLib::insertMapIfKeyUniqueElseError( + BaseLib::insertIfKeyUniqueElseError( coupled_xs, it->first, *_process_solutions[c_id], "global_coupled_x"); } diff --git a/ProcessLib/VectorMatrixAssembler.cpp b/ProcessLib/VectorMatrixAssembler.cpp index 7071f84b0c9..a243c471bed 100644 --- a/ProcessLib/VectorMatrixAssembler.cpp +++ b/ProcessLib/VectorMatrixAssembler.cpp @@ -34,16 +34,16 @@ getPreviousLocalSolutionsOfCoupledProcesses( if (prevous_time_x) { auto const local_coupled_x0 = prevous_time_x->get(indices); - BaseLib::insertMapIfKeyUniqueElseError(local_coupled_xs0, it->first, - local_coupled_x0, - "local_coupled_x0"); + BaseLib::insertIfKeyUniqueElseError(local_coupled_xs0, it->first, + local_coupled_x0, + "local_coupled_x0"); } else { const std::vector<double> local_coupled_x0; - BaseLib::insertMapIfKeyUniqueElseError(local_coupled_xs0, it->first, - local_coupled_x0, - "local_coupled_x0"); + BaseLib::insertIfKeyUniqueElseError(local_coupled_xs0, it->first, + local_coupled_x0, + "local_coupled_x0"); } it++; } @@ -62,7 +62,7 @@ getCurrentLocalSolutionsOfCoupledProcesses( { auto const coupled_x = it->second; auto const local_coupled_x = coupled_x.get(indices); - BaseLib::insertMapIfKeyUniqueElseError( + BaseLib::insertIfKeyUniqueElseError( local_coupled_xs, it->first, local_coupled_x, "local_coupled_x"); it++; } -- GitLab