I am overriding the value and the gradient member functions in the 
TensorFunction class then similar to step 7 I am using compute_global_error to 
compute the L2: and H1 norms. I have to convert my TensorFunction to a 
vector valued function in order to do this using 
VectorFunctionFromTensorFunction<dim>.
I am getting an exception thrown when I ask for the H1 norm saying that the 
gradient operator is not overridden. 

Here is a sketch of the code:


class Exact : public TensorFunction<1, dim>
{
public:
Exact() : TensorFunction<1, dim>(dim)
{
}

virtual Tensor<1, dim> value(const Point<dim> &p) const override;
virtual Tensor<2, dim> gradient(const Point<dim> &p) const override;
};


Tensor<1, dim> Exact<dim>::value(const Point<dim> &p) const
{
return Tensor<1, dim>;
}


Tensor<2, dim> Exact<dim>::gradient(const Point<dim> &p) const
{
return Tensor<2, dim>;
}

int main()
{ 
//blablabla tri, dofs, fe..

         // declate then convert tensor function 
Exact<dim> exact_solution;
VectorFunctionFromTensorFunction<dim> exact_solution_vector_function(
exact_solution, 0, dim);

//L2 works fine
VectorTools::integrate_difference(dof_handler,
solution,
exact_solution_vector_function,
difference_per_cell,
quadrature_formula,
VectorTools::L2_norm);
// THis throws exception 
VectorTools::integrate_difference(dof_handler,
solution,
exact_solution_vector_function,
difference_per_cell,
quadrature_formula,
VectorTools::H1_seminorm);;


}

Doing something as simple as:
Point<dim> p1;
exact_solution_vector_function.value(p1); 
exact_solution_vector_function.gradient(p1); 
is raising the exception. 


I attached the code with the cmake below too.


-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/e7a9106b-ca2a-45b0-9d15-e74832198da4n%40googlegroups.com.

<<attachment: step-1.zip>>

Reply via email to