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
)
add_dune_alberta_flags("duneamdis" OBJECT USE_GENERIC)
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_LIBS_REQUIRED system program_options)
......
......@@ -63,10 +63,10 @@ namespace AMDiS
/// < d_i(psi), b * phi >, where the first corresponds to
/// \p firstOrderType == GRD_PHI and the second one to \p firstOrderType == GRD_PSI.
/// The coefficient \p b must be a scalar expression.
template <class Term, size_t I>
Self& addFOT(Term const& b, const index_<I> _i, FirstOrderType firstOrderType)
template <class Term>
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>
......@@ -90,10 +90,10 @@ namespace AMDiS
/// 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
/// second index \p _j to the derivative component of the trial function.
template <class Term, size_t I, size_t J>
Self& addSOT(Term const& A, const index_<I> _i, const index_<J> _j)
template <class Term>
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>
......@@ -175,15 +175,14 @@ namespace AMDiS
template <class Term>
Self& addFOTImpl(Term const& term, FirstOrderType firstOrderType);
template <class Term, size_t I>
Self& addFOTImpl(Term const& term, const index_<I>,
FirstOrderType firstOrderType);
template <class Term>
Self& addFOTImpl(Term const& term, std::size_t i, FirstOrderType firstOrderType);
template <class Term>
Self& addSOTImpl(Term const& term);
template <class Term, size_t I, size_t J>
Self& addSOTImpl(Term const& term, const index_<I>, const index_<J>);
template <class Term>
Self& addSOTImpl(Term const& term, std::size_t i, std::size_t j);
template <class... Args>
......
......@@ -515,17 +515,17 @@ namespace AMDiS
template <class MeshView>
template <class Term, size_t I>
template <class Term>
Operator<MeshView>& Operator<MeshView>::addFOTImpl(Term const& term,
const index_<I>,
std::size_t i,
FirstOrderType firstOrderType)
{
using OpTerm = GenericOperatorTerm<MeshView, Term, VectorComponent<I>>;
using OpTerm = GenericOperatorTerm<MeshView, Term, VectorComponent>;
if (firstOrderType == GRD_PHI)
firstOrderGrdPhi.push_back(new OpTerm(term));
firstOrderGrdPhi.push_back(new OpTerm(term, {i}));
else
firstOrderGrdPsi.push_back(new OpTerm(term));
firstOrderGrdPsi.push_back(new OpTerm(term, {i}));
return *this;
}
......@@ -540,13 +540,12 @@ namespace AMDiS
template <class MeshView>
template <class Term, size_t I, size_t J>
template <class Term>
Operator<MeshView>& Operator<MeshView>::addSOTImpl(Term const& term,
const index_<I>,
const index_<J>)
std::size_t i, std::size_t j)
{
using OpTerm = GenericOperatorTerm<MeshView, Term, MatrixComponent<I,J>>;
secondOrder.push_back(new OpTerm(term));
using OpTerm = GenericOperatorTerm<MeshView, Term, MatrixComponent>;
secondOrder.push_back(new OpTerm(term, {i,j}));
return *this;
}
......
......@@ -75,11 +75,11 @@ protected:
template <class... Args>
auto evalFotImpl(Args...) const { assert( false ); return 0; }
template <size_t I, class ValueType, class Gradient>
auto evalFotImpl(tag::scalar, VectorComponent<I>, ValueType const& v,
template <class ValueType, class Gradient>
auto evalFotImpl(tag::scalar, VectorComponent comp, ValueType const& v,
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>
......@@ -100,11 +100,11 @@ protected:
template <class... Args>
auto evalSotImpl(Args...) const { assert( false ); return 0; }
template <size_t R, size_t C, class ValueType, class Gradient>
auto evalSotImpl(tag::scalar, MatrixComponent<R, C>, ValueType const& v,
template <class ValueType, class Gradient>
auto evalSotImpl(tag::scalar, MatrixComponent comp, ValueType const& v,
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>
......
......@@ -68,8 +68,9 @@ namespace AMDiS
static constexpr int dow = MeshView::dimensionworld;
public:
GenericOperatorTerm(Term const& term)
GenericOperatorTerm(Term const& term, Traits traits = {})
: term(term)
, traits(traits)
{}
virtual void init(Element const& element,
......@@ -87,28 +88,28 @@ namespace AMDiS
Dune::FieldVector<double,1> const& test,
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,
Dune::FieldVector<double,1> const& test,
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,
Dune::FieldVector<double,dow> const& grad_test,
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,
Dune::FieldVector<double,dow> const& grad_test,
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
......@@ -118,10 +119,10 @@ namespace AMDiS
private:
Term term;
Traits traits;
using value_type = std::decay_t< decltype( std::declval<Term>()[std::declval<size_t>()] ) >;
using _cat = ValueCategory_t<value_type>;
using _traits = Traits;
std::vector<value_type> values;
};
......
......@@ -264,46 +264,49 @@ namespace AMDiS
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) {
rhs->compress(_r);
rhs->getVector(_r) = 0.0;
rhs->compress(r);
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 VectorData = typename ProblemStatSeq<Traits>::template VectorData<_r>;
// The DOFMatrix which should be assembled
auto& dofmatrix = (*systemMatrix)(_r, _c);
auto& solution_vec = (*solution)[_c];
auto& rhs_vec = (*rhs)[_r];
auto& dofmatrix = (*systemMatrix)(r, c);
auto& solution_vec = (*solution)[c];
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 assembleVector = asmVector && _r == _c;
int r = 0, c = 0;
int r_ = 0, c_ = 0;
if (assembleMatrix) {
// init boundary condition
for (auto bc_list : dirichletBc) {
std::tie(r, c) = bc_list.first;
if (r == int(_r)) {
std::tie(r_, c_) = bc_list.first;
if (r_ == _r) {
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 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
......@@ -314,15 +317,15 @@ namespace AMDiS
if (assembleMatrix)
matrixAssembled[row_col] = true;
if (assembleVector)
vectorAssembled[int(_r)] = true;
vectorAssembled[_r] = true;
if (assembleMatrix) {
// finish boundary condition
for (auto bc_list : dirichletBc) {
std::tie(r, c) = bc_list.first;
if (r == int(_r)) {
std::tie(r_, c_) = bc_list.first;
if (r_ == _r) {
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);
}
}
......
......@@ -30,7 +30,7 @@ namespace AMDiS
{
static_assert(std::tuple_size<Tuple>::value == sizeof...(args),
"Nr. of argument != tuple-size");
return Tuple{std::forward<Args>(args)...};
return {std::forward<Args>(args)...};
}
};
......
......@@ -89,17 +89,15 @@ namespace AMDiS
// ---------------------------------------------------------------------------
template <size_t I>
struct VectorComponent
{
static constexpr size_t index = I;
size_t index;
};
template <size_t R, size_t C>
struct MatrixComponent
{
static constexpr size_t row = R;
static constexpr size_t col = C;
size_t row;
size_t col;
};
} // end namespace AMDiS
......@@ -119,7 +119,7 @@ namespace AMDiS
/// Constructor that constructs new base-matrices
SystemMatrix(FeSpaces const& feSpaces)
: feSpaces(feSpaces)
, matrix{}
, matrix()
, dofmatrices(Impl::buildDOFMatrices<DOFMatrices>(feSpaces, feSpaces, matrix))
{}
......
......@@ -29,23 +29,22 @@ int main(int argc, char** argv)
// define the differential operators
using Op = StokesProblem::OperatorType;
for_<0,DOW>([&](auto _i)
{
for (int i = 0; i < DOW; ++i) {
// <viscosity*grad(u_i), grad(v_i)>
Op* opL = new Op;
opL->addSOT( constant(viscosity) );
prob.addMatrixOperator(*opL, _i, _i);
prob.addMatrixOperator(*opL, i, i);
// <p, d_i(v_i)>
Op* opB = new Op;
opB->addFOT( constant(1.0), _i, GRD_PSI );
prob.addMatrixOperator(*opB, _i, DOW);
opB->addFOT( constant(1.0), i, GRD_PSI );
prob.addMatrixOperator(*opB, i, DOW);
// <d_i(u_i), q>
Op* opDiv = new Op;
opDiv->addFOT( constant(1.0), _i, GRD_PHI );
prob.addMatrixOperator(*opDiv, DOW, _i);
});
opDiv->addFOT( constant(1.0), i, GRD_PHI );
prob.addMatrixOperator(*opDiv, DOW, i);
}
Op* opZero = new Op;
opZero->addZOT( constant(0.0) );
......
Supports Markdown
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