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
Cube8Node.m
Go to the documentation of this file.
1 namespace fem{
2 namespace geometry{
3 
4 
5 /* (Autoinserted by mtoc++)
6  * This source code has been filtered by the mtoc++ executable,
7  * which generates code that can be processed by the doxygen documentation tool.
8  *
9  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
10  * Except for the comments, the function bodies of your M-file functions are untouched.
11  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
12  * attached source files that are highly readable by humans.
13  *
14  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
15  * the correct locations in the source code browser.
16  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
17  */
18 
19 class Cube8Node
35  public:
36 
37 
38  Cube8Node(pts,cubes) {
39  if nargin < 2
40  this = fem.geometry.RegularHex8Grid;
41  return;
42  elseif size(unique(pts" , "rows^t),1) ~= size(pts,2);
43  error(" Please provide unique points! ");
44  end
45  this.Nodes= pts;
46  this.Elements= cubes;
47  this.DofsPerElement= 8;
48 
49  /* % Compute edges */
50  e = int16.empty(0,2);
51  for i=1:size(cubes,1)
52  hlp = cubes(i,[1 2 1 3 1 5 3 4 2 4 4 8 3 7 ...
53  8 7 5 7 6 2 6 5 6 8]);
54  e(end+1:end+12,:) = reshape(hlp" ,2,[]) ";
55  end
56  e = unique(e," rows "," stable ");
57  this.Edges= e;
58 
59  /* % Set Face indices */
60  this.MasterFaces= [1 3 5 7
61  2 4 6 8
62  1 2 5 6
63  3 4 7 8
64  1 2 3 4
65  5 6 7 8];
66  this.PatchFacesIdx= [1 3 7 5
67  2 4 8 6
68  1 2 6 5
69  3 4 8 7
70  1 2 4 3
71  5 6 8 7];
72  this.PatchesPerFace= 1;
73  this.Faces= this.computeFaces;
74 
75  /* Sanity checks */
76  this.ReverseAxesIndices= [2 1 4 3 6 5 8 7
77  3 4 1 2 7 8 5 6
78  5:8 1:4];
79  this.OrientationCheckIndices(:,:,1) = [1 2; 3 4; 5 6; 7 8];
80  this.OrientationCheckIndices(:,:,2) = [1 3; 2 4; 5 7; 6 8];
81  this.OrientationCheckIndices(:,:,3) = [1 5; 2 6; 3 7; 4 8];
82  this.checkOrientation;
83  }
84 
85 
86  function cube20 = toCube20Node() {
87  elems8 = this.Elements;
88  nodes8 = this.Nodes;
89  nc = size(elems8,1);
90  /* Transformation matrix for corners to corner+edges locations */
91  i = [1 2 2 3 4 4 5 5 6 7 7 8 9 9 10 10 11 11 12 12 13 14 14 15 16 16 17 17 18 19 19 20];
92  j = [1 1 2 2 1 3 2 4 3 3 4 4 1 5 2 6 3 7 4 8 5 5 6 6 5 7 6 8 7 7 8 8];
93  s = [1 .5 .5 1 .5 .5 .5 .5 1 .5 .5 1 .5 .5 .5 .5 .5 .5 .5 .5 1 .5 .5 1 .5 .5 .5 .5 1 .5 .5 1];
94  T = sparse(i,j,s,20,8);
95  nodes20 = zeros(3,nc*20);
96 
97  /* Iterate all cubes and collect nodes */
98  for cidx = 1:nc
99  pos = 20*(cidx-1)+1:20*cidx;
100  cube = elems8(cidx,:);
101  nodes20(:,pos) = nodes8(:,cube)*T^t;
102  end
103  [nodes20, ~, elems20] = unique(nodes20" , "rows" , "stable^t);
104  cube20 = fem.geometry.Cube20Node(nodes20" ,reshape(elems20,20,[]) ");
105  }
114  function cube27 = toCube27Node() {
115  elems8 = this.Elements;
116  nodes8 = this.Nodes;
117  nc = size(elems8,1);
118  h = .5;
119  v = .25;
120  /* Transformation matrix for corners to corner+edges locations
121  * Nodes 1-13 */
122  i = [1 2 2 3 4 4 5 5 5 5 6 6 7 8 8 9 10 10 11 11 11 11 12 12 13 13 13 13];
123  j = [1 1 2 2 1 3 1 2 3 4 2 4 3 3 4 4 1 5 1 2 5 6 2 6 1 3 5 7];
124  s = [1 h h 1 h h v v v v h h 1 h h 1 .5 .5 v v v v .5 .5 v v v v];
125  /* Node 14 */
126  i = [i ones(1,8)*14];
127  j = [j 1:8];
128  s = [s ones(1,8)/8];
129  /* Nodes 15-27 */
130  i = [i 15 15 15 15 16 16 17 17 17 17 18 18 19 20 20 21 22 22 23 23 23 23 24 24 25 26 26 27];
131  j = [j 2 4 6 8 3 7 3 4 7 8 4 8 5 5 6 6 5 7 5 6 7 8 6 8 7 7 8 8];
132  s = [s v v v v h h v v v v h h 1 h h 1 .5 .5 v v v v .5 .5 1 h h 1];
133  T = sparse(i,j,s,27,8);
134  nodes27 = zeros(3,nc*27);
135 
136  /* Iterate all cubes and collect nodes */
137  for cidx = 1:nc
138  pos = 27*(cidx-1)+1:27*cidx;
139  cube = elems8(cidx,:);
140  nodes27(:,pos) = nodes8(:,cube)*T^t;
141  end
142  [nodes27, ~, elems27] = unique(nodes27" , "rows" , "stable^t);
143  cube27 = fem.geometry.Cube27Node(nodes27" ,reshape(elems27,27,[]) ");
144  }
154 };
155 }
156 }
157 
function cube20 = toCube20Node()
Creates a 20 node cube geometry from this 8 node cube geometry by linear interpolation between corner...
Definition: Cube8Node.m:86
Elements
m x p index vector for all p nodes of m elements
Definition: BaseGeometry.m:41
% Cube indexing: /7—8 1: (-1,-1,-1) 5-+-6/| 2: ( 1,-1,-1) | 3-+-4 3: (-1, 1,-1) 1—2/ 4: ( 1...
Definition: Cube8Node.m:19
Nodes
n x 3 position vector of nodes
Definition: BaseGeometry.m:30
PatchFacesIdx
The indices of the nodes suitable for creating a patch surface object.
Definition: BaseGeometry.m:69
reshape
hanges the dimensions of the handle object array to the specified dimensions. See the MATLAB reshape ...
function cube27 = toCube27Node()
Creates a 20 node cube geometry from this 8 node cube geometry by linear interpolation between corner...
Definition: Cube8Node.m:114
Edges
2 x k index vector for edges between two points
Definition: BaseGeometry.m:52
function faces = computeFaces()
Computes the outward faces of this fem.geometry.
Definition: BaseGeometry.m:378
Cube8Node(pts, cubes)
Definition: Cube8Node.m:38
Faces
A 2 x N_F vector containing the element number in the first row and the face number on that element i...
Definition: BaseGeometry.m:83