Skip to content
Snippets Groups Projects
Verified Commit 9ea3287b authored by Santiago Ospina De Los Ríos's avatar Santiago Ospina De Los Ríos
Browse files

Remove custom noexcept macro

This macro was introduced to make std::move_only_function to be compatible with clang and libstd++, but it is not required anymore as we use function2
parent 811f8b06
No related branches found
No related tags found
1 merge request!84Support libc++ and reduce minimum required standard to c++20
......@@ -16,13 +16,6 @@
/* Defines the revision of dune-copasi */
#define DUNE_COPASI_VERSION_REVISION @DUNE_COPASI_VERSION_REVISION@
// std::move_only_function with noexcept attribute seems to be broken in clang
#if defined(__clang__)
#define DUNE_COPASI_FUNCTOR_NOEXCEPT
#else
#define DUNE_COPASI_FUNCTOR_NOEXCEPT noexcept
#endif
/* end dune-copasi
Everything below here will be overwritten
*/
......@@ -62,7 +62,7 @@ class TIFFGrayscale
TIFFFile const* _tiff_ptr;
std::size_t _row;
std::size_t _max;
fu2::unique_function<std::size_t(std::size_t) const DUNE_COPASI_FUNCTOR_NOEXCEPT>
fu2::unique_function<std::size_t(std::size_t) const noexcept>
_read_col{};
};
......
......@@ -27,10 +27,10 @@ public:
using Vector = FieldVector<double, dim>;
using Tensor = FieldMatrix<double, dim, dim>;
using ScalarFunctor = fu2::unique_function<Scalar() const DUNE_COPASI_FUNCTOR_NOEXCEPT>;
using VectorFunctor = fu2::unique_function<Vector() const DUNE_COPASI_FUNCTOR_NOEXCEPT>;
using ScalarFunctor = fu2::unique_function<Scalar() const noexcept>;
using VectorFunctor = fu2::unique_function<Vector() const noexcept>;
using TensorApplyFunctor =
fu2::unique_function<Vector(Vector) const DUNE_COPASI_FUNCTOR_NOEXCEPT>;
fu2::unique_function<Vector(Vector) const noexcept>;
FunctorFactory() = default;
FunctorFactory(const FunctorFactory&) = delete;
......
......@@ -74,7 +74,7 @@ FunctorFactoryParser<dim>::make_tensor_apply(std::string_view prefix,
if (type == "scalar") {
if (auto parser = parse_scalar_expression(config, local_values, is_membrane_expression)) {
return [parser = std::move(parser)](Vector vec)
DUNE_COPASI_FUNCTOR_NOEXCEPT { return parser()[0] * vec; };
noexcept { return parser()[0] * vec; };
}
return nullptr;
} else if (type == "tensor") {
......@@ -95,7 +95,7 @@ FunctorFactoryParser<dim>::make_tensor_apply(std::string_view prefix,
}
// move parsers into a lambda that evaluates matrix-vector product
return { [_tensor_parser = std::move(tensor_parser)](Vector in) DUNE_COPASI_FUNCTOR_NOEXCEPT {
return { [_tensor_parser = std::move(tensor_parser)](Vector in) noexcept {
Vector out;
for (std::size_t i = 0; i != dim; ++i) {
out[i] = 0.;
......@@ -124,7 +124,7 @@ FunctorFactoryParser<dim>::parse_scalar_expression(const ParameterTree& config,
}
if (std::regex_match(expression, Impl::float_regex)) {
double value = std::stod(expression);
return [_value = value]() DUNE_COPASI_FUNCTOR_NOEXCEPT { return Scalar{ _value }; };
return [_value = value]() noexcept { return Scalar{ _value }; };
} else {
auto parser_type =
string2parser.at(config.get("parser_type", std::string{ parser2string.at(_parser_type) }));
......
......@@ -132,23 +132,23 @@ public:
};
using CompartmentScalarFunction =
CompartmentDifferentiableFunction<Scalar() const DUNE_COPASI_FUNCTOR_NOEXCEPT>;
CompartmentDifferentiableFunction<Scalar() const noexcept>;
using MembraneScalarFunction =
MembraneDifferentiableFunction<Scalar() const DUNE_COPASI_FUNCTOR_NOEXCEPT>;
MembraneDifferentiableFunction<Scalar() const noexcept>;
using CompartmentVectorFunction =
CompartmentDifferentiableFunction<Vector() const DUNE_COPASI_FUNCTOR_NOEXCEPT>;
CompartmentDifferentiableFunction<Vector() const noexcept>;
using MembraneVectorFunction =
MembraneDifferentiableFunction<Vector() const DUNE_COPASI_FUNCTOR_NOEXCEPT>;
MembraneDifferentiableFunction<Vector() const noexcept>;
struct CompartmentDiffusionApply
: public CompartmentDifferentiableFunction<Vector(Vector) const DUNE_COPASI_FUNCTOR_NOEXCEPT>
: public CompartmentDifferentiableFunction<Vector(Vector) const noexcept>
{
CompartmentDiffusionApply(
fu2::unique_function<Vector(Vector) const DUNE_COPASI_FUNCTOR_NOEXCEPT>&& callable,
fu2::unique_function<Vector(Vector) const noexcept>&& callable,
const CompartmentNode& _wrt)
: CompartmentDifferentiableFunction<Vector(
Vector) const DUNE_COPASI_FUNCTOR_NOEXCEPT>{ std::move(callable) }
Vector) const noexcept>{ std::move(callable) }
, wrt{ _wrt }
{
}
......@@ -156,13 +156,13 @@ public:
};
struct MembraneDiffusionApply
: public MembraneDifferentiableFunction<Vector(Vector) const DUNE_COPASI_FUNCTOR_NOEXCEPT>
: public MembraneDifferentiableFunction<Vector(Vector) const noexcept>
{
MembraneDiffusionApply(
fu2::unique_function<Vector(Vector) const DUNE_COPASI_FUNCTOR_NOEXCEPT>&& callable,
fu2::unique_function<Vector(Vector) const noexcept>&& callable,
const MembraneNode& _wrt)
: MembraneDifferentiableFunction<Vector(Vector)
const DUNE_COPASI_FUNCTOR_NOEXCEPT>{ std::move(callable) }
const noexcept>{ std::move(callable) }
, wrt{ _wrt }
{
}
......@@ -468,12 +468,12 @@ private:
auto make_functor = overload(
[&](std::string_view prefix, const ParameterTree& config, bool membrane_expression, ScalarTag)
-> fu2::unique_function<Scalar() const DUNE_COPASI_FUNCTOR_NOEXCEPT> {
-> fu2::unique_function<Scalar() const noexcept> {
return functor_factory.make_scalar(
prefix, config, std::as_const(*this), membrane_expression);
},
[&](std::string_view prefix, const ParameterTree& config, bool membrane_expression, VectorTag)
-> fu2::unique_function<Vector() const DUNE_COPASI_FUNCTOR_NOEXCEPT> {
-> fu2::unique_function<Vector() const noexcept> {
return functor_factory.make_vector(
prefix, config, std::as_const(*this), membrane_expression);
},
......@@ -481,7 +481,7 @@ private:
const ParameterTree& config,
bool membrane_expression,
TensorApplyTag)
-> fu2::unique_function<Vector(Vector) const DUNE_COPASI_FUNCTOR_NOEXCEPT> {
-> fu2::unique_function<Vector(Vector) const noexcept> {
return functor_factory.make_tensor_apply(
prefix, config, std::as_const(*this), membrane_expression);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment