[dune-functions] Crash in interpolate
Carsten Gräser
graeser at mi.fu-berlin.de
Sat Sep 19 23:43:41 CEST 2015
Hi Oliver,
Am 19.09.2015 um 23:22 schrieb Oliver Sander:
> 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?
no, but your vector type does not fit. This is maybe due to a
misunderstanding of how interpolate for subtrees works.
Presumably you expected that your vector fits to the velocity
subtree. But since we (on purpose) don't guarantee that the
global indices are nested like the ansatz tree, this cannot
work unless interpolate generates completely new global indices,
which it does not do.
Instead of this it will always interpolate into a vector
for the whole global basis using the original global indices.
So you would need a
BlockVector<BlockVector<FieldVector<double,1>>>
to interpolate the indentity as a vector field, if this is
really what you want. But then you have the x- and y-coordinates
in the first and second velocity components. If you want the
Lagrange-points for all velocity dofs, you need the implicite
tensor construction, i.e.,
BlockVector<BlockVector<FieldVector<double,dim>>>
Best,
Carsten
>
> 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] ----
>
>
>
>
> _______________________________________________
> dune-functions mailing list
> dune-functions at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-functions
>
--
Prof. Dr. Carsten Gräser
Freie Universität Berlin
Institut für Mathematik
Arnimallee 6
14195 Berlin, Germany
phone: +49 30 838 72637
fax : +49 30 838 472637
email: graeser at mi.fu-berlin.de
URL : http://page.mi.fu-berlin.de/graeser
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.dune-project.org/pipermail/dune-functions/attachments/20150919/d73939c7/attachment.sig>
More information about the dune-functions
mailing list