Commit f6447413 authored by Praetorius, Simon's avatar Praetorius, Simon

removed a lot obsolete code

parent 9e2dadcb
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <iostream>
#include <amdis/AMDiS.hpp>
......@@ -26,13 +26,13 @@ int main(int argc, char** argv)
// -div(A*grad(u)) + div(b*u) + c*u = f
auto opCD = convectionDiffusion(/*A=*/1.0, /*b=*/0.0, /*c=*/1.0, /*f=*/1.0);
prob.addMatrixOperator(opCD, _0, _0);
prob.addVectorOperator(opCD, _0);
prob.addMatrixOperator(opCD, 0, 0);
prob.addVectorOperator(opCD, 0);
// set boundary condition
auto predicate = [](auto const& x){ return x[0] < 1.e-8 || x[1] < 1.e-8; }; // define boundary
auto dbcValues = [](auto const& x){ return 0.0; }; // set value
prob.addDirichletBC(predicate, _0, _0, dbcValues);
prob.addDirichletBC(predicate, 0, 0, dbcValues);
AdaptInfo adaptInfo("adapt");
prob.buildAfterCoarsen(adaptInfo, Flag(0));
......
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <iostream>
#include <fmt/core.h>
......
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <iostream>
#include <amdis/AMDiS.hpp>
......
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <iostream>
#include <ctime>
#include <cmath>
......@@ -41,8 +45,8 @@ int main(int argc, char** argv)
AdaptInfo adaptInfo("adapt");
// tree-paths for components
auto _v = 0_c;
auto _p = 1_c;
auto _v = Dune::Indices::_0;
auto _p = Dune::Indices::_1;
// <1/tau * u, v>
auto opTime = makeOperator(tag::testvec_trialvec{}, density);
......
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <iostream>
#include <ctime>
#include <cmath>
......@@ -30,8 +34,8 @@ int main(int argc, char** argv)
Parameters::get("stokes->viscosity", viscosity);
// tree-paths for components
auto _v = 0_c;
auto _p = 1_c;
auto _v = Dune::Indices::_0;
auto _p = Dune::Indices::_1;
// <viscosity*grad(u_i), grad(v_i)>
for (std::size_t i = 0; i < DOW; ++i) {
......
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <iostream>
#include <ctime>
#include <cmath>
......@@ -30,8 +34,8 @@ int main(int argc, char** argv)
Parameters::get("stokes->viscosity", viscosity);
// tree-paths for components
auto _v = 0_c;
auto _p = 1_c;
auto _v = Dune::Indices::_0;
auto _p = Dune::Indices::_1;
// <viscosity*grad(u_i), grad(v_i)>
for (std::size_t i = 0; i < DOW; ++i) {
......
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <iostream>
#include <ctime>
#include <cmath>
......@@ -24,8 +28,8 @@ int main(int argc, char** argv)
Parameters::get("stokes->viscosity", viscosity);
// tree-paths for components
auto _v = 0_c;
auto _p = 1_c;
auto _v = Dune::Indices::_0;
auto _p = Dune::Indices::_1;
auto opStokes = makeOperator(tag::stokes{}, viscosity);
prob.addMatrixOperator(opStokes, treepath(), treepath());
......
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <iostream>
#include <amdis/AMDiS.hpp>
......
......@@ -10,7 +10,6 @@
#include <amdis/LinearAlgebra.hpp>
#include <amdis/LocalAssemblerList.hpp>
#include <amdis/common/Mpl.hpp>
#include <amdis/common/TypeDefs.hpp>
namespace AMDiS
{
......
......@@ -24,8 +24,8 @@ void Assembler<Traits>::assemble(
// 2. create a local matrix and vector
std::size_t localSize = localView.maxSize();
Impl::ElementMatrix elementMatrix(localSize, localSize);
Impl::ElementVector elementVector(localSize);
mtl::mat::dense2D<typename SystemMatrixType::value_type> elementMatrix(localSize, localSize);
mtl::vec::dense_vector<typename SystemVectorType::value_type> elementVector(localSize);
// 3. traverse grid and assemble operators on the elements
for (auto const& element : elements(globalBasis_.gridView()))
......
......@@ -11,12 +11,14 @@
#include <amdis/Output.hpp>
#include <amdis/common/Concepts.hpp>
#include <amdis/common/ValueCategory.hpp>
#include <amdis/linear_algebra/mtl/MTLDenseVector.hpp>
#include <amdis/linear_algebra/HierarchicWrapper.hpp>
#include <amdis/utility/RangeType.hpp>
#include <amdis/utility/TreeData.hpp>
namespace AMDiS
{
struct BoundaryType { int b; };
/// Implements a boundary condition of Dirichlet-type.
/**
* By calling the methods \ref init() and \ref finish before and after
......@@ -82,13 +84,13 @@ namespace AMDiS
using Dune::Functions::interpolate;
Dune::Hybrid::ifElse(std::is_same<RangeType_t<typename RowBasis::LocalView::Tree>, Range>{},
[&](auto id) {
auto rhsWrapper = wrapper(rhs.vector());
auto rhsWrapper = hierarchicVectorWrapper(rhs.vector());
interpolate(id(rowBasis), rhsWrapper, values_, dirichletNodes_);
});
Dune::Hybrid::ifElse(std::is_same<RangeType_t<typename ColBasis::LocalView::Tree>, Range>{},
[&](auto id) {
auto solutionWrapper = wrapper(solution.vector());
auto solutionWrapper = hierarchicVectorWrapper(solution.vector());
interpolate(id(colBasis), solutionWrapper, values_, dirichletNodes_);
});
......
......@@ -3,9 +3,6 @@
#include <dune/functions/functionspacebases/boundarydofs.hh>
#include <dune/functions/functionspacebases/interpolate.hh>
#include <dune/functions/functionspacebases/subspacebasis.hh>
#include <amdis/LinearAlgebra.hpp>
#include <amdis/linear_algebra/HierarchicWrapper.hpp>
#include <amdis/linear_algebra/mtl/MTLDenseVector.hpp>
namespace AMDiS
{
......
......@@ -2,30 +2,7 @@
#include <amdis/linear_algebra/LinearSolverInterface.hpp>
#include <amdis/linear_algebra/SolverInfo.hpp>
#if defined(AMDIS_BACKEND_ISTL)
#include <amdis/linear_algebra/istl/SystemVector.hpp>
#include <amdis/linear_algebra/istl/SystemMatrix.hpp>
#include <amdis/linear_algebra/istl/LinearSolver.hpp>
#elif defined(AMDIS_BACKEND_MTL)
#include <amdis/linear_algebra/mtl/SystemVector.hpp>
#include <amdis/linear_algebra/mtl/SystemMatrix.hpp>
#include <amdis/linear_algebra/mtl/DOFVector.hpp>
#include <amdis/linear_algebra/mtl/DOFMatrix.hpp>
#include <amdis/linear_algebra/mtl/LinearSolver.hpp>
#include <amdis/linear_algebra/mtl/ITL_Solver.hpp>
#include <amdis/linear_algebra/mtl/BITL_Solver.hpp>
#elif defined(AMDIS_BACKEND_PETSC)
#include <amdis/linear_algebra/petsc/SystemVector.hpp>
#include <amdis/linear_algebra/petsc/SystemMatrix.hpp>
#include <amdis/linear_algebra/petsc/LinearSolver.hpp>
#else
#error "Unknown linear algebra backend!. Set corresponding variable \
AMDIS_BACKEND_ISTL, AMDIS_BACKEND_MTL or AMDIS_BACKEND_PETSC."
#endif
\ No newline at end of file
......@@ -2,9 +2,9 @@
#include <type_traits>
#include <boost/numeric/mtl/mtl.hpp>
#include <amdis/ContextGeometry.hpp>
// #include <amdis/common/ConceptsBase.hpp>
#include <amdis/common/TypeDefs.hpp>
namespace AMDiS
{
......@@ -22,10 +22,13 @@ namespace AMDiS
static_assert( numNodes == 1 || numNodes == 2,
"VectorAssembler gets 1 Node, MatrixAssembler gets 2 Nodes!");
using ElementMatrix = mtl::mat::dense2D<double>; // TODO: choose correct value_type
using ElementVector = mtl::vec::dense_vector<double>;
/// Either an ElementVector or an ElementMatrix (depending on the number of nodes)
using ElementMatrixVector = std::conditional_t<
(sizeof...(Nodes)==1), Impl::ElementVector, std::conditional_t<
(sizeof...(Nodes)==2), Impl::ElementMatrix, void>>;
(sizeof...(Nodes)==1), ElementVector, std::conditional_t<
(sizeof...(Nodes)==2), ElementMatrix, void>>;
public:
/// Virtual destructor
......
......@@ -27,7 +27,6 @@
#include <amdis/StandardProblemIteration.hpp>
#include <amdis/common/TupleUtility.hpp>
#include <amdis/common/TypeDefs.hpp>
#include <amdis/common/Utility.hpp>
#include <amdis/GridFunctions.hpp>
......
......@@ -19,7 +19,6 @@ install(FILES
Size.hpp
Tags.hpp
TupleUtility.hpp
TypeDefs.hpp
Utility.hpp
ValueCategory.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/amdis/common)
#pragma once
#include <type_traits>
#include <amdis/linear_algebra/Mtl.hpp>
namespace AMDiS
{
namespace Impl
{
using ElementVector = mtl::dense_vector<double>;
using ElementMatrix = mtl::dense2D<double>;
using SystemVector = mtl::dense_vector<double>;
using SystemMatrix = mtl::compressed2D<double>;
} // end namespace Impl
struct BoundaryType { int b; };
} // end namespace AMDiS
......@@ -2,9 +2,7 @@
install(FILES
HierarchicWrapper.hpp
LinearAlgebraBase.hpp
LinearSolverInterface.hpp
Mtl.hpp
PreconditionerInterface.hpp
RunnerInterface.hpp
SolverInfo.hpp
......
......@@ -2,11 +2,11 @@
namespace AMDiS
{
class DOFVectorBase
class DOFVectorInterface
{
public:
/// Virtual destructor
~DOFVectorBase() = default;
~DOFVectorInterface() = default;
/// Change dimension of DOFVector to dimension of basis
virtual void compress() = 0;
......
#pragma once
#include <boost/numeric/mtl/mtl_fwd.hpp>
#include <dune/functions/functionspacebases/sizeinfo.hh>
#include <amdis/utility/MultiIndex.hpp>
......@@ -86,7 +87,7 @@ namespace AMDiS
}
template <class... Params>
std::size_t sizeImpl(mtl::dense_vector<Params...> const& v) const
std::size_t sizeImpl(mtl::vec::dense_vector<Params...> const& v) const
{
return mtl::size(v);
}
......
#pragma once
namespace AMDiS
{
namespace Impl
{
// Type-Trait needs to be specialized by linear algebra libraries
template <class Vector>
struct BaseVector { using type = Vector; };
template <class Matrix>
struct BaseMatrix { using type = Matrix; };
}
template <class Vector>
using BaseVector_t = typename Impl::BaseVector<Vector>::type;
template <class Matrix>
using BaseMatrix_t = typename Impl::BaseMatrix<Matrix>::type;
template <class T>
struct Triplet
{
std::size_t row;
std::size_t col;
T value;
};
namespace Impl
{
template <class Vector>
class BaseWrapper
{
public:
using value_type = typename Vector::value_type;
using size_type = typename Vector::size_type;
explicit BaseWrapper(Vector& vec) : vec(vec) {}
void resize(size_type s)
{
vec.resize(s);
}
size_type size() const
{
return vec.size();
}
value_type& operator[](size_type i) { return vec[i]; }
value_type const& operator[](size_type i) const { return vec[i]; }
protected:
Vector& vec;
};
} // end namespace Impl
template <class Vector>
Impl::BaseWrapper<std::remove_reference_t<Vector>> wrapper(Vector&& vec)
{
return {std::forward<Vector>(vec)};
}
} // end namespace AMDiS
......@@ -12,7 +12,6 @@
*/
#include <amdis/common/Utility.hpp>
#include <amdis/linear_algebra/LinearAlgebraBase.hpp>
#include <amdis/linear_algebra/PreconditionerInterface.hpp>
#include <amdis/linear_algebra/RunnerInterface.hpp>
......@@ -25,12 +24,11 @@ namespace AMDiS
class LinearSolverInterface
{
protected:
using RunnerBase = RunnerInterface<Matrix, BaseVector_t<VectorX>,
BaseVector_t<VectorB>>;
using RunnerBase = RunnerInterface<Matrix, VectorX, VectorB>;
public:
/// Destructor.
virtual ~LinearSolverInterface() {}
virtual ~LinearSolverInterface() = default;
/// Public method to call in order to solve a linear system Ax = b.
/**
......
#pragma once
#include <dune/common/ftraits.hh>
#include <boost/numeric/mtl/matrix/compressed2D.hpp>
#include <boost/numeric/mtl/matrix/dense2D.hpp>
#include <boost/numeric/mtl/vector/dense_vector.hpp>
namespace Dune
{
template <class Elt, class Parameters>
struct FieldTraits<mtl::compressed2D<Elt,Parameters>>
{
using field_type = typename FieldTraits<Elt>::field_type;
using real_type = typename FieldTraits<Elt>::real_type;
};
template <class Value, class Parameters>
struct FieldTraits<mtl::dense2D<Value,Parameters>>
{
using field_type = typename FieldTraits<Value>::field_type;
using real_type = typename FieldTraits<Value>::real_type;
};
template <class Value, class Parameters>
struct FieldTraits<mtl::dense_vector<Value,Parameters>>
{
using field_type = typename FieldTraits<Value>::field_type;
using real_type = typename FieldTraits<Value>::real_type;
};
} // end namespace Dune
......@@ -7,7 +7,7 @@ namespace AMDiS
struct PreconditionerInterface
{
/// Virtual destructor.
virtual ~PreconditionerInterface() {}
virtual ~PreconditionerInterface() = default;
/// Is called a the beginning of a solution procedure
virtual void init(Matrix const& fullMatrix) = 0;
......
......@@ -14,7 +14,7 @@ namespace AMDiS
public:
/// virtual destructor
virtual ~RunnerInterface() {}
virtual ~RunnerInterface() = default;
/// Is called at the beginning of a solution procedure
virtual void init(Matrix const& A) = 0;
......
#pragma once
#include "itl/block_diagonal.hpp"
#include <amdis/CreatorMap.hpp>
#include <amdis/linear_algebra/mtl/ITL_Preconditioner.hpp>
namespace AMDiS
{
template <class SubMatrix, std::size_t _N, std::size_t _M, class Vector>
class DefaultCreators<PreconditionerInterface<BlockMTLMatrix<SubMatrix, _N, _M>, Vector>>
{
using Matrix = BlockMTLMatrix<SubMatrix, _N, _M>;
using PreconBase = PreconditionerInterface<Matrix, Vector>;
template <template<class> class ITLPrecon>
using PreconCreator
= typename Preconditioner<Matrix, Vector, ITLPrecon<Matrix>>::Creator;
using Map = CreatorMap<PreconBase>;
public:
static void init()
{
auto pc_diag = new PreconCreator<DiagonalPreconditioner>;
Map::addCreator("diag", pc_diag);
Map::addCreator("jacobi", pc_diag);
auto pc_id = new PreconCreator<IdentityPreconditioner>;
Map::addCreator("identity", pc_id);
Map::addCreator("no", pc_id);
Map::addCreator("default", pc_id);
}
};
} // end namespace AMDiS
#pragma once
#include <amdis/CreatorMap.hpp>
#include <amdis/linear_algebra/mtl/ITL_Solver.hpp>
namespace AMDiS
{
/// Adds default creators for linear solvers based on `BlockMTLMatrix`.
/**
* Adds creators for block matrix aware solvers.
* - *cg*: conjugate gradient method, \see cg_solver_type
* - *cgs*: stabilized conjugate gradient mtheod, \see cgs_solver_type
* - *bcgs*: stabilized bi-conjugate gradient method, \see bicgstab_type
* - *tfqmr*: Transposed-Free Quasi-Minimal Residual method, \see tfqmr_solver_type
* - *bcgsl*: stabilized BiCG(ell) method, \see bicgstab_ell_type
* - *gmres*: Generalized minimal residula method, \see gmres_type
* - *fgmres*: Flexible GMRES, \see fgmres_type
* - *minres*: Minimal residul method, \see minres_solver_type
* - *gcr*: Generalized conjugate residual method, \see gcr_type
* - *umfpack*: external UMFPACK solver, \see UmfpackRunner
**/
template <class SubMatrix, std::size_t _N, std::size_t _M, class Vector>
class DefaultCreators<LinearSolverInterface<BlockMTLMatrix<SubMatrix, _N, _M>, Vector, Vector>>
{
using Matrix = BlockMTLMatrix<SubMatrix, _N, _M>;
using SolverBase = LinearSolverInterface<Matrix, Vector, Vector>;
template <class ITLSolver>
using SolverCreator
= typename LinearSolver<Matrix, Vector,
KrylovRunner<ITLSolver, Matrix, BaseVector_t<Vector>>>::Creator;
#ifdef HAVE_UMFPACK
using UmfpackSolverCreator
= typename LinearSolver<Matrix, Vector,
UmfpackRunner<Matrix, BaseVector_t<Vector>>>::Creator;
#endif
using Map = CreatorMap<SolverBase>;
public:
static void init()
{
auto cg = new SolverCreator<cg_solver_type>;
Map::addCreator("cg", cg);
auto cgs = new SolverCreator<cgs_solver_type>;
Map::addCreator("cgs", cgs);
auto bcgs = new SolverCreator<bicgstab_type>;
Map::addCreator("bicgstab", bcgs);
Map::addCreator("bcgs", bcgs);
auto tfqmr = new SolverCreator<tfqmr_solver_type>;
Map::addCreator("tfqmr", tfqmr);
auto bcgsl = new SolverCreator<bicgstab_ell_type>;
Map::addCreator("bicgstab_ell", bcgsl);
Map::addCreator("bcgsl", bcgsl);
auto gmres = new SolverCreator<gmres_type>;
Map::addCreator("gmres", gmres);
auto fgmres = new SolverCreator<fgmres_type>;
Map::addCreator("fgmres", fgmres);
auto minres = new SolverCreator<minres_solver_type>;
Map::addCreator("minres", minres);
auto gcr = new SolverCreator<gcr_type>;
Map::addCreator("gcr", gcr);
#ifdef HAVE_UMFPACK
auto umfpack = new UmfpackSolverCreator;
Map::addCreator("umfpack", umfpack);
Map::addCreator("direct", umfpack);