interpolation of a function in a defined function space
Hi,
I am using the 'interpolate' function of a Function class, but it doesn't work......
P1_3D.h was generated from ffc for tetrahedron linear element. I defined an Expression F and FunctionSpace. When I tried to interpolate F on the defined function space, it gave the following error:
*** -------
*** Error: Unable to evaluate expression.
*** Reason: Missing eval() function (must be overloaded).
*** Where: This error was encountered inside Expression.cpp.
*** -------
However, I tested f.eval(vals,x), it worked well. The problem only took place when I used interpolate. Where was I wrong?
Thank you.
#include <dolfin.h>
#include <iostream>
#include "P1_3D.h"
using namespace dolfin;
using namespace std;
// =======
class F : public Expression
{
public:
F() : Expression() {}
void eval(double* values, const double* x) const
{
values[0] = sin(1.0*
}
};
//=====
int main()
{
UnitCube mesh(20, 20, 20);
F f; // expression
std::cout<< "value_rank() of Expression f is " << f.value_rank() << "\n";
// Create function spaces
P1_3D:
// Create functions
Function f0(V0);
f0.interpolat
return 0;
}
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Johan Hake
- Solved:
- Last query:
- Last reply: