diff --git a/dune-amdis.pc.in b/dune-amdis.pc.in index 03b2511183256c5e3590b1d13ce0771a9ee8f9a0..e3186b50e9df3066a9f23117efc1a512fb586d08 100644 --- a/dune-amdis.pc.in +++ b/dune-amdis.pc.in @@ -8,8 +8,9 @@ DEPENDENCIES=@REQUIRES@ Name: @PACKAGE_NAME@ Version: @VERSION@ -Description: amdis module -URL: http://www.github.com/spraetor +Description: AMDiS dune-module +URL: https://gitlab.math.tu-dresden.de/spraetor/dune-amdis Requires: dune-common dune-geometry dune-localfunctions dune-istl dune-typetree dune-grid dune-functions +Suggests: dune-uggrid dune-alugrid Libs: -L${libdir} Cflags: -I${includedir} diff --git a/dune.module b/dune.module index e4830a8472bb5b374c4194308ca00f9532298eee..dae9337d4ed1ea698559bd0ea485b196e99219cc 100644 --- a/dune.module +++ b/dune.module @@ -8,3 +8,4 @@ Version: 0.1 Maintainer: simon.praetorius@tu-dresden.de #depending on Depends: dune-common dune-geometry dune-localfunctions dune-istl dune-typetree dune-grid dune-functions +Suggests: dune-uggrid dune-alugrid diff --git a/dune/amdis/Operator.inc.hpp b/dune/amdis/Operator.inc.hpp index 392e8747857bd94de77733934c51ad8cdbc8bfca..15c524b27af78e74a7e752324b7beea60d1b4243 100644 --- a/dune/amdis/Operator.inc.hpp +++ b/dune/amdis/Operator.inc.hpp @@ -82,8 +82,8 @@ namespace AMDiS template <class MeshView> template <class RowView, class ColView> bool Operator<MeshView>::getElementMatrix(RowView const& rowView, - ColView const& colView, - ElementMatrix& elementMatrix, + ColView const& colView, + ElementMatrix& elementMatrix, double* factor) { AMDIS_FUNCNAME("Operator::getElementMatrix()"); @@ -132,7 +132,7 @@ namespace AMDiS template <class MeshView> template <class RowView> bool Operator<MeshView>::getElementVector(RowView const& rowView, - ElementVector& elementVector, + ElementVector& elementVector, double* factor) { AMDIS_FUNCNAME("Operator::getElementVector()"); @@ -175,8 +175,8 @@ namespace AMDiS template <class MeshView> template <class RowView, class ColView> void Operator<MeshView>::assembleZeroOrderTerms(RowView const& rowView, - ColView const& colView, - ElementMatrix& elementMatrix) + ColView const& colView, + ElementMatrix& elementMatrix) { AMDIS_FUNCNAME("Operator::assembleZeroOrderTerms(elementMatrix)"); @@ -196,7 +196,7 @@ namespace AMDiS for (size_t iq = 0; iq < quad.size(); ++iq) { // Position of the current quadrature point in the reference element - const Dune::FieldVector<double,dim>& quadPos = quad[iq].position(); + Dune::FieldVector<double,dim> const& quadPos = quad[iq].position(); // The multiplicative factor in the integral transformation formula const double factor = geometry.integrationElement(quadPos) * quad[iq].weight(); @@ -226,7 +226,7 @@ namespace AMDiS template <class MeshView> template <class RowView> void Operator<MeshView>::assembleZeroOrderTerms(RowView const& rowView, - ElementVector& elementvector) + ElementVector& elementvector) { AMDIS_FUNCNAME("Operator::assembleZeroOrderTerms(elementvector)"); @@ -241,9 +241,7 @@ namespace AMDiS auto const& quad = Dune::QuadratureRules<double, dim>::rule(element.type(), order); for (auto* operatorTerm : zeroOrder) - operatorTerm->init(element, quad); - - + operatorTerm->init(element, quad); for (size_t iq = 0; iq < quad.size(); ++iq) { // Position of the current quadrature point in the reference element @@ -267,8 +265,8 @@ namespace AMDiS template <class MeshView> template <class RowView, class ColView> void Operator<MeshView>::assembleFirstOrderTermsGrdPhi(RowView const& rowView, - ColView const& colView, - ElementMatrix& elementMatrix) + ColView const& colView, + ElementMatrix& elementMatrix) { AMDIS_FUNCNAME("Operator::assembleFirstOrderTermsGrdPhi(elementMatrix)"); @@ -286,8 +284,6 @@ namespace AMDiS for (auto* operatorTerm : firstOrderGrdPhi) operatorTerm->init(element, quad); - - for (size_t iq = 0; iq < quad.size(); ++iq) { // Position of the current quadrature point in the reference element const Dune::FieldVector<double,dim>& quadPos = quad[iq].position(); @@ -327,8 +323,8 @@ namespace AMDiS template <class MeshView> template <class RowView, class ColView> void Operator<MeshView>::assembleFirstOrderTermsGrdPsi(RowView const& rowView, - ColView const& colView, - ElementMatrix& elementMatrix) + ColView const& colView, + ElementMatrix& elementMatrix) { AMDIS_FUNCNAME("Operator::assembleFirstOrderTermsGrdPsi(elementMatrix)"); @@ -435,8 +431,8 @@ namespace AMDiS template <class MeshView> template <class RowView, class ColView> void Operator<MeshView>::assembleSecondOrderTerms(RowView const& rowView, - ColView const& colView, - ElementMatrix& elementMatrix) + ColView const& colView, + ElementMatrix& elementMatrix) { AMDIS_FUNCNAME("Operator::assembleSecondOrderTerms(elementMatrix)"); @@ -517,7 +513,7 @@ namespace AMDiS template <class MeshView> template <class Term> Operator<MeshView>& Operator<MeshView>::addFOTImpl(Term const& term, - std::size_t i, + size_t i, FirstOrderType firstOrderType) { using OpTerm = GenericOperatorTerm<MeshView, Term, VectorComponent>; @@ -542,7 +538,7 @@ namespace AMDiS template <class MeshView> template <class Term> Operator<MeshView>& Operator<MeshView>::addSOTImpl(Term const& term, - std::size_t i, std::size_t j) + size_t i, size_t j) { using OpTerm = GenericOperatorTerm<MeshView, Term, MatrixComponent>; secondOrder.push_back(new OpTerm(term, {i,j})); diff --git a/dune/amdis/OperatorTermBase.hpp b/dune/amdis/OperatorTermBase.hpp index 5a3775db08db611cd41f2a2ed1d20ffb40861b9e..1250f4d9c116aee089b8580ff9b0ee2894d32f7e 100644 --- a/dune/amdis/OperatorTermBase.hpp +++ b/dune/amdis/OperatorTermBase.hpp @@ -30,8 +30,7 @@ namespace AMDiS using PointList = std::vector<Dune::QuadraturePoint<double, dim>>; public: - virtual void init(Element const& element, - PointList const& points) = 0; + virtual void init(Element const& element, PointList const& points) = 0; virtual double evalZot(size_t iq, Dune::FieldVector<double,1> const& test, @@ -58,7 +57,7 @@ namespace AMDiS template <class MeshView, class Term, class Traits = tag::none> class GenericOperatorTerm : public OperatorTerm<MeshView> - , public OperatorEvaluation + , public OperatorEvaluation // NOTE: better: use static functions { using Super = OperatorTerm<MeshView>; using Element = typename Super::Element; @@ -73,8 +72,7 @@ namespace AMDiS , traits(traits) {} - virtual void init(Element const& element, - PointList const& points) override + virtual void init(Element const& element, PointList const& points) override { term.init(element, points); @@ -122,9 +120,9 @@ namespace AMDiS Traits traits; 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>; - std::vector<value_type> values; + std::vector<value_type> values; // NOTE: maybe caching is not necessary here, since cached already in the term }; } // end namespace AMDiS diff --git a/dune/amdis/ProblemInstat.hpp b/dune/amdis/ProblemInstat.hpp index 78a947c7c914089f25cbc05df21d626b832d0d54..13950acc7d45061f060096b6b89dd4a45aab63e9 100644 --- a/dune/amdis/ProblemInstat.hpp +++ b/dune/amdis/ProblemInstat.hpp @@ -8,7 +8,7 @@ namespace AMDiS { // forward declarations class AdaptInfo; - + /** * \ingroup Problem * @@ -21,22 +21,19 @@ namespace AMDiS { using Self = ProblemInstat; using ProblemType = ProblemStat<Traits>; - + using SystemVectorType = typename ProblemType::SystemVectorType; - + public: /// Constructs a ProblemInstat with prob as its stationary problem. - ProblemInstat(std::string name, - ProblemType& prob) - : ProblemInstatBase(name, NULL), - problemStat(prob) + ProblemInstat(std::string name, ProblemType& prob) + : ProblemInstatBase(name, nullptr) + , problemStat(prob) {} - ProblemInstat(std::string name, - ProblemType& prob, - ProblemStatBase& initialProb) - : ProblemInstatBase(name, &initialProb), - problemStat(prob) + ProblemInstat(std::string name, ProblemType& prob, ProblemStatBase& initialProb) + : ProblemInstatBase(name, &initialProb) + , problemStat(prob) {} /// Initialisation of the problem. @@ -60,10 +57,10 @@ namespace AMDiS /// Returns \ref oldSolution. decltype(auto) getOldSolution() { return *oldSolution; } decltype(auto) getOldSolution() const { return *oldSolution; } - + /// Returns the I'th component of \ref oldSolution. template <size_t I = 0> - decltype(auto) getOldSolution(const index_<I> _i = index_<I>()) + decltype(auto) getOldSolution(const index_<I> _i = {}) { return (*oldSolution)[_i]; } @@ -76,14 +73,14 @@ namespace AMDiS ProblemType& problemStat; /// Solution of the last timestep. - shared_ptr<SystemVectorType> oldSolution; + std::shared_ptr<SystemVectorType> oldSolution; }; - + #ifndef AMDIS_NO_EXTERN_PROBLEMINSTAT extern template class ProblemInstat<ProblemStatTraits<2>>; #endif - + } // end namespace AMDiS #include "ProblemInstat.inc.hpp" diff --git a/dune/amdis/ProblemInstat.inc.hpp b/dune/amdis/ProblemInstat.inc.hpp index 40296119539025719789761fbfed5d542e508b3a..2055406ead8d1437b182048d36777ed5f015bd82 100644 --- a/dune/amdis/ProblemInstat.inc.hpp +++ b/dune/amdis/ProblemInstat.inc.hpp @@ -7,6 +7,8 @@ namespace AMDiS template <class Traits> void ProblemInstat<Traits>::transferInitialSolution(AdaptInfo& adaptInfo) { + AMDIS_FUNCNAME("ProblemInstat::transferInitialSolution()"); + test_exit(adaptInfo.getTime() == adaptInfo.getStartTime(), "after initial solution: time != start time"); problemStat.writeFiles(adaptInfo, true); @@ -24,8 +26,6 @@ namespace AMDiS template <class Traits> void ProblemInstat<Traits>::initialize(Flag initFlag) { - AMDIS_FUNCNAME("ProblemInstat::initialize()"); - // === create vector for old solution === if (initFlag.isSet(INIT_UH_OLD)) createUhOld(); @@ -35,6 +35,8 @@ namespace AMDiS template <class Traits> void ProblemInstat<Traits>::createUhOld() { + AMDIS_FUNCNAME("ProblemInstat::createUhOld()"); + if (oldSolution) { warning("oldSolution already created\n"); } @@ -43,7 +45,7 @@ namespace AMDiS // create oldSolution std::vector<std::string> componentNames(size, name + "_uOld"); - oldSolution = make_shared<SystemVectorType>(*problemStat.getFeSpaces(), componentNames); + oldSolution = std::make_shared<SystemVectorType>(*problemStat.getFeSpaces(), componentNames); } } diff --git a/dune/amdis/ProblemInstatBase.hpp b/dune/amdis/ProblemInstatBase.hpp index fe1e9dc30a4457e63ebbe6654da3258634e938af..b3d5ce90e6a1a0aa0fe2755768006495e09504b8 100644 --- a/dune/amdis/ProblemInstatBase.hpp +++ b/dune/amdis/ProblemInstatBase.hpp @@ -7,15 +7,16 @@ namespace AMDiS { // forward declarations class AdaptInfo; - + /** * \ingroup Problem * * \brief * Base class for \ref ProblemInstat. */ - class ProblemInstatBase : public ProblemTimeInterface, - public ProblemStatBase // NOTE: Why is this derived from ProblemStatBase + class ProblemInstatBase + : public ProblemTimeInterface + , public ProblemStatBase // NOTE: Why is this derived from ProblemStatBase { public: /// Constructor. diff --git a/dune/amdis/ProblemStat.hpp b/dune/amdis/ProblemStat.hpp index 5c722ac4c2a9626c45e4d66e3d01b180f9c0ac25..3914707c147379edf1c5d257d6c15e2a396b7087 100644 --- a/dune/amdis/ProblemStat.hpp +++ b/dune/amdis/ProblemStat.hpp @@ -35,7 +35,8 @@ namespace AMDiS { template <class Traits> - class ProblemStatSeq : public ProblemStatBase + class ProblemStatSeq + : public ProblemStatBase { using Self = ProblemStatSeq; @@ -98,26 +99,26 @@ namespace AMDiS * MESH[0]->global refinements: nr of initial global refinements **/ void initialize(Flag initFlag, - Self* adoptProblem = NULL, - Flag adoptFlag = INIT_NOTHING); + Self* adoptProblem = NULL, + Flag adoptFlag = INIT_NOTHING); /// Adds an operator to \ref A. /** @{ */ void addMatrixOperator(OperatorType& op, - int i, int j, + int i, int j, double* factor = NULL, double* estFactor = NULL); - void addMatrixOperator(shared_ptr<OperatorType> op, + void addMatrixOperator(std::shared_ptr<OperatorType> op, int i, int j, double* factor = NULL, double* estFactor = NULL); void addMatrixOperator(std::map< std::pair<int,int>, - shared_ptr<OperatorType> > ops); + std::shared_ptr<OperatorType> > ops); void addMatrixOperator(std::map< std::pair<int,int>, - std::pair<shared_ptr<OperatorType>, bool> > ops); + std::pair<std::shared_ptr<OperatorType>, bool> > ops); /** @} */ @@ -128,40 +129,39 @@ namespace AMDiS double* factor = NULL, double* estFactor = NULL); - void addVectorOperator(shared_ptr<OperatorType> op, + void addVectorOperator(std::shared_ptr<OperatorType> op, int i, double* factor = NULL, double* estFactor = NULL); - void addVectorOperator(std::map< int, - shared_ptr<OperatorType> > ops); - void addVectorOperator(std::map< int, - std::pair<shared_ptr<OperatorType>, bool> > ops); + void addVectorOperator(std::map< int, std::shared_ptr<OperatorType> > ops); + void addVectorOperator(std::map< int, std::pair<std::shared_ptr<OperatorType>, bool> > ops); /** @} */ /// Adds a Dirichlet boundary condition template <class Predicate, class Values> void addDirichletBC(Predicate const& predicate, - int row, int col, - Values const& values); + int row, int col, + Values const& values); /// Implementation of \ref ProblemStatBase::solve virtual void solve(AdaptInfo& adaptInfo, - bool createMatrixData = true, - bool storeMatrixData = false) override; + bool createMatrixData = true, + bool storeMatrixData = false) override; /// Implementation of \ref ProblemStatBase::buildAfterCoarse virtual void buildAfterCoarsen(AdaptInfo& adaptInfo, - Flag flag, - bool asmMatrix = true, - bool asmVector = true) override; + Flag flag, + bool asmMatrix = true, + bool asmVector = true) override; /// Writes output files. void writeFiles(AdaptInfo& adaptInfo, bool force = false); + public: // get-methods /// Returns nr of components \ref nComponents @@ -196,9 +196,9 @@ namespace AMDiS /// Return the \ref linearSolver auto getSolver() { return linearSolver; } - void setSolver(std::shared_ptr<LinearSolverType> const& solver_) + void setSolver(std::shared_ptr<LinearSolverType> const& solver) { - linearSolver = solver_; + linearSolver = solver; } /// Return the \ref mesh @@ -207,7 +207,7 @@ namespace AMDiS void setMesh(std::shared_ptr<Mesh> const& mesh_) { mesh = mesh_; - meshView = make_shared<MeshView>(mesh->leafGridView()); + meshView = std::make_shared<MeshView>(mesh->leafGridView()); createFeSpaces(); createMatricesAndVectors(); @@ -251,7 +251,7 @@ namespace AMDiS "No mesh name specified for '", name, "->mesh'!"); mesh = MeshCreator<Mesh>::create(meshName); - meshView = make_shared<MeshView>(mesh->leafGridView()); + meshView = std::make_shared<MeshView>(mesh->leafGridView()); msg("Create mesh:"); msg("#elements = " , mesh->size(0)); @@ -262,16 +262,16 @@ namespace AMDiS void createFeSpaces() { - feSpaces = make_shared<FeSpaces>(constructTuple<FeSpaces>(*meshView)); + feSpaces = std::make_shared<FeSpaces>(constructTuple<FeSpaces>(*meshView)); } void createMatricesAndVectors() { - systemMatrix = make_shared<SystemMatrixType>(*feSpaces); - solution = make_shared<SystemVectorType>(*feSpaces, componentNames); + systemMatrix = std::make_shared<SystemMatrixType>(*feSpaces); + solution = std::make_shared<SystemVectorType>(*feSpaces, componentNames); auto rhsNames = std::vector<std::string>(nComponents, "rhs"); - rhs = make_shared<SystemVectorType>(*feSpaces, rhsNames); + rhs = std::make_shared<SystemVectorType>(*feSpaces, rhsNames); } void createSolver() @@ -287,11 +287,10 @@ namespace AMDiS void createFileWriter() { - filewriter = make_shared<FileWriter<Traits>>(name + "->output", - *meshView, - componentNames); + filewriter = std::make_shared<FileWriter<Traits>>(name + "->output", *meshView, componentNames); } + protected: // sub-methods to assemble DOFMatrix template <class LhsData, class RhsData, class Elements> @@ -299,37 +298,28 @@ namespace AMDiS template <class RowView, class ColView> bool getElementMatrix(RowView const& rowView, - ColView const& colView, - ElementMatrix& elementMatrix, - std::list<shared_ptr<OperatorType>>& operators, + ColView const& colView, + ElementMatrix& elementMatrix, + std::list<std::shared_ptr<OperatorType>>& operators, std::list<double*> const& factors); template <class RowView> bool getElementVector(RowView const& rowView, - ElementVector& elementVector, - std::list<shared_ptr<OperatorType>>& operators, + ElementVector& elementVector, + std::list<std::shared_ptr<OperatorType>>& operators, std::list<double*> const& factors); template <class Matrix, class RowIndexSet, class ColIndexSet> void addElementMatrix(Matrix& matrix, - RowIndexSet const& rowIndexSet, - ColIndexSet const& colIndexSet, - ElementMatrix const& elementMatrix); + RowIndexSet const& rowIndexSet, + ColIndexSet const& colIndexSet, + ElementMatrix const& elementMatrix); template <class Vector, class IndexSet> void addElementVector(Vector& vector, - IndexSet const& indexSet, - ElementVector const& elementvector); - - private: // some internal methods - - template <size_t I = 0> - typename FeSpace<I>::NodeFactory& - getNodeFactory(const index_<I> = index_<I>()) - { - return const_cast<typename FeSpace<I>::NodeFactory&>(std::get<I>(*feSpaces).nodeFactory()); - } + IndexSet const& indexSet, + ElementVector const& elementvector); private: @@ -341,35 +331,35 @@ namespace AMDiS std::vector<std::string> componentNames; /// Mesh of this problem. - shared_ptr<Mesh> mesh; // TODO: generalize to multi-mesh problems + std::shared_ptr<Mesh> mesh; // TODO: generalize to multi-mesh problems /// Name of the mesh std::string meshName; /// A gridView object - shared_ptr<MeshView> meshView; + std::shared_ptr<MeshView> meshView; /// Pointer to the meshes for the different problem components std::vector<Mesh*> componentMeshes; /// FE spaces of this problem. - shared_ptr<FeSpaces> feSpaces; // eventuell const + std::shared_ptr<FeSpaces> feSpaces; // eventuell const /// A FileWriter object - shared_ptr<FileWriter<Traits>> filewriter; + std::shared_ptr<FileWriter<Traits>> filewriter; /// An object of the linearSolver Interface - shared_ptr<LinearSolverType> linearSolver; + std::shared_ptr<LinearSolverType> linearSolver; /// A block-matrix that is filled during assembling - shared_ptr<SystemMatrixType> systemMatrix; + std::shared_ptr<SystemMatrixType> systemMatrix; /// A block-vector with the solution components - shared_ptr<SystemVectorType> solution; + std::shared_ptr<SystemVectorType> solution; /// A block-vector (load-vector) corresponding to the right.hand side /// of the equation, filled during assembling - shared_ptr<SystemVectorType> rhs; + std::shared_ptr<SystemVectorType> rhs; template <class T> @@ -381,48 +371,47 @@ namespace AMDiS /// A map (i,j) -> list<DirichleBC> string a boundary conditions for /// each matrix block - MatrixEntries<shared_ptr<DirichletBC<WorldVector>>> dirichletBc; + MatrixEntries<std::shared_ptr<DirichletBC<WorldVector>>> dirichletBc; /// A map (i,j) -> list<OperatorType> string the differential operators for /// each matrix block - MatrixEntries<shared_ptr<OperatorType>> matrixOperators; + MatrixEntries<std::shared_ptr<OperatorType>> matrixOperators; MatrixEntries<double*> matrixFactors; std::map< std::pair<int,int>, bool > matrixAssembled; // if false, do reassemble std::map< std::pair<int,int>, bool > matrixChanging; // if true, or vectorAssembled false, do reassemble /// A map (i) -> list<OperatorType> string the differential operators for /// each rhs block - VectorEntries<shared_ptr<OperatorType>> vectorOperators; + VectorEntries<std::shared_ptr<OperatorType>> vectorOperators; VectorEntries<double*> vectorFactors; std::map< int, bool > vectorAssembled; // if false, do reassemble std::map< int, bool > vectorChanging; // if true, or vectorAssembled false, do reassemble - template <int r, int c> + template <int R, int C> struct MatrixData { using DOFMatrixType = - std::tuple_element_t<c, std::tuple_element_t<r, typename SystemMatrixType::DOFMatrices>>; + std::tuple_element_t<C, std::tuple_element_t<R, typename SystemMatrixType::DOFMatrices>>; DOFMatrixType& matrix; - std::list<shared_ptr<OperatorType>>& operators; + std::list<std::shared_ptr<OperatorType>>& operators; std::list<double*> const& factors; bool assemble; - std::pair<int,int> row_col = {r, c}; + std::pair<int,int> row_col = {R, C}; }; - template <int r> + template <int I> struct VectorData { - using DOFVectorType = - std::tuple_element_t<r, typename SystemVectorType::DOFVectors>; + using DOFVectorType = std::tuple_element_t<I, typename SystemVectorType::DOFVectors>; DOFVectorType& vector; - std::list<shared_ptr<OperatorType>>& operators; + std::list<std::shared_ptr<OperatorType>>& operators; std::list<double*> const& factors; bool assemble; - int row = r; + int row = I; }; }; @@ -437,8 +426,9 @@ namespace AMDiS namespace Impl { template <class ProblemStatType> - struct ProblemStat : public ProblemStatType, - public StandardProblemIteration + struct ProblemStat + : public ProblemStatType + , public StandardProblemIteration { using ProblemStatType::getName; diff --git a/dune/amdis/ProblemStat.inc.hpp b/dune/amdis/ProblemStat.inc.hpp index 23c5b6a440f5a2070cabb233815a7d31478c72ee..43342b9f730315407c956048b335a0d22be143f0 100644 --- a/dune/amdis/ProblemStat.inc.hpp +++ b/dune/amdis/ProblemStat.inc.hpp @@ -107,7 +107,7 @@ namespace AMDiS template <class Traits> - void ProblemStatSeq<Traits>::addMatrixOperator(shared_ptr<OperatorType> op, + void ProblemStatSeq<Traits>::addMatrixOperator(std::shared_ptr<OperatorType> op, int i, int j, double* factor, double* estFactor) @@ -127,18 +127,18 @@ namespace AMDiS double* factor, double* estFactor) { - addMatrixOperator(make_shared<OperatorType>(op), i, j, factor, estFactor); + addMatrixOperator(std::make_shared<OperatorType>(op), i, j, factor, estFactor); } template <class Traits> - void ProblemStatSeq<Traits>::addMatrixOperator(std::map< std::pair<int,int>, shared_ptr<OperatorType> > ops) + void ProblemStatSeq<Traits>::addMatrixOperator(std::map< std::pair<int,int>, std::shared_ptr<OperatorType> > ops) { for (auto op : ops) addMatrixOperator(op.second, op.first.first, op.first.second); } template <class Traits> - void ProblemStatSeq<Traits>::addMatrixOperator(std::map< std::pair<int,int>, std::pair<shared_ptr<OperatorType>,bool> > ops) + void ProblemStatSeq<Traits>::addMatrixOperator(std::map< std::pair<int,int>, std::pair<std::shared_ptr<OperatorType>,bool> > ops) { for (auto op : ops) { auto row_col = op.first; @@ -149,7 +149,7 @@ namespace AMDiS } template <class Traits> - void ProblemStatSeq<Traits>::addVectorOperator(shared_ptr<OperatorType> op, + void ProblemStatSeq<Traits>::addVectorOperator(std::shared_ptr<OperatorType> op, int i, double* factor, double* estFactor) @@ -168,18 +168,18 @@ namespace AMDiS double* factor, double* estFactor) { - addVectorOperator(make_shared<OperatorType>(op), i, factor, estFactor); + addVectorOperator(std::make_shared<OperatorType>(op), i, factor, estFactor); } template <class Traits> - void ProblemStatSeq<Traits>::addVectorOperator(std::map< int, shared_ptr<OperatorType> > ops) + void ProblemStatSeq<Traits>::addVectorOperator(std::map< int, std::shared_ptr<OperatorType> > ops) { for (auto op : ops) addVectorOperator(op.second, op.first); } template <class Traits> - void ProblemStatSeq<Traits>::addVectorOperator(std::map< int, std::pair<shared_ptr<OperatorType>, bool> > ops) + void ProblemStatSeq<Traits>::addVectorOperator(std::map< int, std::pair<std::shared_ptr<OperatorType>, bool> > ops) { for (auto op : ops) { vectorOperators[op.first].push_back(op.second.first); @@ -259,54 +259,54 @@ namespace AMDiS Timer t; For<0, nComponents>::loop([this](auto const _r) { - this->getNodeFactory(_r).initializeIndices(); + this->getFeSpace(_r).update(this->getMeshView()); }); 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](auto const c) + For<0, nComponents>::loop([this, &nnz, asmMatrix_, asmVector](auto const _c) { - static const int _c = decltype(c)::value; - static const int _r = decltype(r)::value; - index_<_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>; + 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(_r, _c); + auto row_col = std::make_pair(R, C); bool assembleMatrix = asmMatrix_ && (!matrixAssembled[row_col] || matrixChanging[row_col]); - bool assembleVector = asmVector && _r == _c; + bool assembleVector = asmVector && R == C; int r_ = 0, c_ = 0; if (assembleMatrix) { // init boundary condition for (auto bc_list : dirichletBc) { std::tie(r_, c_) = bc_list.first; - if (r_ == _r) { - for (auto bc : bc_list.second) - bc->init(c_ == _c, dofmatrix, solution_vec, rhs_vec); + if (r_ == R) { + for (auto bc : bc_list.second) + 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[_r], vectorFactors[_r], assembleVector}; + auto vec = VectorData{rhs_vec, vectorOperators[R], vectorFactors[R], assembleVector}; // assemble the DOFMatrix block and the corresponding rhs vector, of r==c @@ -317,15 +317,15 @@ namespace AMDiS if (assembleMatrix) matrixAssembled[row_col] = true; if (assembleVector) - vectorAssembled[_r] = true; + vectorAssembled[R] = true; if (assembleMatrix) { // finish boundary condition for (auto bc_list : dirichletBc) { std::tie(r_, c_) = bc_list.first; - if (r_ == _r) { - for (auto bc : bc_list.second) - bc->finish(c_ == _c, dofmatrix, solution_vec, rhs_vec); + if (r_ == R) { + for (auto bc : bc_list.second) + bc->finish(c_ == C, dofmatrix, solution_vec, rhs_vec); } } @@ -404,7 +404,7 @@ namespace AMDiS bool ProblemStatSeq<Traits>::getElementMatrix(RowView const& rowLocalView, ColView const& colLocalView, ElementMatrix& elementMatrix, - std::list<shared_ptr<OperatorType>>& operators, + std::list<std::shared_ptr<OperatorType>>& operators, std::list<double*> const& factors) { auto const nRows = rowLocalView.tree().finiteElement().size(); @@ -434,7 +434,7 @@ namespace AMDiS template <class RowView> bool ProblemStatSeq<Traits>::getElementVector(RowView const& rowLocalView, ElementVector& elementVector, - std::list<shared_ptr<OperatorType>>& operators, + std::list<std::shared_ptr<OperatorType>>& operators, std::list<double*> const& factors) { auto const nRows = rowLocalView.tree().finiteElement().size(); diff --git a/install_dune.py b/install_dune.py deleted file mode 100644 index 517cf342547150f36e20e92ab2914ada19fca4cc..0000000000000000000000000000000000000000 --- a/install_dune.py +++ /dev/null @@ -1,125 +0,0 @@ -import os -import subprocess - -def shell(command): - subprocess.call(command, shell=True) - -def cd(directory): - os.chdir(directory) - -def rm(filename): - os.remove(filename) - -def mkdir(directory): - if not os.path.exists(directory): - os.makedirs(directory) - -# configure blas library -blas_name = 'blas' -blas_dir = '/usr/lib/openblas-base' -blas_lib = blas_dir + '/lib' + blas_name + '.a' - -# configure source and install directory -source_dir = '/opt/sources/dune' -install_dir = '/opt/software/dune_debug' -alberta_install_dir = '/opt/software/alberta_debug' - -num_proc = 8 -build_type = 'Debug' - - -alberta_source = ['alberta-3.0.1', - 'http://www.mathematik.uni-stuttgart.de/fak8/ians/lehrstuhl/nmh/downloads/alberta/alberta-3.0.1.tar.gz', - 'https://www.ians.uni-stuttgart.de/subversion/alberta/trunk/albertadist'] - -ug_source = ['ug-3.12.1', - 'http://conan.iwr.uni-heidelberg.de/download/ug-3.12.1.tar.gz'] - -vc_source = 'https://github.com/VcDevel/Vc.git' - -modules = ['dune-common', 'dune-geometry', 'dune-localfunctions', 'dune-istl', - 'dune-grid', 'dune-typetree', 'dune-functions'] - -repos = ['https://gitlab.dune-project.org/core/dune-common.git', - 'https://gitlab.dune-project.org/core/dune-geometry.git', - 'https://gitlab.dune-project.org/core/dune-localfunctions.git', - 'https://gitlab.dune-project.org/core/dune-istl.git', - 'https://gitlab.dune-project.org/core/dune-grid.git', - 'https://gitlab.dune-project.org/pdelab/dune-typetree.git', - 'https://gitlab.dune-project.org/staging/dune-functions.git'] - - -mkdir(source_dir) - -# install alberta -cd(source_dir) -if not os.path.exists(alberta_source[0] + '.tar-gz') and \ - not os.path.exists(alberta_source[0]): - shell('wget ' + alberta_source[1]) - shell('tar -xzf ' + alberta_source[0] + '.tar.gz') - mkdir(alberta_source[0] + '/build') - -cd(alberta_source[0] + '/build') -disable_debug = '--disable_debug ' -if build_type == 'Debug': - disable_debug = '' -shell('../configure --disable-graphics ' + disable_debug - + '--disable-chained-basis-functions --disable-vector-basis-functions ' - + '--with-blas --with-blas-name=' + blas_name + ' --with-blas-lib=' + blas_dir + ' ' - + '--prefix=' + alberta_install_dir) -shell('make -j' + str(num_proc)) -shell('make install') - - -# install UG -cd(source_dir) -if not os.path.exists(ug_source[0] + '.tar.gz') and \ - not os.path.exists(ug_source[0]): - shell('wget ' + ug_source[1]) - shell('tar -xzf ' + ug_source[0] + '.tar.gz') - mkdir(ug_source[0] + '/build') - -cd(ug_source[0] + '/build') -shell('../configure --enable-dune --enable-parallel --prefix=' + install_dir) -shell('make -j' + str(num_proc)) -shell('make install') - - -# install Vc -cd(source_dir) -if not os.path.exists('Vc'): - shell('git clone ' + vc_source + ' Vc') - mkdir('Vc/build') - -cd(source_dir + '/Vc/build') -rm('CMakeCache.txt') -shell('cmake -DCMAKE_BUILD_TYPE=' + build_type + ' -DCMAKE_INSTALL_PREFIX:PATH=' + install_dir + ' ' - + '-DENABLE_MIC:BOOL=OFF ..') -shell('make -j' + str(num_proc) + ' install') - - -# install Dune modules -for i, m in enumerate(modules): - cd(source_dir) - if not os.path.exists(m): - shell('git clone ' + repos[i] + ' ' + m) - mkdir(m + '/build') - -for m in modules: - cd(source_dir + '/' + m + '/build') - rm('CMakeCache.txt') - shell('cmake -DCMAKE_BUILD_TYPE=' + build_type + ' -DCMAKE_INSTALL_PREFIX:PATH=' + install_dir + ' ' - + '-DCXX_MAX_STANDARD=14 -DCMAKE_PREFIX_PATH:PATH=' + install_dir + '/lib/cmake ' - + '-DUG_DIR:PATH=' + install_dir + '/lib/cmake/ug -DVc_DIR:PATH=' + install_dir + '/lib/cmake/Vc ' - + '-DBLAS_blas_LIBRARY:PATH=' + blas_lib + ' ' - + '-DALBERTA_ROOT:PATH=' + alberta_install_dir + ' ..') - shell('make -j' + str(num_proc) + ' install') - - -# manually change the following things: -# 1) Add AddVcFlags.cmake to /opt/sources/dune/dune-common/cmake/modules/CMakeLists.txt -# 2) Add constexpr to line 291 in /opt/sources/dune/dune-functions/dune/functions/functionspacesbases/interpolate.hh -# 3) Modify /opt/sources/dune/dune-functions/CMakeLists and remove examples sub-directory - - -