1
// Copyright (C) 2008 Anders Logg.
2
// Licensed under the GNU LGPL Version 2.1.
4
// First added: 2008-03-11
5
// Last changed: 2007-03-17
7
// Testing evaluation at arbitrary points
10
#include "Projection.h"
12
using namespace dolfin;
14
class F : public Function
18
F(Mesh& mesh) : Function(mesh) {}
20
real eval(const real* x) const
22
return sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2]);
29
// Create mesh and a point in the mesh
30
UnitCube mesh(8, 8, 8);
31
real x[3] = {0.3, 0.3, 0.3};
32
real values[1] = {0.0};
34
// A user-defined function
37
// Project to a discrete function
38
ProjectionBilinearForm a;
39
ProjectionLinearForm L(f);
40
LinearPDE pde(a, L, mesh);
44
// Evaluate user-defined function f
45
message("f(x) = %g", f.eval(x));
47
// Evaluate discrete function g (projection of f)
48
message("g(x) = %g", g.eval(x));