%Break in FCM_dV/line 398
%save gs_P gs_w
the_gs_P=gs_points(:,:)';% I*nw x 3
the_gs_w=gs_w(:);% I*nw x 1
save TMP_Bracket_Pw.mat the_gs_P the_gs_w

%

%Break in integrand_fdv_over_S/line 13
load TMP_Bracket_Pw.mat
the_gs_f=fdvMat;
jdnz=the_gs_w~=0;
the_gs_w=the_gs_w(jdnz,:);
the_gs_P=the_gs_P(jdnz,:);
the_gs_f=the_gs_f(jdnz,:);

the_gs_wf=the_gs_f.*the_gs_w;

%
% write NBC

fid = fopen('NNew_Data/NBC.txt', 'wt');
mat = the_gs_P;
for i = 1:size(mat, 1)
    fprintf(fid, '%f\t', mat(i,:));
    fprintf(fid, '\n');
end

% mat = the_norm;
% for i = 1:size(mat, 1)
%     fprintf(fid, '%f\t', mat(i,:));
%     fprintf(fid, '\n');
% end

mat = the_gs_wf;
for i = 1:size(mat, 1)
    fprintf(fid, '%f\t', mat(i,:));
    fprintf(fid, '\n');
end

fclose(fid);