[dune-functions] Crash in interpolate

Oliver Sander oliver.sander at tu-dresden.de
Sat Sep 19 23:22:06 CEST 2015


Hi guys,
I am trying to interpolate the R^d identity function with respect to the velocity part
of a Taylor-Hood basis.  For this, I have added the lines

  BlockVector<FieldVector<double,dim> > lagrangeNodes;
  interpolate(taylorHoodBasis, TypeTree::hybridTreePath(TypeTree::Indices::_0), lagrangeNodes, [](FieldVector<double,dim> x){ return x; });

into the stokes-taylorhood.cc example file.

However, the code segfaults with a not-very-helpful backtrace.  valgrind, however, shows an 'invalid write'
in interpolate (see below).  Is this a bug or am I using the hybridTreePath thingy wrong?

Thanks,
Oliver

Konsole output
Konsole output
~/dune/dune-functions/build-cmake/examples(master)>valgrind --db-attach=yes ./stokes-taylorhood       
==15716==  
==15716== Warning: --db-attach is a deprecated feature which will be
==15716==    removed in the next release. Use --vgdb-error=1 instead
==15716==  
==15716== Memcheck, a memory error detector
==15716== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==15716== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==15716== Command: ./stokes-taylorhood
==15716==  
==15716== Invalid write of size 8
==15716==    at 0x45EC02: leaf<const Dune::Functions::PQkNode<Dune::GridView<Dune::DefaultLeafGridViewTraits<const Dune::YaspGrid<2>,
(Dune::PartitionIteratorType)4u> >, 2, long unsigned int, Dune::TypeTree::HybridTreePath<std::integral_constant<long unsigned int, 0ul
>, long unsigned int> >, Dune::TypeTree::DynamicTreePath> (interpolate.hh:147)
==15716==    by 0x45EC02: apply<const Dune::Functions::PQkNode<Dune::GridView<Dune::DefaultLeafGridViewTraits<const Dune::YaspGrid<2>,
(Dune::PartitionIteratorType)4u> >, 2, long unsigned int, Dune::TypeTree::HybridTreePath<std::integral_constant<long unsigned int, 0u
l>, long unsigned int> >&, Dune::Functions::Imp::LocalInterpolateVisitor<Dune::Functions::DefaultGlobalBasis<Dune::Functions::TaylorHo
odNodeFactory<Dune::GridView<Dune::DefaultLeafGridViewTraits<const Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, std::array<l
ong unsigned int, 2ul>, long unsigned int> >, Dune::Functions::TaylorHoodVelocityTree<Dune::GridView<Dune::DefaultLeafGridViewTraits<c
onst Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, long unsigned int, Dune::TypeTree::HybridTreePath<std::integral_constant<l
ong unsigned int, 0ul> > >, Dune::Functions::DefaultNodeToRangeMap<Dune::Functions::TaylorHoodVelocityTree<Dune::GridView<Dune::Defaul
tLeafGridViewTraits<const Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, long unsigned int, Dune::TypeTree::HybridTreePath<std
::integral_constant<long unsigned int, 0ul> > > >, Dune::Functions::HierarchicVectorWrapper<Dune::BlockVector<Dune::FieldVector<double
, 2> > >&&, Dune::Functions::LocalAnalyticGridViewFunction<Dune::FieldVector<double, 2>(Dune::FieldVector<double, 2>), Dune::GridView<
Dune::DefaultLeafGridViewTraits<const Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, main(int, char**)::<lambda(Dune::FieldVec
tor<double, 2>)>, Dune::Functions::LocalDerivativeTraits<Dune::Functions::GridViewEntitySet<Dune::GridView<Dune::DefaultLeafGridViewTr
aits<const Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, 0>, Dune::Functions::DefaultDerivativeTraits>::Traits>, Dune::Functi
ons::HierarchicVectorWrapper<const Dune::Functions::Imp::AllTrueBitSetVector>&&>&, Dune::TypeTree::MutableDynamicTreePath> (traversal.
hh:76)
==15716==    by 0x45EC02: apply<const Dune::Functions::TaylorHoodVelocityTree<Dune::GridView<Dune::DefaultLeafGridViewTraits<const Dun
e::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, long unsigned int, Dune::TypeTree::HybridTreePath<std::integral_constant<long unsi
gned int, 0ul> > >&, Dune::Functions::Imp::LocalInterpolateVisitor<Dune::Functions::DefaultGlobalBasis<Dune::Functions::TaylorHoodNode
Factory<Dune::GridView<Dune::DefaultLeafGridViewTraits<const Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, std::array<long un
signed int, 2ul>, long unsigned int> >, Dune::Functions::TaylorHoodVelocityTree<Dune::GridView<Dune::DefaultLeafGridViewTraits<const D
une::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, long unsigned int, Dune::TypeTree::HybridTreePath<std::integral_constant<long un
signed int, 0ul> > >, Dune::Functions::DefaultNodeToRangeMap<Dune::Functions::TaylorHoodVelocityTree<Dune::GridView<Dune::DefaultLeafG
ridViewTraits<const Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, long unsigned int, Dune::TypeTree::HybridTreePath<std::inte
gral_constant<long unsigned int, 0ul> > > >, Dune::Functions::HierarchicVectorWrapper<Dune::BlockVector<Dune::FieldVector<double, 2> >
>&&, Dune::Functions::LocalAnalyticGridViewFunction<Dune::FieldVector<double, 2>(Dune::FieldVector<double, 2>), Dune::GridView<Dune::
DefaultLeafGridViewTraits<const Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, main(int, char**)::<lambda(Dune::FieldVector<do
uble, 2>)>, Dune::Functions::LocalDerivativeTraits<Dune::Functions::GridViewEntitySet<Dune::GridView<Dune::DefaultLeafGridViewTraits<c
onst Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, 0>, Dune::Functions::DefaultDerivativeTraits>::Traits>, Dune::Functions::H
ierarchicVectorWrapper<const Dune::Functions::Imp::AllTrueBitSetVector>&&>&, Dune::TypeTree::MutableDynamicTreePath> (traversal.hh:130
)
==15716==    by 0x45EC02: apply<const Dune::Functions::TaylorHoodVelocityTree<Dune::GridView<Dune::DefaultLeafGridViewTraits<const Dun
e::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, long unsigned int, Dune::TypeTree::HybridTreePath<std::integral_constant<long unsi
gned int, 0ul> > >&, Dune::Functions::Imp::LocalInterpolateVisitor<Dune::Functions::DefaultGlobalBasis<Dune::Functions::TaylorHoodNode
Factory<Dune::GridView<Dune::DefaultLeafGridViewTraits<const Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, std::array<long un
signed int, 2ul>, long unsigned int> >, Dune::Functions::TaylorHoodVelocityTree<Dune::GridView<Dune::DefaultLeafGridViewTraits<const D
une::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, long unsigned int, Dune::TypeTree::HybridTreePath<std::integral_constant<long un
signed int, 0ul> > >, Dune::Functions::DefaultNodeToRangeMap<Dune::Functions::TaylorHoodVelocityTree<Dune::GridView<Dune::DefaultLeafG
ridViewTraits<const Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, long unsigned int, Dune::TypeTree::HybridTreePath<std::inte
gral_constant<long unsigned int, 0ul> > > >, Dune::Functions::HierarchicVectorWrapper<Dune::BlockVector<Dune::FieldVector<double, 2> >
>&&, Dune::Functions::LocalAnalyticGridViewFunction<Dune::FieldVector<double, 2>(Dune::FieldVector<double, 2>), Dune::GridView<Dune::
DefaultLeafGridViewTraits<const Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, main(int, char**)::<lambda(Dune::FieldVector<do
uble, 2>)>, Dune::Functions::LocalDerivativeTraits<Dune::Functions::GridViewEntitySet<Dune::GridView<Dune::DefaultLeafGridViewTraits<c
onst Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, 0>, Dune::Functions::DefaultDerivativeTraits>::Traits>, Dune::Functions::H
ierarchicVectorWrapper<const Dune::Functions::Imp::AllTrueBitSetVector>&&>&> (traversal.hh:41)
==15716==    by 0x45EC02: applyToTree<const Dune::Functions::TaylorHoodVelocityTree<Dune::GridView<Dune::DefaultLeafGridViewTraits<con
st Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, long unsigned int, Dune::TypeTree::HybridTreePath<std::integral_constant<lon
g unsigned int, 0ul> > >&, Dune::Functions::Imp::LocalInterpolateVisitor<Dune::Functions::DefaultGlobalBasis<Dune::Functions::TaylorHo
odNodeFactory<Dune::GridView<Dune::DefaultLeafGridViewTraits<const Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, std::array<l
ong unsigned int, 2ul>, long unsigned int> >, Dune::Functions::TaylorHoodVelocityTree<Dune::GridView<Dune::DefaultLeafGridViewTraits<c
onst Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, long unsigned int, Dune::TypeTree::HybridTreePath<std::integral_constant<l
ong unsigned int, 0ul> > >, Dune::Functions::DefaultNodeToRangeMap<Dune::Functions::TaylorHoodVelocityTree<Dune::GridView<Dune::Defaul
tLeafGridViewTraits<const Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, long unsigned int, Dune::TypeTree::HybridTreePath<std
::integral_constant<long unsigned int, 0ul> > > >, Dune::Functions::HierarchicVectorWrapper<Dune::BlockVector<Dune::FieldVector<double
, 2> > >&&, Dune::Functions::LocalAnalyticGridViewFunction<Dune::FieldVector<double, 2>(Dune::FieldVector<double, 2>), Dune::GridView<
Dune::DefaultLeafGridViewTraits<const Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, main(int, char**)::<lambda(Dune::FieldVec
tor<double, 2>)>, Dune::Functions::LocalDerivativeTraits<Dune::Functions::GridViewEntitySet<Dune::GridView<Dune::DefaultLeafGridViewTr
aits<const Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, 0>, Dune::Functions::DefaultDerivativeTraits>::Traits>, Dune::Functi
ons::HierarchicVectorWrapper<const Dune::Functions::Imp::AllTrueBitSetVector>&&>&> (traversal.hh:188)
==15716==    by 0x45EC02: interpolateTreeSubset<Dune::Functions::DefaultGlobalBasis<Dune::Functions::TaylorHoodNodeFactory<Dune::GridV
iew<Dune::DefaultLeafGridViewTraits<const Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, std::array<long unsigned int, 2ul>, l
ong unsigned int> >, Dune::TypeTree::HybridTreePath<std::integral_constant<long unsigned int, 0ul> >&, Dune::Functions::DefaultNodeToR
angeMap<Dune::Functions::TaylorHoodVelocityTree<Dune::GridView<Dune::DefaultLeafGridViewTraits<const Dune::YaspGrid<2>, (Dune::Partiti
onIteratorType)4u> >, long unsigned int, Dune::TypeTree::HybridTreePath<std::integral_constant<long unsigned int, 0ul> > > >, Dune::Bl
ockVector<Dune::FieldVector<double, 2> >&, main(int, char**)::<lambda(Dune::FieldVector<double, 2>)>&, Dune::Functions::Imp::AllTrueBi
tSetVector> (interpolate.hh:226)
==15716==    by 0x45EC02: interpolate<Dune::Functions::DefaultGlobalBasis<Dune::Functions::TaylorHoodNodeFactory<Dune::GridView<Dune::
DefaultLeafGridViewTraits<const Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, std::array<long unsigned int, 2ul>, long unsign
ed int> >, Dune::TypeTree::HybridTreePath<std::integral_constant<long unsigned int, 0ul> >&, Dune::BlockVector<Dune::FieldVector<doubl
e, 2> >&, main(int, char**)::<lambda(Dune::FieldVector<double, 2>)>&, Dune::Functions::Imp::AllTrueBitSetVector> (interpolate.hh:272)
==15716==    by 0x45EC02: interpolate<Dune::Functions::DefaultGlobalBasis<Dune::Functions::TaylorHoodNodeFactory<Dune::GridView<Dune::
DefaultLeafGridViewTraits<const Dune::YaspGrid<2>, (Dune::PartitionIteratorType)4u> >, std::array<long unsigned int, 2ul>, long unsign
ed int> >, Dune::TypeTree::HybridTreePath<std::integral_constant<long unsigned int, 0ul> >, Dune::BlockVector<Dune::FieldVector<double
, 2> >&, main(int, char**)::<lambda(Dune::FieldVector<double, 2>)> > (interpolate.hh:317)
==15716==    by 0x45EC02: main (stokes-taylorhood.cc:277)
==15716==  Address 0x7771a30 is 32 bytes before a block of size 128 in arena "client"
==15716==  
==15716==  
==15716== ---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ----


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune-functions/attachments/20150919/ce7683cf/attachment.htm>


More information about the dune-functions mailing list