Documentation for Concepts 2.0 (Main Steps) | Tutorials | Class Documentation | Developer Tools

Main Steps in a Concepts Application

The main steps are:

  1. Create the mesh. More about meshes: geometry.
      Square *msh;
      msh = new Square();
  2. Create the space. More about spaces:

    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.
  3. (Refine the mesh.)
  4. Create the bilinear forms and the according matrices and combine them (assembling) to form the stiffness matrix. More: bilinear forms and matrices.
      hp_Identity bf(gauss);
      op_Local A(*spc, bf); 
    
      hp_Identity id(gauss);
      op_Local I(*spc, id);
    
      op_LiCo L(I, A);
  5. Create the linear form and the according vector. More: linear forms and vectors.
      hp_Riesz lf(fex, gauss);
      fnc_Vector f(*spc, lf);
  6. Create a solver and solve the linear system. More: solvers.
      fnc_Vector u(*spc);
      op_CG Linv(L, eps, iter);
      Linv(f, u);
  7. (Analyse the error and proceed with step 3 if the error is too large.)
  8. Post processing: plots, error computation etc.

    Initialize a post processor:

      ofstream *ofs;
      tbx_GlobalPostprocess postProcess(*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;
  9. Remove the matrices, vectors, the space and the mesh.
      delete spc;
      delete msh;
The steps in parentesis are optional.
Documentation for Concepts 2.0 (Main Steps) | Tutorials | Class Documentation | Developer Tools