| 1 |
% add path to call Matrix Market routines |
| 2 |
addpath('../MatrixMarket_routines/') |
| 3 |
|
| 4 |
%number of nodes in x direction for each region |
| 5 |
nregion_nodes_x = 4; |
| 6 |
|
| 7 |
%number of nodes in y direction for each region |
| 8 |
nregion_nodes_y = 4; |
| 9 |
|
| 10 |
%number of intervals splitting the x dicretion of the domain |
| 11 |
nintervals_x = 1; |
| 12 |
|
| 13 |
%number of intervals splitting the y direction of the domain |
| 14 |
nintervals_y = 2; |
| 15 |
|
| 16 |
%total number of regions |
| 17 |
nregions = nintervals_x * nintervals_y; |
| 18 |
|
| 19 |
%Output file names |
| 20 |
node_filename = 'node_multiregional.txt'; |
| 21 |
matrix_filename = 'A_multiregional.mm'; |
| 22 |
|
| 23 |
% routine that creates nodes structure and composite stiffness matrix |
| 24 |
[nodes, A] = create_matrix(nregion_nodes_x, nregion_nodes_y, nintervals_x, nintervals_y); |
| 25 |
|
| 26 |
%Writing node data structure and operator into a file |
| 27 |
node_fileID = fopen(node_filename,'w'); |
| 28 |
if ( node_fileID == -1 ) |
| 29 |
error('Cannot open file for output'); |
| 30 |
end; |
| 31 |
fprintf(node_fileID, '%s \n', '%TotalNodes %TotalRegions'); |
| 32 |
fprintf(node_fileID, '%d \t %d\n', size(A,1), nregions); |
| 33 |
fprintf(node_fileID, '%s\n', '%Node %Region'); |
| 34 |
fclose(node_fileID); |
| 35 |
dlmwrite(node_filename, nodes, '-append', 'delimiter', '\t', 'precision', '%8d'); |
| 36 |
|
| 37 |
%Writing the matrix in a file with Matrix Market format |
| 38 |
mmwriteNonOptimized(matrix_filename, A); |
| 39 |
|