rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
merge_alu3d_hexa.m
1 function Mmerge = merge_alu3d_hexa(M1,M2);
2 %function Mmerge = merge_alu3d_hexa(M1,M2);
3 %
4 % function performing a merging of two alugrid3d hexa meshes. Assuming
5 % that they are non-overlapping, i.e. no domain-check is performed, but simple
6 % index-shift
7 
8 % Bernard Haasdonk 13.3.2006
9 
10  clear('Mmerge');
11  Mmerge.num_vertices = M1.num_vertices + M2.num_vertices;
12  Mmerge.vertices = [ M1.vertices, M2.vertices];
13  Mmerge.num_elements = M1.num_elements + M2.num_elements;
14  % perform index-shift in element-description for second mesh:
15  Mmerge.elements = [ M1.elements, M2.elements + M1.num_vertices];
16  Mmerge.num_faces = M1.num_faces + M2.num_faces;
17  % perform index-shift in boundary vertex indices for second mesh:
18  M2faces_shifted = M2.faces + ...
19  repmat([0 0 1 1 1 1]'*M1.num_vertices,1,M2.num_faces);
20  Mmerge.faces = [ M1.faces, M2faces_shifted];
21 
22 
23 
24 
25 
26 % TO BE ADJUSTED TO NEW SYNTAX
27 %| \docupdate