Dear John,

> If the link doesn't work, it's the second prototype of 
> get_function_gradients in the FEValuesBase class. It wants a 
> std::vector<std::vector<Tensor<1,dim> > >, not a 
> std::vector<Tensor<2,dim> >. In fact there isn't a prototype that 
> expects a std::vector<Tensor<2,dim> >, so I'm not sure why it compiles! 
> I don't really have a question about this, I'm just raising it as an 
> unusual point (or perhaps I'm looking at the incorrect class).

Indeed, you have been looking at the incorrect class. You are using the
operator [] on FEValuesBase, and that gives you an object of type "const
FEValuesViews::Vector < dim, spacedim >". Hence, you are actually
calling FEValuesViews::Vector::get_function_gradients, where the
argument for the gradients is std::vector<Tensor<2,dim> >, and you need
to look there. I agree that it is not straight-forward to find this in
the documentation (given the fact that both FEValuesBase and
FEValuesViews have a get_function_gradients method), but it is a neat
programming trick to get more compile-time information about the number
of PDE components into FEValues without adding template arguments for
the number of components to FEValues directly. As you mention, this is
much neater when you later access the gradients, and it adds additional
access possibilities like symmetric gradients, curls, or divergences
which are really only defined if you have dim components in your PDE
variable.

Best,
Martin

_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to