34 #define D_INIT_VALUE -9999.0
56 for (r=lmap->
nrl;r<=lmap->nrh;r++){
57 for (c=lmap->
ncl;c<=lmap->nch;c++)
58 if (lmap->element[r][c]==novalue) {
59 M->element[r][c]=dnovalue;
61 M->element[r][c]=(double)lmap->element[r][c];
80 long j,i,l,kl,kp,kbond;
83 if (grid->
polygons->
nh!=v->
nh) printf (
"Error in interpolete_volume2lines v (quantity vector) size (%ld) is not equal to the numbers of polygons (%ld) !! \n",v->
nh,grid->
polygons->
nh);
87 for (j=ve->
nl;j<=ve->nh;j++) {
91 for (i=v->
nl;i<=v->nh;i++) {
96 if (ve->element[kl]==
D_INIT_VALUE) ve->element[kl]=v->element[i];
98 if (ve->element[kl]==
D_INIT_VALUE) ve->element[kl]=(v->element[i]+v->element[kp])/2.0;
102 for (j=ve->
nl;j<=ve->nh;j++) {
103 if (ve->element[j]==
D_INIT_VALUE) printf (
"Error in interpolete_volume2lines v (quantity vector) (%ld) at position %ld was not well initialized!! \n",ve->
nh,j);
130 for (r=lmap->
nrl;r<=lmap->nrh;r++){
131 for (c=lmap->
ncl;c<=lmap->nch;c++) {
132 if ((lmap->element[r][c]==novalue) || (r==lmap->
nrl) || (r==lmap->
nrh) || (c==lmap->
ncl) || (c==lmap->
nrh)) {
133 M->element[r][c]=dnovalue;
134 }
else if ((Msource->element[r][c]!=dnovalue) && (Msource->element[r+dr][c+dc])!=dnovalue){
135 M->element[r][c]=(Msource->element[r][c]+Msource->element[r+dr][c+dc])/2.0;
137 }
else if ((Msource->element[r][c]==dnovalue) && (Msource->element[r+dr][c+dc]!=dnovalue)){
138 M->element[r][c]=Msource->element[r+dr][c+dc];
140 }
else if ((Msource->element[r][c]!=dnovalue) && (Msource->element[r+dr][c+dc]==dnovalue)) {
141 M->element[r][c]=Msource->element[r][c];
144 printf(
"Error 1 in get_doublemap_spav no value : address[%ld][%ld]=%ld and ref_map[%ld][%ld]=%lf ref_map[%ld][%ld]=%lf \n",r,c,lmap->element[r][c],r,c,Msource->element[r][c],r+dr,c+dc,Msource->element[r+dr][c+dc]);
150 for (r=M->
nrl;r<=M->nrh;r++){
151 for (c=M->
ncl;c<=M->nch;c++){
152 if ((lmap->element[r][c]==novalue) && (M->element[r][c]==dnovalue)) {
153 }
else if ((lmap->element[r][c]==novalue) || (M->element[r][c]==dnovalue)) {
154 printf(
"Error 2 in get_doublemap_spav no value : (row=%ld col=%ld) address[%ld][%ld]=%ld and ref_map[%ld][%ld]=%lf ref_map[%ld][%ld]=%lf map[%ld][%ld]=%lf\n",M->
nrh,M->
nch,r,c,lmap->element[r][c],r,c,Msource->element[r][c],r+dr,c+dc,Msource->element[r+dr][c+dc],r,c,M->element[r][c]);
184 printf (
"0) function get_doublevector_for_lines (novalue=%lf)\n",novalue);
186 n_horizontal=v_horizontal->
nh;
187 printf (
"1) function get_doublevector_for_lines n_horizontal=%ld \n",n_horizontal);
188 for (r=v_addresses->
nrl;r<=v_addresses->nrh;r++) {
189 for(c=v_addresses->
ncl;c<=v_addresses->nch;c++) {
190 if (mh->element[r][c]!=novalue) v_addresses->element[r][c]=v_addresses->element[r][c]-n_horizontal;
197 for (j=v->
nl;j<=n_horizontal;j++) {
198 v->element[j]=v_horizontal->element[j];
200 for (j=n_horizontal+1;j<=v->
nh;j++) {
201 v->element[j]=v_vertical->element[j-n_horizontal];
204 for (r=v_addresses->
nrl;r<=v_addresses->nrh;r++) {
205 for(c=v_addresses->
ncl;r<=v_addresses->nch;c++) {
206 if (mh->element[r][c]!=novalue) v_addresses->element[r][c]=v_addresses->element[r][c]+n_horizontal;
213 printf (
"function get_doublevector_for_lines n_lines=%ld n_horizontal=%ld \n",v->
nh,n_horizontal);
248 for(r=indices->
nrl;r<=indices->nrh;r++){
249 for(c=indices->
ncl;c<=indices->nch;c++){
250 indices->element[r][c]=indices->element[r][c]-n0;
254 write_map(filename,float_type,map_format,M,UVref);
256 for(r=indices->
nrl;r<=indices->nrh;r++){
257 for(c=indices->
ncl;c<=indices->nch;c++){
258 indices->element[r][c]=indices->element[r][c]+n0;
289 char *filename_h=
join_strings(filename,
"_horizontal_lines");
290 char *filename_v=
join_strings(filename,
"_vertical_lines");
296 for (i=v_horizontal->
nl;i<=v_horizontal->nh;i++) {
297 v_horizontal->element[i]=v->element[i];
300 for (i=v_vertical->
nl;i<=v_vertical->nh;i++) {
301 v_vertical->element[i]=v->element[i+v_horizontal->
nh];
344 for (i=v->
nl;i<=v->nh;i++) {
345 v->element[i]=(double)i;
347 write_line_map(filename,v,n_horizontal,UVref,indices_h,indices_v,Mref_h,Mref_v,float_type,map_format);
370 for (i=v->
nl;i<=v->nh;i++){
371 v->element[i]=(double)i;
386 for(i=v->
nl;i<=v->nh;i++){
400 if ((M1->
nrh!=L1->
nrh) || (M1->
nch!=L1->
nch)) printf(
"Error:: in check_matrices [%ld,%ld] and M [%ld,%ld] has different sizes! \n",L1->
nrh,L1->
nch,M1->
nrh,M1->
nch);
402 for (r=M1->
nrl;r<=M1->nrh;r++) {
403 for (c=M1->
ncl;c<=M1->nch;c++) {
404 if ((M1->element[r][c]==dnull) && (L1->element[r][c]==lnull)) {
405 }
else if ((M1->element[r][c]==dnull) || (L1->element[r][c]==lnull)) {
406 printf (
"Error Function check_matrices: dmatrix and lomatrix [%ld,%ld] have different values %lf and %ld!! \n",r,c,M1->element[r][c],L1->element[r][c]);
407 printf(
"Neighnourg ponts: dmatrix[%ld][%ld]=%lf and dmatrix[%ld][%ld]=%lf\n",r-1,c,M1->element[r-1][c],r,c-1,M1->element[r][c-1]);
412 if (print==1) printf(
"Function check matrix Exit %d\n",s);
429 double error_v=-9999.0;
430 if ((k<v->nl) || (k>v->
nh)) {
431 printf(
"Warning in function in get_value_from_doublevector: value %ld execeeds the size of the vector %ld %ld, function returns %lf ! \n",k,v->
nl,v->
nh,error_v);
434 return v->element[k];
436 printf(
"Error in function in get_value_from_doublevector: value %ld (between %ld %ld) is not read correctly, function returns %lf ! \n",k,v->
nl,v->
nh,error_v);
447 char *function_name=
"write_doublevector_in_ft_format";
452 fprintf(fd,
"index{1} \n");
455 fprintf(fd,
"1: double array STANDARD_NAME {\n");
456 for (l=v->
nl;l<v->nh;l++) {
457 fprintf(fd,
"%le, \n",v->element[l]);
459 fprintf(fd,
"%le} \n",v->element[v->
nh]);
477 char *function_name=
"read_doublevector_from_a_ft_format_single_file";
478 fd=fopen(filename,
"r");
481 printf(
"Waring in %s: velocity file is missing",function_name);