here is the more detailed code:
without setting the initial values (the part next to the TODO) everything is working fine,but changing the eval
-Function of the initial class doesnt change anything.
//Setup constants
const int dim = 2;
Poisson::Initial initial;
dolfin::Constant dirichlet(0.0);
dolfin::FunctionSpace fSpace();
auto mesh = std::make_shared<dolfin::UnitSquareMesh(32, 32)>();
DimensionWrapper<dim> dimensionWrapper;
//Setup FunctionSpace, Linear and BilinearForm (based on dim)
auto V = std::make_shared<decltype(dimensionWrapper.FunctionSpace(mesh))>(dimensionWrapper.FunctionSpace(mesh));
auto a = dimensionWrapper.BilinearForm(V,V);
auto L = dimensionWrapper.LinearForm(V);
//setup solution
dolfin::Function u(V);
//TODO: implement initial values (not working yet)
u.interpolate(initial);
//Define boundary condition
auto u0 = std::make_shared<dolfin::Constant>(dirichletBoundary);
auto boundary = std::make_shared<DirichletBoundary>();
dolfin::DirichletBC bc(V, u0, boundary);
//Set Boundary Condition for Problem
Source f;
dUdN g;
L.g = g;
L.f = f;
//Compute solution
dolfin::solve(a == L, u, bc);
The initial class is defined as :
class Initial : public dolfin::Expression {
void eval(dolfin::Array<double> &values, const dolfin::Array<double> &x) const{
values[0] = 1;
}
};
I hope, my question is now clear and you might be able to help me.