[dune-functions] Problems writing vector-valued vtk files
Carsten Gräser
graeser at mi.fu-berlin.de
Wed Mar 18 12:11:35 CET 2015
Hi,
Am 18.03.2015 um 11:46 schrieb Oliver Sander:
> Hi Steffen, hi all,
>
>>> I am trying to get the new vtkwriter to write vector-valued functions,
>>> and I can't get it to work. Is this a bug or am I forgetting some important
>>> option? To reproduce, please apply the attached short patch to poisson-pq2.cc.
>>> Then, running the program aborts with
>>>
>>> poisson-pq2: /home/sander/dune/dune-common/dune/common/densevector.hh:538: typename Dune::PromotionTraits<typename Dune::DenseMatVecTraits<V>::value_type, typename
>>> Dune::DenseVector<Other>::field_type>::PromotedType Dune::DenseVector<V>::operator*(const Dune::DenseVector<Other>&) const [with Other = Dune::FieldVector<double, 1>; V = Dune::FieldVector<double, 3>;
>>> typename Dune::PromotionTraits<typename Dune::DenseMatVecTraits<V>::value_type, typename Dune::DenseVector<Other>::field_type>::PromotedType = double]: Assertion `y.size() == size()' failed.
>>> Abgebrochen
>>
>> That’s strange - I can run this program and get a valid VTK file. Are you sure your dune-grid
>> is up to date?
>
> yes. And actually, as it turns out I don't need VTK at all to provoke this assertion
> failure. The following code snippet in poisson-pq2 is enough:
>
> typedef BlockVector<FieldVector<double,3> > EmbeddedVectorType;
> EmbeddedVectorType xEmbedded(x.size());
> for (size_t i=0; i<x.size(); i++)
> xEmbedded[i] = {0, 0, 0};
>
> Dune::Functions::DiscreteScalarGlobalBasisFunction<decltype(feBasis),decltype(xEmbedded)> xFunction(feBasis,xEmbedded);
> auto localXFunction = localFunction(xFunction);
>
> localXFunction.bind(*gridView.begin<0>());
> std::cout << localXFunction(FieldVector<double,2>(0)) << std::endl;
>
> I kind-of see where the problem is coming from: I would expect the Range type of xFunction and localXFunction to be
> FieldVector<double,3>. However, in discretescalarglobalbasisfunction.hh the type for both is set to the range type
> of the LocalBasis, which is FieldVector<double,1>. This leads to a mismatch during function evaluation.
that's correct (in some sense). I just adpated the old version, which
was inherently scala, to the new interface. I guess that's why it has
...Scalar... in its name. I guess I can extend this to work with
different coefficient types (like we do in dune-fufem). I'll have a look
at this.
However there's another problem lurking around the corner: What would
we like to do in case of a vector valued local basis?
Best,
Carsten
>
> Shouldn't the Range type of localXFunction be something like decltype(xEmbedded)::value_type? I.e., the type of one coefficient?
> Or rather, the type that I get when I multiply a coefficient by a basis function value?
> Is this simply a bug in discretescalarglobalbasisfunction.hh? Or am I missing a design feature here?
>
> Bye,
> Oliver
--
Prof. Dr. Carsten Gräser
Freie Universität Berlin
Institut für Mathematik
Arnimallee 6
14195 Berlin, Germany
phone: +49 30 838 75399
fax : +49 30 838 54977
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/20150318/59b392e8/attachment.sig>
More information about the dune-functions
mailing list