accu.template
ascii_write_subdomains.m
Go to the documentation of this file.
1 function ascii_write_subdomains( xc, ia, e, basename)
2 %
3 % Saves the 2D triangular mesh in the minimal way (only coordinates, vertex connectivity, minimal boundary edge info)
4 % in an ASCII file.
5 % Matlab indexing is stored (starts with 1).
6 %
7 % The output file format is compatible with Mesh_2d_3_matlab:Mesh_2d_3_matlab(std::string const &fname) in jacobi_oo_stl/geom.h
8 %
9 % IN:
10 % coordinates xc: [2][nnode]
11 % connectivity ia: [4][nelem] with t(4,:) are the subdomain numbers
12 % edges e: [7][nedges] boundary edges
13 % e([1,2],:) - start/end vertex of edge
14 % e([3,4],:) - start/end values
15 % e(5,:) - segment number
16 % e([6,7],:) - left/right subdomain
17 % basename: file name without extension
18 %
19 % Data have been generated via <https://de.mathworks.com/help/pde/ug/initmesh.html initmesh>.
20 %
21 fname = [basename, '_sd.txt'];
22 
24 ndim = int32(size(xc,1));
27 
28 
29 % dlmwrite(fname,nnode,'delimiter','\t','precision',16) % number of nodes
30 % dlmwrite(fname,ndim,'-append','delimiter','\t','precision',16) % space dimension
31 % dlmwrite(fname,nelem,'-append','delimiter','\t','precision',16) % number of elements
32 dlmwrite(fname,nelem,'delimiter','\t','precision',16) % number of elements
33 % dlmwrite(fname,nvert_e,'-append','delimiter','\t','precision',16) % number of vertices per element
34 
35 % % dlmwrite(fname,xc(:),'-append','delimiter','\t','precision',16) % coordinates
36 % dlmwrite(fname,xc([1,2],:).','-append','delimiter','\t','precision',16) % coordinates
37 
38 % subdomain info
39 tmp=int32(ia(4,:));
40 % % dlmwrite(fname,tmp(:),'-append','delimiter','\t','precision',16) % connectivity in Matlab indexing
41 % dlmwrite(fname,tmp(:,:).','-append','delimiter','\t','precision',16) % connectivity in Matlab indexing
42 dlmwrite(fname,tmp(:,:).','-append','delimiter','\t') % connectivity in Matlab indexing
43 
44 % % store only start and end point of boundary edges,
45 % nbedges = size(e,2);
46 % dlmwrite(fname,nbedges,'-append','delimiter','\t','precision',16) % number boundary edges
47 % tmp=int32(e(1:2,:));
48 % % dlmwrite(fname,tmp(:),'-append','delimiter','\t','precision',16) % boundary edges in Matlab indexing
49 % dlmwrite(fname,tmp(:,:).','-append','delimiter','\t','precision',16) % boundary edges in Matlab indexing
50 
51 end
xc
xc
Definition: ascii_read_meshvector.m:30
nnode
function vertex minimal boundary edge info in an ASCII file Matlab indexing is stored(starts with 1). % % The output file format is compatible with Mesh_2d_3_matlab nnode
Definition: ascii_write_subdomains.m:23
ascii_write_subdomains
function ascii_write_subdomains(xc, ia, e, basename) % % Saves the 2D triangular mesh in the minimal way(only coordinates
int32
ia(4,: int32()
nelem
nelem
Definition: ascii_write_subdomains.m:25
tmp
tmp(:,:).'
ndim
ndim
Definition: ascii_write_subdomains.m:24
connectivity
function vertex connectivity
Definition: ascii_write_subdomains.m:3
size
e, 2 size()
txt
id txt()
nvert_e
nvert_e
Definition: ascii_write_subdomains.m:26
dlmwrite
dlmwrite(fname, nnode, 'delimiter','\t', 'precision', 16) % number of nodes % dlmwrite(fname
ia
ia
Definition: ascii_read_meshvector.m:35