1
// Copyright (C) 2008 Anders Logg.
2
// Licensed under the GNU LGPL Version 2.1.
4
// First added: 2008-03-11
5
// Last changed: 2008-11-19
7
// Demonstrating function evaluation at arbitrary points.
10
#include "Projection.h"
12
using namespace dolfin;
14
class F : public Function
17
void eval(double* values, const double* x) const
19
values[0] = sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2]);
25
// Create mesh and a point in the mesh
26
UnitCube mesh(8, 8, 8);
27
double x[3] = {0.31, 0.32, 0.33};
29
// A user-defined function
32
// Project to a discrete function
33
ProjectionFunctionSpace V(mesh);
34
ProjectionBilinearForm a(V, V);
35
ProjectionLinearForm L(V);
37
VariationalProblem pde(a, L);
41
// Evaluate user-defined function f
44
message("f(x) = %g", value);
46
// Evaluate discrete function g (projection of f)
48
message("g(x) = %g", value);