[Dune] Compilation Errors in Example From "Getting started with DUNE"

Adrian G Maroni agmaroni at gmail.com
Thu Jun 30 13:23:10 CEST 2016


I have installed all DUNE core modules, release 2.4.1. In total, I
have the following modules:

dune-common, dune-geometry, dune-localfunctions, dune-grid,
dune-typetree, dune-istl, dune-functions, dune-alugrid,
dune-grid-howto, dune-pdelab, dune-curvilineargeometry.

I am currently working on the Poisson equation example from the
introductory handout. I am able to generate the project, save the
attached code as a single file and configure the project as a module.
Unfortunately, when I try to build it with the make directive, I get a
long list of C++ errors. I run a 64 bit Fedora system with the linux
kernels and C++ compiler most up to date. My compiler version is:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin
--enable-initfini-array --disable-libgcj --with-isl --enable-libmpx
--enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 5.3.1 20160406 (Red Hat 5.3.1-6) (GCC)



Compilation errors are:





$ dunecontrol --only=dune-poissonequation make
--- going to build dune-poissonequation  ---
--- calling make for dune-poissonequation ---
build directory: build-cmake
cmake --build . --
[ 50%] Building CXX object
src/CMakeFiles/dune-poissonequation.dir/dune-poissonequation.cc.o
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:
In function ‘int main(int, char**)’:
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:274:13:
error: ‘UGGrid’ does not name a type
     typedef UGGrid<dim> GridType;
             ^
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:275:21:
error: ‘GridType’ was not declared in this scope
     std::shared_ptr<GridType> grid(GmshReader<GridType>::read("l-shape.msh"));
                     ^
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:275:29:
error: template argument 1 is invalid
     std::shared_ptr<GridType> grid(GmshReader<GridType>::read("l-shape.msh"));
                             ^
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:275:47:
error: the value of ‘GridType’ is not usable in a constant expression
     std::shared_ptr<GridType> grid(GmshReader<GridType>::read("l-shape.msh"));
                                               ^
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:275:21:
note: ‘GridType’ was not declared ‘constexpr’
     std::shared_ptr<GridType> grid(GmshReader<GridType>::read("l-shape.msh"));
                     ^
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:275:55:
error: type/value mismatch at argument 1 in template parameter list
for ‘template<class GridType> class Dune::GmshReader’
     std::shared_ptr<GridType> grid(GmshReader<GridType>::read("l-shape.msh"));
                                                       ^
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:275:55:
note:   expected a type, got ‘GridType’
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:275:62:
error: expected ‘,’ or ‘...’ before ‘(’ token
     std::shared_ptr<GridType> grid(GmshReader<GridType>::read("l-shape.msh"));
                                                              ^
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:277:11:
error: request for member ‘globalRefine’ in ‘grid’, which is of
non-class type ‘int(int)’
     grid->globalRefine(2);
/*@\label{li:poissonequation_global_refinement}@*/
           ^
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:279:13:
error: ‘GridType’ does not name a type
     typedef GridType::LeafGridView GridView;
             ^
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:280:14:
error: missing template arguments before ‘gridView’
     GridView gridView = grid->leafGridView();
/*@\label{li:poissonequation_gridcreation_end}@*/
              ^
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:300:40:
error: type/value mismatch at argument 1 in template parameter list
for ‘template<class GV, int k, class ST> using PQkNodalBasis =
Dune::Functions::DefaultGlobalBasis<Dune::Functions::PQkNodeFactory<GV,
k, Dune::Functions::FlatMultiIndex<ST>, ST> >’
     Functions::PQkNodalBasis<GridView,1> basis(gridView);
/*@\label{li:poissonequation_select_fe_basis}@*/
                                        ^
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:300:40:
note:   expected a type, got ‘GridView’
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:300:48:
error: ‘gridView’ was not declared in this scope
     Functions::PQkNodalBasis<GridView,1> basis(gridView);
/*@\label{li:poissonequation_select_fe_basis}@*/
                                                ^
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:303:67:
error: no matching function for call to ‘assemblePoissonProblem(int&,
MatrixType&, VectorType&, main(int, char**)::<lambda(const
Dune::FieldVector<double, 2>&)>&)’
     assemblePoissonProblem(basis, stiffnessMatrix, rhs, sourceTerm);
      /*@\label{li:poissonequation_call_assembleLaplaceMatrix}@*/
                                                                   ^
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:182:6:
note: candidate: template<class Basis> void
assemblePoissonProblem(const Basis&,
Dune::BCRSMatrix<Dune::FieldMatrix<double, 1, 1> >&,
Dune::BlockVector<Dune::FieldVector<double, 1> >&,
std::function<double(Dune::FieldVector<double, typename
Basis::GridView:: dimension>)>)
 void assemblePoissonProblem(const Basis& basis,
      ^
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:182:6:
note:   template argument deduction/substitution failed:
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:
In substitution of ‘template<class Basis> void
assemblePoissonProblem(const Basis&,
Dune::BCRSMatrix<Dune::FieldMatrix<double, 1, 1> >&,
Dune::BlockVector<Dune::FieldVector<double, 1> >&,
std::function<double(Dune::FieldVector<double, typename
Basis::GridView:: dimension>)>) [with Basis = int]’:
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:303:67:
  required from here
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:182:6:
error: ‘int’ is not a class, struct, or union type
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:357:22:
error: request for member ‘size’ in ‘basis’, which is of non-class
type ‘int’
   VectorType x(basis.size());
                      ^
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:382:21:
error: type/value mismatch at argument 1 in template parameter list
for ‘template<class GridView> class Dune::VTKWriter’
   VTKWriter<GridView> vtkWriter(gridView);
                     ^
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:382:21:
note:   expected a type, got ‘GridView’
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:383:13:
error: request for member ‘addVertexData’ in ‘vtkWriter’, which is of
non-class type ‘int’
   vtkWriter.addVertexData(x, "solution");
             ^
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:384:13:
error: request for member ‘write’ in ‘vtkWriter’, which is of
non-class type ‘int’
   vtkWriter.write("poissonequation-result");
             ^
In file included from
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:26:0:
/usr/local/include/dune/functions/functionspacebases/interpolate.hh:
In instantiation of ‘void Dune::Functions::interpolate(const B&, const
TP&, C&&, const F&, const BV&) [with B = int; TP =
Dune::TypeTree::HybridTreePath<>; C = std::vector<char>&; F =
main(int, char**)::<lambda(auto:2)>; BV =
Dune::Functions::Imp::AllTrueBitSetVector]’:
/usr/local/include/dune/functions/functionspacebases/interpolate.hh:301:15:
  required from ‘void Dune::Functions::interpolate(const B&, C&&,
const F&) [with B = int; C = std::vector<char>&; F = main(int,
char**)::<lambda(auto:2)>]’
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:316:60:
  required from here
/usr/local/include/dune/functions/functionspacebases/interpolate.hh:277:77:
error: no matching function for call to
‘makeDefaultNodeToRangeMap(const int&, const
Dune::TypeTree::HybridTreePath<>&)’
   interpolateTreeSubset(basis, treePath, coeff, f,
makeDefaultNodeToRangeMap(basis, treePath), bitVector);
                                                                             ^
In file included from
/usr/local/include/dune/functions/functionspacebases/interpolate.hh:23:0,
                 from
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:26:
/usr/local/include/dune/functions/functionspacebases/defaultnodetorangemap.hh:97:29:
note: candidate: template<class Tree>
Dune::Functions::DefaultNodeToRangeMap<Tree>
Dune::Functions::makeDefaultNodeToRangeMap(const Tree&)
 DefaultNodeToRangeMap<Tree> makeDefaultNodeToRangeMap(const Tree& tree)
                             ^
/usr/local/include/dune/functions/functionspacebases/defaultnodetorangemap.hh:97:29:
note:   template argument deduction/substitution failed:
In file included from
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:26:0:
/usr/local/include/dune/functions/functionspacebases/interpolate.hh:277:77:
note:   candidate expects 1 argument, 2 provided
   interpolateTreeSubset(basis, treePath, coeff, f,
makeDefaultNodeToRangeMap(basis, treePath), bitVector);
                                                                             ^
In file included from
/usr/local/include/dune/functions/functionspacebases/interpolate.hh:23:0,
                 from
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:26:
/usr/local/include/dune/functions/functionspacebases/defaultnodetorangemap.hh:105:6:
note: candidate: template<class Basis, class TreePath> decltype
(Dune::Functions::makeDefaultNodeToRangeMap(Dune::TypeTree::child(basis.localView().tree(),
treePath))) Dune::Functions::makeDefaultNodeToRangeMap(const Basis&,
TreePath&&)
 auto makeDefaultNodeToRangeMap(const Basis& basis, TreePath&& treePath)
      ^
/usr/local/include/dune/functions/functionspacebases/defaultnodetorangemap.hh:105:6:
note:   template argument deduction/substitution failed:
/usr/local/include/dune/functions/functionspacebases/defaultnodetorangemap.hh:
In substitution of ‘template<class Basis, class TreePath> decltype
(Dune::Functions::makeDefaultNodeToRangeMap(Dune::TypeTree::child(basis.localView().tree(),
treePath))) Dune::Functions::makeDefaultNodeToRangeMap(const Basis&,
TreePath&&) [with Basis = int; TreePath = const
Dune::TypeTree::HybridTreePath<>&]’:
/usr/local/include/dune/functions/functionspacebases/interpolate.hh:277:77:
  required from ‘void Dune::Functions::interpolate(const B&, const
TP&, C&&, const F&, const BV&) [with B = int; TP =
Dune::TypeTree::HybridTreePath<>; C = std::vector<char>&; F =
main(int, char**)::<lambda(auto:2)>; BV =
Dune::Functions::Imp::AllTrueBitSetVector]’
/usr/local/include/dune/functions/functionspacebases/interpolate.hh:301:15:
  required from ‘void Dune::Functions::interpolate(const B&, C&&,
const F&) [with B = int; C = std::vector<char>&; F = main(int,
char**)::<lambda(auto:2)>]’
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:316:60:
  required from here
/usr/local/include/dune/functions/functionspacebases/defaultnodetorangemap.hh:106:56:
error: request for member ‘localView’ in ‘basis’, which is of
non-class type ‘const int’
   -> decltype(makeDefaultNodeToRangeMap(TypeTree::child(basis.localView().tree(),treePath)))
                                                        ^
In file included from
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:26:0:
/usr/local/include/dune/functions/functionspacebases/interpolate.hh:
In instantiation of ‘void Dune::Functions::interpolate(const B&, const
TP&, C&&, const F&, const BV&) [with B = int; TP =
Dune::BlockVector<Dune::FieldVector<double, 1> >; C = main(int,
char**)::<lambda(auto:3)>&; F = std::vector<char>; BV =
Dune::Functions::Imp::AllTrueBitSetVector]’:
/usr/local/include/dune/functions/functionspacebases/interpolate.hh:322:15:
  required from ‘void Dune::Functions::interpolate(const B&, const
TreePath&, C&&, const F&) [with B = int; TreePath =
Dune::BlockVector<Dune::FieldVector<double, 1> >; C = main(int,
char**)::<lambda(auto:3)>&; F = std::vector<char>]’
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:340:67:
  required from here
/usr/local/include/dune/functions/functionspacebases/interpolate.hh:277:77:
error: no matching function for call to
‘makeDefaultNodeToRangeMap(const int&, const
Dune::BlockVector<Dune::FieldVector<double, 1> >&)’
   interpolateTreeSubset(basis, treePath, coeff, f,
makeDefaultNodeToRangeMap(basis, treePath), bitVector);
                                                                             ^
In file included from
/usr/local/include/dune/functions/functionspacebases/interpolate.hh:23:0,
                 from
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:26:
/usr/local/include/dune/functions/functionspacebases/defaultnodetorangemap.hh:97:29:
note: candidate: template<class Tree>
Dune::Functions::DefaultNodeToRangeMap<Tree>
Dune::Functions::makeDefaultNodeToRangeMap(const Tree&)
 DefaultNodeToRangeMap<Tree> makeDefaultNodeToRangeMap(const Tree& tree)
                             ^
/usr/local/include/dune/functions/functionspacebases/defaultnodetorangemap.hh:97:29:
note:   template argument deduction/substitution failed:
In file included from
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:26:0:
/usr/local/include/dune/functions/functionspacebases/interpolate.hh:277:77:
note:   candidate expects 1 argument, 2 provided
   interpolateTreeSubset(basis, treePath, coeff, f,
makeDefaultNodeToRangeMap(basis, treePath), bitVector);
                                                                             ^
In file included from
/usr/local/include/dune/functions/functionspacebases/interpolate.hh:23:0,
                 from
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:26:
/usr/local/include/dune/functions/functionspacebases/defaultnodetorangemap.hh:105:6:
note: candidate: template<class Basis, class TreePath> decltype
(Dune::Functions::makeDefaultNodeToRangeMap(Dune::TypeTree::child(basis.localView().tree(),
treePath))) Dune::Functions::makeDefaultNodeToRangeMap(const Basis&,
TreePath&&)
 auto makeDefaultNodeToRangeMap(const Basis& basis, TreePath&& treePath)
      ^
/usr/local/include/dune/functions/functionspacebases/defaultnodetorangemap.hh:105:6:
note:   template argument deduction/substitution failed:
/usr/local/include/dune/functions/functionspacebases/defaultnodetorangemap.hh:
In substitution of ‘template<class Basis, class TreePath> decltype
(Dune::Functions::makeDefaultNodeToRangeMap(Dune::TypeTree::child(basis.localView().tree(),
treePath))) Dune::Functions::makeDefaultNodeToRangeMap(const Basis&,
TreePath&&) [with Basis = int; TreePath = const
Dune::BlockVector<Dune::FieldVector<double, 1> >&]’:
/usr/local/include/dune/functions/functionspacebases/interpolate.hh:277:77:
  required from ‘void Dune::Functions::interpolate(const B&, const
TP&, C&&, const F&, const BV&) [with B = int; TP =
Dune::BlockVector<Dune::FieldVector<double, 1> >; C = main(int,
char**)::<lambda(auto:3)>&; F = std::vector<char>; BV =
Dune::Functions::Imp::AllTrueBitSetVector]’
/usr/local/include/dune/functions/functionspacebases/interpolate.hh:322:15:
  required from ‘void Dune::Functions::interpolate(const B&, const
TreePath&, C&&, const F&) [with B = int; TreePath =
Dune::BlockVector<Dune::FieldVector<double, 1> >; C = main(int,
char**)::<lambda(auto:3)>&; F = std::vector<char>]’
.../../dune-examples/dune-poissonequation/src/dune-poissonequation.cc:340:67:
  required from here
/usr/local/include/dune/functions/functionspacebases/defaultnodetorangemap.hh:106:56:
error: request for member ‘localView’ in ‘basis’, which is of
non-class type ‘const int’
   -> decltype(makeDefaultNodeToRangeMap(TypeTree::child(basis.localView().tree(),treePath)))
                                                        ^
src/CMakeFiles/dune-poissonequation.dir/build.make:62: recipe for
target 'src/CMakeFiles/dune-poissonequation.dir/dune-poissonequation.cc.o'
failed
gmake[2]: *** [src/CMakeFiles/dune-poissonequation.dir/dune-poissonequation.cc.o]
Error 1
CMakeFiles/Makefile2:1141: recipe for target
'src/CMakeFiles/dune-poissonequation.dir/all' failed
gmake[1]: *** [src/CMakeFiles/dune-poissonequation.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
gmake: *** [all] Error 2
--- Failed to build dune-poissonequation ---
Terminating dunecontrol due to previous errors!




Thank you very much.

Sincerely,

Adrian Maroni




More information about the Dune mailing list