function create_tables()

num_nodes = 3;

param = repmat([3 10],num_nodes,1);
save_param_to_file(param,'param.dat');

in_a = repmat([0 0 1.0],num_nodes,1);
save_to_file(in_a,'in_a.dat');

in_b = repmat([0 0 -1/4 0 1 1.0],num_nodes,1);
save_to_file(in_b,'in_b.dat');

in_c = repmat([0 2 1.0 1 2 0.02],num_nodes,1);
save_to_file(in_c,'in_c.dat');

out = zeros(num_nodes,3);
for i = 1:num_nodes
   out(i,:) = [i-1 i-1 1.0];
end
save_to_file(out,'out.dat');


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function save_to_file(data,filename)

fp = fopen(filename,'w');

[m,n] = size(data);

if (mod(n,3) ~= 0)
    disp('error:  need 3*N columns, where N is an integer');
    return;
end

for i = 1:m
   for j = 1:3:n
      fprintf(fp,'%d %d %5.3e ',data(i,j),data(i,j+1),data(i,j+2));
   end
   fprintf(fp,'\n');
end

fclose(fp);


function save_param_to_file(data,filename)

fp = fopen(filename,'w');

[m,n] = size(data);

for i = 1:m
   for j = 1:n
      fprintf(fp,'%5.3e ',data(i,j));
   end
   fprintf(fp,'\n');
end

fclose(fp);
