The main steps are:
Square *msh; msh = new Square();
First we initialize the needed variables for the refinement level, the polynomial degree and the boundary conditions:
uint l = 0; uint p = 1; hp_BoundaryCondition* bc = new hp_BoundaryCondition(); bc->add(geo_Attribute(1), tbx_Boundary(tbx_Boundary::DIRICHLET, new tbx_Formula("(0)")));Then we can create the space.
hp_HP2d *spc; spc = new hp_HP2d(*msh, l, p, bc);The elements are created, when the space is first accessed. During this process, each element gets its own T matrix which maps the local to the global degrees of freedom.
hp_Identity bf(gauss); op_LocalA(*spc, bf); hp_Identity id(gauss); op_Local I(*spc, id); op_LiCo L(I, A);
hp_Riesz lf(fex, gauss); fnc_Vectorf(*spc, lf);
fnc_Vectoru(*spc); op_CG Linv(L, eps, iter); Linv(f, u);
Initialize a post processor:
ofstream *ofs; tbx_GlobalPostprocesspostProcess(*spc);
Sketch the mesh:
ofs = new ofstream("hp0.eps"); graph_MeshEPS eps(*ofs, *msh); postProcess(eps); delete ofs;
Plot of the numerical solution:
ofs = new ofstream("hp0.data"); graph_Gnuplot graph(*ofs, u); postProcess(graph); delete ofs;
delete spc; delete msh;