accu.template
Loading...
Searching...
No Matches
ascii_read_meshvector.m
Go to the documentation of this file.
1function [ 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
16DELIMETER = ' ';
17
18fprintf('Read file %s\n',fname)
19
20% Read mesh constants
21nn = dlmread(fname,DELIMETER,[0 0 0 3]); %% row_1, col_1, row_2, col_2 in C indexing!!!
22nnode = nn(1);
23ndim = nn(2);
24nelem = nn(3);
25nvert = nn(4);
26
27% Read coordinates
30xc = dlmread(fname,DELIMETER,[row_start 0 row_end ndim-1]);
31
32% Read connectivity
35ia = dlmread(fname,DELIMETER,[row_start 0 row_end nvert-1]);
36
37% Read solution
40v = dlmread(fname,DELIMETER,[row_start 0 row_end 0]);
41end
42
43
fprintf('Read file %s\n', fname) % Read mesh const ants nn
Read coordinates row_start
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
function vertex connectivity