Commit 5a874ddf authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

some compiler problems removed

parent 59f0c65c
...@@ -18,6 +18,7 @@ dune_add_library("duneamdis" NO_EXPORT ...@@ -18,6 +18,7 @@ dune_add_library("duneamdis" NO_EXPORT
) )
add_dune_alberta_flags("duneamdis" OBJECT USE_GENERIC) add_dune_alberta_flags("duneamdis" OBJECT USE_GENERIC)
target_compile_definitions("duneamdis" PUBLIC AMDIS_BACKEND_MTL=1) target_compile_definitions("duneamdis" PUBLIC AMDIS_BACKEND_MTL=1)
target_compile_options("duneamdis" PUBLIC -ftemplate-backtrace-limit=0)
set(BOOST_VERSION "1.54") set(BOOST_VERSION "1.54")
set(BOOST_LIBS_REQUIRED system program_options) set(BOOST_LIBS_REQUIRED system program_options)
......
...@@ -63,10 +63,10 @@ namespace AMDiS ...@@ -63,10 +63,10 @@ namespace AMDiS
/// < d_i(psi), b * phi >, where the first corresponds to /// < d_i(psi), b * phi >, where the first corresponds to
/// \p firstOrderType == GRD_PHI and the second one to \p firstOrderType == GRD_PSI. /// \p firstOrderType == GRD_PHI and the second one to \p firstOrderType == GRD_PSI.
/// The coefficient \p b must be a scalar expression. /// The coefficient \p b must be a scalar expression.
template <class Term, size_t I> template <class Term>
Self& addFOT(Term const& b, const index_<I> _i, FirstOrderType firstOrderType) Self& addFOT(Term const& b, std::size_t i, FirstOrderType firstOrderType)
{ {
return addFOTImpl(toTerm(b), _i, firstOrderType); return addFOTImpl(toTerm(b), i, firstOrderType);
} }
template <class... Args> template <class... Args>
...@@ -90,10 +90,10 @@ namespace AMDiS ...@@ -90,10 +90,10 @@ namespace AMDiS
/// where \p A can be a matrix or a scalar expression. The first index \p _i /// where \p A can be a matrix or a scalar expression. The first index \p _i
/// corresponds to the derivative component of the test-function and the /// corresponds to the derivative component of the test-function and the
/// second index \p _j to the derivative component of the trial function. /// second index \p _j to the derivative component of the trial function.
template <class Term, size_t I, size_t J> template <class Term>
Self& addSOT(Term const& A, const index_<I> _i, const index_<J> _j) Self& addSOT(Term const& A, std::size_t i, std::size_t j)
{ {
return addSOTImpl(toTerm(A), _i, _j); return addSOTImpl(toTerm(A), i, j);
} }
template <class... Args> template <class... Args>
...@@ -175,15 +175,14 @@ namespace AMDiS ...@@ -175,15 +175,14 @@ namespace AMDiS
template <class Term> template <class Term>
Self& addFOTImpl(Term const& term, FirstOrderType firstOrderType); Self& addFOTImpl(Term const& term, FirstOrderType firstOrderType);
template <class Term, size_t I> template <class Term>
Self& addFOTImpl(Term const& term, const index_<I>, Self& addFOTImpl(Term const& term, std::size_t i, FirstOrderType firstOrderType);
FirstOrderType firstOrderType);
template <class Term> template <class Term>
Self& addSOTImpl(Term const& term); Self& addSOTImpl(Term const& term);
template <class Term, size_t I, size_t J> template <class Term>
Self& addSOTImpl(Term const& term, const index_<I>, const index_<J>); Self& addSOTImpl(Term const& term, std::size_t i, std::size_t j);
template <class... Args> template <class... Args>
......
...@@ -515,17 +515,17 @@ namespace AMDiS ...@@ -515,17 +515,17 @@ namespace AMDiS
template <class MeshView> template <class MeshView>
template <class Term, size_t I> template <class Term>
Operator<MeshView>& Operator<MeshView>::addFOTImpl(Term const& term, Operator<MeshView>& Operator<MeshView>::addFOTImpl(Term const& term,
const index_<I>, std::size_t i,
FirstOrderType firstOrderType) FirstOrderType firstOrderType)
{ {
using OpTerm = GenericOperatorTerm<MeshView, Term, VectorComponent<I>>; using OpTerm = GenericOperatorTerm<MeshView, Term, VectorComponent>;
if (firstOrderType == GRD_PHI) if (firstOrderType == GRD_PHI)
firstOrderGrdPhi.push_back(new OpTerm(term)); firstOrderGrdPhi.push_back(new OpTerm(term, {i}));
else else
firstOrderGrdPsi.push_back(new OpTerm(term)); firstOrderGrdPsi.push_back(new OpTerm(term, {i}));
return *this; return *this;
} }
...@@ -540,13 +540,12 @@ namespace AMDiS ...@@ -540,13 +540,12 @@ namespace AMDiS
template <class MeshView> template <class MeshView>
template <class Term, size_t I, size_t J> template <class Term>
Operator<MeshView>& Operator<MeshView>::addSOTImpl(Term const& term, Operator<MeshView>& Operator<MeshView>::addSOTImpl(Term const& term,
const index_<I>, std::size_t i, std::size_t j)
const index_<J>)
{ {
using OpTerm = GenericOperatorTerm<MeshView, Term, MatrixComponent<I,J>>; using OpTerm = GenericOperatorTerm<MeshView, Term, MatrixComponent>;
secondOrder.push_back(new OpTerm(term)); secondOrder.push_back(new OpTerm(term, {i,j}));
return *this; return *this;
} }
......
...@@ -75,11 +75,11 @@ protected: ...@@ -75,11 +75,11 @@ protected:
template <class... Args> template <class... Args>
auto evalFotImpl(Args...) const { assert( false ); return 0; } auto evalFotImpl(Args...) const { assert( false ); return 0; }
template <size_t I, class ValueType, class Gradient> template <class ValueType, class Gradient>
auto evalFotImpl(tag::scalar, VectorComponent<I>, ValueType const& v, auto evalFotImpl(tag::scalar, VectorComponent comp, ValueType const& v,
Gradient const& grad_test, Scalar const& trial) const Gradient const& grad_test, Scalar const& trial) const
{ {
return v * grad_test[I] * trial; return v * grad_test[comp.index] * trial;
} }
template <class ValueType, class Gradient> template <class ValueType, class Gradient>
...@@ -100,11 +100,11 @@ protected: ...@@ -100,11 +100,11 @@ protected:
template <class... Args> template <class... Args>
auto evalSotImpl(Args...) const { assert( false ); return 0; } auto evalSotImpl(Args...) const { assert( false ); return 0; }
template <size_t R, size_t C, class ValueType, class Gradient> template <class ValueType, class Gradient>
auto evalSotImpl(tag::scalar, MatrixComponent<R, C>, ValueType const& v, auto evalSotImpl(tag::scalar, MatrixComponent comp, ValueType const& v,
Gradient const& grad_test, Gradient const& grad_trial) const Gradient const& grad_test, Gradient const& grad_trial) const
{ {
return v * (grad_test[R] * grad_trial[C]); return v * (grad_test[comp.row] * grad_trial[comp.col]);
} }
template <class ValueType, class Gradient> template <class ValueType, class Gradient>
......
...@@ -68,8 +68,9 @@ namespace AMDiS ...@@ -68,8 +68,9 @@ namespace AMDiS
static constexpr int dow = MeshView::dimensionworld; static constexpr int dow = MeshView::dimensionworld;
public: public:
GenericOperatorTerm(Term const& term) GenericOperatorTerm(Term const& term, Traits traits = {})
: term(term) : term(term)
, traits(traits)
{} {}
virtual void init(Element const& element, virtual void init(Element const& element,
...@@ -87,28 +88,28 @@ namespace AMDiS ...@@ -87,28 +88,28 @@ namespace AMDiS
Dune::FieldVector<double,1> const& test, Dune::FieldVector<double,1> const& test,
Dune::FieldVector<double,1> const trial = 1.0) const override Dune::FieldVector<double,1> const trial = 1.0) const override
{ {
return this->evalZotImpl(_cat{}, _traits{}, values[iq], test, trial); return this->evalZotImpl(_cat{}, traits, values[iq], test, trial);
} }
virtual double evalFot1(size_t iq, virtual double evalFot1(size_t iq,
Dune::FieldVector<double,1> const& test, Dune::FieldVector<double,1> const& test,
Dune::FieldVector<double,dow> const& grad_trial) const override Dune::FieldVector<double,dow> const& grad_trial) const override
{ {
return this->evalFotImpl(_cat{}, _traits{}, values[iq], grad_trial, test); return this->evalFotImpl(_cat{}, traits, values[iq], grad_trial, test);
} }
virtual double evalFot2(size_t iq, virtual double evalFot2(size_t iq,
Dune::FieldVector<double,dow> const& grad_test, Dune::FieldVector<double,dow> const& grad_test,
Dune::FieldVector<double,1> const trial = 1.0) const override Dune::FieldVector<double,1> const trial = 1.0) const override
{ {
return this->evalFotImpl(_cat{}, _traits{}, values[iq], grad_test, trial); return this->evalFotImpl(_cat{}, traits, values[iq], grad_test, trial);
} }
virtual double evalSot(size_t iq, virtual double evalSot(size_t iq,
Dune::FieldVector<double,dow> const& grad_test, Dune::FieldVector<double,dow> const& grad_test,
Dune::FieldVector<double,dow> const& grad_trial) const override Dune::FieldVector<double,dow> const& grad_trial) const override
{ {
return this->evalSotImpl(_cat{}, _traits{}, values[iq], grad_test, grad_trial); return this->evalSotImpl(_cat{}, traits, values[iq], grad_test, grad_trial);
} }
virtual int getDegree(Dune::GeometryType const& t) const override virtual int getDegree(Dune::GeometryType const& t) const override
...@@ -118,10 +119,10 @@ namespace AMDiS ...@@ -118,10 +119,10 @@ namespace AMDiS
private: private:
Term term; Term term;
Traits traits;
using value_type = std::decay_t< decltype( std::declval<Term>()[std::declval<size_t>()] ) >; using value_type = std::decay_t< decltype( std::declval<Term>()[std::declval<size_t>()] ) >;
using _cat = ValueCategory_t<value_type>; using _cat = ValueCategory_t<value_type>;
using _traits = Traits;
std::vector<value_type> values; std::vector<value_type> values;
}; };
......
...@@ -259,51 +259,54 @@ namespace AMDiS ...@@ -259,51 +259,54 @@ namespace AMDiS
Timer t; Timer t;
For<0, nComponents>::loop([this](auto const _r) { For<0, nComponents>::loop([this](auto const _r) {
this->getNodeFactory(_r).initializeIndices(); this->getNodeFactory(_r).initializeIndices();
}); });
size_t nnz = 0; size_t nnz = 0;
For<0, nComponents>::loop([this, &nnz, asmMatrix_, asmVector_](auto const _r) For<0, nComponents>::loop([this, &nnz, asmMatrix_, asmVector_](auto const r)
{ {
msg(this->getFeSpace(_r).size(), " DOFs for FeSpace[", _r, "]"); msg(this->getFeSpace(r).size(), " DOFs for FeSpace[", r, "]");
bool asmVector = asmVector_ && (!vectorAssembled[int(_r)] || vectorChanging[int(_r)]); bool asmVector = asmVector_ && (!vectorAssembled[int(r)] || vectorChanging[int(r)]);
if (asmVector) { if (asmVector) {
rhs->compress(_r); rhs->compress(r);
rhs->getVector(_r) = 0.0; rhs->getVector(r) = 0.0;
} }
For<0, nComponents>::loop([this, &nnz, asmMatrix_, asmVector, r=_r](auto const _c) For<0, nComponents>::loop([this, &nnz, asmMatrix_, asmVector](auto const c)
{ {
auto const _r = r; static const int _c = decltype(c)::value;
static const int _r = decltype(r)::value;
index_<_r> r{};
using MatrixData = typename ProblemStatSeq<Traits>::template MatrixData<_r, _c>; using MatrixData = typename ProblemStatSeq<Traits>::template MatrixData<_r, _c>;
using VectorData = typename ProblemStatSeq<Traits>::template VectorData<_r>; using VectorData = typename ProblemStatSeq<Traits>::template VectorData<_r>;
// The DOFMatrix which should be assembled // The DOFMatrix which should be assembled
auto& dofmatrix = (*systemMatrix)(_r, _c); auto& dofmatrix = (*systemMatrix)(r, c);
auto& solution_vec = (*solution)[_c]; auto& solution_vec = (*solution)[c];
auto& rhs_vec = (*rhs)[_r]; auto& rhs_vec = (*rhs)[r];
auto row_col = std::make_pair(int(_r), int(_c)); auto row_col = std::make_pair(_r, _c);
bool assembleMatrix = asmMatrix_ && (!matrixAssembled[row_col] || matrixChanging[row_col]); bool assembleMatrix = asmMatrix_ && (!matrixAssembled[row_col] || matrixChanging[row_col]);
bool assembleVector = asmVector && _r == _c; bool assembleVector = asmVector && _r == _c;
int r = 0, c = 0; int r_ = 0, c_ = 0;
if (assembleMatrix) { if (assembleMatrix) {
// init boundary condition // init boundary condition
for (auto bc_list : dirichletBc) { for (auto bc_list : dirichletBc) {
std::tie(r, c) = bc_list.first; std::tie(r_, c_) = bc_list.first;
if (r == int(_r)) { if (r_ == _r) {
for (auto bc : bc_list.second) for (auto bc : bc_list.second)
bc->init(c == int(_c), dofmatrix, solution_vec, rhs_vec); bc->init(c_ == _c, dofmatrix, solution_vec, rhs_vec);
} }
} }
} }
auto mat = MatrixData{dofmatrix, matrixOperators[row_col], matrixFactors[row_col], assembleMatrix}; auto mat = MatrixData{dofmatrix, matrixOperators[row_col], matrixFactors[row_col], assembleMatrix};
auto vec = VectorData{rhs_vec, vectorOperators[int(_r)], vectorFactors[int(_r)], assembleVector}; auto vec = VectorData{rhs_vec, vectorOperators[_r], vectorFactors[_r], assembleVector};
// assemble the DOFMatrix block and the corresponding rhs vector, of r==c // assemble the DOFMatrix block and the corresponding rhs vector, of r==c
...@@ -314,20 +317,20 @@ namespace AMDiS ...@@ -314,20 +317,20 @@ namespace AMDiS
if (assembleMatrix) if (assembleMatrix)
matrixAssembled[row_col] = true; matrixAssembled[row_col] = true;
if (assembleVector) if (assembleVector)
vectorAssembled[int(_r)] = true; vectorAssembled[_r] = true;
if (assembleMatrix) { if (assembleMatrix) {
// finish boundary condition // finish boundary condition
for (auto bc_list : dirichletBc) { for (auto bc_list : dirichletBc) {
std::tie(r, c) = bc_list.first; std::tie(r_, c_) = bc_list.first;
if (r == int(_r)) { if (r_ == _r) {
for (auto bc : bc_list.second) for (auto bc : bc_list.second)
bc->finish(c == int(_c), dofmatrix, solution_vec, rhs_vec); bc->finish(c_ == _c, dofmatrix, solution_vec, rhs_vec);
} }
} }
nnz += dofmatrix.getNnz(); nnz += dofmatrix.getNnz();
} }
}); });
}); });
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include <dune/amdis/common/Utility.hpp> #include <dune/amdis/common/Utility.hpp>
namespace AMDiS namespace AMDiS
{ {
namespace Impl namespace Impl
{ {
template <class Tuple, size_t N> template <class Tuple, size_t N>
...@@ -17,36 +17,36 @@ namespace AMDiS ...@@ -17,36 +17,36 @@ namespace AMDiS
template <class Arg, class... Args> template <class Arg, class... Args>
static Tuple make(Arg&& arg, Args&&... args) static Tuple make(Arg&& arg, Args&&... args)
{ {
return ConstructTuple<Tuple, N-1>::make( return ConstructTuple<Tuple, N-1>::make(
std::forward<Arg>(arg), std::forward<Arg>(arg), std::forward<Args>(args)...); std::forward<Arg>(arg), std::forward<Arg>(arg), std::forward<Args>(args)...);
} }
}; };
template <class Tuple> template <class Tuple>
struct ConstructTuple<Tuple, 1> struct ConstructTuple<Tuple, 1>
{ {
template <class... Args> template <class... Args>
static Tuple make(Args&&... args) static Tuple make(Args&&... args)
{ {
static_assert(std::tuple_size<Tuple>::value == sizeof...(args), static_assert(std::tuple_size<Tuple>::value == sizeof...(args),
"Nr. of argument != tuple-size"); "Nr. of argument != tuple-size");
return Tuple{std::forward<Args>(args)...}; return {std::forward<Args>(args)...};
} }
}; };
template <class Tuple> template <class Tuple>
struct ConstructTuple<Tuple, 0> struct ConstructTuple<Tuple, 0>
{ {
template <class... Args> template <class... Args>
static Tuple make(Args&&... args) static Tuple make(Args&&... args)
{ {
static_assert(std::tuple_size<Tuple>::value == 0, static_assert(std::tuple_size<Tuple>::value == 0,
"Construction of empty tuples with empty argument list only!"); "Construction of empty tuples with empty argument list only!");
return {}; return {};
} }
}; };
template <class Tuple> template <class Tuple>
struct FoldTuples struct FoldTuples
{ {
...@@ -56,7 +56,7 @@ namespace AMDiS ...@@ -56,7 +56,7 @@ namespace AMDiS
{ {
return Tuple{make_element(index_<Is>(), std::forward<Tuples>(tuples)...)...}; return Tuple{make_element(index_<Is>(), std::forward<Tuples>(tuples)...)...};
} }
template <size_t I, class... Tuples> template <size_t I, class... Tuples>
static std::tuple_element_t<I, Tuple> make_element(index_<I>, Tuples&&... tuples) static std::tuple_element_t<I, Tuple> make_element(index_<I>, Tuples&&... tuples)
{ {
...@@ -64,19 +64,19 @@ namespace AMDiS ...@@ -64,19 +64,19 @@ namespace AMDiS
return std::tuple_element_t<I, Tuple>{get<I>(std::forward<Tuples>(tuples))...}; return std::tuple_element_t<I, Tuple>{get<I>(std::forward<Tuples>(tuples))...};
} }
}; };
} // end namespace Impl } // end namespace Impl
/// Construct a tuple with each element constructed by the same argument arg. /// Construct a tuple with each element constructed by the same argument arg.
/// Returns tuple { tuple_element_t<0>(arg), tuple_element_t<1>(arg), ... } /// Returns tuple { tuple_element_t<0>(arg), tuple_element_t<1>(arg), ... }
template <class Tuple, class Arg> template <class Tuple, class Arg>
Tuple constructTuple(Arg&& arg) Tuple constructTuple(Arg&& arg)
{ {
return Impl::ConstructTuple<Tuple, std::tuple_size<Tuple>::value>::make( return Impl::ConstructTuple<Tuple, std::tuple_size<Tuple>::value>::make(
std::forward<Arg>(arg)); std::forward<Arg>(arg));
} }
/// Construct a tuple of tuples, by folding a list of tuples of the same size. /// Construct a tuple of tuples, by folding a list of tuples of the same size.
/// Return tuple { {arg0[0], arg1[0], arg2[0], ...}, {arg0[1], arg1[1], arg2[1], ...}, ...} /// Return tuple { {arg0[0], arg1[0], arg2[0], ...}, {arg0[1], arg1[1], arg2[1], ...}, ...}
template <class Tuple, class... Args> template <class Tuple, class... Args>
...@@ -85,85 +85,85 @@ namespace AMDiS ...@@ -85,85 +85,85 @@ namespace AMDiS
return Impl::FoldTuples<Tuple>::make(MakeSeq_t<std::tuple_size<Tuple>::value>(), return Impl::FoldTuples<Tuple>::make(MakeSeq_t<std::tuple_size<Tuple>::value>(),
std::forward<Args>(args)...); std::forward<Args>(args)...);
} }
namespace Impl namespace Impl
{ {
template <template<class> class Base, class Tuple, class Indices> struct MakeTuple; template <template<class> class Base, class Tuple, class Indices> struct MakeTuple;
template <template<class> class Base, class Tuple, size_t... I> template <template<class> class Base, class Tuple, size_t... I>
struct MakeTuple<Base, Tuple, Indices<I...>> struct MakeTuple<Base, Tuple, Indices<I...>>
{ {
using type = std::tuple<Base<std::tuple_element_t<I, Tuple>>...>; using type = std::tuple<Base<std::tuple_element_t<I, Tuple>>...>;
}; };
} // end namespace Impl } // end namespace Impl
/// Constructs tuple type, by wrapping Base around the tuple elements. /// Constructs tuple type, by wrapping Base around the tuple elements.
/// Returns tuple type tuple<Base<tuple_element_t<0>>, Base<tuple_element_t<1>>, ...> /// Returns tuple type tuple<Base<tuple_element_t<0>>, Base<tuple_element_t<1>>, ...>
template <template<class> class Base, class Tuple> template <template<class> class Base, class Tuple>
using MakeTuple_t = using MakeTuple_t =
typename Impl::MakeTuple<Base, Tuple, MakeSeq_t<std::tuple_size<Tuple>::value>>::type; typename Impl::MakeTuple<Base, Tuple, MakeSeq_t<std::tuple_size<Tuple>::value>>::type;
namespace Impl namespace Impl
{ {
template <template<class,class> class Base, class Tuple1, class Tuple2, class Indices> struct MakeTuple2; template <template<class,class> class Base, class Tuple1, class Tuple2, class Indices> struct MakeTuple2;
template <template<class,class> class Base, class Tuple1, class Tuple2, size_t... I> template <template<class,class> class Base, class Tuple1, class Tuple2, size_t... I>
struct MakeTuple2<Base, Tuple1, Tuple2, Indices<I...>> struct MakeTuple2<Base, Tuple1, Tuple2, Indices<I...>>
{ {
using type = std::tuple<Base<std::tuple_element_t<I, Tuple1>, std::tuple_element_t<I, Tuple2>>...>; using type = std::tuple<Base<std::tuple_element_t<I, Tuple1>, std::tuple_element_t<I, Tuple2>>...>;
}; };
} // end namespace Impl