[dune-functions] Problems writing vector-valued vtk files
Oliver Sander
sander at igpm.rwth-aachen.de
Wed Mar 18 11:46:47 CET 2015
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.
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
-------------- 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/e957822a/attachment.sig>
More information about the dune-functions
mailing list