00001 #include <string.h>
00002 #include <stdlib.h>
00003 #include "outdrivert.h"
00004 #include "intools.h"
00005 #include "galias.h"
00006 #include "globalt.h"
00007 #include "probdesct.h"
00008 #include "transbclc.h"
00009 #include "transtop.h"
00010 #include "transprint.h"
00011 #include "nodet.h"
00012 #include "elementt.h"
00013 #include "globmatt.h"
00014 #include "intpointst.h"
00015 #include <math.h>
00016
00017 static int prunkn = 15;
00018 static int prgrad = 15;
00019 static int prflux = 15;
00020 static int proth = 15;
00021 static int preqoth = 15;
00022
00023
00024
00025
00026
00027 outdrivert::outdrivert()
00028 {
00029 memset(outfn, 0, sizeof(*outfn)*FNAMELEN);
00030 memset(outdiagfn, 0, sizeof(*outdiagfn)*FNAMELEN);
00031 memset(outgrfn, 0, sizeof(*outgrfn)*FNAMELEN);
00032 outf = outgr = NULL;
00033 outdiagf = NULL;
00034 textout = off;
00035 nlcs = 0;
00036 nclcs = NULL;
00037 bvlcs = NULL;
00038 gf = grftt_no;
00039 ncut = 0;
00040 idn1 = 1;
00041 ide1 = 1;
00042 ndiag = 0;
00043 odiag = NULL;
00044 vtk_num = 0;
00045 }
00046
00047
00048
00049
00050
00051
00052 outdrivert::~outdrivert()
00053 {
00054 long i;
00055
00056 delete [] outdiagf;
00057 delete [] nclcs;
00058 for (i=0; i<nlcs; i++)
00059 delete [] bvlcs[i];
00060 delete [] odiag;
00061 }
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078 long outdrivert::read(XFILE *in)
00079 {
00080 long i;
00081 char *str;
00082
00083
00084 xfscanf(in, "%k%m", "textout", &flagsw_kwdset, &textout);
00085 if (textout)
00086 {
00087 if (xfscanf(in," %a", outfn) != 1)
00088 {
00089 fprintf(stderr, "\n\nError reading filename for output\n");
00090 fprintf(stderr, " function outdrivert::read (file %s, line %d)\n", __FILE__, __LINE__);
00091 return 1;
00092 }
00093 fprintf(stdout, "\n Output file name (transport): %s", outfn);
00094
00095 if (no.read(in))
00096 return 2;
00097 if (no.dstep.st == sel_no)
00098 str = " not";
00099 else
00100 str = "";
00101 fprintf(stdout, "\n Output of transport nodal values will%s be performed", str);
00102
00103 if (eo.read(in))
00104 return 3;
00105 if (eo.dstep.st == sel_no)
00106 str = " not";
00107 else
00108 str = "";
00109 fprintf(stdout, "\n Output of transport element values will%s be performed", str);
00110
00111 xfscanf(in, "%k", "user_defined_points");
00112 if (po.read(in))
00113 return 4;
00114 if (po.dstep.st == sel_no)
00115 str = " not";
00116 else
00117 str = "";
00118 fprintf(stdout, "\n Output of transport UDP values will%s be performed", str);
00119 }
00120
00121
00122
00123 if (xfscanf(in, "%k%m", "outgr_format", &graphftt_kwdset, (int *)&gf) != 2)
00124 {
00125 fprintf(stderr, "\n\nError reading type of grahics output\n");
00126 fprintf(stderr, " function outdrivert::read (file %s, line %d)\n", __FILE__, __LINE__);
00127 return 5;
00128 }
00129
00130 if (gf == grftt_open_dx)
00131 {
00132 Tp->gradcomp = 1;
00133 Tp->gradpos = 2;
00134 Tp->gradaver = 1;
00135 Tp->fluxcomp = 1;
00136 Tp->fluxpos = 2;
00137 Tp->fluxaver = 1;
00138 Tp->othercomp = 1;
00139 Tp->otherpos = 2;
00140 Tp->otheraver = 1;
00141 Tp->eqothercomp = 1;
00142 Tp->eqotherpos = 2;
00143 Tp->eqotheraver = 1;
00144 }
00145
00146 if (gf != grftt_no)
00147 {
00148 if (xfscanf(in, " %a", outgrfn) != 1)
00149 {
00150 fprintf(stderr, "\n\nError reading filename for graphics output\n");
00151 fprintf(stderr, " function outdrivert::read (file %s, line %d)\n", __FILE__, __LINE__);
00152 return 5;
00153 }
00154 }
00155
00156 if (Mesprt)
00157 {
00158 switch (gf)
00159 {
00160 case grftt_no:
00161 fprintf(stdout, "\n Graphic output will not be performed");
00162 break;
00163 case grftt_open_dx:
00164 fprintf(stdout, "\n Graphic output will be in OpenDX format");
00165 fprintf(stdout, "\n Filename of graphic output : %s", outgrfn);
00166 break;
00167 case grftt_femcad:
00168 fprintf(stdout, "\n Graphic output will be in FemCAD format");
00169 fprintf(stdout, "\n Filename of graphic output : %s", outgrfn);
00170 break;
00171 case grftt_gid:
00172 fprintf(stdout, "\n Graphic output will be in GiD format");
00173 fprintf(stdout, "\n Filename of graphic output : %s", outgrfn);
00174 break;
00175 case grftt_gid_sep:
00176 fprintf(stdout, "\n Graphic output will be in GiD format separated to quantities");
00177 fprintf(stdout, "\n Filename of graphic output : %s", outgrfn);
00178 break;
00179 case grftt_vtk:
00180 fprintf(stdout, "\n Graphic output will be in VTK format");
00181 fprintf(stdout, "\n Filename of graphic output : %s", outgrfn);
00182 break;
00183 }
00184 }
00185
00186 if (gf != grftt_no)
00187 {
00188 if (nog.read(in))
00189 return 6;
00190 if (nog.dstep.st == sel_no)
00191 str = " not";
00192 else
00193 str = "";
00194 if (Mesprt)
00195 fprintf(stdout, "\n Graphical output of transport nodal values will%s be performed", str);
00196
00197 if (eog.read(in))
00198 return 7;
00199 if (eog.dstep.st == sel_no)
00200 str = " not";
00201 else
00202 str = "";
00203 if (Mesprt)
00204 fprintf(stdout, "\n Graphical output of transport element values will%s be performed", str);
00205 }
00206
00207
00208 switch (Tp->tprob)
00209 {
00210 case nonstationary_problem:
00211 case nonlinear_nonstationary_problem:
00212 case discont_nonstat_problem:
00213 case discont_nonlin_nonstat_problem:
00214 case growing_np_problem:
00215 case growing_np_problem_nonlin:
00216 if (xfscanf(in, "%k%ld", "numdiag", &ndiag) != 2)
00217 {
00218 fprintf(stderr, "\n\nError reading number of diagrams\n");
00219 fprintf(stderr, " function outdrivert::read (file %s, line %d)\n", __FILE__, __LINE__);
00220 return 8;
00221 }
00222 if (ndiag == 0)
00223 {
00224 if (Mesprt)
00225 fprintf (stdout, "\n Number of diagrams : %ld", ndiag);
00226 return 0;
00227 }
00228 if (xfscanf(in, " %a", outdiagfn) != 1)
00229 {
00230 fprintf(stderr, "\n\nError reading filename for diagrams\n");
00231 fprintf(stderr, " function outdrivert::read (file %s, line %d)\n", __FILE__, __LINE__);
00232 return 9;
00233 }
00234 if (Mesprt)
00235 {
00236 fprintf (stdout, "\n Number of diagrams : %ld", ndiag);
00237 fprintf (stdout, "\n Diagram filename : %s",outdiagfn);
00238 }
00239 odiag = new outdiagt[ndiag];
00240 outdiagf = new FILE* [ndiag];
00241 memset(outdiagf, 0, sizeof(*outdiagf)*ndiag);
00242 for (i=0; i<ndiag; i++)
00243 {
00244 if (odiag[i].read(in))
00245 return 8;
00246 }
00247 break;
00248 default:
00249 break;
00250 }
00251 return 0;
00252 }
00253
00254
00255
00256
00257
00258
00259
00260 void outdrivert::print(FILE *out)
00261 {
00262 long i;
00263
00264 fprintf(out, "\n\n#\n# outdriver section\n#\n");
00265 fprintf(out, "%d\n", (int)textout);
00266
00267 if (textout == on){
00268 fprintf(out, "\n%s\n", outfn);
00269 no.print(out);
00270 eo.print(out);
00271 po.print(out);
00272 }
00273
00274 fprintf(out, "%d\n", (int)gf);
00275 if (gf != grftt_no){
00276 fprintf(out, "%s\n", outgrfn);
00277 nog.print(out);
00278 eog.print(out);
00279 }
00280
00281 switch (Tp->tprob)
00282 {
00283 case nonstationary_problem:
00284 case nonlinear_nonstationary_problem:
00285 case discont_nonstat_problem:
00286 case discont_nonlin_nonstat_problem:
00287 case growing_np_problem:
00288 case growing_np_problem_nonlin:
00289 fprintf(out, "%ld\n", ndiag);
00290 if (ndiag == 0)
00291 break;
00292 fprintf(out, "%s\n", outdiagfn);
00293 for (i=0; i<ndiag; i++)
00294 odiag[i].print(out);
00295 break;
00296 default:
00297 break;
00298 }
00299 }
00300
00301
00302
00303
00304
00305
00306
00307 void outdrivert::print_header(FILE *out)
00308 {
00309 fprintf(out, "%15s **** * **** **** *\n", " ");
00310 fprintf(out, "%15s * * * * *\n", " ");
00311 fprintf(out, "%15s * * *** *** *\n", " ");
00312 fprintf(out, "%15s * * * * *\n", " ");
00313 fprintf(out, "%15s**** * * **** **** TRFEL OUTPUT\n", " ");
00314
00315 fprintf(out, "\n%s\n", Tp->name);
00316 fprintf(out, "\n\n\n\n\n");
00317 }
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329 void outdrivert::print_newstep(FILE *out, long lcid, long istep, double time)
00330 {
00331 long i;
00332 double lambda;
00333
00334 if (textout == on)
00335 {
00336
00337 switch (Tp->tprt)
00338 {
00339 case secondst:
00340 lambda = time;
00341 break;
00342 case minutest:
00343 lambda = time/60.0;
00344 break;
00345 case hourst:
00346 lambda = time/3600.0;
00347 break;
00348 case dayst:
00349 lambda = time/86400.0;
00350 break;
00351 default:
00352 {
00353 print_err("unknown type of time printing",__FILE__,__LINE__,__func__);
00354 }
00355 }
00356
00357 if (no.dstep.presence_id(istep, time, Tp->timecont) ||
00358 eo.dstep.presence_id(istep, time, Tp->timecont) ||
00359 po.dstep.presence_id(istep, time, Tp->timecont))
00360 {
00361 for (i=0; i<53; i++)
00362 fprintf(out, "*");
00363 fprintf(out, "\n%10sStep number=% ld, time/load step=% g\n", " ", istep, lambda);
00364 for (i=0; i<53; i++)
00365 fprintf(out, "*");
00366 fprintf(out, "\n\n\n\n");
00367 }
00368 }
00369 }
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381 void outdrivert::print_out(FILE *out, long lcid, long istep, double time)
00382 {
00383 if (textout == on)
00384 {
00385 if (no.dstep.presence_id(istep, time, Tp->timecont))
00386 no.print_out(out, lcid);
00387 if (eo.dstep.presence_id(istep, time, Tp->timecont))
00388 eo.print_out(out, lcid);
00389 if (po.dstep.presence_id(istep, time, Tp->timecont))
00390 po.print_out(out, lcid);
00391 }
00392 }
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407 void outdrivert::print_out_forced(FILE *out, long lcid, long istep, double time)
00408 {
00409 if (textout == on)
00410 {
00411 no.print_out(out, lcid);
00412 eo.print_out(out, lcid);
00413 po.print_out(out, lcid);
00414 }
00415 }
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428 void outdrivert::print_diags(long lcid, double lambda, long istep, double *fi)
00429 {
00430 long i;
00431 for(i=0; i<ndiag; i++)
00432 odiag[i].printval(outdiagf[i], lcid, lambda, istep, fi);
00433 }
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447 void outdrivert::print_diags_forced(long lcid, double lambda, long istep, double *fi)
00448 {
00449 long i;
00450 for(i=0; i<ndiag; i++)
00451 odiag[i].printval_forced(outdiagf[i], lcid, lambda, istep, fi);
00452 }
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466 void outdrivert::print_graphics(FILE *out, long lcid, double lambda, long istep, double *fi)
00467 {
00468 long i;
00469 char dlcid[50];
00470
00471
00472 switch (gf)
00473 {
00474 case grftt_no:
00475 break;;
00476 case grftt_femcad:
00477 break;
00478 case grftt_open_dx:
00479 {
00480 for (i=0; i<1; i++)
00481 {
00482
00483
00484 }
00485 break;
00486 }
00487 case grftt_gid:
00488 {
00489 if ((nog.dstep.presence_id(istep, lambda, Tp->timecont)))
00490 {
00491 if (Tp->tprob == stationary_problem)
00492 sprintf(dlcid, "%ld", istep);
00493 else{
00494
00495 switch (Tp->tprt)
00496 {
00497 case secondst:
00498 sprintf(dlcid, "%e", lambda);
00499 break;
00500 case minutest:
00501 sprintf(dlcid, "%e", lambda/60.0);
00502 break;
00503 case hourst:
00504 sprintf(dlcid, "%e", lambda/3600.0);
00505 break;
00506 case dayst:
00507 sprintf(dlcid, "%e", lambda/86400.0);
00508 break;
00509 default:
00510 {
00511 print_err("unknown type of time printing",__FILE__,__LINE__,__func__);
00512 }
00513 }
00514
00515 }
00516 nog.print_graphics(out, lcid, dlcid, gf, fi);
00517 }
00518
00519 if ((eog.dstep.presence_id(istep, lambda, Tp->timecont)))
00520 {
00521 if (Tp->tprob == stationary_problem)
00522 sprintf(dlcid, "%ld", istep);
00523 else{
00524
00525 switch (Tp->tprt)
00526 {
00527 case secondst:
00528 sprintf(dlcid, "%e", lambda);
00529 break;
00530 case minutest:
00531 sprintf(dlcid, "%e", lambda/60.0);
00532 break;
00533 case hourst:
00534 sprintf(dlcid, "%e", lambda/3600.0);
00535 break;
00536 case dayst:
00537 sprintf(dlcid, "%e", lambda/86400.0);
00538 break;
00539 default:
00540 {
00541 print_err("unknown type of time printing",__FILE__,__LINE__,__func__);
00542 }
00543 }
00544
00545 }
00546 eog.print_graphics(out, lcid, dlcid, gf, ide1);
00547 }
00548 break;
00549 }
00550 case grftt_gid_sep:
00551 {
00552 if ((nog.dstep.presence_id(istep, lambda, Tp->timecont)))
00553 {
00554 if (Tp->tprob == stationary_problem)
00555 sprintf(dlcid, "%ld", istep);
00556 else{
00557
00558 switch (Tp->tprt)
00559 {
00560 case secondst:
00561 sprintf(dlcid, "%e", lambda);
00562 break;
00563 case minutest:
00564 sprintf(dlcid, "%e", lambda/60.0);
00565 break;
00566 case hourst:
00567 sprintf(dlcid, "%e", lambda/3600.0);
00568 break;
00569 case dayst:
00570 sprintf(dlcid, "%e", lambda/86400.0);
00571 break;
00572 default:
00573 {
00574 print_err("unknown type of time printing",__FILE__,__LINE__,__func__);
00575 }
00576 }
00577
00578 }
00579 nog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, fi, hf_off);
00580 }
00581 if ((eog.dstep.presence_id(istep, lambda, Tp->timecont)))
00582 {
00583 if (Tp->tprob == stationary_problem)
00584 sprintf(dlcid, "%ld", istep);
00585 else{
00586
00587 switch (Tp->tprt)
00588 {
00589 case secondst:
00590 sprintf(dlcid, "%e", lambda);
00591 break;
00592 case minutest:
00593 sprintf(dlcid, "%e", lambda/60.0);
00594 break;
00595 case hourst:
00596 sprintf(dlcid, "%e", lambda/3600.0);
00597 break;
00598 case dayst:
00599 sprintf(dlcid, "%e", lambda/86400.0);
00600 break;
00601 default:
00602 {
00603 print_err("unknown type of time printing",__FILE__,__LINE__,__func__);
00604 }
00605 }
00606
00607 }
00608 eog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, hf_off, ide1);
00609 }
00610 break;
00611 }
00612 case grftt_vtk:
00613 {
00614 if (nog.dstep.presence_id(istep, lambda, Tp->timecont))
00615 {
00616 char fname[FNAMELEN+70];
00617 FILE *vtk_file;
00618 char *path;
00619 char *name;
00620 char *suffix;
00621
00622 filename_decomposition(outgrfn,path,name,suffix);
00623 sprintf(fname,"%s%s%04ld%s", path, name, istep, suffix);
00624 delete [] path; delete [] name; delete [] suffix;
00625
00626 if((vtk_file = fopen(fname, "w"))==NULL){
00627 fprintf(stderr, "\n\nUnable to open graphics file '%s' in function print_graphics()\n", fname);
00628 fprintf(stderr, " (file %s, line %d)\n", __FILE__, __LINE__);
00629 abort();
00630 }
00631 print_default_vtk(vtk_file,lcid,istep,lambda);
00632 write_vtk_unkn(vtk_file,lcid,vtk_num==0?1:0);
00633 fclose(vtk_file);
00634 vtk_num++;
00635 }
00636 break;
00637 }
00638 default:
00639 {
00640 fprintf(stderr, "\nUnknown type of graphics format is required in function\n");
00641 fprintf(stderr, "outdriverm::print_graphics (file %s, line %d)\n", __FILE__, __LINE__);
00642 }
00643 }
00644 }
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659 void outdrivert::print_graphics_forced(FILE *out, long lcid, double lambda, long istep, double *fi)
00660 {
00661 long i;
00662 char dlcid[50];
00663
00664
00665 switch (gf)
00666 {
00667 case grftt_no:
00668 break;;
00669 case grftt_femcad:
00670 break;
00671 case grftt_open_dx:
00672 {
00673 for (i=0; i<1; i++)
00674 {
00675
00676
00677 }
00678 break;
00679 }
00680 case grftt_gid:
00681 {
00682 if (Tp->tprob == stationary_problem)
00683 sprintf(dlcid, "%ld", istep);
00684 else
00685 {
00686 switch (Tp->tprt)
00687 {
00688 case secondst:
00689 sprintf(dlcid, "%e", lambda);
00690 break;
00691 case minutest:
00692 sprintf(dlcid, "%e", lambda/60.0);
00693 break;
00694 case hourst:
00695 sprintf(dlcid, "%e", lambda/3600.0);
00696 break;
00697 case dayst:
00698 sprintf(dlcid, "%e", lambda/86400.0);
00699 break;
00700 default:
00701 print_err("unknown type of time printing",__FILE__,__LINE__,__func__);
00702 }
00703 }
00704 nog.print_graphics(out, lcid, dlcid, gf, fi);
00705
00706 if (Tp->tprob == stationary_problem)
00707 sprintf(dlcid, "%ld", istep);
00708 else
00709 {
00710 switch (Tp->tprt)
00711 {
00712 case secondst:
00713 sprintf(dlcid, "%e", lambda);
00714 break;
00715 case minutest:
00716 sprintf(dlcid, "%e", lambda/60.0);
00717 break;
00718 case hourst:
00719 sprintf(dlcid, "%e", lambda/3600.0);
00720 break;
00721 case dayst:
00722 sprintf(dlcid, "%e", lambda/86400.0);
00723 break;
00724 default:
00725 print_err("unknown type of time printing",__FILE__,__LINE__,__func__);
00726 }
00727 }
00728 eog.print_graphics(out, lcid, dlcid, gf, ide1);
00729
00730 break;
00731 }
00732 case grftt_gid_sep:
00733 {
00734 if (Tp->tprob == stationary_problem)
00735 sprintf(dlcid, "%ld", istep);
00736 else
00737 {
00738 switch (Tp->tprt)
00739 {
00740 case secondst:
00741 sprintf(dlcid, "%e", lambda);
00742 break;
00743 case minutest:
00744 sprintf(dlcid, "%e", lambda/60.0);
00745 break;
00746 case hourst:
00747 sprintf(dlcid, "%e", lambda/3600.0);
00748 break;
00749 case dayst:
00750 sprintf(dlcid, "%e", lambda/86400.0);
00751 break;
00752 default:
00753 print_err("unknown type of time printing",__FILE__,__LINE__,__func__);
00754 }
00755 }
00756 nog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, fi, hf_off);
00757
00758 if (Tp->tprob == stationary_problem)
00759 sprintf(dlcid, "%ld", istep);
00760 else
00761 {
00762 switch (Tp->tprt)
00763 {
00764 case secondst:
00765 sprintf(dlcid, "%e", lambda);
00766 break;
00767 case minutest:
00768 sprintf(dlcid, "%e", lambda/60.0);
00769 break;
00770 case hourst:
00771 sprintf(dlcid, "%e", lambda/3600.0);
00772 break;
00773 case dayst:
00774 sprintf(dlcid, "%e", lambda/86400.0);
00775 break;
00776 default:
00777 print_err("unknown type of time printing",__FILE__,__LINE__,__func__);
00778 }
00779 }
00780 eog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, hf_off, ide1);
00781
00782 break;
00783 }
00784 case grftt_vtk:
00785 {
00786 char fname[FNAMELEN+70];
00787 FILE *vtk_file;
00788 char *path;
00789 char *name;
00790 char *suffix;
00791
00792 filename_decomposition(outgrfn,path,name,suffix);
00793 sprintf(fname,"%s%s%04ld%s", path, name, istep, suffix);
00794 delete [] path; delete [] name; delete [] suffix;
00795
00796 if((vtk_file = fopen(fname, "w"))==NULL) {
00797 fprintf(stderr, "\n\nUnable to open graphics file '%s' in function print_graphics()\n", fname);
00798 fprintf(stderr, " (file %s, line %d)\n", __FILE__, __LINE__);
00799 abort();
00800 }
00801 print_default_vtk(vtk_file,lcid,istep,lambda);
00802 write_vtk_unkn(vtk_file,lcid,vtk_num==0?1:0);
00803 fclose(vtk_file);
00804 vtk_num++;
00805
00806 break;
00807 }
00808 default:
00809 {
00810 fprintf(stderr, "\nUnknown type of graphics format is required in function\n");
00811 fprintf(stderr, "outdriverm::print_graphics (file %s, line %d)\n", __FILE__, __LINE__);
00812 }
00813 }
00814 }
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826 void outdrivert::create_files_gidsp(char *mode)
00827 {
00828 char *dlcid = "";
00829
00830 if (gf != grftt_gid_sep)
00831 {
00832 fprintf(stderr, "\nWrong graphics format is required in function outdrivert::create_files_gidsp\n");
00833 fprintf(stderr, "(file %s, line %d)\n", __FILE__, __LINE__);
00834 abort();
00835 }
00836 if (nog.dstep.st != sel_no)
00837 nog.print_graphics(outgrfngs, mode, 0, dlcid, gf, NULL, header);
00838 if (eog.dstep.st != sel_no)
00839 eog.print_graphics(outgrfngs, mode, 0, dlcid, gf, header, ide1);
00840 }
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852 void outdrivert::close_files_gidsp()
00853 {
00854 char *dlcid = "";
00855
00856 if (gf != grftt_gid_sep)
00857 {
00858 fprintf(stderr, "\nWrong graphics format is required in function outdrivert::create_files_gidsp\n");
00859 fprintf(stderr, "(file %s, line %d)\n", __FILE__, __LINE__);
00860 abort();
00861 }
00862 if (nog.dstep.st != sel_no)
00863 nog.print_graphics(outgrfngs, "at", 0, dlcid, gf, NULL, footer);
00864 if (eog.dstep.st != sel_no)
00865 eog.print_graphics(outgrfngs, "at", 0, dlcid, gf, footer, ide1);
00866 }
00867
00868
00869
00870
00871
00872
00873 nodeoutt::nodeoutt()
00874 {
00875 selunkn = selgrad = selflux = seloth = seleqoth = NULL;
00876 }
00877
00878
00879
00880
00881
00882
00883 nodeoutt::~nodeoutt()
00884 {
00885 delete [] selunkn;
00886 delete [] selgrad;
00887 delete [] selflux;
00888 delete [] seloth;
00889 delete [] seleqoth;
00890 }
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907 long nodeoutt::read(XFILE *in)
00908 {
00909 long i;
00910
00911 xfscanf(in, "%k", "sel_nodstep");
00912 dstep.read(in);
00913 if (dstep.st == sel_no)
00914 return 0;
00915
00916
00917 xfscanf(in, "%k", "unknowns_nodes");
00918 selnunkn.read(in);
00919 switch (selnunkn.st)
00920 {
00921 case sel_no:
00922 break;
00923 case sel_all:
00924 case sel_range:
00925 case sel_list:
00926 xfscanf(in, "%k", "unknowns_comp");
00927 selunkn = new sel[selnunkn.n];
00928 for (i=0; i<selnunkn.n; i++)
00929 selunkn[i].read(in);
00930 break;
00931 default:
00932 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::read\n");
00933 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
00934 return 2;
00935 }
00936
00937
00938 xfscanf(in, "%k", "grad_nodes");
00939 selngrad.read(in);
00940 switch (selngrad.st)
00941 {
00942 case sel_no:
00943 break;
00944 case sel_all:
00945 case sel_range:
00946 case sel_list:
00947 xfscanf(in, "%k", "nodgrad_unkn");
00948 if(Tp->gradcomp == 0)
00949 Tp->gradcomp = 1;
00950 if(Tp->gradaver == 0)
00951 {
00952 Tp->gradaver = 1;
00953 Tp->gradpos = 2;
00954 }
00955 selgrad = new sel[selngrad.n];
00956 for(i=0; i<selngrad.n; i++)
00957 selgrad[i].read(in);
00958 break;
00959 default:
00960 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::read\n");
00961 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
00962 return 3;
00963 }
00964
00965
00966
00967 xfscanf(in, "%k", "flux_nodes");
00968 selnflux.read(in);
00969 switch (selnflux.st)
00970 {
00971 case sel_no:
00972 break;
00973 case sel_all:
00974 case sel_range:
00975 case sel_list:
00976 xfscanf(in, "%k", "nodflux_unkn");
00977 if(Tp->gradcomp == 0)
00978 Tp->gradcomp = 1;
00979 if(Tp->fluxcomp == 0)
00980 Tp->fluxcomp = 1;
00981 if(Tp->gradaver == 0)
00982 {
00983 Tp->gradpos = 2;
00984 Tp->gradaver = 1;
00985 }
00986 if(Tp->fluxaver == 0)
00987 {
00988 Tp->fluxpos = 2;
00989 Tp->fluxaver = 1;
00990 }
00991 selflux = new sel[selnflux.n];
00992 for(i=0; i<selnflux.n; i++)
00993 selflux[i].read(in);
00994 break;
00995 default:
00996 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::read\n");
00997 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
00998 return 4;
00999 }
01000
01001
01002 xfscanf(in, "%k", "other_nodes");
01003 selnoth.read(in);
01004 switch (selnoth.st)
01005 {
01006 case sel_no:
01007 break;
01008 case sel_all:
01009 case sel_range:
01010 case sel_list:
01011 xfscanf(in, "%k", "nodother_comp");
01012 if(Tp->othercomp == 0)
01013 Tp->othercomp = 1;
01014 if(Tp->otheraver == 0)
01015 {
01016 Tp->otherpos = 2;
01017 Tp->otheraver = 1;
01018 }
01019 seloth = new sel[selnoth.n];
01020 for (i=0; i < selnoth.n; i++)
01021 seloth[i].read(in);
01022 break;
01023 default:
01024 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::read\n");
01025 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01026 return 5;
01027 }
01028
01029
01030 xfscanf(in, "%k", "eqother_nodes");
01031 selneqoth.read(in);
01032 switch (selneqoth.st)
01033 {
01034 case sel_no:
01035 break;
01036 case sel_all:
01037 case sel_range:
01038 case sel_list:
01039 xfscanf(in, "%k", "nodeqother_comp");
01040 if(Tp->eqothercomp == 0)
01041 Tp->eqothercomp = 1;
01042 if(Tp->eqotheraver == 0)
01043 {
01044 Tp->eqotherpos = 2;
01045 Tp->eqotheraver = 1;
01046 }
01047 seleqoth = new sel[selneqoth.n];
01048 for (i=0; i < selneqoth.n; i++)
01049 seleqoth[i].read(in);
01050 break;
01051 default:
01052 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::read\n");
01053 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01054 return 6;
01055 }
01056
01057
01058 xfscanf(in, "%k", "flux_nodes");
01059 selnforcet.read(in);
01060 switch (selnforcet.st)
01061 {
01062 case sel_no:
01063 break;
01064 case sel_all:
01065 case sel_range:
01066 case sel_list:
01067 xfscanf(in, "%k", "flux_comp");
01068 selforcet = new sel[selnforcet.n];
01069 for (i=0; i<selnunkn.n; i++)
01070 selforcet[i].read(in);
01071 break;
01072 default:
01073 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::read\n");
01074 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01075 return 2;
01076 }
01077
01078 return 0;
01079 }
01080
01081
01082
01083
01084
01085
01086
01087
01088 void nodeoutt::print(FILE *out)
01089 {
01090 long i;
01091
01092
01093 dstep.print(out);
01094 if (dstep.st == sel_no)
01095 return;
01096 fprintf(out, "\n");
01097
01098
01099 selnunkn.print(out);
01100 switch(selnunkn.st)
01101 {
01102 case sel_no:
01103 break;
01104 case sel_all:
01105 case sel_range:
01106 case sel_list:
01107 for(i=0; i<selnunkn.n; i++)
01108 selunkn[i].print(out);
01109 break;
01110 default:
01111 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::print\n");
01112 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01113 return;
01114 }
01115
01116
01117
01118 selngrad.print(out);
01119 switch (selngrad.st)
01120 {
01121 case sel_no:
01122 break;
01123 case sel_all:
01124 case sel_range:
01125 case sel_list:
01126 for(i=0; i<selngrad.n; i++)
01127 selgrad[i].print(out);
01128 fprintf(out, "\n");
01129 break;
01130 default:
01131 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::print\n");
01132 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01133 return;
01134 }
01135
01136
01137 selnflux.print(out);
01138 switch (selnflux.st)
01139 {
01140 case sel_no:
01141 break;
01142 case sel_all:
01143 case sel_range:
01144 case sel_list:
01145 for(i=0; i<selnflux.n; i++)
01146 selflux[i].print(out);
01147 fprintf(out, "\n");
01148 break;
01149 default:
01150 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::print\n");
01151 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01152 return;
01153 }
01154
01155
01156 selnoth.print(out);
01157 switch (selnoth.st)
01158 {
01159 case sel_no:
01160 break;
01161 case sel_all:
01162 case sel_range:
01163 case sel_list:
01164 for(i=0; i<selnoth.n; i++)
01165 seloth[i].print(out);
01166 break;
01167 default:
01168 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::print\n");
01169 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01170 return;
01171 }
01172
01173
01174 selneqoth.print(out);
01175 switch (selneqoth.st)
01176 {
01177 case sel_no:
01178 break;
01179 case sel_all:
01180 case sel_range:
01181 case sel_list:
01182 for(i=0; i<selneqoth.n; i++)
01183 seleqoth[i].print(out);
01184 break;
01185 default:
01186 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::print\n");
01187 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01188 return;
01189 }
01190
01191
01192 selnforcet.print(out);
01193 switch (selnforcet.st)
01194 {
01195 case sel_no:
01196 break;
01197 case sel_all:
01198 case sel_range:
01199 case sel_list:
01200 for (i=0; i<selnunkn.n; i++)
01201 selforcet[i].print(out);
01202 break;
01203 default:
01204 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::print\n");
01205 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01206 return;
01207 }
01208
01209 }
01210
01211
01212
01213
01214
01215
01216
01217
01218
01219
01220 void nodeoutt::print_out(FILE *out, long lcid)
01221 {
01222 if (selnunkn.st != sel_no)
01223 {
01224 fprintf(out, "** Nodal unknowns :\n\n");
01225 print_unkn(out, lcid);
01226 }
01227 if (selngrad.st != sel_no)
01228 {
01229 fprintf(out, "** Nodal averaged gradients of unknowns :\n\n");
01230 print_grad(out, lcid);
01231 }
01232 if (selnflux.st != sel_no)
01233 {
01234 fprintf(out, "** Nodal averaged fluxes of unknowns :\n\n");
01235 print_flux(out, lcid);
01236 }
01237 if (selnoth.st != sel_no)
01238 {
01239 fprintf(out, "** Nodal averaged other values :\n\n");
01240 print_other(out);
01241 }
01242 if (selneqoth.st != sel_no)
01243 {
01244 fprintf(out, "** Nodal averaged eq_other values :\n\n");
01245 print_eqother(out);
01246 }
01247
01248
01249
01250
01251
01252
01253
01254 }
01255
01256
01257
01258
01259
01260
01261
01262
01263
01264
01265
01266
01267 void nodeoutt::print_unkn(FILE *out, long lcid)
01268 {
01269 long i, j, ndofn;
01270 double *r;
01271
01272 for (i=0; i<Tt->nn; i++)
01273 {
01274 if (selnunkn.presence_id(i))
01275 {
01276 fprintf(out, " Node %7ld", i+1);
01277 ndofn = Tt->give_ndofn(i);
01278 r = new double[ndofn];
01279 nodalval(lcid, r, i);
01280 for (j=0; j<ndofn; j++)
01281 {
01282 if (selnunkn.presence_id(selunkn,i,j)){
01283
01284 fprintf(out, " r_%ld=% .*e", j+1, prunkn, r[j]);
01285 }
01286 }
01287 delete [] r;
01288 fprintf(out, "\n");
01289 }
01290 }
01291 fprintf(out, "\n");
01292 }
01293
01294
01295
01296
01297
01298
01299
01300
01301
01302
01303
01304 void nodeoutt::print_grad(FILE *out, long lcid)
01305 {
01306 long i, j, k, ncomp, ir;
01307
01308 ncomp = Tt->nodes[0].ncompgrad;
01309
01310 for (i=0; i<Tt->nn; i++)
01311 {
01312 if (selngrad.presence_id(i, ir))
01313 {
01314 fprintf(out, " Node %7ld\n", i+1);
01315 ncomp = Tt->nodes[i].ncompgrad;
01316 for (j=0; j<Tp->ntm; j++){
01317 if (selngrad.presence_id(selgrad,i,j))
01318 for (k=0; k<ncomp; k++)
01319 {
01320 fprintf(out, " grad_%ld_%ld=% .*e", j+1, k+1, prgrad, Tt->nodes[i].gradient[j][k]);
01321 }
01322 fprintf(out, "\n");
01323 }
01324 }
01325 }
01326 fprintf(out, "\n");
01327 }
01328
01329
01330
01331
01332
01333
01334
01335
01336
01337
01338
01339 void nodeoutt::print_flux(FILE *out, long lcid)
01340 {
01341 long i, ir, j, k, ncomp;
01342
01343 ncomp = Tt->nodes[0].ncompgrad;
01344 for (i=0; i<Tt->nn; i++)
01345 {
01346 if (selnflux.presence_id(i, ir))
01347 {
01348 fprintf(out, " Node %7ld\n", i+1);
01349 ncomp = Tt->nodes[i].ncompgrad;
01350 for (j=0; j<Tp->ntm; j++){
01351 if (selnflux.presence_id(selflux, i, j))
01352 for (k=0; k<ncomp; k++)
01353 {
01354 fprintf(out, " flux_%ld_%ld=% .*e", j+1, k+1, prflux, Tt->nodes[i].flux[j][k]);
01355 }
01356 fprintf(out, "\n");
01357 }
01358 }
01359 }
01360 fprintf(out, "\n");
01361 }
01362
01363
01364
01365
01366
01367
01368
01369
01370
01371
01372
01373 void nodeoutt::print_other(FILE *out)
01374 {
01375 long i, j, ncomp;
01376
01377 ncomp = Tt->nodes[0].ncompother;
01378 for (i=0; i<Tt->nn; i++)
01379 {
01380 if (selnoth.presence_id(i))
01381 {
01382 fprintf(out, " Node %7ld", i+1);
01383 ncomp = Tt->nodes[i].ncompother;
01384 for (j=0; j<ncomp; j++)
01385 {
01386 if (selnoth.presence_id(seloth, i, j)){
01387 fprintf(out, "\n");
01388 fprintf(out, " other_%ld ", j+1);
01389 Tm->give_othervalue_name(out,0,j);
01390 fprintf(out, " =% .*e", proth, Tt->nodes[i].other[j]);
01391 }
01392 }
01393 fprintf(out, "\n");
01394 }
01395 }
01396 fprintf(out, "\n");
01397 }
01398
01399
01400
01401
01402
01403
01404
01405
01406
01407
01408
01409
01410 void nodeoutt::print_eqother(FILE *out)
01411 {
01412 long i, j, ncomp;
01413
01414 ncomp = Tt->nodes[0].ncompeqother;
01415 for (i=0; i<Tt->nn; i++)
01416 {
01417 if (selneqoth.presence_id(i))
01418 {
01419 fprintf(out, " Node %7ld", i+1);
01420 ncomp = Tt->nodes[i].ncompeqother;
01421 for (j=0; j<ncomp; j++)
01422 {
01423 if (selneqoth.presence_id(seleqoth, i, j)){
01424 fprintf(out, "\n");
01425 fprintf(out, " eqother_%ld ", j+1);
01426 Tm->give_eqothervalue_name(out,0,j);
01427 fprintf(out, " =% .*e", preqoth, Tt->nodes[i].eqother[j]);
01428 }
01429 }
01430 fprintf(out, "\n");
01431 }
01432 }
01433 fprintf(out, "\n");
01434 }
01435
01436
01437
01438
01439
01440
01441
01442
01443
01444
01445
01446 void nodeoutt::print_forcet(FILE *out)
01447 {
01448
01449
01450
01451
01452
01453
01454
01455
01456
01457
01458
01459
01460
01461
01462
01463
01464
01465
01466
01467
01468 fprintf(out, "\n");
01469 }
01470
01471
01472
01473
01474
01475
01476
01477
01478 nodeoutgt::nodeoutgt()
01479 {
01480 selunkn = selgrad = selflux = seloth = seleqoth = NULL;
01481 }
01482
01483
01484
01485
01486
01487
01488 nodeoutgt::~nodeoutgt()
01489 {
01490 delete [] selunkn;
01491 delete [] selgrad;
01492 delete [] selflux;
01493 delete [] seloth;
01494 delete [] seleqoth;
01495 }
01496
01497
01498
01499
01500
01501
01502
01503
01504
01505
01506
01507
01508
01509
01510
01511
01512 long nodeoutgt::read(XFILE *in)
01513 {
01514 long i;
01515
01516 xfscanf(in, "%k", "sel_nodstep");
01517 dstep.read(in);
01518 if (dstep.st == sel_no)
01519 return 0;
01520
01521
01522 xfscanf(in, "%k", "unknowns_nodes");
01523 selnunkn.read(in);
01524 switch (selnunkn.st)
01525 {
01526 case sel_no:
01527 break;
01528 case sel_all:
01529 case sel_range:
01530 case sel_list:
01531 xfscanf(in, "%k", "unknowns_comp");
01532 selunkn = new sel[selnunkn.n];
01533 for (i=0; i<selnunkn.n; i++)
01534 selunkn[i].read(in);
01535 break;
01536 default:
01537 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::read\n");
01538 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01539 return 2;
01540 }
01541
01542
01543 xfscanf(in, "%k", "grad_nodes");
01544 selngrad.read(in);
01545 switch (selngrad.st)
01546 {
01547 case sel_no:
01548 break;
01549 case sel_all:
01550 case sel_range:
01551 case sel_list:
01552 xfscanf(in, "%k", "nodgrad_unkn");
01553 if(Tp->gradcomp == 0)
01554 Tp->gradcomp = 1;
01555 if(Tp->gradaver == 0)
01556 {
01557 Tp->gradpos = 2;
01558 Tp->gradaver = 1;
01559 }
01560 selgrad = new sel[selngrad.n];
01561 for(i=0; i<selngrad.n; i++)
01562 selgrad[i].read(in);
01563 break;
01564 default:
01565 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::read\n");
01566 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01567 return 3;
01568 }
01569
01570
01571
01572 xfscanf(in, "%k", "flux_nodes");
01573 selnflux.read(in);
01574 switch (selnflux.st)
01575 {
01576 case sel_no:
01577 break;
01578 case sel_all:
01579 case sel_range:
01580 case sel_list:
01581 xfscanf(in, "%k", "nodflux_unkn");
01582 if(Tp->gradcomp == 0)
01583 Tp->gradcomp = 1;
01584 if(Tp->fluxcomp == 0)
01585 Tp->fluxcomp = 1;
01586 if(Tp->gradaver == 0)
01587 {
01588 Tp->gradpos = 2;
01589 Tp->gradaver = 1;
01590 }
01591 if(Tp->fluxaver == 0)
01592 {
01593 Tp->fluxpos = 2;
01594 Tp->fluxaver = 1;
01595 }
01596 selflux = new sel[selnflux.n];
01597 for(i=0; i<selnflux.n; i++)
01598 selflux[i].read(in);
01599 break;
01600 default:
01601 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::read\n");
01602 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01603 return 4;
01604 }
01605
01606
01607 xfscanf(in, "%k", "other_nodes");
01608 selnoth.read(in);
01609 switch (selnoth.st)
01610 {
01611 case sel_no:
01612 break;
01613 case sel_all:
01614 case sel_range:
01615 case sel_list:
01616 xfscanf(in, "%k", "nodother_comp");
01617 if(Tp->othercomp == 0)
01618 Tp->othercomp = 1;
01619 if(Tp->otheraver == 0)
01620 {
01621 Tp->otherpos = 2;
01622 Tp->otheraver = 1;
01623 }
01624 seloth = new sel[selnoth.n];
01625 for (i=0; i < selnoth.n; i++)
01626 seloth[i].read(in);
01627 break;
01628 default:
01629 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::read\n");
01630 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01631 return 5;
01632 }
01633
01634
01635 xfscanf(in, "%k", "eqother_nodes");
01636 selneqoth.read(in);
01637 switch (selneqoth.st)
01638 {
01639 case sel_no:
01640 break;
01641 case sel_all:
01642 case sel_range:
01643 case sel_list:
01644 xfscanf(in, "%k", "nodeqother_comp");
01645 if(Tp->eqothercomp == 0)
01646 Tp->eqothercomp = 1;
01647 if(Tp->eqotheraver == 0)
01648 {
01649 Tp->eqotherpos = 2;
01650 Tp->eqotheraver = 1;
01651 }
01652 seleqoth = new sel[selneqoth.n];
01653 for (i=0; i < selneqoth.n; i++)
01654 seleqoth[i].read(in);
01655 break;
01656 default:
01657 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::read\n");
01658 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01659 return 6;
01660 }
01661
01662
01663 xfscanf(in, "%k", "flux_nodes");
01664 selnforcet.read(in);
01665 switch (selnforcet.st)
01666 {
01667 case sel_no:
01668 break;
01669 case sel_all:
01670 case sel_range:
01671 case sel_list:
01672 xfscanf(in, "%k", "flux_comp");
01673 selforcet = new sel[selnforcet.n];
01674 for (i=0; i<selnunkn.n; i++)
01675 selforcet[i].read(in);
01676 break;
01677 default:
01678 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::read\n");
01679 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01680 return 2;
01681 }
01682
01683
01684
01685 return 0;
01686 }
01687
01688
01689
01690
01691
01692
01693
01694
01695 void nodeoutgt::print(FILE *out)
01696 {
01697 long i;
01698
01699
01700 dstep.print(out);
01701 if (dstep.st == sel_no)
01702 return;
01703 fprintf(out, "\n");
01704
01705
01706 selnunkn.print(out);
01707 switch(selnunkn.st)
01708 {
01709 case sel_no:
01710 break;
01711 case sel_all:
01712 case sel_range:
01713 case sel_list:
01714 for(i=0; i<selnunkn.n; i++)
01715 selunkn[i].print(out);
01716 break;
01717 default:
01718 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::print\n");
01719 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01720 return;
01721 }
01722
01723
01724
01725 selngrad.print(out);
01726 switch (selngrad.st)
01727 {
01728 case sel_no:
01729 break;
01730 case sel_all:
01731 case sel_range:
01732 case sel_list:
01733 for(i=0; i<selngrad.n; i++)
01734 selgrad[i].print(out);
01735 fprintf(out, "\n");
01736 break;
01737 default:
01738 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::print\n");
01739 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01740 return;
01741 }
01742
01743
01744 selnflux.print(out);
01745 switch (selnflux.st)
01746 {
01747 case sel_no:
01748 break;
01749 case sel_all:
01750 case sel_range:
01751 case sel_list:
01752 for(i=0; i<selnflux.n; i++)
01753 selflux[i].print(out);
01754 fprintf(out, "\n");
01755 break;
01756 default:
01757 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::print\n");
01758 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01759 return;
01760 }
01761
01762
01763 selnoth.print(out);
01764 switch (selnoth.st)
01765 {
01766 case sel_no:
01767 break;
01768 case sel_all:
01769 case sel_range:
01770 case sel_list:
01771 for(i=0; i<selnoth.n; i++)
01772 seloth[i].print(out);
01773 break;
01774 default:
01775 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::print\n");
01776 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01777 return;
01778 }
01779
01780
01781 selneqoth.print(out);
01782 switch (selneqoth.st)
01783 {
01784 case sel_no:
01785 break;
01786 case sel_all:
01787 case sel_range:
01788 case sel_list:
01789 for(i=0; i<selneqoth.n; i++)
01790 seleqoth[i].print(out);
01791 break;
01792 default:
01793 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::print\n");
01794 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01795 return;
01796 }
01797
01798
01799 selnforcet.print(out);
01800 switch (selnforcet.st)
01801 {
01802 case sel_no:
01803 break;
01804 case sel_all:
01805 case sel_range:
01806 case sel_list:
01807 for (i=0; i<selnunkn.n; i++)
01808 selforcet[i].print(out);
01809 break;
01810 default:
01811 fprintf(stderr, "\n\nUnknown type of selection is required in function nodeoutt::read\n");
01812 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
01813 return;
01814 }
01815
01816 }
01817
01818
01819
01820
01821
01822
01823
01824
01825
01826
01827
01828
01829 void nodeoutgt::print_graphics(FILE *out, long lcid, char *desclcid, graphftt gf, double *ifor)
01830 {
01831 long i, j;
01832
01833 if (gf == grftt_open_dx)
01834 return;
01835
01836 if (selnunkn.st != sel_no)
01837 {
01838 if (gf == grftt_gid)
01839 write_gid_unkn(out, lcid, desclcid);
01840 }
01841
01842 if (selnflux.st != sel_no)
01843 {
01844 for(i=0; i<Tp->ntm; i++)
01845 {
01846 for (j=0; j<selnflux.n; j++)
01847 {
01848 if (selflux[j].presence_id(i))
01849 {
01850 if (gf == grftt_gid)
01851 write_gid_nodvectort(out, flux, lcid, i, desclcid);
01852 break;
01853 }
01854 }
01855 }
01856 }
01857
01858
01859 if (selngrad.st != sel_no)
01860 {
01861 for(i=0; i<Tp->ntm; i++)
01862 {
01863 for (j=0; j<selngrad.n; j++)
01864 {
01865 if (selgrad[j].presence_id(i))
01866 {
01867 if (gf == grftt_gid)
01868 write_gid_nodvectort(out, grad, lcid, i, desclcid);
01869 break;
01870 }
01871 }
01872 }
01873 }
01874
01875
01876 if (selnoth.st != sel_no)
01877 {
01878 for(i=0; i<Tt->nodes[0].ncompother; i++)
01879 {
01880 for (j=0; j<selnoth.n; j++)
01881 {
01882 if (seloth[j].presence_id(i))
01883 {
01884 if (gf == grftt_gid)
01885 write_gid_nodscalart(out, othert, lcid, i, desclcid);
01886 break;
01887 }
01888 }
01889 }
01890 }
01891
01892
01893 if (selneqoth.st != sel_no)
01894 {
01895 for(i=0; i<Tt->nodes[0].ncompeqother; i++)
01896 {
01897 for (j=0; j<selneqoth.n; j++)
01898 {
01899 if (seleqoth[j].presence_id(i))
01900 {
01901 if (gf == grftt_gid)
01902 write_gid_nodscalart(out, eqothert, lcid, i, desclcid);
01903 break;
01904 }
01905 }
01906 }
01907 }
01908
01909 if (selnforcet.st != sel_no)
01910 {
01911 if (gf == grftt_gid)
01912 write_gid_nforcest(out, lcid, desclcid, ifor);
01913 else
01914 write_nforcest(out, lcid, desclcid, ifor);
01915 }
01916 }
01917
01918
01919
01920
01921
01922
01923
01924
01925
01926
01927
01928
01929
01930
01931
01932
01933
01934
01935
01936
01937 void nodeoutgt::print_graphics(char *outfn, char *mode, long lcid, char *desclcid, graphftt gf, double *ifor, hflagsw hf)
01938 {
01939 long i, j, sl;
01940 char fname[FNAMELEN+70];
01941 FILE *out;
01942
01943 sl = strlen(outfn);
01944 if (gf != grftt_gid_sep)
01945 {
01946 fprintf(stderr, "\nInvalid graphics format is required in function nodeoutt::print_graphics\n");
01947 fprintf(stderr, "(file %s, line %d)", __FILE__, __LINE__);
01948 return;
01949 }
01950
01951 if (selnunkn.st != sel_no)
01952 {
01953 sprintf(fname, "%s.unkn.flavia.res", outfn);
01954 out = fopen(fname, mode);
01955 if (out == NULL)
01956 {
01957 fprintf(stderr, "\n\nUnable to open graphics file '%s' in function nodeoutt::print_graphics\n", fname);
01958 fprintf(stderr, " (file %s, line %d)\n", __FILE__, __LINE__);
01959 abort();
01960 }
01961 switch (hf)
01962 {
01963 case header:
01964 fseek(out, 0, SEEK_END);
01965 if (ftell(out) == 0)
01966 {
01967 fprintf(out, "GiD Post Results File 1.0\n");
01968 export_gid_gauss_ptt(out);
01969 }
01970 if (Adat)
01971 fprintf(out, "\nOnGroup adapt_step_%ld\n\n", Adat->istep+1);
01972 case hf_off:
01973 write_gid_unkn(out, lcid, desclcid);
01974 break;
01975 case footer:
01976 if (Adat)
01977 fprintf(out, "End OnGroup\n\n");
01978 break;
01979 default:
01980 {
01981 print_err("unknown type of header/footer flag is required", __FILE__, __LINE__, __func__);
01982 abort();
01983 }
01984 }
01985 fclose(out);
01986 }
01987 if (selngrad.st != sel_no)
01988 {
01989 for(i=0; i<Tp->ntm; i++)
01990 {
01991 for (j=0; j<selngrad.n; j++)
01992 {
01993 if (selgrad[j].presence_id(i))
01994 {
01995 sprintf(fname, "%s.nodal_grad%ld.flavia.res", outfn, i+1);
01996 out = fopen(fname, mode);
01997 if (out == NULL)
01998 {
01999 fprintf(stderr, "\n\nUnable to open graphics file '%s' in function nodeoutt::print_graphics\n", fname);
02000 fprintf(stderr, " (file %s, line %d)\n", __FILE__, __LINE__);
02001 abort();
02002 }
02003 if (hf == footer)
02004 {
02005 if (Adat)
02006 fprintf(out, "End OnGroup\n\n");
02007 fclose(out);
02008 break;
02009 }
02010 if (hf == header)
02011 {
02012 fseek(out, 0, SEEK_END);
02013 if (ftell(out) == 0){
02014 fprintf(out, "GiD Post Results File 1.0\n");
02015 export_gid_gauss_ptt(out);
02016 }
02017 if (Adat)
02018 fprintf(out, "\nOnGroup adapt_step_%ld\n\n", Adat->istep+1);
02019 else
02020 write_gid_nodvectort(out, grad, lcid, i, desclcid);
02021 fclose(out);
02022 break;
02023 }
02024 }
02025 }
02026 }
02027 }
02028 if (selnflux.st != sel_no)
02029 {
02030 for(i=0; i<Tp->ntm; i++)
02031 {
02032 for (j=0; j<selnflux.n; j++)
02033 {
02034 if (selflux[j].presence_id(i))
02035 {
02036 sprintf(fname, "%s.nodal_flux%ld.flavia.res", outfn, i+1);
02037 out = fopen(fname, mode);
02038 if (out == NULL)
02039 {
02040 fprintf(stderr, "\n\nUnable to open graphics file '%s' in function nodeoutt::print_graphics\n", fname);
02041 fprintf(stderr, " (file %s, line %d)\n", __FILE__, __LINE__);
02042 abort();
02043 }
02044 if (hf == footer)
02045 {
02046 if (Adat)
02047 fprintf(out, "End OnGroup\n\n");
02048 fclose(out);
02049 break;
02050 }
02051 if (hf == header)
02052 {
02053 fseek(out, 0, SEEK_END);
02054 if (ftell(out) == 0){
02055 fprintf(out, "GiD Post Results File 1.0\n");
02056 export_gid_gauss_ptt(out);
02057 }
02058 if (Adat)
02059 fprintf(out, "\nOnGroup adapt_step_%ld\n\n", Adat->istep+1);
02060 }
02061 else
02062 write_gid_nodvectort(out, flux, lcid, i, desclcid);
02063 fclose(out);
02064 break;
02065 }
02066 }
02067 }
02068 }
02069 if (selnoth.st != sel_no)
02070 {
02071 for(i=0; i<Tt->nodes[0].ncompother; i++)
02072 {
02073 for (j=0; j<selnoth.n; j++)
02074 {
02075 if (seloth[j].presence_id(i))
02076 {
02077 sprintf(fname, "%s.nodal_other%ld.flavia.res", outfn, i+1);
02078 out = fopen(fname, mode);
02079 if (out == NULL)
02080 {
02081 fprintf(stderr, "\n\nUnable to open graphics file '%s' in function nodeoutt::print_graphics\n", fname);
02082 fprintf(stderr, " (file %s, line %d)\n", __FILE__, __LINE__);
02083 abort();
02084 }
02085 if (hf == footer)
02086 {
02087 if (Adat)
02088 fprintf(out, "End OnGroup\n\n");
02089 fclose(out);
02090 break;
02091 }
02092 if (hf == header)
02093 {
02094 fseek(out, 0, SEEK_END);
02095 if (ftell(out) == 0){
02096 fprintf(out, "GiD Post Results File 1.0\n");
02097 export_gid_gauss_ptt(out);
02098 }
02099 if (Adat)
02100 fprintf(out, "\nOnGroup adapt_step_%ld\n\n", Adat->istep+1);
02101 }
02102 else
02103 write_gid_nodscalart(out, othert, lcid, i, desclcid);
02104 fclose(out);
02105 break;
02106 }
02107 }
02108 }
02109 }
02110 if (selneqoth.st != sel_no)
02111 {
02112 for(i=0; i<Tt->nodes[0].ncompeqother; i++)
02113 {
02114 for (j=0; j<selneqoth.n; j++)
02115 {
02116 if (seleqoth[j].presence_id(i))
02117 {
02118 sprintf(fname, "%s.nodal_eqother%ld.flavia.res", outfn, i+1);
02119 out = fopen(fname, mode);
02120 if (out == NULL)
02121 {
02122 fprintf(stderr, "\n\nUnable to open graphics file '%s' in function nodeoutt::print_graphics\n", fname);
02123 fprintf(stderr, " (file %s, line %d)\n", __FILE__, __LINE__);
02124 abort();
02125 }
02126 if (hf == footer)
02127 {
02128 if (Adat)
02129 fprintf(out, "End OnGroup\n\n");
02130 fclose(out);
02131 break;
02132 }
02133 if (hf == header)
02134 {
02135 fseek(out, 0, SEEK_END);
02136 if (ftell(out) == 0){
02137 fprintf(out, "GiD Post Results File 1.0\n");
02138 export_gid_gauss_ptt(out);
02139 }
02140 if (Adat)
02141 fprintf(out, "\nOnGroup adapt_step_%ld\n\n", Adat->istep+1);
02142 }
02143 else
02144 write_gid_nodscalart(out, eqothert, lcid, i, desclcid);
02145 fclose(out);
02146 break;
02147 }
02148 }
02149 }
02150 }
02151 if (selnforcet.st != sel_no)
02152 {
02153 sprintf(fname, "%s.flux.res", outfn);
02154 out = fopen(fname, mode);
02155 if (out == NULL)
02156 {
02157 fprintf(stderr, "\n\nUnable to open graphics file '%s' in function nodeoutgt::print_graphics\n", fname);
02158 fprintf(stderr, " (file %s, line %d)\n", __FILE__, __LINE__);
02159 abort();
02160 }
02161 switch (hf)
02162 {
02163 case header:
02164 fseek(out, 0, SEEK_END);
02165 if (ftell(out) == 0)
02166 {
02167 fprintf(out, "GiD Post Results File 1.0\n");
02168 export_gid_gauss_ptt(out);
02169 }
02170 if (Adat)
02171 fprintf(out, "\nOnGroup adapt_step_%ld\n\n", Adat->istep+1);
02172 case hf_off:
02173 write_gid_nforcest(out, lcid, desclcid, ifor);
02174 break;
02175 case footer:
02176 if (Adat)
02177 fprintf(out, "End OnGroup\n\n");
02178 break;
02179 default:
02180 {
02181 print_err("unknown type of header/footer flag is required", __FILE__, __LINE__, __func__);
02182 abort();
02183 }
02184 }
02185 fclose(out);
02186 }
02187 }
02188
02189
02190
02191
02192
02193
02194
02195
02196 elemoutt::elemoutt()
02197 {
02198 selgrad = selflux = seloth = seleqoth = NULL;
02199 }
02200
02201
02202
02203
02204
02205
02206 elemoutt::~elemoutt()
02207 {
02208 delete [] selgrad;
02209 delete [] selflux;
02210 delete [] seloth;
02211 delete [] seleqoth;
02212 }
02213
02214
02215
02216
02217
02218
02219
02220
02221
02222
02223
02224
02225
02226
02227
02228
02229 long elemoutt::read(XFILE *in)
02230 {
02231 long i;
02232
02233 xfscanf(in, "%k", "sel_elemstep");
02234 dstep.read(in);
02235 if (dstep.st == sel_no)
02236 return 0;
02237
02238
02239 xfscanf(in, "%k", "grad_elems");
02240 selegrad.read(in);
02241 switch (selegrad.st)
02242 {
02243 case sel_no:
02244 break;
02245 case sel_all:
02246 case sel_range:
02247 case sel_list:
02248 xfscanf(in, "%k", "elemgrad_unkn");
02249 Tp->gradcomp = 1;
02250 Tp->gradpos = 1;
02251 selgrad = new sel[selegrad.n];
02252 for(i=0; i<selegrad.n; i++)
02253 selgrad[i].read(in);
02254 break;
02255 default:
02256 fprintf(stderr, "\n\nUnknown type of selection is required in function elemoutt::read\n");
02257 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
02258 return 2;
02259 }
02260
02261
02262
02263 xfscanf(in, "%k", "flux_elems");
02264 seleflux.read(in);
02265 switch (seleflux.st)
02266 {
02267 case sel_no:
02268 break;
02269 case sel_all:
02270 case sel_range:
02271 case sel_list:
02272 xfscanf(in, "%k", "elemflux_comp");
02273 Tp->gradcomp = 1;
02274 Tp->gradpos = 1;
02275 Tp->fluxcomp = 1;
02276 Tp->fluxpos = 1;
02277 selflux = new sel[seleflux.n];
02278 for(i=0; i<seleflux.n; i++)
02279 selflux[i].read(in);
02280 break;
02281 default:
02282 fprintf(stderr, "\n\nUnknown type of selection is required in function elemoutt::read\n");
02283 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
02284 return 3;
02285 }
02286
02287
02288 xfscanf(in, "%k", "other_elems");
02289 seleoth.read(in);
02290 switch (seleoth.st)
02291 {
02292 case sel_no:
02293 break;
02294 case sel_all:
02295 case sel_range:
02296 case sel_list:
02297 xfscanf(in, "%k", "elemother_comp");
02298 Tp->othercomp = 1;
02299 Tp->otherpos = 1;
02300 seloth = new sel[seleoth.n];
02301 for (i=0; i<seleoth.n; i++)
02302 seloth[i].read(in);
02303 break;
02304 default:
02305 fprintf(stderr, "\n\nUnknown type of selection is required in function elemoutt::read\n");
02306 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
02307 return 4;
02308 }
02309
02310
02311 xfscanf(in, "%k", "eqother_elems");
02312 seleeqoth.read(in);
02313 switch (seleeqoth.st)
02314 {
02315 case sel_no:
02316 break;
02317 case sel_all:
02318 case sel_range:
02319 case sel_list:
02320 xfscanf(in, "%k", "elemeqother_comp");
02321 Tp->eqothercomp = 1;
02322 Tp->eqotherpos = 1;
02323 seleqoth = new sel[seleeqoth.n];
02324 for (i=0; i<seleeqoth.n; i++)
02325 seleqoth[i].read(in);
02326 break;
02327 default:
02328 fprintf(stderr, "\n\nUnknown type of selection is required in function elemoutt::read\n");
02329 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
02330 return 5;
02331 }
02332 return 0;
02333 }
02334
02335
02336
02337
02338
02339
02340
02341
02342
02343 void elemoutt::print(FILE *out)
02344 {
02345 long i;
02346
02347
02348 dstep.print(out);
02349 if (dstep.st == sel_no)
02350 return;
02351
02352
02353 selegrad.print(out);
02354 switch (selegrad.st)
02355 {
02356 case sel_no:
02357 break;
02358 case sel_all:
02359 case sel_range:
02360 case sel_list:
02361 for(i=0; i<selegrad.n; i++)
02362 selgrad[i].print(out);
02363 fprintf(out, "\n");
02364 break;
02365 default:
02366 fprintf(stderr, "\n\nUnknown type of selection is required in function elemoutt::print\n");
02367 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
02368 return;
02369 }
02370
02371
02372 seleflux.print(out);
02373 switch (seleflux.st)
02374 {
02375 case sel_no:
02376 break;
02377 case sel_all:
02378 case sel_range:
02379 case sel_list:
02380 for(i=0; i<seleflux.n; i++)
02381 selflux[i].print(out);
02382 fprintf(out, "\n");
02383 break;
02384 default:
02385 fprintf(stderr, "\n\nUnknown type of selection is required in function elemoutt::print\n");
02386 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
02387 return;
02388 }
02389
02390
02391 seleoth.print(out);
02392 switch (seleoth.st)
02393 {
02394 case sel_no:
02395 break;
02396 case sel_all:
02397 case sel_range:
02398 case sel_list:
02399 for(i=0; i<seleoth.n; i++)
02400 seloth[i].print(out);
02401 break;
02402 default:
02403 fprintf(stderr, "\n\nUnknown type of selection is required in function elemoutt::print\n");
02404 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
02405 return;
02406 }
02407
02408
02409 seleeqoth.print(out);
02410 switch (seleeqoth.st)
02411 {
02412 case sel_no:
02413 break;
02414 case sel_all:
02415 case sel_range:
02416 case sel_list:
02417 for(i=0; i<seleeqoth.n; i++)
02418 seleqoth[i].print(out);
02419 break;
02420 default:
02421 fprintf(stderr, "\n\nUnknown type of selection is required in function elemoutt::print\n");
02422 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
02423 return;
02424 }
02425 }
02426
02427
02428
02429
02430
02431
02432
02433
02434
02435
02436 void elemoutt::print_out(FILE *out, long lcid)
02437 {
02438 if (selegrad.st != sel_no)
02439 {
02440 fprintf(out, "** Element gradients :\n\n");
02441 print_grad(out, lcid);
02442 }
02443 if (seleflux.st != sel_no)
02444 {
02445 fprintf(out, "** Element fluxes :\n\n");
02446 print_flux(out, lcid);
02447 }
02448 if (seleoth.st != sel_no)
02449 {
02450 fprintf(out, "** Element other values :\n\n");
02451 print_other(out);
02452 }
02453 if (seleeqoth.st != sel_no)
02454 {
02455 fprintf(out, "** Element eq_other values :\n\n");
02456 print_eqother(out);
02457 }
02458 }
02459
02460
02461
02462
02463
02464
02465
02466
02467
02468
02469 void elemoutt::print_grad(FILE *out, long lcid)
02470 {
02471 long i, ii, j, k, ncomp, ipp, tnipe;
02472
02473 for (i=0; i<Tt->ne; i++)
02474 {
02475 if (selegrad.presence_id(i))
02476 {
02477 ipp = Tt->elements[i].ipp[0][0];
02478 tnipe = Tt->give_tnip(i);
02479 fprintf(out, " Element %7ld, integration points %ld - %ld\n ", i+1, ipp+1, ipp+tnipe);
02480 ncomp = Tt->give_ncomp (i);
02481 for (j=0; j<tnipe; j++)
02482 {
02483 for (ii=0; ii<Tp->ntm; ii++)
02484 for (k=0; k<ncomp; k++)
02485 {
02486 if (selegrad.presence_id(selgrad, i, ii))
02487 fprintf(out, " grad_%ld_%ld=% .*e", ii+1, k+1, prgrad, Tm->ip[ipp+j].grad[ii][k]);
02488 }
02489 if (j < tnipe-1)
02490 fprintf(out, "\n ");
02491 else
02492 fprintf(out, "\n");
02493 }
02494 }
02495 }
02496 fprintf(out, "\n");
02497 }
02498
02499
02500
02501
02502
02503
02504
02505
02506
02507
02508
02509 void elemoutt::print_flux(FILE *out, long lcid)
02510 {
02511 long i, ii, j, k, ncomp, ipp, tnipe;
02512
02513 for (i=0; i<Tt->ne; i++)
02514 {
02515 if (seleflux.presence_id(i))
02516 {
02517 ipp = Tt->elements[i].ipp[0][0];
02518 tnipe = Tt->give_tnip(i);
02519 fprintf(out, " Element %7ld, integration points %ld - %ld\n ", i+1, ipp+1, ipp+tnipe);
02520 ncomp = Tt->give_ncomp (i);
02521 for (j=0; j<tnipe; j++)
02522 {
02523 for (ii=0; ii<Tp->ntm; ii++)
02524 for (k=0; k<ncomp; k++)
02525 {
02526 if (seleflux.presence_id(selflux, i, ii))
02527 fprintf(out, " flux_%ld_%ld=% .*e", ii+1, k+1, prflux, Tm->ip[ipp+j].fluxes[ii][k]);
02528 }
02529 if (j < tnipe-1)
02530 fprintf(out, "\n ");
02531 else
02532 fprintf(out, "\n");
02533 }
02534 }
02535 }
02536 fprintf(out, "\n");
02537 }
02538
02539
02540
02541
02542
02543
02544
02545
02546
02547
02548 void elemoutt::print_other(FILE *out)
02549 {
02550 long i, j, k, ncomp, ipp, tnipe;
02551
02552 for (i=0; i<Tt->ne; i++)
02553 {
02554 if (seleoth.presence_id(i))
02555 {
02556 ipp = Tt->elements[i].ipp[0][0];
02557 tnipe = Tt->give_tnip(i);
02558 fprintf(out, " Element %7ld, integration points %ld - %ld\n ", i+1, ipp+1, ipp+tnipe);
02559 ncomp = Tm->givencompother();
02560 for (j=0; j<tnipe; j++)
02561 {
02562 for (k=0; k<ncomp; k++)
02563 {
02564 if (seleoth.presence_id(seloth, i, k)){
02565 fprintf(out, "\n");
02566 fprintf(out, " other_%ld ", k+1);
02567 Tm->give_othervalue_name(out,0,k);
02568 fprintf(out, " =% .*e", proth, Tm->ip[ipp+j].other[k]);
02569 }
02570 }
02571 if (j < tnipe-1)
02572 fprintf(out, "\n ");
02573 else
02574 fprintf(out, "\n");
02575 }
02576 }
02577 }
02578 fprintf(out, "\n");
02579 }
02580
02581
02582
02583
02584
02585
02586
02587
02588
02589 void elemoutt::print_eqother(FILE *out)
02590 {
02591 long i, j, k, ncomp, ipp, tnipe;
02592
02593 for (i=0; i<Tt->ne; i++)
02594 {
02595 if (seleeqoth.presence_id(i))
02596 {
02597 ipp = Tt->elements[i].ipp[0][0];
02598 tnipe = Tt->give_tnip(i);
02599 fprintf(out, " Element %7ld, integration points %ld - %ld\n ", i+1, ipp+1, ipp+tnipe);
02600 ncomp = Tm->ip[ipp].ncompeqother;
02601 for (j=0; j<tnipe; j++)
02602 {
02603 for (k=0; k<ncomp; k++)
02604 {
02605 if (seleeqoth.presence_id(seleqoth, i, k)){
02606 fprintf(out, "\n");
02607 fprintf(out, " eqother_%ld ", k+1);
02608 Tm->give_eqothervalue_name(out,0,k);
02609 fprintf(out, " =% .*e", preqoth, Tm->ip[ipp+j].eqother[k]);
02610 }
02611 }
02612 if (j < tnipe-1)
02613 fprintf(out, "\n ");
02614 else
02615 fprintf(out, "\n");
02616 }
02617 }
02618 }
02619 fprintf(out, "\n");
02620 }
02621
02622
02623
02624
02625
02626
02627
02628 elemoutgt::elemoutgt()
02629 {
02630 selgrad = selflux = seloth = seleqoth = NULL;
02631 ide1 = 1;
02632 }
02633
02634
02635
02636
02637
02638
02639 elemoutgt::~elemoutgt()
02640 {
02641 delete [] selgrad;
02642 delete [] selflux;
02643 delete [] seloth;
02644 delete [] seleqoth;
02645 }
02646
02647
02648
02649
02650
02651
02652
02653
02654
02655
02656
02657
02658
02659
02660
02661
02662 long elemoutgt::read(XFILE *in)
02663 {
02664 long i;
02665
02666 xfscanf(in, "%k", "sel_elemstep");
02667 dstep.read(in);
02668 if (dstep.st == sel_no)
02669 return 0;
02670
02671
02672 xfscanf(in, "%k", "grad_elems");
02673 selegrad.read(in);
02674 switch (selegrad.st)
02675 {
02676 case sel_no:
02677 break;
02678 case sel_all:
02679 case sel_range:
02680 case sel_list:
02681 xfscanf(in, "%k", "elemgrad_unkn");
02682 Tp->gradcomp = 1;
02683 Tp->gradpos = 1;
02684 selgrad = new sel[selegrad.n];
02685 for(i=0; i<selegrad.n; i++)
02686 selgrad[i].read(in);
02687 break;
02688 default:
02689 fprintf(stderr, "\n\nUnknown type of selection is required in function elemoutt::read\n");
02690 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
02691 return 2;
02692 }
02693
02694
02695
02696 xfscanf(in, "%k", "flux_elems");
02697 seleflux.read(in);
02698 switch (seleflux.st)
02699 {
02700 case sel_no:
02701 break;
02702 case sel_all:
02703 case sel_range:
02704 case sel_list:
02705 xfscanf(in, "%k", "elemflux_unkn");
02706 Tp->gradcomp = 1;
02707 Tp->fluxcomp = 1;
02708 Tp->gradpos = 1;
02709 Tp->fluxpos = 1;
02710 selflux = new sel[seleflux.n];
02711 for(i=0; i<seleflux.n; i++)
02712 selflux[i].read(in);
02713 break;
02714 default:
02715 fprintf(stderr, "\n\nUnknown type of selection is required in function elemoutt::read\n");
02716 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
02717 return 3;
02718 }
02719
02720
02721 xfscanf(in, "%k", "other_elems");
02722 seleoth.read(in);
02723 switch (seleoth.st)
02724 {
02725 case sel_no:
02726 break;
02727 case sel_all:
02728 case sel_range:
02729 case sel_list:
02730 xfscanf(in, "%k", "elemother_comp");
02731 Tp->othercomp = 1;
02732 Tp->otherpos = 1;
02733 seloth = new sel[seleoth.n];
02734 for (i=0; i<seleoth.n; i++)
02735 seloth[i].read(in);
02736 break;
02737 default:
02738 fprintf(stderr, "\n\nUnknown type of selection is required in function elemoutt::read\n");
02739 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
02740 return 4;
02741 }
02742
02743
02744 xfscanf(in, "%k", "eqother_elems");
02745 seleeqoth.read(in);
02746 switch (seleeqoth.st)
02747 {
02748 case sel_no:
02749 break;
02750 case sel_all:
02751 case sel_range:
02752 case sel_list:
02753 xfscanf(in, "%k", "elemeqother_comp");
02754 Tp->eqothercomp = 1;
02755 Tp->eqotherpos = 1;
02756 seleqoth = new sel[seleeqoth.n];
02757 for (i=0; i<seleeqoth.n; i++)
02758 seleqoth[i].read(in);
02759 break;
02760 default:
02761 fprintf(stderr, "\n\nUnknown type of selection is required in function elemoutt::read\n");
02762 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
02763 return 5;
02764 }
02765 return 0;
02766 }
02767
02768
02769
02770
02771
02772
02773
02774
02775
02776 void elemoutgt::print(FILE *out)
02777 {
02778 long i;
02779
02780
02781 dstep.print(out);
02782 if (dstep.st == sel_no)
02783 return;
02784
02785
02786 selegrad.print(out);
02787 switch (selegrad.st)
02788 {
02789 case sel_no:
02790 break;
02791 case sel_all:
02792 case sel_range:
02793 case sel_list:
02794 for(i=0; i<selegrad.n; i++)
02795 selgrad[i].print(out);
02796 fprintf(out, "\n");
02797 break;
02798 default:
02799 fprintf(stderr, "\n\nUnknown type of selection is required in function elemoutt::print\n");
02800 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
02801 return;
02802 }
02803
02804
02805 seleflux.print(out);
02806 switch (seleflux.st)
02807 {
02808 case sel_no:
02809 break;
02810 case sel_all:
02811 case sel_range:
02812 case sel_list:
02813 for(i=0; i<seleflux.n; i++)
02814 selflux[i].print(out);
02815 fprintf(out, "\n");
02816 break;
02817 default:
02818 fprintf(stderr, "\n\nUnknown type of selection is required in function elemoutt::print\n");
02819 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
02820 return;
02821 }
02822
02823
02824 seleoth.print(out);
02825 switch (seleoth.st)
02826 {
02827 case sel_no:
02828 break;
02829 case sel_all:
02830 case sel_range:
02831 case sel_list:
02832 for(i=0; i<seleoth.n; i++)
02833 seloth[i].print(out);
02834 break;
02835 default:
02836 fprintf(stderr, "\n\nUnknown type of selection is required in function elemoutt::print\n");
02837 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
02838 return;
02839 }
02840
02841
02842 seleeqoth.print(out);
02843 switch (seleeqoth.st)
02844 {
02845 case sel_no:
02846 break;
02847 case sel_all:
02848 case sel_range:
02849 case sel_list:
02850 for(i=0; i<seleeqoth.n; i++)
02851 seleqoth[i].print(out);
02852 break;
02853 default:
02854 fprintf(stderr, "\n\nUnknown type of selection is required in function elemoutt::print\n");
02855 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
02856 return;
02857 }
02858 }
02859
02860
02861
02862
02863
02864
02865
02866
02867
02868
02869
02870
02871
02872
02873
02874
02875
02876 void elemoutgt::print_graphics(FILE *out, long lcid, const char *desclcid, graphftt gf, long idelem1)
02877 {
02878 ide1 = idelem1;
02879 if (gf == grftt_open_dx)
02880 return;
02881
02882 print_gr_grad_scal(out, desclcid, gf);
02883 print_gr_flux_scal(out, desclcid, gf);
02884 print_gr_oth_scal(out, lcid, desclcid, gf);
02885 print_gr_eqoth_scal(out, lcid, desclcid, gf);
02886
02887 print_gr_grad_vec(out, lcid, desclcid, gf);
02888 print_gr_flux_vec(out, lcid, desclcid, gf);
02889 print_gr_oth_vec(out, lcid, desclcid, gf);
02890 print_gr_eqoth_vec(out, lcid, desclcid, gf);
02891 }
02892
02893
02894
02895
02896
02897
02898
02899
02900
02901
02902
02903
02904
02905
02906 void elemoutgt::print_gr_grad_scal(FILE *out, const char *desclcid, graphftt gf)
02907 {
02908 long i,ii,j;
02909
02910 if (selegrad.st != sel_no)
02911 {
02912 for(ii=0; ii<Tp->ntm; ii++)
02913 {
02914 for(i=0; i<Tp->gdim; i++)
02915 {
02916 for (j=0; j<selegrad.n; j++)
02917 {
02918 if ((selgrad[j].st == sel_mtx) || (selgrad[j].st == sel_range_mtx) ||
02919 (selgrad[j].st == sel_range_vec) || (selgrad[j].st == sel_vec))
02920 continue;
02921 if (selgrad[j].presence_id(ii))
02922 {
02923 if (gf == grftt_gid)
02924 write_gid_elemscalart(out, grad, ii, i, desclcid);
02925 break;
02926 }
02927 }
02928 }
02929 }
02930 }
02931 }
02932
02933
02934
02935
02936
02937
02938
02939
02940
02941
02942
02943
02944
02945
02946 void elemoutgt::print_gr_flux_scal(FILE *out, const char *desclcid, graphftt gf)
02947 {
02948 long i,ii,j;
02949
02950 if (seleflux.st != sel_no)
02951 {
02952 for(ii=0; ii<Tp->ntm; ii++)
02953 {
02954 for(i=0; i<Tp->gdim; i++)
02955 {
02956 for (j=0; j<seleflux.n; j++)
02957 {
02958 if ((selgrad[j].st == sel_mtx) || (selgrad[j].st == sel_range_mtx) ||
02959 (selgrad[j].st == sel_range_vec) || (selgrad[j].st == sel_vec))
02960 continue;
02961 if (selflux[j].presence_id(ii))
02962 {
02963 if (gf == grftt_gid)
02964 write_gid_elemscalart(out, flux, ii, i, desclcid);
02965 break;
02966 }
02967 }
02968 }
02969 }
02970 }
02971 }
02972
02973
02974
02975
02976
02977
02978
02979
02980
02981
02982
02983
02984
02985
02986
02987 void elemoutgt::print_gr_oth_scal(FILE *out, long lcid, const char *desclcid, graphftt gf)
02988 {
02989 long i,j;
02990
02991 if (seleoth.st != sel_no)
02992 {
02993 for(i=0; i<Tm->ip[0].ncompother; i++)
02994 {
02995 for (j=0; j<seleoth.n; j++)
02996 {
02997 if ((seloth[j].st == sel_mtx) || (seloth[j].st == sel_range_mtx) ||
02998 (seloth[j].st == sel_range_vec) || (selgrad[j].st == sel_vec))
02999 continue;
03000 if (seloth[j].presence_id(i))
03001 {
03002 if (gf == grftt_gid)
03003 write_gid_elemscalart(out, othert, lcid, i, desclcid);
03004 break;
03005 }
03006 }
03007 }
03008 }
03009 }
03010
03011
03012
03013
03014
03015
03016
03017
03018
03019
03020
03021
03022
03023
03024
03025 void elemoutgt::print_gr_eqoth_scal(FILE *out, long lcid, const char *desclcid, graphftt gf)
03026 {
03027 long i,j;
03028
03029 if (seleeqoth.st != sel_no)
03030 {
03031 for(i=0; i<Tm->ip[0].ncompeqother; i++)
03032 {
03033 for (j=0; j<seleeqoth.n; j++)
03034 {
03035 if ((seleqoth[j].st == sel_mtx) || (seleqoth[j].st == sel_range_mtx) ||
03036 (seleqoth[j].st == sel_range_vec) || (selgrad[j].st == sel_vec))
03037 continue;
03038 if (seleqoth[j].presence_id(i))
03039 {
03040 if (gf == grftt_gid)
03041 write_gid_elemscalart(out, eqothert, lcid, i, desclcid);
03042 break;
03043 }
03044 }
03045 }
03046 }
03047 }
03048
03049
03050
03051
03052
03053
03054
03055
03056
03057
03058
03059
03060
03061
03062
03063 void elemoutgt::print_gr_grad_vec(FILE *out, long lcid, const char *desclcid, graphftt gf)
03064 {
03065 long j;
03066
03067 if (selegrad.st != sel_no)
03068 {
03069 for (j=0; j<selegrad.n; j++)
03070 {
03071 if (selgrad[j].st != sel_vec)
03072 continue;
03073 if (gf == grftt_gid)
03074 write_gid_elemvectort(out, grad, lcid, j, desclcid);
03075 else
03076 {
03077 print_err("required export format of a strain vector is not supported", __FILE__, __LINE__, __func__);
03078 abort();
03079 }
03080 }
03081 }
03082 }
03083
03084
03085
03086
03087
03088
03089
03090
03091
03092
03093
03094
03095
03096
03097 void elemoutgt::print_gr_flux_vec(FILE *out, long lcid, const char *desclcid, graphftt gf)
03098 {
03099 long j;
03100
03101 if (seleflux.st != sel_no)
03102 {
03103 for (j=0; j<seleflux.n; j++)
03104 {
03105 if (selflux[j].st != sel_vec)
03106 continue;
03107 if (gf == grftt_gid)
03108 write_gid_elemvectort(out, flux, lcid, j, desclcid);
03109 else
03110 {
03111 print_err("required export format of a strain vector is not supported", __FILE__, __LINE__, __func__);
03112 abort();
03113 }
03114 }
03115 }
03116 }
03117
03118
03119
03120
03121
03122
03123
03124
03125
03126
03127
03128
03129
03130
03131
03132 void elemoutgt::print_gr_oth_vec(FILE *out, long lcid, const char *desclcid, graphftt gf)
03133 {
03134 long j;
03135
03136 if (seleoth.st != sel_no)
03137 {
03138 for (j=0; j<seleoth.n; j++)
03139 {
03140 if (seloth[j].st != sel_range_vec)
03141 continue;
03142 if (gf == grftt_gid)
03143 write_gid_elemvectort(out, othert, lcid, j, desclcid);
03144 else
03145 {
03146 print_err("unsupported export format of an other values vector is required",__FILE__, __LINE__, __func__);
03147 abort();
03148 }
03149 }
03150 }
03151 }
03152
03153
03154
03155
03156
03157
03158
03159
03160
03161
03162
03163
03164
03165
03166
03167 void elemoutgt::print_gr_eqoth_vec(FILE *out, long lcid, const char *desclcid, graphftt gf)
03168 {
03169 long j;
03170
03171 if (seleeqoth.st != sel_no)
03172 {
03173 for (j=0; j<seleeqoth.n; j++)
03174 {
03175 if (seleqoth[j].st != sel_range_vec)
03176 continue;
03177 if (gf == grftt_gid)
03178 write_gid_elemvectort(out, eqothert, lcid, j, desclcid);
03179 else
03180 {
03181 print_err("unsupported export format of an eqother values vector is required",__FILE__, __LINE__, __func__);
03182 abort();
03183 }
03184 }
03185 }
03186 }
03187
03188
03189
03190
03191
03192
03193
03194
03195
03196
03197
03198
03199
03200
03201
03202
03203
03204
03205
03206 void elemoutgt::print_graphics(const char *outfn, const char *mode, long lcid, const char *desclcid,
03207 graphftt gf, hflagsw hf, long idelem1)
03208 {
03209 ide1 = idelem1;
03210 if (gf != grftt_gid_sep)
03211 {
03212 print_err("invalid graphics format is required", __FILE__, __LINE__, __func__);
03213 return;
03214 }
03215 print_gr_grad_scal(outfn, mode, desclcid, hf);
03216 print_gr_flux_scal(outfn, mode, desclcid, hf);
03217 print_gr_oth_scal(outfn, mode, lcid, desclcid, hf);
03218 print_gr_eqoth_scal(outfn, mode, lcid, desclcid, hf);
03219
03220 print_gr_grad_vec(outfn, mode, lcid, desclcid, hf);
03221 print_gr_flux_vec(outfn, mode, lcid, desclcid, hf);
03222 print_gr_oth_vec(outfn, mode, lcid, desclcid, hf);
03223 print_gr_eqoth_vec(outfn, mode, lcid, desclcid, hf);
03224
03225 return;
03226 }
03227
03228
03229
03230
03231
03232
03233
03234
03235
03236
03237
03238
03239
03240
03241
03242
03243
03244
03245
03246 void elemoutgt::print_gr_grad_scal(const char *outfn, const char *mode, const char *desclcid, hflagsw hf)
03247 {
03248 long i,ii,j, sl;
03249 char fname[FNAMELEN+70];
03250 FILE *out;
03251
03252 sl = strlen(outfn);
03253
03254 if (selegrad.st != sel_no)
03255 {
03256 for(ii=0; ii<Tp->ntm; ii++)
03257 {
03258 for(i=0; i<Tm->ip[0].ncompgrad; i++)
03259 {
03260 for (j=0; j<selegrad.n; j++)
03261 {
03262 if (selgrad[j].presence_id(ii))
03263 {
03264 sprintf(fname, "%s.elem_grad%ld_%ld.flavia.res", outfn, ii+1, i+1);
03265 out = fopen(fname, mode);
03266 if (out == NULL)
03267 {
03268 fprintf(stderr, "\n\nUnable to open graphics file '%s' in function elemoutt::print_graphics\n", fname);
03269 fprintf(stderr, " (file %s, line %d)\n", __FILE__, __LINE__);
03270 abort();
03271 }
03272 if (hf == footer)
03273 {
03274 if (Adat)
03275 fprintf(out, "End OnGroup\n\n");
03276 fclose(out);
03277 break;
03278 }
03279 if (hf == header)
03280 {
03281 fseek(out, 0, SEEK_END);
03282 if (ftell(out) == 0)
03283 {
03284 fprintf(out, "GiD Post Results File 1.0\n");
03285 export_gid_gauss_ptt(out);
03286 }
03287 if (Adat)
03288 fprintf(out, "\nOnGroup adapt_step_%ld\n\n", Adat->istep+1);
03289 }
03290 else
03291 write_gid_elemscalart(out, grad, ii, i, desclcid);
03292 fclose(out);
03293 break;
03294 }
03295 }
03296 }
03297 }
03298 }
03299 }
03300
03301
03302
03303
03304
03305
03306
03307
03308
03309
03310
03311
03312
03313
03314
03315
03316
03317
03318
03319 void elemoutgt::print_gr_flux_scal(const char *outfn, const char *mode, const char *desclcid, hflagsw hf)
03320 {
03321 long i,ii,j, sl;
03322 char fname[FNAMELEN+70];
03323 FILE *out;
03324
03325 sl = strlen(outfn);
03326
03327 if (seleflux.st != sel_no)
03328 {
03329 for(ii=0; ii<Tp->ntm; ii++)
03330 {
03331 for(i=0; i<Tm->ip[0].ncompgrad; i++)
03332 {
03333 for (j=0; j<seleflux.n; j++)
03334 {
03335 if (selflux[j].presence_id(ii))
03336 {
03337 sprintf(fname, "%s.elem_flux%ld_%ld.flavia.res", outfn, ii+1, i+1);
03338 out = fopen(fname, mode);
03339 if (out == NULL)
03340 {
03341 fprintf(stderr, "\n\nUnable to open graphics file '%s' in function elemoutt::print_graphics\n", fname);
03342 fprintf(stderr, " (file %s, line %d)\n", __FILE__, __LINE__);
03343 abort();
03344 }
03345 if (hf == footer)
03346 {
03347 if (Adat)
03348 fprintf(out, "End OnGroup\n\n");
03349 fclose(out);
03350 break;
03351 }
03352 if (hf == header)
03353 {
03354 fseek(out, 0, SEEK_END);
03355 if (ftell(out) == 0)
03356 {
03357 fprintf(out, "GiD Post Results File 1.0\n");
03358 export_gid_gauss_ptt(out);
03359 }
03360 if (Adat)
03361 fprintf(out, "\nOnGroup adapt_step_%ld\n\n", Adat->istep+1);
03362 }
03363 else
03364 write_gid_elemscalart(out, flux, ii, i, desclcid);
03365 fclose(out);
03366 break;
03367 }
03368 }
03369 }
03370 }
03371 }
03372 }
03373
03374
03375
03376
03377
03378
03379
03380
03381
03382
03383
03384
03385
03386
03387
03388
03389
03390
03391
03392
03393 void elemoutgt::print_gr_oth_scal(const char *outfn, const char *mode, long lcid, const char *desclcid, hflagsw hf)
03394 {
03395 long i, j, sl;
03396 char fname[FNAMELEN+70];
03397 FILE *out;
03398
03399 sl = strlen(outfn);
03400
03401 if (seleoth.st != sel_no)
03402 {
03403 for(i=0; i<Tm->ip[0].ncompother; i++)
03404 {
03405 for (j=0; j<seleoth.n; j++)
03406 {
03407 if (seloth[j].presence_id(i))
03408 {
03409 sprintf(fname, "%s.elem_other%ld.flavia.res", outfn, i+1);
03410 out = fopen(fname, mode);
03411 if (out == NULL)
03412 {
03413 fprintf(stderr, "\n\nUnable to open graphics file '%s' in function elemoutt::print_graphics\n", fname);
03414 fprintf(stderr, " (file %s, line %d)\n", __FILE__, __LINE__);
03415 abort();
03416 }
03417 if (hf == footer)
03418 {
03419 if (Adat)
03420 fprintf(out, "End OnGroup\n\n");
03421 fclose(out);
03422 break;
03423 }
03424 if (hf == header)
03425 {
03426 fseek(out, 0, SEEK_END);
03427 if (ftell(out) == 0)
03428 {
03429 fprintf(out, "GiD Post Results File 1.0\n");
03430 export_gid_gauss_ptt(out);
03431 }
03432 if (Adat)
03433 fprintf(out, "\nOnGroup adapt_step_%ld\n\n", Adat->istep+1);
03434 }
03435 else
03436 write_gid_elemscalart(out, othert, lcid, i, desclcid);
03437 fclose(out);
03438 break;
03439 }
03440 }
03441 }
03442 }
03443 }
03444
03445
03446
03447
03448
03449
03450
03451
03452
03453
03454
03455
03456
03457
03458
03459
03460
03461
03462
03463
03464 void elemoutgt::print_gr_eqoth_scal(const char *outfn, const char *mode, long lcid, const char *desclcid, hflagsw hf)
03465 {
03466 long i, j, sl;
03467 char fname[FNAMELEN+70];
03468 FILE *out;
03469
03470 sl = strlen(outfn);
03471
03472 if (seleeqoth.st != sel_no)
03473 {
03474 for(i=0; i<Tm->ip[0].ncompeqother; i++)
03475 {
03476 for (j=0; j<seleeqoth.n; j++)
03477 {
03478 if (seleqoth[j].presence_id(i))
03479 {
03480 sprintf(fname, "%s.elem_eqother%ld.flavia.res", outfn, i+1);
03481 out = fopen(fname, mode);
03482 if (out == NULL)
03483 {
03484 fprintf(stderr, "\n\nUnable to open graphics file '%s' in function elemoutt::print_graphics\n", fname);
03485 fprintf(stderr, " (file %s, line %d)\n", __FILE__, __LINE__);
03486 abort();
03487 }
03488 if (hf == footer)
03489 {
03490 if (Adat)
03491 fprintf(out, "End OnGroup\n\n");
03492 fclose(out);
03493 break;
03494 }
03495 if (hf == header)
03496 {
03497 fseek(out, 0, SEEK_END);
03498 if (ftell(out) == 0)
03499 {
03500 fprintf(out, "GiD Post Results File 1.0\n");
03501 export_gid_gauss_ptt(out);
03502 }
03503 if (Adat)
03504 fprintf(out, "\nOnGroup adapt_step_%ld\n\n", Adat->istep+1);
03505 }
03506 else
03507 write_gid_elemscalart(out, eqothert, lcid, i, desclcid);
03508 fclose(out);
03509 break;
03510 }
03511 }
03512 }
03513 }
03514 }
03515
03516
03517
03518
03519
03520
03521
03522
03523
03524
03525
03526
03527
03528
03529
03530
03531
03532
03533
03534
03535 void elemoutgt::print_gr_grad_vec(const char *outfn, const char *mode, long lcid, const char *desclcid, hflagsw hf)
03536 {
03537 long j, sl;
03538 char fname[FNAMELEN+70];
03539 FILE *out;
03540
03541 sl = strlen(outfn);
03542
03543 if (selegrad.st != sel_no)
03544 {
03545 for (j=0; j<selegrad.n; j++)
03546 {
03547 if (selgrad[j].st != sel_vec)
03548 continue;
03549 sprintf(fname, "%s.elem_grad%ld_v_s%ld.flavia.res", outfn, selgrad[j].id1[0]+1, j+1);
03550 out = fopen(fname, mode);
03551 if (out == NULL)
03552 {
03553 fprintf(stderr, "\n\nUnable to open graphics file '%s' in function elemoutt::print_graphics\n", fname);
03554 fprintf(stderr, " (file %s, line %d)\n", __FILE__, __LINE__);
03555 abort();
03556 }
03557 if (hf == footer)
03558 {
03559 if (Adat)
03560 fprintf(out, "End OnGroup\n\n");
03561 fclose(out);
03562 break;
03563 }
03564 if (hf == header)
03565 {
03566 fseek(out, 0, SEEK_END);
03567 if (ftell(out) == 0)
03568 {
03569 fprintf(out, "GiD Post Results File 1.0\n");
03570 export_gid_gauss_ptt(out);
03571 }
03572 if (Adat)
03573 fprintf(out, "\nOnGroup adapt_step_%ld\n\n", Adat->istep+1);
03574 }
03575 else
03576 write_gid_elemvectort(out, grad, lcid, j, desclcid);
03577 fclose(out);
03578 break;
03579 }
03580 }
03581 }
03582
03583
03584
03585
03586
03587
03588
03589
03590
03591
03592
03593
03594
03595
03596
03597
03598
03599
03600
03601
03602 void elemoutgt::print_gr_flux_vec(const char *outfn, const char *mode, long lcid, const char *desclcid, hflagsw hf)
03603 {
03604 long j, sl;
03605 char fname[FNAMELEN+70];
03606 FILE *out;
03607
03608 sl = strlen(outfn);
03609
03610 if (seleflux.st != sel_no)
03611 {
03612 for (j=0; j<seleflux.n; j++)
03613 {
03614 if (selflux[j].st != sel_vec)
03615 continue;
03616 sprintf(fname, "%s.elem_flux%ld_v_s%ld.flavia.res", outfn, selflux[j].id1[0]+1, j+1);
03617 out = fopen(fname, mode);
03618 if (out == NULL)
03619 {
03620 fprintf(stderr, "\n\nUnable to open graphics file '%s' in function elemoutt::print_graphics\n", fname);
03621 fprintf(stderr, " (file %s, line %d)\n", __FILE__, __LINE__);
03622 abort();
03623 }
03624 if (hf == footer)
03625 {
03626 if (Adat)
03627 fprintf(out, "End OnGroup\n\n");
03628 fclose(out);
03629 break;
03630 }
03631 if (hf == header)
03632 {
03633 fseek(out, 0, SEEK_END);
03634 if (ftell(out) == 0)
03635 {
03636 fprintf(out, "GiD Post Results File 1.0\n");
03637 export_gid_gauss_ptt(out);
03638 }
03639 if (Adat)
03640 fprintf(out, "\nOnGroup adapt_step_%ld\n\n", Adat->istep+1);
03641 }
03642 else
03643 write_gid_elemvectort(out, flux, lcid, j, desclcid);
03644 fclose(out);
03645 break;
03646 }
03647 }
03648 }
03649
03650
03651
03652
03653
03654
03655
03656
03657
03658
03659
03660
03661
03662
03663
03664
03665
03666
03667
03668
03669 void elemoutgt::print_gr_oth_vec(const char *outfn, const char *mode, long lcid, const char *desclcid, hflagsw hf)
03670 {
03671 long j, sl;
03672 char fname[FNAMELEN+70];
03673 FILE *out;
03674
03675 sl = strlen(outfn);
03676
03677 if (seleoth.st != sel_no)
03678 {
03679 for (j=0; j<seleoth.n; j++)
03680 {
03681 if (seloth[j].st != sel_range_vec)
03682 continue;
03683 sprintf(fname, "%s.elem_other_v%ld-%ld_s%ld.flavia.res", outfn, seloth[j].id1[0]+1, seloth[j].ncomp[0], j+1);
03684 out = fopen(fname, mode);
03685 if (out == NULL)
03686 {
03687 fprintf(stderr, "\n\nUnable to open graphics file '%s' in function elemoutt::print_graphics\n", fname);
03688 fprintf(stderr, " (file %s, line %d)\n", __FILE__, __LINE__);
03689 abort();
03690 }
03691 if (hf == footer)
03692 {
03693 if (Adat)
03694 fprintf(out, "End OnGroup\n\n");
03695 fclose(out);
03696 break;
03697 }
03698 if (hf == header)
03699 {
03700 fseek(out, 0, SEEK_END);
03701 if (ftell(out) == 0)
03702 {
03703 fprintf(out, "GiD Post Results File 1.0\n");
03704 export_gid_gauss_ptt(out);
03705 }
03706 if (Adat)
03707 fprintf(out, "\nOnGroup adapt_step_%ld\n\n", Adat->istep+1);
03708 }
03709 else
03710 write_gid_elemvectort(out, flux, lcid, j, desclcid);
03711 fclose(out);
03712 break;
03713 }
03714 }
03715 }
03716
03717
03718
03719
03720
03721
03722
03723
03724
03725
03726
03727
03728
03729
03730
03731
03732
03733
03734
03735
03736 void elemoutgt::print_gr_eqoth_vec(const char *outfn, const char *mode, long lcid, const char *desclcid, hflagsw hf)
03737 {
03738 long j, sl;
03739 char fname[FNAMELEN+70];
03740 FILE *out;
03741
03742 sl = strlen(outfn);
03743
03744 if (seleeqoth.st != sel_no)
03745 {
03746 for (j=0; j<seleeqoth.n; j++)
03747 {
03748 if (seleqoth[j].st != sel_range_vec)
03749 continue;
03750 sprintf(fname, "%s.elem_eqother_v%ld-%ld_s%ld.flavia.res", outfn, seleqoth[j].id1[0]+1, seleqoth[j].ncomp[0], j+1);
03751 out = fopen(fname, mode);
03752 if (out == NULL)
03753 {
03754 fprintf(stderr, "\n\nUnable to open graphics file '%s' in function elemoutt::print_graphics\n", fname);
03755 fprintf(stderr, " (file %s, line %d)\n", __FILE__, __LINE__);
03756 abort();
03757 }
03758 if (hf == footer)
03759 {
03760 if (Adat)
03761 fprintf(out, "End OnGroup\n\n");
03762 fclose(out);
03763 break;
03764 }
03765 if (hf == header)
03766 {
03767 fseek(out, 0, SEEK_END);
03768 if (ftell(out) == 0)
03769 {
03770 fprintf(out, "GiD Post Results File 1.0\n");
03771 export_gid_gauss_ptt(out);
03772 }
03773 if (Adat)
03774 fprintf(out, "\nOnGroup adapt_step_%ld\n\n", Adat->istep+1);
03775 }
03776 else
03777 write_gid_elemvectort(out, flux, lcid, j, desclcid);
03778 fclose(out);
03779 break;
03780 }
03781 }
03782 }
03783
03784
03785
03786
03787
03788
03789
03790
03791 pointoutt::pointoutt()
03792 {
03793 npnt = 0;
03794 ksi = eta = zeta = NULL;
03795 selgrad = selflux = seloth = seleqoth = NULL;
03796 }
03797
03798
03799
03800
03801
03802
03803 pointoutt::~pointoutt()
03804 {
03805 delete [] ksi;
03806 delete [] eta;
03807 delete [] zeta;
03808 delete [] selgrad;
03809 delete [] selflux;
03810 delete [] seloth;
03811 delete [] seleqoth;
03812 }
03813
03814
03815
03816
03817
03818
03819
03820
03821
03822
03823
03824
03825
03826
03827 long pointoutt::read(XFILE *in)
03828 {
03829 long i;
03830
03831 dstep.read(in);
03832 if (dstep.st == sel_no)
03833 return 0;
03834 if (xfscanf(in, "%k%ld", "numpoints", &npnt) != 2)
03835 {
03836 fprintf(stderr, "\n\nError reading number of points\n");
03837 fprintf(stderr, " in function pointoutt::read, (file %s, line %d)\n", __FILE__, __LINE__);
03838 return 1;
03839 }
03840 if (npnt == 0)
03841 return 0;
03842
03843 ksi = new double [npnt];
03844 eta = new double [npnt];
03845 zeta = new double [npnt];
03846 memset(ksi, 0, sizeof(*ksi)*npnt);
03847 memset(eta, 0, sizeof(*eta)*npnt);
03848 memset(zeta, 0, sizeof(*zeta)*npnt);
03849 for (i=0; i<npnt; i++)
03850 {
03851 if (xfscanf(in, "%k %le %k %le %k %le", "ksi", ksi+i, "eta", eta+i, "zeta", zeta+i) != 6)
03852 {
03853 fprintf(stderr, "\n\nError reading coordinates of UDP\n");
03854 fprintf(stderr, " in function pointoutt::read, (file %s, line %d)\n", __FILE__, __LINE__);
03855 return 2;
03856 }
03857 }
03858
03859 selelem.read(in);
03860 switch(selelem.st)
03861 {
03862 case sel_no:
03863 return 0;
03864 case sel_all:
03865 case sel_range:
03866 case sel_list:
03867 selpnt = new sel[selelem.n];
03868 for (i=0; i<selelem.n; i++)
03869 selpnt[i].read(in);
03870 break;
03871 default:
03872 fprintf(stderr, "\n\nUnknown type of selection is required in function pointoutt::read\n");
03873 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
03874 return 3;
03875 }
03876
03877 sellc.read(in);
03878 if (sellc.st == sel_no)
03879 return 0;
03880
03881 selgrad = new sel[npnt];
03882 selflux = new sel[npnt];
03883 seloth = new sel[npnt];
03884 seleqoth = new sel[npnt];
03885
03886 for (i=0; i<npnt; i++)
03887 {
03888
03889 selgrad[i].read(in);
03890
03891
03892 selflux[i].read(in);
03893
03894
03895 seloth[i].read(in);
03896
03897
03898 seleqoth[i].read(in);
03899
03900
03901 if (selgrad[i].st != sel_no)
03902 Tp->gradcomp = 1;
03903 if (selflux[i].st != sel_no)
03904 Tp->fluxcomp = 1;
03905 if (seloth[i].st != sel_no)
03906 Tp->othercomp = 1;
03907 if (seleqoth[i].st != sel_no)
03908 Tp->eqothercomp = 1;
03909 }
03910 return 0;
03911 }
03912
03913
03914
03915
03916
03917
03918
03919
03920 void pointoutt::print(FILE *out)
03921 {
03922 long i;
03923 dstep.print(out);
03924 if ((dstep.st == sel_no) || (npnt == 0))
03925 {
03926 fprintf(out, "\n");
03927 return;
03928 }
03929 fprintf(out, " %ld\n", npnt);
03930 if (npnt == 0)
03931 return;
03932
03933 for (i=0; i<npnt; i++)
03934 fprintf(out, "%e %e %e\n", ksi[i], eta[i], zeta[i]);
03935
03936
03937 selelem.print(out);
03938 switch(selelem.st)
03939 {
03940 case sel_no:
03941 return;
03942 case sel_all:
03943 case sel_range:
03944 case sel_list:
03945 for (i=0; i<selelem.n; i++)
03946 selpnt[i].print(out);
03947 break;
03948 default:
03949 fprintf(stderr, "\n\nUnknown type of selection is required in function pointoutt::read\n");
03950 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
03951 return;
03952 }
03953
03954 sellc.print(out);
03955 if (sellc.st == sel_no)
03956 return;
03957
03958 for (i=0; i<npnt; i++)
03959 {
03960
03961 selgrad[i].print(out);
03962
03963 selflux[i].print(out);
03964
03965 seloth[i].print(out);
03966
03967 seleqoth[i].print(out);
03968 }
03969 }
03970
03971
03972
03973
03974
03975
03976
03977
03978
03979
03980
03981 void pointoutt::print_out(FILE *out, long lcid)
03982 {
03983 long i;
03984
03985 for (i=0; i<npnt; i++)
03986 {
03987 if (selgrad[i].st != sel_no)
03988 fprintf(out, "** UDP gradients :\n\n");
03989 }
03990 print_grad(out, lcid);
03991
03992 for (i=0; i<npnt; i++)
03993 {
03994 if (selflux[i].st != sel_no)
03995 fprintf(out, "** UDP fluxes :\n\n");
03996 }
03997 print_flux(out, lcid);
03998
03999 for (i=0; i<npnt; i++)
04000 {
04001 if (seloth[i].st != sel_no)
04002 fprintf(out, "** UDP other values :\n\n");
04003 print_other(out, i);
04004 }
04005 for (i=0; i<npnt; i++)
04006 {
04007 if (seleqoth[i].st != sel_no)
04008 fprintf(out, "** UDP eqother values :\n\n");
04009 print_eqother(out, i);
04010 }
04011 }
04012
04013
04014
04015
04016
04017
04018
04019
04020
04021
04022
04023 void pointoutt::print_grad(FILE *out, long lcid)
04024 {
04025 long i,j,k,l,n, ncomp, id;
04026
04027 for (i=0; i<Tt->ne; i++)
04028 {
04029 if (selelem.presence_id(i))
04030 {
04031 fprintf(out, " Element %7ld:\n",i+1);
04032 ncomp = Tt->give_ncomp(i);
04033 id = lcid*ncomp;
04034 switch(selelem.st)
04035 {
04036 case sel_no:
04037 n=0;
04038 break;
04039 case sel_all:
04040 case sel_range:
04041 case sel_list:
04042 n=selelem.n;
04043 break;
04044 default:
04045 fprintf(stderr, "\n\nUnknown type of selection is required in function pointoutt::print_grad\n");
04046 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
04047 return;
04048 }
04049 for (j=0; j<n; j++)
04050 {
04051 for (k=0; k<npnt; k++)
04052 {
04053 if (selpnt[j].presence_id(k))
04054 {
04055 fprintf(out, " point %ld:", k+1);
04056 for (l=0; l<ncomp; l++)
04057 {
04058 if(selgrad[k].presence_id(l))
04059 fprintf(out, " eps_%ld=% *e", l+1, prgrad, Tm->grad.ev[i][k][id+l]);
04060 }
04061 fprintf(out, "\n");
04062 }
04063 }
04064 }
04065 fprintf(out, "\n");
04066 }
04067 }
04068 }
04069
04070
04071
04072
04073
04074
04075
04076
04077
04078
04079
04080
04081 void pointoutt::print_flux(FILE *out, long lcid)
04082 {
04083 long i,j,k,l,n, ncomp, id;
04084
04085 for (i=0; i<Tt->ne; i++)
04086 {
04087 if (selelem.presence_id(i))
04088 {
04089 fprintf(out, " Element %7ld:\n", i+1);
04090 ncomp = Tt->give_ncomp(i);
04091 id = lcid*ncomp;
04092 switch(selelem.st)
04093 {
04094 case sel_no:
04095 n=0;
04096 break;
04097 case sel_all:
04098 case sel_range:
04099 case sel_list:
04100 n=selelem.n;
04101 break;
04102 default:
04103 fprintf(stderr, "\n\nUnknown type of selection is required in function pointoutt::print_flux\n");
04104 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
04105 return;
04106 }
04107 for (j=0; j<n; j++)
04108 {
04109 for (k=0; k<npnt; k++)
04110 {
04111 if (selpnt[j].presence_id(k))
04112 {
04113 fprintf(out, " point %ld:", k+1);
04114 for (l=0; l<ncomp; l++)
04115 {
04116 if(selgrad[k].presence_id(l))
04117 fprintf(out, " sig_%ld=% *e", l+1, prgrad, Tm->flux.ev[i][k][id+l]);
04118 }
04119 fprintf(out, "\n");
04120 }
04121 }
04122 }
04123 fprintf(out, "\n");
04124 }
04125 }
04126 }
04127
04128
04129
04130
04131
04132
04133
04134
04135
04136
04137
04138
04139
04140 void pointoutt::print_other(FILE *out, long pid)
04141 {
04142 long i,j,k,l,n, ncomp;
04143
04144 for (i=0; i<Tt->ne; i++)
04145 {
04146 if (selelem.presence_id(i))
04147 {
04148
04149 ncomp = Tm->ip[Tt->elements[i].ipp[0][0]].ncompother;
04150 switch(selelem.st)
04151 {
04152 case sel_no:
04153 n=0;
04154 break;
04155 case sel_all:
04156 case sel_range:
04157 case sel_list:
04158 n=selelem.n;
04159 break;
04160 default:
04161 fprintf(stderr, "\n\nUnknown type of selection is required in function pointoutt::print_other\n");
04162 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
04163 return;
04164 }
04165 for (j=0; j<n; j++)
04166 {
04167 for (k=0; k<npnt; k++)
04168 {
04169 if (selpnt[j].presence_id(k))
04170 {
04171
04172 for (l=0; l<ncomp; l++)
04173 {
04174
04175
04176 }
04177
04178 }
04179 }
04180 }
04181
04182 }
04183 }
04184 }
04185
04186
04187
04188
04189
04190
04191
04192
04193
04194
04195
04196 void pointoutt::print_eqother(FILE *out, long pid)
04197 {
04198 long i,j,k,l,n, ncomp;
04199
04200 for (i=0; i<Tt->ne; i++)
04201 {
04202 if (selelem.presence_id(i))
04203 {
04204
04205 ncomp = Tm->ip[Tt->elements[i].ipp[0][0]].ncompeqother;
04206 switch(selelem.st)
04207 {
04208 case sel_no:
04209 n=0;
04210 break;
04211 case sel_all:
04212 case sel_range:
04213 case sel_list:
04214 n=selelem.n;
04215 break;
04216 default:
04217 fprintf(stderr, "\n\nUnknown type of selection is required in function pointoutt::print_eqother\n");
04218 fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__);
04219 return;
04220 }
04221 for (j=0; j<n; j++)
04222 {
04223 for (k=0; k<npnt; k++)
04224 {
04225 if (selpnt[j].presence_id(k))
04226 {
04227
04228 for (l=0; l<ncomp; l++)
04229 {
04230
04231
04232 }
04233
04234 }
04235 }
04236 }
04237
04238 }
04239 }
04240 }