Skip to content
Snippets Groups Projects
Commit b1a450e5 authored by Andreas Dedner's avatar Andreas Dedner
Browse files

Revert "modified version so that it can be directly installed using pip"

This reverts commit 25fecb38.
parent 25fecb38
No related branches found
No related tags found
No related merge requests found
graft patches
include LICENSE.md
include README.md
include addModules.sh
git clone https://gitlab.dune-project.org/staging/dune-typetree
git clone https://gitlab.dune-project.org/staging/dune-functions
git clone https://git.imp.fu-berlin.de/agnumpde/dune-matrix-vector.git
git clone https://git.imp.fu-berlin.de/agnumpde/dune-fufem.git
git clone https://git.imp.fu-berlin.de/agnumpde/dune-solvers.git
git clone https://git.imp.fu-berlin.de/agnumpde/dune-tnnmg.git
cd dune-matrix-vector
git apply ../patches/dune-matrix-vector*.diff
cd ..
cd dune-fufem
git apply ../patches/dune-fufem*.diff
cd ..
diff --git a/dune/fufem/assemblers/localassemblers/CMakeLists.txt b/dune/fufem/assemblers/localassemblers/CMakeLists.txt
index 47147149..caca70f3 100644
--- a/dune/fufem/assemblers/localassemblers/CMakeLists.txt
+++ b/dune/fufem/assemblers/localassemblers/CMakeLists.txt
@@ -2,7 +2,6 @@ install(FILES
adolchessianassembler.hh
adolclinearizationassembler.hh
adolclocalenergy.hh
- boundarymassassembler.hh
convolutionassembler.hh
dunefunctionsl2functionalassembler.hh
generalizedboundarymassassembler.hh
From 20120f236296534a13a6b50de474a8018eafbbf6 Mon Sep 17 00:00:00 2001
From: Matthew Collins <m.t.collins@warwick.ac.uk>
Date: Thu, 22 Mar 2018 12:40:19 +0000
Subject: [PATCH 1/2] transfer operator made to work with adaptive grid view
---
.../assemblers/transferoperatorassembler.hh | 67 +++++++++----------
1 file changed, 32 insertions(+), 35 deletions(-)
diff --git a/dune/fufem/assemblers/transferoperatorassembler.hh b/dune/fufem/assemblers/transferoperatorassembler.hh
index 16a73e9d..c1451250 100644
index 05109580..515607a3 100644
--- a/dune/fufem/assemblers/transferoperatorassembler.hh
+++ b/dune/fufem/assemblers/transferoperatorassembler.hh
@@ -15,19 +15,19 @@
@@ -15,33 +15,33 @@
#include <dune/fufem/functionspacebases/dunefunctionsbasis.hh>
#include <dune/functions/functionspacebases/lagrangebasis.hh>
#include <dune/functions/functionspacebases/pq1nodalbasis.hh>
-template <class GridType>
+template <class GridViewType>
......@@ -28,19 +25,38 @@ index 16a73e9d..c1451250 100644
public:
- typedef typename GridType::template Codim<0>::Entity Element;
- typedef DuneFunctionsBasis<Dune::Functions::LagrangeBasis<typename GridType::LevelGridView, 1> > LevelBasis;
+ typedef typename GridViewType::template Codim<0>::Entity Element;
+ typedef DuneFunctionsBasis<Dune::Functions::LagrangeBasis<typename GridViewType::Grid::LevelGridView, 1> > LevelBasis;
- typedef DuneFunctionsBasis<Dune::Functions::PQ1NodalBasis<typename GridType::LevelGridView>> LevelBasis;
+ typedef typename GridViewType::Grid::template Codim<0>::Entity Element;
+ typedef DuneFunctionsBasis<Dune::Functions::PQ1NodalBasis<typename GridViewType::Grid::LevelGridView>> LevelBasis;
typedef typename LevelBasis::LocalFiniteElement LocalFiniteElement;
- MultilevelBasis(const GridType& grid) :
- grid(grid)
+ MultilevelBasis(const GridViewType& gv) :
+ gridView(gv), grid(gv.grid())
+ MultilevelBasis(const GridViewType& gridview) :
+ gridview(gridview)
{
const auto& globalIdSet = grid.globalIdSet();
const auto& leafIndexSet = grid.leafIndexSet();
@@ -49,11 +49,11 @@ class MultilevelBasis
- const auto& globalIdSet = grid.globalIdSet();
- const auto& leafIndexSet = grid.leafIndexSet();
+ const auto& globalIdSet = gridview.grid().globalIdSet();
+ const auto& leafIndexSet = gridview.indexSet();
- int maxLevel = grid.maxLevel();
+ int maxLevel = gridview.grid().maxLevel();
levelBasis_.resize(maxLevel+1);
for(int level=0; level<=maxLevel; ++level)
- levelBasis_[level] = std::make_shared<LevelBasis>(grid.levelGridView(level));
+ levelBasis_[level] = std::make_shared<LevelBasis>(gridview.grid().levelGridView(level));
idToIndex.resize(maxLevel+1);
size_.resize(maxLevel+1);
- size_[maxLevel] = grid.size(dim);
+ size_[maxLevel] = gridview.grid().size(dim);
// build extended level indices as map (globalId -> index)
// 1. enumerate vertices on each level
@@ -49,23 +49,23 @@ class MultilevelBasis
// 3. on maxlevel take the leaf indices
//
// example: level=*, copy=(*), leaf=[*]
......@@ -55,46 +71,57 @@ index 16a73e9d..c1451250 100644
// 1-----------------------2-----------------------3
// first use the level indices
@@ -65,7 +65,7 @@ class MultilevelBasis
for(int level=0; level<maxLevel; ++level)
{
- const auto& indexSet = grid.levelIndexSet(level);
+ const auto& indexSet = gridview.grid().levelIndexSet(level);
size_[level] = indexSet.size(dim);
- for (const auto& it : vertices(grid.levelGridView(level)))
+ for (const auto& it : vertices(gridview.grid().levelGridView(level)))
idToIndex[level][globalIdSet.id(it)] = indexSet.index(it);
}
- for (const auto& it : vertices(grid.leafGridView()))
+ for (const auto& it : vertices(gridView))
+ for (const auto& it : vertices(gridview))
{
idToIndex[maxLevel][globalIdSet.id(it)] = leafIndexSet.index(it);
@@ -96,32 +96,32 @@ class MultilevelBasis
@@ -90,16 +90,16 @@ class MultilevelBasis
int index(const Element& e, const int i, const int level) const
{
const Dune::LocalKey& localKey = getLocalFiniteElement(e).localCoefficients().localKey(i);
- const IdType id = grid.globalIdSet().subId(e, localKey.subEntity(), localKey.codim());
+ const IdType id = gridview.grid().globalIdSet().subId(e, localKey.subEntity(), localKey.codim());
return idToIndex[level].find(id)->second;
}
private:
- const GridType& grid;
+ const GridViewType& gridView;
+ const typename GridViewType::Grid& grid;
+ const GridViewType& gridview;
std::vector<std::shared_ptr<LevelBasis> > levelBasis_;
- typedef typename GridType::Traits::GlobalIdSet::IdType IdType;
+ typedef typename GridViewType::Grid::GlobalIdSet::IdType IdType;
+ typedef typename GridViewType::Grid::Traits::GlobalIdSet::IdType IdType;
std::vector< std::map<IdType,int> > idToIndex;
std::vector<int> size_;
};
//! Assembler for a hierarchy of multigrid transfer operators
-template <class GridType>
+template <class GridViewType>
@@ -110,18 +110,21 @@ template <class GridType>
class TransferOperatorAssembler {
+ typedef typename GridViewType::Grid GridType;
public:
- TransferOperatorAssembler(const GridType& grid) :
- grid(grid)
+ TransferOperatorAssembler(const GridViewType& gridView) :
+ gridView(gridView),
+ grid(gridView.grid()), maxLevel(gridView.grid().maxLevel())
+ template <typename U = GridType, typename = decltype(std::declval<U>().grid().maxLevel() )>
+ TransferOperatorAssembler(const GridType& gridview) :
+ grid(gridview), maxLevel(gridview.grid().maxLevel())
{}
-
+ template <typename U = GridType, typename = decltype(std::declval<U>().maxLevel() ), int = 1 >
+ TransferOperatorAssembler(const GridType& gridview) :
+ grid(gridview), maxLevel(gridview.maxLevel())
+ {}
template <class TransferOperator>
void assembleOperatorHierarchy(std::vector<TransferOperator>& T) const
{
......@@ -105,7 +132,7 @@ index 16a73e9d..c1451250 100644
M.resize(maxLevel);
for (int i=0; i<maxLevel; ++i)
@@ -135,8 +135,6 @@ class TransferOperatorAssembler {
@@ -135,8 +138,6 @@ class TransferOperatorAssembler {
typedef typename RealTransferOperator::TransferOperatorType TransferOperatorType;
std::vector <TransferOperatorType*> M;
......@@ -114,7 +141,7 @@ index 16a73e9d..c1451250 100644
M.resize(maxLevel);
for (int i=0; i<maxLevel; ++i)
@@ -152,8 +150,6 @@ class TransferOperatorAssembler {
@@ -152,8 +153,6 @@ class TransferOperatorAssembler {
{
std::vector <typename TransferOperator::TransferOperatorType*> M;
......@@ -123,7 +150,7 @@ index 16a73e9d..c1451250 100644
M.resize(maxLevel);
for (int i=0; i<maxLevel; ++i)
@@ -172,7 +168,7 @@ class TransferOperatorAssembler {
@@ -172,7 +171,7 @@ class TransferOperatorAssembler {
template <class Matrix>
void assembleMatrixHierarchy(std::vector<std::shared_ptr<Matrix> >& M) const
{
......@@ -132,14 +159,13 @@ index 16a73e9d..c1451250 100644
M.push_back(std::make_shared<Matrix>());
std::vector <Matrix*> Mraw(M.size());
@@ -201,14 +197,11 @@ class TransferOperatorAssembler {
@@ -201,14 +200,11 @@ class TransferOperatorAssembler {
Dune::Timer timer;
- int maxLevel = grid.maxLevel();
-
- MultilevelBasis<GridType> multiLevelBasis(grid);
+ MultilevelBasis<GridViewType> multiLevelBasis(gridView);
MultilevelBasis<GridType> multiLevelBasis(grid);
#ifdef FE_VERBOSE
std::cout << "FE:" << "globalId -> index maps build in " << timer.elapsed() << " seconds." << std::endl;
#endif
......@@ -148,7 +174,7 @@ index 16a73e9d..c1451250 100644
TransformationHierarchy transformationHierarchy(maxLevel);
for (int level=0; level<maxLevel; ++level)
transformationHierarchy[level].resize(multiLevelBasis.size(level+1));
@@ -220,7 +213,7 @@ class TransferOperatorAssembler {
@@ -220,10 +216,10 @@ class TransferOperatorAssembler {
// loop over all levels
timer.reset();
......@@ -156,8 +182,12 @@ index 16a73e9d..c1451250 100644
+ for(int level=0; level<maxLevel; ++level)
{
// loop over all elements of current level
for (const auto& cIt : elements(grid.levelGridView(level)))
@@ -300,7 +293,7 @@ class TransferOperatorAssembler {
- for (const auto& cIt : elements(grid.levelGridView(level)))
+ for (const auto& cIt : elements(grid.grid().levelGridView(level)))
{
const LFE& coarseFE = multiLevelBasis.getLocalFiniteElement(cIt);
@@ -300,7 +296,7 @@ class TransferOperatorAssembler {
} // end of loop over all elements of current level
} // end of loop over all levels
#ifdef FE_VERBOSE
......@@ -166,13 +196,14 @@ index 16a73e9d..c1451250 100644
#endif
// setup transfer operator matrices
@@ -340,7 +333,9 @@ class TransferOperatorAssembler {
@@ -341,6 +337,7 @@ class TransferOperatorAssembler {
private:
static const int dim = GridType::dimension;
+ const GridViewType& gridView;
const GridType& grid;
+ int maxLevel;
};
#endif
--
2.20.1
From 5cb33d82b75e81cad997fed468b9174e0b47e415 Mon Sep 17 00:00:00 2001
From: Matthew Collins <m.t.collins@warwick.ac.uk>
Date: Mon, 16 Jul 2018 16:58:15 +0100
Subject: [PATCH 2/2] changed transer assembler
---
dune/fufem/assemblers/transferoperatorassembler.hh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dune/fufem/assemblers/transferoperatorassembler.hh b/dune/fufem/assemblers/transferoperatorassembler.hh
index 515607a3..6ff5b895 100644
--- a/dune/fufem/assemblers/transferoperatorassembler.hh
+++ b/dune/fufem/assemblers/transferoperatorassembler.hh
@@ -13,7 +13,7 @@
#include <dune/geometry/referenceelements.hh>
#include <dune/fufem/functionspacebases/dunefunctionsbasis.hh>
-#include <dune/functions/functionspacebases/pq1nodalbasis.hh>
+#include <dune/functions/functionspacebases/pqknodalbasis.hh>
template <class GridViewType>
class MultilevelBasis
@@ -23,7 +23,7 @@ class MultilevelBasis
public:
typedef typename GridViewType::Grid::template Codim<0>::Entity Element;
- typedef DuneFunctionsBasis<Dune::Functions::PQ1NodalBasis<typename GridViewType::Grid::LevelGridView>> LevelBasis;
+ typedef DuneFunctionsBasis<Dune::Functions::PQkNodalBasis<typename GridViewType::Grid::LevelGridView, 1>> LevelBasis;
typedef typename LevelBasis::LocalFiniteElement LocalFiniteElement;
MultilevelBasis(const GridViewType& gridview) :
--
2.20.1
diff --git a/dune/matrix-vector/CMakeLists.txt b/dune/matrix-vector/CMakeLists.txt
index 43f113f..658746e 100644
--- a/dune/matrix-vector/CMakeLists.txt
+++ b/dune/matrix-vector/CMakeLists.txt
@@ -17,6 +17,7 @@ install(FILES
getscalar.hh
ldlt.hh
promote.hh
+ resize.hh
singlenonzerocolumnmatrix.hh
singlenonzerorowmatrix.hh
transpose.hh
......@@ -29,7 +29,7 @@
#include <dune/solvers/iterationsteps/truncatedblockgsstep.hh>
#include <dune/solvers/norms/energynorm.hh>
#include <dune/solvers/solvers/loopsolver.hh>
// #include <dune/solvers/test/common.hh>
#include <dune/solvers/test/common.hh>
#include <dune/solvers/transferoperators/compressedmultigridtransfer.hh>
......@@ -48,7 +48,7 @@
#include <dune/tnnmg/projections/obstacledefectprojection.hh>
// #include <dune/solvers/test/common.hh>
#include <dune/solvers/test/common.hh>
template <class DomainType, class RangeType, class F>
......
......@@ -29,7 +29,7 @@
#include <dune/solvers/iterationsteps/truncatedblockgsstep.hh>
#include <dune/solvers/norms/energynorm.hh>
#include <dune/solvers/solvers/loopsolver.hh>
// #include <dune/solvers/test/common.hh>
#include <dune/solvers/test/common.hh>
#include <dune/solvers/transferoperators/compressedmultigridtransfer.hh>
......@@ -48,7 +48,7 @@
#include <dune/tnnmg/projections/obstacledefectprojection.hh>
// #include <dune/solvers/test/common.hh>
#include <dune/solvers/test/common.hh>
//stripped down version of solving obstacle problem by truncated non-smooth newton multi-grid method
template<class GridViewType, class MatrixType, class VectorType>
......
import os, sys
from setuptools import setup, find_packages, Extension
from setuptools.command.build_ext import build_ext
builddir = os.path.abspath(os.getcwd())
def inVEnv():
# if sys.real_prefix exists, this is a virtualenv set up with the virtualenv package
if hasattr(sys, 'real_prefix'):
return 1
# if a virtualenv is set up with pyvenv, we check for equality of base_prefix and prefix
if hasattr(sys, 'base_prefix'):
return (sys.prefix != sys.base_prefix)
# if none of the above conditions triggered, this is probably no virtualenv interpreter
return 0
def get_install_prefix():
# test if in virtual env
if inVEnv():
return sys.prefix
# use system default
return None
def get_runtime_libdirs():
if inVEnv():
return [os.path.join(get_install_prefix(), 'lib')]
else:
# try to guess modules path for unix systems
return [p for p in ['.',
'/usr/local/lib',
'/usr/lib']
if os.path.isdir(p)]
# compute number of cores for building like petsc does it
def compute_make_np(i):
f16 = .80
f32 = .65
f64 = .50
f99 = .30
if (i<=2): return 2
elif (i<=4): return i
elif (i<=16): return int(4+(i-4)*f16)
elif (i<=32): return int(4+12*f16+(i-16)*f32)
elif (i<=64): return int(4+12*f16+16*f32+(i-32)*f64)
else: return int(4+12*f16+16*f32+32*f64+(i-64)*f99)
return
def dunecontrol():
addModules = 'bash ./addModules.sh'
status = os.system(addModules)
if status != 0: raise RuntimeError(status)
optsfile = open("config.opts", "w")
optsfile.write('CMAKE_FLAGS=\"' + ('-DCMAKE_INSTALL_PREFIX='+get_install_prefix() if get_install_prefix() is not None else '') +
' -DBUILD_SHARED_LIBS=TRUE -DDUNE_ENABLE_PYTHONBINDINGS=TRUE'+
' -DDUNE_PYTHON_INSTALL_LOCATION="none"' +
' -DDUNE_GRID_GRIDTYPE_SELECTOR=ON' +
' -DALLOW_CXXFLAGS_OVERWRITE=ON' +
' -DUSE_PTHREADS=ON' +
' -DCMAKE_BUILD_TYPE=Release' +
' -DCMAKE_DISABLE_FIND_PACKAGE_LATEX=TRUE' +
' -DCMAKE_DISABLE_DOCUMENTATION=TRUE' +
'\"\n')
optsfile.write('MAKE_FLAGS=\"-j ' + str(compute_make_np(os.cpu_count())) + '\"')
optsfile.close()
configure = 'dunecontrol --opts=config.opts configure'
status = os.system(configure)
if status != 0: raise RuntimeError(status)
install = 'dunecontrol --opts=config.opts make install'
status = os.system(install)
if status != 0: raise RuntimeError(status)
class BuildExt(build_ext):
def build_extensions(self):
dunecontrol()
self.extensions.pop(0) # empty extension was added to run `dunecontrol`
for ext in self.extensions:
ext.extra_compile_args += ['-std=c++17', '-fvisibility=hidden']
build_ext.build_extensions(self)
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(name="phasefield",
version="0.0.1",
version="1.0.1",
author="Matthew Collins and Andreas Dedner",
author_email="a.s.dedner@warwick.ac.uk",
description="Interface problem solver based on the phase-field methodology",
......@@ -99,8 +16,7 @@ setup(name="phasefield",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
"Operating System :: OS Independent"],
install_requires=['UFL == 2017.1.0'],
zip_safe = 0,
package_data = {'': ['*.cc']},
ext_modules=[Extension("", [])],
cmdclass={'build_ext': BuildExt}
package_data = {'': ['*.cc']}
)
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