# Poisson問題の完全な例¶

```using bgeot::base_small_vector;
// Exact solution. Allows an interpolation for the Dirichlet condition.
scalar_type sol_u(const base_node &x) { return sin(x[0]+x[1]); }
// Right hand side. Allows an interpolation for the source term.
scalar_type sol_f(const base_node &x) { return 2*sin(x[0]+x[1]); }
// Gradient of the solution. Allows an interpolation for the Neumann term.
{ return base_small_vector(cos(x[0]+x[1]), cos(x[0]+x[1]); }

int main(void) {

// ... definition of a mesh
// ... definition of a finite element method mf_u
// ... definition of a finite element method mf_rhs
// ... definition of an integration method mim
// ... definition of boundaries NEUMANN_BOUNDARY_NUM
//                        and DIRICHLET_BOUNDARY_NUM

// Model object
getfem::model laplacian_model;

// Main unknown of the problem

// Laplacian term on u.

// Volumic source term.
std::vector<scalar_type> F(mf_rhs.nb_dof());
getfem::interpolation_function(mf_rhs, F, sol_f);

// Neumann condition.
gmm::resize(F, mf_rhs.nb_dof()*N);
(laplacian_model, mim, "u", "NeumannData", NEUMANN_BOUNDARY_NUM);

// Dirichlet condition.
gmm::resize(F, mf_rhs.nb_dof());
getfem::interpolation_function(mf_rhs, F, sol_u);
(laplacian_model, mim, "u", mf_u, DIRICHLET_BOUNDARY_NUM, "DirichletData");

gmm::iteration iter(residual, 1, 40000);
getfem::standard_solve(laplacian_model, iter);

std::vector<scalar_type> U(mf_u.nb_dof());
gmm::copy(laplacian_model.real_variable("u"), U);

// ... doing something with the solution ...

return 0;
}
```

ブリック要素は任意の次数で追加できます．