Commit e1055324 authored by Andreas Nüßing's avatar Andreas Nüßing

[PenaltyFluxWeighting] rename parameter to weights

We change the name of the parameter back to "weights" and print out a
deprecation warning if someone uses the old parameter semantics.
parent ad49e01c
......@@ -73,7 +73,7 @@ namespace duneuro
, problem_(problem)
, functionSpace_(subTriangulation_->gridView(), subTriangulation_)
, edgeNormProvider_(config.get<std::string>("edge_norm_type"), 1.0)
, weighting_(config.get<std::string>("weighting"))
, weighting_(config.get<std::string>("weights"))
, localOperator_(
*problem_, edgeNormProvider_, weighting_,
ConvectionDiffusion_DG_Scheme::fromString(config.get<std::string>("scheme")),
......
#include <duneuro/common/deprecated.hh>
#include <iostream>
namespace duneuro
{
void issueDeprecationWarning(const std::string& msg)
{
std::cout << "DEPRECATION WARNING:\n" << msg << std::endl;
}
}
#ifndef DUNEURO_DEPRECATED_HH
#define DUNEURO_DEPRECATED_HH
#include <string>
namespace duneuro
{
void issueDeprecationWarning(const std::string& msg);
}
#endif // DUNEURO_DEPRECATED_HH
......@@ -67,7 +67,7 @@ namespace duneuro
, problem_(problem)
, functionSpace_(volumeConductor_->gridView())
, edgeNormProvider_(config.get<std::string>("edge_norm_type"), 1.0)
, weighting_(config.get<std::string>("weighting"))
, weighting_(config.get<std::string>("weights"))
, localOperator_(
*problem_, edgeNormProvider_, weighting_,
ConvectionDiffusion_DG_Scheme::fromString(config.get<std::string>("scheme")),
......
......@@ -2,9 +2,12 @@
#define DUNEURO_PENALTY_FLUX_WEIGHTING_HH
#include <dune/common/fmatrix.hh>
#include <dune/common/parametertree.hh>
#include <dune/geometry/referenceelements.hh>
#include <duneuro/common/deprecated.hh>
namespace duneuro
{
template <class T>
......@@ -157,8 +160,21 @@ namespace duneuro
};
enum class PenaltyFluxWeightsTypes { constant, tensorOnly, annavarapu, barrau };
static inline PenaltyFluxWeightsTypes penaltyFluxWeightingFromString(const std::string& name)
static inline PenaltyFluxWeightsTypes penaltyFluxWeightingFromString(std::string name)
{
// deprecation mechanism, issue warning if type is convertible to bool (old behaviour)
// should be removed after some period of time
try {
Dune::ParameterTree tree;
tree["type"] = name;
bool v = tree.get<bool>("type");
issueDeprecationWarning(
"the behavior of \"weights\" has been changed. To obtain the old weighting, set "
"\"weights\" to \"tensorOnly\", to turn weighting off, set \"weights\" to "
"\"constant\"");
name = v ? "tensorOnly" : "constant";
} catch (Dune::RangeError& ex) {
}
if (name == "constant")
return PenaltyFluxWeightsTypes::constant;
else if (name == "tensorOnly")
......
......@@ -70,7 +70,7 @@ namespace duneuro
, problem_(problem)
, functionSpace_(subTriangulation_->gridView(), subTriangulation_)
, edgeNormProvider_(config.get<std::string>("edge_norm_type"), 1.0)
, weighting_(config.get<std::string>("weighting"))
, weighting_(config.get<std::string>("weights"))
, localOperator_(
*problem_, edgeNormProvider_, weighting_,
ConvectionDiffusion_DG_Scheme::fromString(config.get<std::string>("scheme")),
......
......@@ -61,7 +61,7 @@ namespace duneuro
, elementNeighborhoodMap_(std::make_shared<ElementNeighborhoodMap<typename VC::GridView>>(
volumeConductor_->gridView()))
, edgeNormProvider_(solverConfig.get<std::string>("edge_norm_type"), 1.0)
, weighting_(solverConfig.get<std::string>("weighting"))
, weighting_(solverConfig.get<std::string>("weights"))
, config_(config)
, intorderadd_lb_(config.get<unsigned int>("intorderadd_lb"))
, scheme_(
......
......@@ -38,7 +38,7 @@ namespace duneuro
: BaseT(search)
, problem_(volumeConductor->gridView(), volumeConductor)
, edgeNormProvider_(solverConfig.get<std::string>("edge_norm_type", "houston"), 1.0)
, weighting_(solverConfig.get<std::string>("weighting", "tensorOnly"))
, weighting_(solverConfig.get<std::string>("weights", "tensorOnly"))
, lop_(problem_, weighting_, config.get<unsigned int>("intorderadd"),
config.get<unsigned int>("intorderadd_lb"))
, x_(fs.getGFS(), 0.0)
......
......@@ -40,7 +40,7 @@ namespace duneuro
TDCSPatchUDGAssembler(Problem& problem, std::shared_ptr<ST> subTriangulation, const FS& fs,
const Dune::ParameterTree& config)
: edgeNormProvider_(config.get<std::string>("edge_norm_type"), 1.0)
, weighting_(config.get<std::string>("weighting"))
, weighting_(config.get<std::string>("weights"))
, lop_(problem, edgeNormProvider_,
ConvectionDiffusion_DG_Scheme::fromString(config.get<std::string>("scheme")),
weighting_, config.get<double>("penalty"))
......
......@@ -2,6 +2,7 @@ set(duneuro_SOURCES ${CMAKE_SOURCE_DIR}/duneuro/meeg/fitted_meeg_driver_2d.cc)
set(duneuro_SOURCES ${duneuro_SOURCES} ${CMAKE_SOURCE_DIR}/duneuro/tes/fitted_tdcs_driver_2d.cc)
set(duneuro_SOURCES ${duneuro_SOURCES} ${CMAKE_SOURCE_DIR}/duneuro/meeg/fitted_meeg_driver_3d.cc)
set(duneuro_SOURCES ${duneuro_SOURCES} ${CMAKE_SOURCE_DIR}/duneuro/tes/fitted_tdcs_driver_3d.cc)
set(duneuro_SOURCES ${duneuro_SOURCES} ${CMAKE_SOURCE_DIR}/duneuro/common/deprecated.cc)
if (dune-udg_FOUND)
set(duneuro_SOURCES ${duneuro_SOURCES} ${CMAKE_SOURCE_DIR}/duneuro/meeg/unfitted_meeg_driver_2d.cc)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment