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
evaluate.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 g = models.muscle.Constraint.evaluate(uvwdof,double t) {
21 
22  sys = this.fsys;
23  isproj = ~isempty(this.V);
24  /* If we evaluate inside a projected (reduced) model, reconstruct */
25  if isproj
26  uvwdof = this.V*uvwdof;
27  end
28 
29  /* This should be more correct
30  * unassembled = ~isproj && this.ComputeUnassembled;
31  * unassembled = this.ComputeUnassembled; */
32 
33  /* % Include dirichlet values to state vector */
34  uvwcomplete = sys.includeDirichletValues(t, uvwdof);
35 
36  /* % Evaluate g(u) */
37  sys = this.fsys;
38  mc = sys.Model.Config;
39  fe_pos = mc.FEM;
40  geo = fe_pos.Geometry;
41  fe_press = mc.PressureFEM;
42  pgeo = fe_press.Geometry;
43  elem_idx_u_glob = sys.idx_u_elems_local;
44  elem_idx_p_glob = sys.idx_p_elems_local;
45  unassembled = this.ComputeUnassembled;
46  dofsperelem_p = pgeo.DofsPerElement;
47  num_gp = fe_pos.GaussPointsPerElem;
48  num_elements = geo.NumElements;
49 
50  /* Init result vector dvw */
51  if unassembled
52  g = zeros(this.fDim_unass,1);
53  else
54  g = zeros(pgeo.NumNodes,1);
55  end
56 
57  for m = 1:num_elements
58  elemidx_u = elem_idx_u_glob(:,:,m); /* 1:num_u_glob is all u */
59 
60  elemidx_p = elem_idx_p_glob(:,m);
61 
62  u = uvwcomplete(elemidx_u);
63 
64  integrand_p = zeros(dofsperelem_p,1);
65  for gp = 1:num_gp
66  pos = 3*(gp-1)+1:3*gp;
67  dtn = fe_pos.transgrad(:,pos,m);
68 
69  /* Deformation gradient */
70  F = u * dtn;
71 
72  /* % Assembly part I - sum up contributions from gauss points */
73  weight = fe_pos.GaussWeights(gp) * fe_pos.elem_detjac(m,gp);
74 
75  integrand_p = integrand_p + weight * (det(F)-1) * fe_press.Ngp(:,gp,m);
76  end /* end of gauss point loop */
77 
78 
79  /* % Assembly part II - sum up contributions of elements
80  * Unassembled or assembled? */
81  if unassembled
82  pos = (1:dofsperelem_p) + (m-1) * dofsperelem_p;
83  g(pos) = integrand_p(:);
84  else
85  elemidx_p_out = elemidx_p;
86  g(elemidx_p_out) = g(elemidx_p_out) + integrand_p;
87  end
88  end /* end of element loop */
89 
90 end
91 }
100 };
101 };
#define F(x, y, z)
Definition: CalcMD5.c:168
function fx = evaluate(x, t)
Evaluates the f-approximation. Depending on a possible projection and the CustomProjection-property t...
Definition: ACoreFun.m:296