[dune-functions] Crash in interpolate

Oliver Sander oliver.sander at tu-dresden.de
Sun Sep 20 20:08:45 CEST 2015


Hi Carsten,

[snip]
>
> 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.
Thanks for the explanation.  What you propose works as expected.
Can the code be changed to give an error message instead of the
segfault?

>  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>>>
This does not work for me.  It compiles and runs, but the interpolated values
are not correct (each FieldVector has the same value in all entries).  However,
this is not a problem to me.  BV<BV<FV<,dim>>> does not fit the multi-indices
of the TaylorHoodBasis, so it is not surprising that this doesn't work.

Best,
Oliver

>
> 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
>>
>
>
>
> _______________________________________________
> dune-functions mailing list
> dune-functions at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-functions

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


More information about the dune-functions mailing list