Actual source code: example6.edp
 1 /*******************************************************
 2  *  This file is part of the FreeFEM tutorial made by  *
 3  *      Pierre Jolivet <pierre@joliv.et>               *
 4  *                                                     *
 5  *  See https://joliv.et/FreeFem-tutorial for more     *
 6  *                                                     *
 7  *   Description: rectangular distributed matrices     *
 8  *******************************************************/
  
10 load "PETSc"
11 macro dimension()3// EOM
12 include "macro_ddm.idp"
 
14 func Pk2 = P2;
15 func Pk1 = P1;
 
17 mesh3 Th = cube(5, 5, 5);
18 Mat A, C;
19 {
20     DmeshCreate(Th);
21     MatCreate(Th, A, Pk2);
22     MatCreate(Th, C, Pk1);
23 }
24 matrix Loc;
25 fespace Vh(Th, Pk2);
26 fespace Ph(Th, Pk1);
27 Loc.resize(Vh.ndof, Ph.ndof);
28 for(int i = 0; i < Ph.ndof; ++i)
29     Loc(i, i) = 1;
30 Mat B(A, C, Loc);
31 ObjectView(B, format = "info");
32 real[int] in(Ph.ndof);
33 real[int] out(Vh.ndof);
34 in = 1;
35 out = B * in;
36 in = B' * out;