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
HexahedronSerendipity.m
Go to the documentation of this file.
1 namespace fem{
2 
3 
4 /* (Autoinserted by mtoc++)
5  * This source code has been filtered by the mtoc++ executable,
6  * which generates code that can be processed by the doxygen documentation tool.
7  *
8  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
9  * Except for the comments, the function bodies of your M-file functions are untouched.
10  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
11  * attached source files that are highly readable by humans.
12  *
13  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
14  * the correct locations in the source code browser.
15  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
16  */
17 
19  :public fem.BaseFEM {
27  public:
28 
30  if nargin < 1
31  geo = fem.geometry.Cube20Node;
32  end
33  this = this@fem.BaseFEM(geo);
34  }
35 
36 
37  function Nx = N(colvec<double> x) {
38  Nx = [(1-x(1,:)).*(1-x(2,:)).*(1-x(3,:)).*(-x(1,:)-x(2,:)-x(3,:)-2)/8;... /* C1 */
39 
40  (1-x(1,:).^2).*(1-x(2,:)).*(1-x(3,:))/4;... /* E2 */
41 
42  (1+x(1,:)).*(1-x(2,:)).*(1-x(3,:)).*(x(1,:)-x(2,:)-x(3,:)-2)/8;... /* C3 */
43 
44  (1-x(2,:).^2).*(1-x(1,:)).*(1-x(3,:))/4;... /* E4 */
45 
46  (1-x(2,:).^2).*(1+x(1,:)).*(1-x(3,:))/4;... /* E5 */
47 
48  (1-x(1,:)).*(1+x(2,:)).*(1-x(3,:)).*(-x(1,:)+x(2,:)-x(3,:)-2)/8;... /* C6 */
49 
50  (1-x(1,:).^2).*(1+x(2,:)).*(1-x(3,:))/4;... /* E7 */
51 
52  (1+x(1,:)).*(1+x(2,:)).*(1-x(3,:)).*(x(1,:)+x(2,:)-x(3,:)-2)/8;... /* C8 */
53 
54  (1-x(3,:).^2).*(1-x(1,:)).*(1-x(2,:))/4;... /* E9 */
55 
56  (1-x(3,:).^2).*(1+x(1,:)).*(1-x(2,:))/4;... /* E10 */
57 
58  (1-x(3,:).^2).*(1-x(1,:)).*(1+x(2,:))/4;... /* E11 */
59 
60  (1-x(3,:).^2).*(1+x(1,:)).*(1+x(2,:))/4;... /* E12 */
61 
62  (1-x(1,:)).*(1-x(2,:)).*(1+x(3,:)).*(-x(1,:)-x(2,:)+x(3,:)-2)/8;... /* C13 */
63 
64  (1-x(1,:).^2).*(1-x(2,:)).*(1+x(3,:))/4;... /* E14 */
65 
66  (1+x(1,:)).*(1-x(2,:)).*(1+x(3,:)).*(x(1,:)-x(2,:)+x(3,:)-2)/8;... /* C15 */
67 
68  (1-x(2,:).^2).*(1-x(1,:)).*(1+x(3,:))/4;... /* E16 */
69 
70  (1-x(2,:).^2).*(1+x(1,:)).*(1+x(3,:))/4;... /* E17 */
71 
72  (1-x(1,:)).*(1+x(2,:)).*(1+x(3,:)).*(-x(1,:)+x(2,:)+x(3,:)-2)/8;... /* C18 */
73 
74  (1-x(1,:).^2).*(1+x(2,:)).*(1+x(3,:))/4;... /* E19 */
75 
76  (1+x(1,:)).*(1+x(2,:)).*(1+x(3,:)).*(x(1,:)+x(2,:)+x(3,:)-2)/8]; /* C20 */
77 
78  }
95  function dNx = gradN(colvec<double> x) {
96  dNx = [[-(1-x(2,:)).*(1-x(3,:)).*(-x(1,:)-x(2,:)-x(3,:)-2)-(1-x(1,:)).*(1-x(2,:)).*(1-x(3,:)) -(1-x(1,:)).*(1-x(3,:)).*(-x(1,:)-x(2,:)-x(3,:)-2)-(1-x(1,:)).*(1-x(2,:)).*(1-x(3,:)) -(1-x(1,:)).*(1-x(2,:)).*(-x(1,:)-x(2,:)-x(3,:)-2)-(1-x(1,:)).*(1-x(2,:)).*(1-x(3,:))]/8;... /* 1 */
97 
98  [-2*x(1,:).*(1-x(2,:)).*(1-x(3,:)) -(1-x(1,:).^2).*(1-x(3,:)) -(1-x(1,:).^2).*(1-x(2,:))]/4;...
99  [(1-x(2,:)).*(1-x(3,:)).*(x(1,:)-x(2,:)-x(3,:)-2)+(1+x(1,:)).*(1-x(2,:)).*(1-x(3,:)) -(1+x(1,:)).*(1-x(3,:)).*(x(1,:)-x(2,:)-x(3,:)-2)-(1+x(1,:)).*(1-x(2,:)).*(1-x(3,:)) -(1+x(1,:)).*(1-x(2,:)).*(x(1,:)-x(2,:)-x(3,:)-2)-(1+x(1,:)).*(1-x(2,:)).*(1-x(3,:))]/8;...
100  [-(1-x(2,:).^2).*(1-x(3,:)) -2*x(2,:).*(1-x(1,:)).*(1-x(3,:)) -(1-x(2,:).^2).*(1-x(1,:))]/4;...
101  [(1-x(2,:).^2).*(1-x(3,:)) -2*x(2,:).*(1+x(1,:)).*(1-x(3,:)) -(1-x(2,:).^2).*(1+x(1,:))]/4;...
102  [-(1+x(2,:)).*(1-x(3,:)).*(-x(1,:)+x(2,:)-x(3,:)-2)-(1-x(1,:)).*(1+x(2,:)).*(1-x(3,:)) (1-x(1,:)).*(1-x(3,:)).*(-x(1,:)+x(2,:)-x(3,:)-2)+(1-x(1,:)).*(1+x(2,:)).*(1-x(3,:)) -(1-x(1,:)).*(1+x(2,:)).*(-x(1,:)+x(2,:)-x(3,:)-2)-(1-x(1,:)).*(1+x(2,:)).*(1-x(3,:))]/8;...
103  [-2*x(1,:).*(1+x(2,:)).*(1-x(3,:)) (1-x(1,:).^2).*(1-x(3,:)) -(1-x(1,:).^2).*(1+x(2,:))]/4;...
104  [(1+x(2,:)).*(1-x(3,:)).*(x(1,:)+x(2,:)-x(3,:)-2)+(1+x(1,:)).*(1+x(2,:)).*(1-x(3,:)) (1+x(1,:)).*(1-x(3,:)).*(x(1,:)+x(2,:)-x(3,:)-2)+(1+x(1,:)).*(1+x(2,:)).*(1-x(3,:)) -(1+x(1,:)).*(1+x(2,:)).*(x(1,:)+x(2,:)-x(3,:)-2)-(1+x(1,:)).*(1+x(2,:)).*(1-x(3,:))]/8;...
105  [-(1-x(3,:).^2).*(1-x(2,:)) -(1-x(3,:).^2).*(1-x(1,:)) -2*x(3,:).*(1-x(1,:)).*(1-x(2,:))]/4;...
106  [(1-x(3,:).^2).*(1-x(2,:)) -(1-x(3,:).^2).*(1+x(1,:)) -2*x(3,:).*(1+x(1,:)).*(1-x(2,:))]/4;... /* E10 */
107 
108 
109  [-(1-x(3,:).^2).*(1+x(2,:)) (1-x(3,:).^2).*(1-x(1,:)) -2*x(3,:).*(1-x(1,:)).*(1+x(2,:))]/4;...
110  [(1-x(3,:).^2).*(1+x(2,:)) (1-x(3,:).^2).*(1+x(1,:)) -2*x(3,:).*(1+x(1,:)).*(1+x(2,:))]/4;...
111  [-(1-x(2,:)).*(1+x(3,:)).*(-x(1,:)-x(2,:)+x(3,:)-2)-(1-x(1,:)).*(1-x(2,:)).*(1+x(3,:)) -(1-x(1,:)).*(1+x(3,:)).*(-x(1,:)-x(2,:)+x(3,:)-2)-(1-x(1,:)).*(1-x(2,:)).*(1+x(3,:)) (1-x(1,:)).*(1-x(2,:)).*(-x(1,:)-x(2,:)+x(3,:)-2)+(1-x(1,:)).*(1-x(2,:)).*(1+x(3,:))]/8;...
112  [-2*x(1,:).*(1-x(2,:)).*(1+x(3,:)) -(1-x(1,:).^2).*(1+x(3,:)) (1-x(1,:).^2).*(1-x(2,:))]/4;...
113  [(1-x(2,:)).*(1+x(3,:)).*(x(1,:)-x(2,:)+x(3,:)-2)+(1+x(1,:)).*(1-x(2,:)).*(1+x(3,:)) -(1+x(1,:)).*(1+x(3,:)).*(x(1,:)-x(2,:)+x(3,:)-2)-(1+x(1,:)).*(1-x(2,:)).*(1+x(3,:)) (1+x(1,:)).*(1-x(2,:)).*(x(1,:)-x(2,:)+x(3,:)-2)+(1+x(1,:)).*(1-x(2,:)).*(1+x(3,:))]/8;...
114  [-(1-x(2,:).^2).*(1+x(3,:)) -2*x(2,:).*(1-x(1,:)).*(1+x(3,:)) (1-x(2,:).^2).*(1-x(1,:))]/4;...
115  [(1-x(2,:).^2).*(1+x(3,:)) -2*x(2,:).*(1+x(1,:)).*(1+x(3,:)) (1-x(2,:).^2).*(1+x(1,:))]/4;...
116  [-(1+x(2,:)).*(1+x(3,:)).*(-x(1,:)+x(2,:)+x(3,:)-2)-(1-x(1,:)).*(1+x(2,:)).*(1+x(3,:)) (1-x(1,:)).*(1+x(3,:)).*(-x(1,:)+x(2,:)+x(3,:)-2)+(1-x(1,:)).*(1+x(2,:)).*(1+x(3,:)) (1-x(1,:)).*(1+x(2,:)).*(-x(1,:)+x(2,:)+x(3,:)-2)+(1-x(1,:)).*(1+x(2,:)).*(1+x(3,:))]/8;...
117  [-2*x(1,:).*(1+x(2,:)).*(1+x(3,:)) (1-x(1,:).^2).*(1+x(3,:)) (1-x(1,:).^2).*(1+x(2,:))]/4;...
118  [(1+x(2,:)).*(1+x(3,:)).*(x(1,:)+x(2,:)+x(3,:)-2)+(1+x(1,:)).*(1+x(2,:)).*(1+x(3,:)) (1+x(1,:)).*(1+x(3,:)).*(x(1,:)+x(2,:)+x(3,:)-2)+(1+x(1,:)).*(1+x(2,:)).*(1+x(3,:)) (1+x(1,:)).*(1+x(2,:)).*(x(1,:)+x(2,:)+x(3,:)-2)+(1+x(1,:)).*(1+x(2,:)).*(1+x(3,:))]/8];
119  }
120 
121 
122  public: /* ( Static ) */
123 
124  static function res = test_QuadraticBasisFun() {
125  q = fem.HexahedronSerendipity;
126  res = fem.BaseFEM.test_BasisFun(q);
127 
128  /* test for correct basis function values on nodes */
129  [X,Y,Z] = ndgrid(-1:1:1,-1:1:1,-1:1:1);
130  p = [X(:) Y(:) Z(:)]^t;
131  /* Remove 7 (inner points not used here) */
132  p(:,[5,11,13,14,15,17,23]) = [];
133  res = res && isequal(q.N(p),eye(20));
134  }
135 
136 
137 
138 };
139 }
140 
141 
142 
FEMBASE Summary of this class goes here Detailed explanation goes here.
Definition: BaseFEM.m:18
static function res = test_QuadraticBasisFun()
#define X(i, j)
Triquatratic: Quadratic ansatz functions on cube with 20 nodes per cube.
function Nx = N(colvec< double > x)
Triquadratic basis functions.
function dNx = gradN(colvec< double > x)
#define Y(i, j)