KerMor  0.9
Model order reduction for nonlinear dynamical systems and nonlinear approximation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
computeSparsityPattern.m
Go to the documentation of this file.
1 #include "Constraint.m"
2 namespace models{
3 namespace muscle{
4 
5 
6 /* (Autoinserted by mtoc++)
7  * This source code has been filtered by the mtoc++ executable,
8  * which generates code that can be processed by the doxygen documentation tool.
9  *
10  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
11  * Except for the comments, the function bodies of your M-file functions are untouched.
12  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
13  * attached source files that are highly readable by humans.
14  *
15  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
16  * the correct locations in the source code browser.
17  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
18  */
19 
20 function SP = models.muscle.Constraint.computeSparsityPattern() {
21  sys = this.fsys;
22  mc = sys.Model.Config;
23  fe_pos = mc.FEM;
24  geo = fe_pos.Geometry;
25  fe_press = mc.PressureFEM;
26  pgeo = fe_press.Geometry;
27 
28  num_elements = geo.NumElements;
29  num_gausspoints = fe_pos.GaussPointsPerElem;
30  dofsperelem_displ = geo.DofsPerElement;
31  dofsperelem_press = pgeo.DofsPerElement;
32 
33  /* Compute indices vectors size for speed */
34  itotal = num_elements*num_gausspoints...
35  *(dofsperelem_press*(3*dofsperelem_displ)) ;
36  i = zeros(itotal,1," int32 ");
37  j = zeros(itotal,1," int32 ");
38 
39  curoff = 0;
40  pones = ones(dofsperelem_press,1," int32 ");
41  for m = 1:num_elements
42  elemidx_u = sys.idx_u_elems_local(:,:,m);
43  elemidx_p = sys.idx_p_elems_local(:,m);
44  for gp = 1:num_gausspoints
45  for k = 1:dofsperelem_displ
46  /* % grad u g(u) */
47  step = 3*dofsperelem_press;
48  /* dx,dy,dz */
49  i(curoff + (1:step)) = [elemidx_p(:)
50  elemidx_p(:)
51  elemidx_p(:)];
52  j(curoff + (1:step)) = [pones*elemidx_u(1,k)
53  pones*elemidx_u(2,k)
54  pones*elemidx_u(3,k)];
55  curoff = curoff + step;
56  end
57  end
58  end
59  /* Create g constraint pattern */
60  M = pgeo.NumNodes;
61  SP = sparse(double(i),double(j),ones(size(i)),M,6*geo.NumNodes+M);
62  /* Reomve BC affected nodes */
63  SP(:,sys.idx_uv_bc_glob) = [];
64  SP = logical(SP);
65 end
66 
67 
68 }
75 };
76 };
A boolean value.