jacobi.template
ascii_read_meshvector.m
Go to the documentation of this file.
1 function [ xc, ia, v ] = ascii_read_meshvector( fname )
2 %
3 % Loads the 2D triangular mesh (coordinates, vertex connectivity)
4 % together with values on its vertices from an ASCII file.
5 % Matlab indexing is stored (starts with 1).
6 %
7 % The input file format is compatible
8 % with Mesh_2d_3_matlab:Write_ascii_matlab(..) in jacobi_oo_stl/geom.h
9 %
10 %
11 % IN: fname - filename
12 % OUT: xc - coordinates
13 % ia - mesh connectivity
14 % v - solution vector
15 
16 DELIMETER = ' ';
17 
18 fprintf('Read file %s\n',fname)
19 
20 % Read mesh constants
21 nn = dlmread(fname,DELIMETER,[0 0 0 3]); %% row_1, col_1, row_2, col_2 in C indexing!!!
22 nnode = nn(1);
23 ndim = nn(2);
24 nelem = nn(3);
25 nvert = nn(4);
26 
27 % Read coordinates
28 row_start = 0+1;
30 xc = dlmread(fname,DELIMETER,[row_start 0 row_end ndim-1]);
31 
32 % Read connectivity
33 row_start = row_end+1;
35 ia = dlmread(fname,DELIMETER,[row_start 0 row_end nvert-1]);
36 
37 % Read solution
38 row_start = row_end+1;
40 v = dlmread(fname,DELIMETER,[row_start 0 row_end 0]);
41 end
42 
43 
xc
xc
Definition: ascii_read_meshvector.m:30
row_end
row_end
Definition: ascii_read_meshvector.m:29
end
end
Definition: visualize_par_results.m:9
h
h
Definition: visualize_par_results.m:47
fname
end fname
Definition: visualize_par_results.m:44
connectivity
function vertex connectivity
Definition: ascii_write_mesh.m:3
row_start
Read coordinates row_start
Definition: ascii_read_meshvector.m:28
v
v
Definition: ascii_read_meshvector.m:40
fprintf
fprintf('Read file %s\n', fname) % Read mesh const ants nn
row_2
row_2
Definition: ascii_read_meshvector.m:21
ndim
ndim
Definition: ascii_read_meshvector.m:23
col_1
col_1
Definition: ascii_read_meshvector.m:21
ia
ia
Definition: ascii_read_meshvector.m:35
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_mesh.m:23
nelem
nelem
Definition: ascii_read_meshvector.m:24
nvert
nvert
Definition: ascii_read_meshvector.m:25
row_1
row_1
Definition: ascii_read_meshvector.m:21