00001 #include <string.h>
00002 #include <stdlib.h>
00003 #include "outdriverm.h"
00004 #include "iotools.h"
00005 #include "galias.h"
00006 #include "global.h"
00007 #include "probdesc.h"
00008 #include "mechbclc.h"
00009 #include "mechtop.h"
00010 #include "mechprint.h"
00011 #include "node.h"
00012 #include "element.h"
00013 #include "globmat.h"
00014 #include "intpoints.h"
00015 #include "sequent.h"
00016 #include "vecttens.h"
00017 #include <math.h>
00018
00019
00020 static int prdisp = 15;
00021 static int prstra = 15;
00022 static int prstre = 15;
00023 static int proth = 15;
00024 static int prreac = 15;
00025
00026
00027
00028
00029
00030
00031
00032
00033 outdriverm::outdriverm()
00034 {
00035 memset(outfn, 0, sizeof(*outfn)*FNAMELEN);
00036 memset(outdiagfn, 0, sizeof(*outdiagfn)*FNAMELEN);
00037 memset(outgrfn, 0, sizeof(*outgrfn)*FNAMELEN);
00038 outf = outgr = NULL;
00039 outdiagf = NULL;
00040 textout = off;
00041 gf = grfmt_no;
00042 ncut = 0;
00043 idn1 = 1;
00044 ide1 = 1;
00045 ndiag = 0;
00046 odiag = NULL;
00047 vtk_num = 0;
00048 nlcs = 0L;
00049 lcs = NULL;
00050 }
00051
00052
00053
00054
00055
00056
00057
00058
00059 outdriverm::~outdriverm()
00060 {
00061 delete [] outdiagf;
00062 delete [] odiag;
00063 delete [] lcs;
00064 }
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 long outdriverm::read(XFILE *in)
00087 {
00088 long i, n;
00089 const char *str;
00090
00091 xfscanf(in, "%k%m", "textout", &flagsw_kwdset, &textout);
00092 if (textout)
00093 {
00094 if (xfscanf(in," %a", outfn) != 1)
00095 {
00096 print_err("cannot read filename for output", __FILE__, __LINE__, __func__);
00097 return 1;
00098 }
00099 fprintf(stdout, "\n Output file name (mechanics): %s", outfn);
00100
00101 if (no.read(in))
00102 return 2;
00103 if (no.dstep.st == sel_no)
00104 str = " not";
00105 else
00106 str = "";
00107 fprintf(stdout, "\n Output of mechanical nodal values will%s be performed", str);
00108
00109 if (eo.read(in))
00110 return 3;
00111 if (eo.dstep.st == sel_no)
00112 str = " not";
00113 else
00114 str = "";
00115 fprintf(stdout, "\n Output of mechanical element values will%s be performed", str);
00116 if (po.read(in))
00117 return 4;
00118 if (po.dstep.st == sel_no)
00119 str = " not";
00120 else
00121 str = "";
00122 fprintf(stdout, "\n Output of mechanical UDP values will%s be performed", str);
00123 }
00124 if (xfscanf(in, "%k%m", "outgr_format", &graphfmt_kwdset, (int *)&gf) != 2)
00125 {
00126 print_err("cannot read type of grahics output", __FILE__, __LINE__, __func__);
00127 return 5;
00128 }
00129 if (gf == grfmt_open_dx)
00130 {
00131 Mp->straincomp = 1;
00132 Mp->strainpos = 2;
00133 Mp->strainaver = 1;
00134 Mp->stresscomp = 1;
00135 Mp->stresspos = 2;
00136 Mp->stressaver = 1;
00137 Mp->othercomp = 1;
00138 Mp->otherpos = 2;
00139 Mp->otheraver = 1;
00140 Mp->reactcomp = 1;
00141 }
00142 if (gf != grfmt_no)
00143 {
00144 if (xfscanf(in, " %a", outgrfn) != 1)
00145 {
00146 print_err("cannot read filename for graphics output", __FILE__, __LINE__, __func__);
00147 return 5;
00148 }
00149 }
00150 switch (gf)
00151 {
00152 case grfmt_no:
00153 fprintf(stdout, "\n Graphic output will not be performed");
00154 break;
00155 case grfmt_open_dx:
00156 fprintf(stdout, "\n Graphic output will be in OpenDX format");
00157 fprintf(stdout, "\n Filename of graphic output: %s", outgrfn);
00158 break;
00159 case grfmt_femcad:
00160 fprintf(stdout, "\n Graphic output will be in FemCAD format");
00161 fprintf(stdout, "\n Filename of graphic output: %s", outgrfn);
00162 break;
00163 case grfmt_gid:
00164 fprintf(stdout, "\n Graphic output will be in GiD format");
00165 fprintf(stdout, "\n Filename of graphic output: %s", outgrfn);
00166 break;
00167 case grfmt_gid_sep:
00168 fprintf(stdout, "\n Graphic output will be in GiD format separated to quantities");
00169 fprintf(stdout, "\n Filename of graphic output: %s", outgrfn);
00170 break;
00171 case grfmt_vtk:
00172 fprintf(stdout, "\n Graphic output will be in VTK format");
00173 fprintf(stdout, "\n Filename of graphic output: %s", outgrfn);
00174 break;
00175 }
00176
00177 if (gf != grfmt_no)
00178 {
00179 if (nog.read(in))
00180 return 6;
00181 if (nog.dstep.st == sel_no)
00182 str = " not";
00183 else
00184 str = "";
00185 fprintf(stdout, "\n Graphical output of mechanical nodal values will%s be performed", str);
00186
00187 if (eog.read(in))
00188 return 7;
00189 if (eog.dstep.st == sel_no)
00190 str = " not";
00191 else
00192 str = "";
00193 fprintf(stdout, "\n Graphical output of mechanical element values will%s be performed", str);
00194 }
00195 switch (Mp->tprob)
00196 {
00197 case lin_floating_subdomain:
00198 case mat_nonlinear_statics:
00199 case eigen_dynamics:
00200 case forced_dynamics:
00201 case mech_timedependent_prob:
00202 case nonlin_floating_subdomain:
00203 case growing_mech_structure:
00204 case earth_pressure:
00205 if (xfscanf(in, "%k%ld", "numdiag", &ndiag) != 2)
00206 {
00207 print_err("cannot read number of diagrams", __FILE__, __LINE__, __func__);
00208 return 8;
00209 }
00210 if (ndiag == 0)
00211 {
00212 fprintf (stdout, "\n Number of diagrams : %ld", ndiag);
00213 return 0;
00214 }
00215 if (xfscanf(in, " %a", outdiagfn) != 1)
00216 {
00217 print_err("cannot read filename for diagrams", __FILE__, __LINE__, __func__);
00218 return 8;
00219 }
00220 fprintf (stdout, "\n Number of diagrams: %ld", ndiag);
00221 fprintf (stdout, "\n Diagram filename: %s",outdiagfn);
00222 odiag = new outdiagm[ndiag];
00223 outdiagf = new FILE* [ndiag];
00224 memset(outdiagf, 0, sizeof(*outdiagf)*ndiag);
00225 for (i=0; i<ndiag; i++)
00226 {
00227 if (odiag[i].read(in))
00228 return 8;
00229 }
00230 break;
00231 default:
00232 break;
00233 }
00234 if (testlcs() == 1)
00235 {
00236 if (xfscanf(in, "%k%ld", "numlcs", &nlcs) != 2)
00237 {
00238 print_err("cannot read number of local coordinate systems", __FILE__, __LINE__, __func__);
00239 return 9;
00240 }
00241 if (nlcs <= 0)
00242 {
00243 print_err("wrong number of local coordinate systems", __FILE__, __LINE__, __func__);
00244 return 9;
00245 }
00246 lcs = new gfmatrix[nlcs];
00247 for (i=0; i<nlcs; i++)
00248 {
00249 xfscanf(in, "%k%ld", "ncomp", &n);
00250 if ((n < 2) || (n > 3))
00251 {
00252 print_err("wrong number of base vector component %ld.\nIt must be either 2 or 3", __FILE__, __LINE__, __func__);
00253 return 9;
00254 }
00255
00256 allocim(3, lcs[i]);
00257
00258 lcs[i].m = lcs[i].n = n;
00259 readm(in, lcs[i]);
00260 lcs[i].m = lcs[i].n = 3;
00261 }
00262 }
00263 return 0;
00264 }
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276 void outdriverm::print(FILE *out)
00277 {
00278 long i;
00279 fprintf(out, "\n#\n# outdriver section\n#\n");
00280 fprintf(out, "%d\n", (int)textout);
00281 if (textout == on)
00282 {
00283 fprintf(out, "%s\n", outfn);
00284 no.print(out);
00285 eo.print(out);
00286 po.print(out);
00287 }
00288 fprintf(out, "%d\n", (int)gf);
00289 if (gf != grfmt_no)
00290 {
00291 fprintf(out, "%s\n", outgrfn);
00292 nog.print(out);
00293 eog.print(out);
00294 }
00295 switch (Mp->tprob)
00296 {
00297 case lin_floating_subdomain:
00298 case mat_nonlinear_statics:
00299 case eigen_dynamics:
00300 case forced_dynamics:
00301 case mech_timedependent_prob:
00302 case growing_mech_structure:
00303 case nonlin_floating_subdomain:
00304 case earth_pressure:
00305 fprintf(out, "%ld\n", ndiag);
00306 if (ndiag == 0)
00307 break;
00308 fprintf(out, "%s\n", outdiagfn);
00309 for (i=0; i<ndiag; i++)
00310 odiag[i].print(out);
00311 break;
00312 default:
00313 break;
00314 }
00315 }
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328 void outdriverm::print_header(FILE *out)
00329 {
00330 fprintf(out, "%15s **** * **** **** *\n", " ");
00331 fprintf(out, "%15s * * * * *\n", " ");
00332 fprintf(out, "%15s * * *** *** *\n", " ");
00333 fprintf(out, "%15s * * * * *\n", " ");
00334 fprintf(out, "%15s**** * * **** **** MEFEL OUTPUT\n", " ");
00335
00336
00337
00338
00339
00340
00341
00342
00343 fprintf(out, "\n%s\n", Mp->name);
00344 fprintf(out, "\n\n\n\n\n");
00345 }
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361 void outdriverm::print_newstep(FILE *out, long lcid, long istep, double time)
00362 {
00363 long i;
00364 double lambda;
00365
00366 if (textout)
00367 {
00368 if(Mp->tpr == seconds)
00369 lambda = time;
00370 if(Mp->tpr == minutes)
00371 lambda = time/60.0;
00372 if(Mp->tpr == hours)
00373 lambda = time/3600.0;
00374 if(Mp->tpr == days)
00375 lambda = time/86400.0;
00376
00377 if ((no.sellc.presence_id(lcid+1) && no.dstep.presence_id(istep, time, Mp->timecon)) ||
00378 (eo.sellc.presence_id(lcid+1) && eo.dstep.presence_id(istep, time, Mp->timecon)) ||
00379 (po.sellc.presence_id(lcid+1) && po.dstep.presence_id(istep, time, Mp->timecon)))
00380 {
00381 for (i=0; i<53; i++)
00382 fprintf(out, "*");
00383 fprintf(out, "\n%10sStep number=% ld, time/load step=% g\n", " ", istep, lambda);
00384 for (i=0; i<53; i++)
00385 fprintf(out, "*");
00386 fprintf(out, "\n\n\n\n");
00387 }
00388 }
00389 }
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403 void outdriverm::print_out(FILE *out, long lcid, long istep, double time)
00404 {
00405 if (textout)
00406 {
00407 fprintf(out, "* LOAD CASE NUMBER %ld\n\n\n", lcid+1);
00408
00409 if (no.sellc.presence_id(lcid+1) && (no.dstep.presence_id(istep, time, Mp->timecon)))
00410 no.print_out(out, lcid);
00411 if (eo.sellc.presence_id(lcid+1) && (eo.dstep.presence_id(istep, time, Mp->timecon)))
00412 eo.print_out(out, lcid);
00413 if (po.sellc.presence_id(lcid+1) && (po.dstep.presence_id(istep, time, Mp->timecon)))
00414 po.print_out(out, lcid);
00415 }
00416 }
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432 void outdriverm::print_out_forced(FILE *out, long lcid, long istep, double time)
00433 {
00434 if (textout)
00435 {
00436 fprintf(out, "* LOAD CASE NUMBER %ld\n\n\n", lcid+1);
00437
00438 if (no.sellc.presence_id(lcid+1))
00439 no.print_out(out, lcid);
00440 if (eo.sellc.presence_id(lcid+1))
00441 eo.print_out(out, lcid);
00442 if (po.sellc.presence_id(lcid+1))
00443 po.print_out(out, lcid);
00444 }
00445 }
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461 void outdriverm::print_diags(long lcid, double lambda, long istep, double *fi)
00462 {
00463 long i;
00464 for(i=0; i<ndiag; i++)
00465 odiag[i].printval(outdiagf[i], lcid, lambda, istep, fi);
00466 }
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483 void outdriverm::print_diags_forced(long lcid, double lambda, long istep, double *fi)
00484 {
00485 long i;
00486 for(i=0; i<ndiag; i++)
00487 odiag[i].printval_forced(outdiagf[i], lcid, lambda, istep, fi);
00488 }
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505 void outdriverm::print_graphics(FILE *out, long lcid, double lambda, long istep, double *fi)
00506 {
00507 long i;
00508 char dlcid[50];
00509
00510 switch (gf)
00511 {
00512 case grfmt_no:
00513 break;;
00514 case grfmt_femcad:
00515 break;
00516 case grfmt_open_dx:
00517 {
00518 for (i=0; i<Mb->nlc; i++)
00519 {
00520 if (gf == grfmt_open_dx)
00521 print_default_dx (Gtm, Mp, Mt, Mm, i, outgrfn);
00522 }
00523 break;
00524 }
00525 case grfmt_gid:
00526 {
00527 if (nog.sellc.presence_id(lcid+1) && (nog.dstep.presence_id(istep, lambda, Mp->timecon)))
00528 {
00529 switch (Mp->tprob)
00530 {
00531 case mech_timedependent_prob:
00532 case growing_mech_structure:
00533 case eigen_dynamics:
00534 case forced_dynamics:
00535 if(Mp->tpr == seconds)
00536 sprintf(dlcid, "%e", lambda);
00537 if(Mp->tpr == minutes)
00538 sprintf(dlcid, "%e", lambda/60.0);
00539 if(Mp->tpr == hours)
00540 sprintf(dlcid, "%e", lambda/3600.0);
00541 if(Mp->tpr == days)
00542 sprintf(dlcid, "%e", lambda/86400.0);
00543 nog.print_graphics(out, lcid, dlcid, gf, fi);
00544 break;
00545 default:
00546 sprintf(dlcid, "%ld", istep);
00547 nog.print_graphics(out, lcid, dlcid, gf, fi);
00548 }
00549 }
00550 if (eog.sellc.presence_id(lcid+1) && (eog.dstep.presence_id(istep, lambda, Mp->timecon)))
00551 {
00552 switch (Mp->tprob)
00553 {
00554 case mech_timedependent_prob:
00555 case growing_mech_structure:
00556 if(Mp->tpr == seconds)
00557 sprintf(dlcid, "%e", lambda);
00558 if(Mp->tpr == minutes)
00559 sprintf(dlcid, "%e", lambda/60.0);
00560 if(Mp->tpr == hours)
00561 sprintf(dlcid, "%e", lambda/3600.0);
00562 if(Mp->tpr == days)
00563 sprintf(dlcid, "%e", lambda/86400.0);
00564 eog.print_graphics(out, lcid, dlcid, gf, ide1);
00565 break;
00566 default:
00567 sprintf(dlcid, "%ld", istep);
00568 eog.print_graphics(out, lcid, dlcid, gf, ide1);
00569 }
00570 }
00571 break;
00572 }
00573 case grfmt_gid_sep:
00574 {
00575 if (nog.sellc.presence_id(lcid+1) && (nog.dstep.presence_id(istep, lambda, Mp->timecon)))
00576 {
00577 switch (Mp->tprob)
00578 {
00579 case mech_timedependent_prob:
00580 case growing_mech_structure:
00581 if(Mp->tpr == seconds)
00582 sprintf(dlcid, "%e", lambda);
00583 if(Mp->tpr == minutes)
00584 sprintf(dlcid, "%e", lambda/60.0);
00585 if(Mp->tpr == hours)
00586 sprintf(dlcid, "%e", lambda/3600.0);
00587 if(Mp->tpr == days)
00588 sprintf(dlcid, "%e", lambda/86400.0);
00589 nog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, fi);
00590 break;
00591 default:
00592 sprintf(dlcid, "%ld", istep);
00593 nog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, fi);
00594 }
00595 }
00596 if (eog.sellc.presence_id(lcid+1) && (eog.dstep.presence_id(istep, lambda, Mp->timecon)))
00597 {
00598 switch (Mp->tprob)
00599 {
00600 case mech_timedependent_prob:
00601 case growing_mech_structure:
00602 if(Mp->tpr == seconds)
00603 sprintf(dlcid, "%e", lambda);
00604 if(Mp->tpr == minutes)
00605 sprintf(dlcid, "%e", lambda/60.0);
00606 if(Mp->tpr == hours)
00607 sprintf(dlcid, "%e", lambda/3600.0);
00608 if(Mp->tpr == days)
00609 sprintf(dlcid, "%e", lambda/86400.0);
00610 eog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, ide1);
00611 break;
00612 default:
00613 sprintf(dlcid, "%ld", istep);
00614 eog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, ide1);
00615 }
00616 }
00617 break;
00618 }
00619 case grfmt_vtk:
00620 {
00621 if (nog.sellc.presence_id(lcid+1) && (nog.dstep.presence_id(istep, lambda, Mp->timecon)))
00622 {
00623 char fname[FNAMELEN+70];
00624 FILE *vtk_file;
00625 char *path;
00626 char *name;
00627 char *suffix;
00628
00629 filename_decomposition (outgrfn,path,name,suffix);
00630 sprintf(fname,"%s%s%04ld%s", path, name, istep, suffix);
00631 delete [] path; delete [] name; delete [] suffix;
00632
00633 if((vtk_file = fopen(fname, "w"))==NULL)
00634 {
00635 print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname);
00636 abort();
00637 }
00638 switch (Mp->tprob)
00639 {
00640 case mech_timedependent_prob:
00641 if(Mp->tpr == seconds)
00642 sprintf(dlcid, "%e", lambda);
00643 if(Mp->tpr == minutes)
00644 sprintf(dlcid, "%e", lambda/60.0);
00645 if(Mp->tpr == hours)
00646 sprintf(dlcid, "%e", lambda/3600.0);
00647 if(Mp->tpr == days)
00648 sprintf(dlcid, "%e", lambda/86400.0);
00649 print_default_vtk(vtk_file, lcid, istep, (double) atof(dlcid));
00650 write_vtk_unkn(vtk_file, lcid, dlcid);
00651 fclose(vtk_file);
00652 vtk_num++;
00653 break;
00654 default:
00655 {
00656
00657 }
00658 }
00659 }
00660 break;
00661 }
00662 default:
00663 print_err("unknown type of graphics format is required", __FILE__, __LINE__, __func__);
00664 }
00665 }
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683 void outdriverm::print_graphics_forced(FILE *out, long lcid, double lambda, long istep, double *fi)
00684 {
00685 long i;
00686 char dlcid[50];
00687
00688 switch (gf)
00689 {
00690 case grfmt_no:
00691 break;;
00692 case grfmt_femcad:
00693 break;
00694 case grfmt_open_dx:
00695 {
00696 for (i=0; i<Mb->nlc; i++)
00697 {
00698 if (gf == grfmt_open_dx)
00699 print_default_dx (Gtm, Mp, Mt, Mm, i, outgrfn);
00700 }
00701 break;
00702 }
00703 case grfmt_gid:
00704 {
00705 if (nog.sellc.presence_id(lcid+1))
00706 {
00707 switch (Mp->tprob)
00708 {
00709 case mech_timedependent_prob:
00710 case growing_mech_structure:
00711 if(Mp->tpr == seconds)
00712 sprintf(dlcid, "%e", lambda);
00713 if(Mp->tpr == minutes)
00714 sprintf(dlcid, "%e", lambda/60.0);
00715 if(Mp->tpr == hours)
00716 sprintf(dlcid, "%e", lambda/3600.0);
00717 if(Mp->tpr == days)
00718 sprintf(dlcid, "%e", lambda/86400.0);
00719 nog.print_graphics(out, lcid, dlcid, gf, fi);
00720 break;
00721 default:
00722 sprintf(dlcid, "%ld", istep);
00723 nog.print_graphics(out, lcid, dlcid, gf, fi);
00724 }
00725 }
00726 if (eog.sellc.presence_id(lcid+1))
00727 {
00728 switch (Mp->tprob)
00729 {
00730 case mech_timedependent_prob:
00731 case growing_mech_structure:
00732 if(Mp->tpr == seconds)
00733 sprintf(dlcid, "%e", lambda);
00734 if(Mp->tpr == minutes)
00735 sprintf(dlcid, "%e", lambda/60.0);
00736 if(Mp->tpr == hours)
00737 sprintf(dlcid, "%e", lambda/3600.0);
00738 if(Mp->tpr == days)
00739 sprintf(dlcid, "%e", lambda/86400.0);
00740 eog.print_graphics(out, lcid, dlcid, gf, ide1);
00741 break;
00742 default:
00743 sprintf(dlcid, "%ld", istep);
00744 eog.print_graphics(out, lcid, dlcid, gf, ide1);
00745 }
00746 }
00747 break;
00748 }
00749 case grfmt_gid_sep:
00750 {
00751 if (nog.sellc.presence_id(lcid+1))
00752 {
00753 switch (Mp->tprob)
00754 {
00755 case mech_timedependent_prob:
00756 case growing_mech_structure:
00757 if(Mp->tpr == seconds)
00758 sprintf(dlcid, "%e", lambda);
00759 if(Mp->tpr == minutes)
00760 sprintf(dlcid, "%e", lambda/60.0);
00761 if(Mp->tpr == hours)
00762 sprintf(dlcid, "%e", lambda/3600.0);
00763 if(Mp->tpr == days)
00764 sprintf(dlcid, "%e", lambda/86400.0);
00765 nog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, fi);
00766 break;
00767 default:
00768 sprintf(dlcid, "%ld", istep);
00769 nog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, fi);
00770 }
00771 }
00772 if (eog.sellc.presence_id(lcid+1))
00773 {
00774 switch (Mp->tprob)
00775 {
00776 case mech_timedependent_prob:
00777 case growing_mech_structure:
00778 if(Mp->tpr == seconds)
00779 sprintf(dlcid, "%e", lambda);
00780 if(Mp->tpr == minutes)
00781 sprintf(dlcid, "%e", lambda/60.0);
00782 if(Mp->tpr == hours)
00783 sprintf(dlcid, "%e", lambda/3600.0);
00784 if(Mp->tpr == days)
00785 sprintf(dlcid, "%e", lambda/86400.0);
00786 eog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, ide1);
00787 break;
00788 default:
00789 sprintf(dlcid, "%ld", istep);
00790 eog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, ide1);
00791 }
00792 }
00793 break;
00794 }
00795 default:
00796 print_err("unknown type of graphics format is required", __FILE__, __LINE__, __func__);
00797 }
00798 }
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824 void outdriverm::create_files_gidsp(const char *mode)
00825 {
00826 char dlcid[1];
00827 dlcid[0] = '\0';
00828
00829 if (gf != grfmt_gid_sep)
00830 {
00831 print_err("wrong graphics format is required", __FILE__, __LINE__, __func__);
00832 abort();
00833 }
00834 if (nog.dstep.st != sel_no)
00835 nog.print_graphics(outgrfngs, mode, 0, dlcid, gf, NULL);
00836 if (eog.dstep.st != sel_no)
00837 eog.print_graphics(outgrfngs, mode, 0, dlcid, gf, ide1);
00838 }
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851 long outdriverm::testlcs()
00852 {
00853 long i;
00854
00855 if (no.transtra)
00856 {
00857 for (i=0; i<no.selnstra.n; i++)
00858 {
00859 if (no.transtra[i] > 0)
00860 return 1;
00861 }
00862 }
00863 if (no.transtre)
00864 {
00865 for (i=0; i<no.selnstre.n; i++)
00866 {
00867 if (no.transtre[i] > 0)
00868 return 1;
00869 }
00870 }
00871 if (eo.transtra)
00872 {
00873 for (i=0; i<eo.selestra.n; i++)
00874 {
00875 if (eo.transtra[i] > 0)
00876 return 1;
00877 }
00878 }
00879 if (eo.transtre)
00880 {
00881 for (i=0; i<eo.selestre.n; i++)
00882 {
00883 if (eo.transtre[i] > 0)
00884 return 1;
00885 }
00886 }
00887 if (po.transtra)
00888 {
00889 for (i=0; i<po.npnt; i++)
00890 {
00891 if (po.transtra[i] > 0)
00892 return 1;
00893 }
00894 }
00895 if (po.transtre)
00896 {
00897 for (i=0; i<po.npnt; i++)
00898 {
00899 if (po.transtre[i] > 0)
00900 return 1;
00901 }
00902 }
00903 if (nog.transtra)
00904 {
00905 for (i=0; i<nog.selnstra.n; i++)
00906 {
00907 if (nog.transtra[i] > 0)
00908 return 1;
00909 }
00910 }
00911 if (nog.transtre)
00912 {
00913 for (i=0; i<nog.selnstre.n; i++)
00914 {
00915 if (nog.transtre[i] > 0)
00916 return 1;
00917 }
00918 }
00919 if (eog.transtra)
00920 {
00921 for (i=0; i<eog.selestra.n; i++)
00922 {
00923 if (eog.transtra[i] > 0)
00924 return 1;
00925 }
00926 }
00927 if (eog.transtre)
00928 {
00929 for (i=0; i<eog.selestre.n; i++)
00930 {
00931 if (eog.transtre[i] > 0)
00932 return 1;
00933 }
00934 }
00935 return 0;
00936 }
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952 void outdriverm::conv_sel_prop(siftop *top)
00953 {
00954 no.conv_sel_prop(top);
00955 eo.conv_sel_prop(top);
00956 nog.conv_sel_prop(top);
00957 eog.conv_sel_prop(top);
00958 }
00959
00960
00961
00962
00963
00964
00965
00966
00967 nodeoutm::nodeoutm()
00968 {
00969 react = 0;
00970 seldisp = selstra = selstre = seloth = NULL;
00971 transtra = transtre = NULL;
00972 }
00973
00974
00975
00976
00977
00978
00979
00980
00981 nodeoutm::~nodeoutm()
00982 {
00983 delete [] seldisp;
00984 delete [] selstra;
00985 delete [] selstre;
00986 delete [] seloth;
00987 delete [] transtra;
00988 delete [] transtre;
00989 }
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006
01007
01008 long nodeoutm::read(XFILE *in)
01009 {
01010 long i;
01011
01012 xfscanf(in, "%k", "sel_nodstep");
01013 dstep.read(in);
01014 if (dstep.st == sel_no)
01015 return 0;
01016 xfscanf(in, "%k", "sel_nodlc");
01017 sellc.read(in);
01018
01019
01020 xfscanf(in, "%k", "displ_nodes");
01021 selndisp.read(in);
01022 switch (selndisp.st)
01023 {
01024 case sel_no:
01025 break;
01026 case sel_all:
01027 case sel_range:
01028 case sel_list:
01029 xfscanf(in, "%k", "displ_comp");
01030 seldisp = new sel[selndisp.n];
01031 for (i=0; i<selndisp.n; i++)
01032 seldisp[i].read(in);
01033 break;
01034 default:
01035 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
01036 return 2;
01037 }
01038
01039
01040 xfscanf(in, "%k", "strain_nodes");
01041 selnstra.read(in);
01042 switch (selnstra.st)
01043 {
01044 case sel_no:
01045 break;
01046 case sel_all:
01047 case sel_range:
01048 case sel_list:
01049 xfscanf(in, "%k", "nodstrain_comp");
01050 Mp->straincomp = 1;
01051 Mp->strainpos = 2;
01052 Mp->strainaver = 1;
01053 transtra = new long[selnstra.n];
01054 memset(transtra, 0, sizeof(*transtra)*selnstra.n);
01055 selstra = new sel[selnstra.n];
01056 for(i=0; i<selnstra.n; i++)
01057 selstra[i].read(in);
01058 xfscanf(in, "%k", "nodstra_transfid");
01059 for(i=0; i<selnstra.n; i++)
01060 {
01061 if (xfscanf(in, "%ld", transtra+i) != 1)
01062 {
01063 print_err("cannot read strain selection", __FILE__, __LINE__, __func__);
01064 return 3;
01065 }
01066 }
01067 break;
01068 default:
01069 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
01070 return 3;
01071 }
01072
01073
01074
01075 xfscanf(in, "%k", "stress_nodes");
01076 selnstre.read(in);
01077 switch (selnstre.st)
01078 {
01079 case sel_no:
01080 break;
01081 case sel_all:
01082 case sel_range:
01083 case sel_list:
01084 xfscanf(in, "%k", "nodstress_comp");
01085 Mp->straincomp = 1;
01086 Mp->strainpos = 2;
01087 Mp->strainaver = 1;
01088 Mp->stresscomp = 1;
01089 Mp->stresspos = 2;
01090 Mp->stressaver = 1;
01091 transtre = new long[selnstre.n];
01092 memset(transtre, 0, sizeof(*transtre)*selnstre.n);
01093 selstre = new sel[selnstre.n];
01094 for(i=0; i<selnstre.n; i++)
01095 selstre[i].read(in);
01096 xfscanf(in, "%k", "nodstre_transfid");
01097 for(i=0; i<selnstre.n; i++)
01098 {
01099 if (xfscanf(in, "%ld", transtre+i) != 1)
01100 {
01101 print_err("cannot read stress selection", __FILE__, __LINE__, __func__);
01102 return 3;
01103 }
01104 }
01105 break;
01106 default:
01107 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
01108 return 4;
01109 }
01110
01111
01112 xfscanf(in, "%k", "other_nodes");
01113 selnoth.read(in);
01114 switch (selnoth.st)
01115 {
01116 case sel_no:
01117 break;
01118 case sel_all:
01119 case sel_range:
01120 case sel_list:
01121 xfscanf(in, "%k", "nodother_comp");
01122 if(Mp->othercomp == 0)
01123 Mp->othercomp = 1;
01124 if(Mp->otheraver == 0)
01125 {
01126 Mp->otherpos = 2;
01127 Mp->otheraver = 1;
01128 }
01129 seloth = new sel[selnoth.n];
01130 for (i=0; i < selnoth.n; i++)
01131 seloth[i].read(in);
01132 break;
01133 default:
01134 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
01135 return 5;
01136 }
01137
01138
01139 if (xfscanf(in, "%k%ld", "reactions", &react) != 2)
01140 {
01141 print_err("cannot read selection of reactions", __FILE__, __LINE__, __func__);
01142 return 6;
01143 }
01144 if (react)
01145 Mp->reactcomp = 1;
01146 return 0;
01147 }
01148
01149
01150
01151
01152
01153
01154
01155
01156
01157
01158
01159
01160 void nodeoutm::print(FILE *out)
01161 {
01162 long i;
01163
01164
01165 dstep.print(out);
01166 if (dstep.st == sel_no)
01167 return;
01168 sellc.print(out);
01169 fprintf(out, "\n");
01170
01171
01172 selndisp.print(out);
01173 switch(selndisp.st)
01174 {
01175 case sel_no:
01176 break;
01177 case sel_all:
01178 case sel_range:
01179 case sel_list:
01180 for(i=0; i<selndisp.n; i++)
01181 seldisp[i].print(out);
01182 break;
01183 default:
01184 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
01185 return;
01186 }
01187
01188
01189
01190 selnstra.print(out);
01191 switch (selnstra.st)
01192 {
01193 case sel_no:
01194 break;
01195 case sel_all:
01196 case sel_range:
01197 case sel_list:
01198 for(i=0; i<selnstra.n; i++)
01199 selstra[i].print(out);
01200 for(i=0; i<selnstra.n; i++)
01201 fprintf(out, "%ld ", transtra[i]);
01202 fprintf(out, "\n");
01203 break;
01204 default:
01205 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
01206 return;
01207 }
01208
01209
01210 selnstre.print(out);
01211 switch (selnstre.st)
01212 {
01213 case sel_no:
01214 break;
01215 case sel_all:
01216 case sel_range:
01217 case sel_list:
01218 for(i=0; i<selnstre.n; i++)
01219 selstre[i].print(out);
01220 for(i=0; i<selnstre.n; i++)
01221 fprintf(out, "%ld ", transtre[i]);
01222 fprintf(out, "\n");
01223 break;
01224 default:
01225 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
01226 return;
01227 }
01228
01229
01230 selnoth.print(out);
01231 switch (selnoth.st)
01232 {
01233 case sel_no:
01234 break;
01235 case sel_all:
01236 case sel_range:
01237 case sel_list:
01238 for(i=0; i<selnoth.n; i++)
01239 seloth[i].print(out);
01240 break;
01241 default:
01242 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
01243 return;
01244 }
01245
01246
01247 fprintf(out, "%ld\n", react);
01248 }
01249
01250
01251
01252
01253
01254
01255
01256
01257
01258
01259
01260
01261
01262
01263 void nodeoutm::print_out(FILE *out, long lcid)
01264 {
01265 if (selndisp.st != sel_no)
01266 {
01267 fprintf(out, "** Nodal displacements:\n\n");
01268 print_disp(out, lcid);
01269 }
01270 if (Mp->homog == 3)
01271 {
01272 long j,ncomp = Mt->give_ncomp(0, 0);
01273 double *lhs = Lsrs->give_lhs(0);
01274 fprintf(out, "** Calculated macro-strains for the homogenization problem:\n\n");
01275 j=Ndofm-ncomp;
01276 for (long i=0; i<ncomp; i++)
01277 fprintf(out, "EPS_%ld=% .*e\n", i+1, prstra, lhs[j+i]);
01278 fprintf(out, "\n");
01279 }
01280
01281 if (selnstra.st != sel_no)
01282 {
01283 fprintf(out, "** Nodal averaged strains:\n\n");
01284 print_stra(out, lcid);
01285 }
01286 if (selnstre.st != sel_no)
01287 {
01288 fprintf(out, "** Nodal averaged stresses:\n\n");
01289 print_stre(out, lcid);
01290 }
01291 if (selnoth.st != sel_no)
01292 {
01293 fprintf(out, "** Nodal averaged other values:\n\n");
01294 print_other(out);
01295 }
01296 if (react)
01297 {
01298 fprintf(out, "** Reactions:\n\n");
01299 print_react(out, lcid);
01300 }
01301 }
01302
01303
01304
01305
01306
01307
01308
01309
01310
01311
01312
01313
01314
01315
01316 void nodeoutm::print_disp(FILE *out, long lcid)
01317 {
01318 long i, j, ndofn;
01319 double *r;
01320
01321
01322
01323
01324
01325
01326
01327 for (i=0; i<Mt->nn; i++)
01328 {
01329 if (Gtm->lnso[i]==0)
01330 continue;
01331 if (selndisp.presence_id(i))
01332 {
01333 fprintf(out, " Node %7ld", i+1);
01334
01335
01336
01337
01338 ndofn = Mt->give_ndofn(i);
01339 r = new double [ndofn];
01340 noddispl (lcid, r, i);
01341
01342
01343
01344
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362
01363
01364
01365
01366
01367
01368
01369
01370
01371
01372
01373
01374
01375
01376
01377
01378
01379
01380
01381
01382
01383
01384
01385
01386
01387
01388
01389
01390 for (j=0; j<ndofn; j++)
01391 {
01392 if (selndisp.presence_id(seldisp,i,j)){
01393
01394
01395
01396
01397 fprintf(out, " r_%ld=% .*e", j+1, prdisp, r[j]);
01398
01399 }
01400 }
01401 delete [] r;
01402
01403 fprintf(out, "\n");
01404
01405
01406
01407 }
01408 }
01409 fprintf(out, "\n");
01410 }
01411
01412
01413
01414
01415
01416
01417
01418
01419
01420
01421
01422
01423
01424
01425 void nodeoutm::print_stra(FILE *out, long lcid)
01426 {
01427 long i, j, ncomp, id, ir;
01428 vector aux;
01429 char *namevar[] = {"x", "y", "z"};
01430 matrix t;
01431 vector str, p;
01432
01433 if(Outdm->nlcs > 0)
01434 {
01435 allocv(3, p);
01436 allocm(3, 3, t);
01437 }
01438
01439 for (i=0; i<Mt->nn; i++)
01440 {
01441 if (Gtm->lnso[i]==0)
01442 continue;
01443 if (selnstra.presence_id(i, ir))
01444 {
01445 fprintf(out, " Node %7ld", i+1);
01446 ncomp = Mt->nodes[i].ncompstr;
01447 id = lcid*ncomp;
01448 if (transtra[ir] > 0)
01449 {
01450 reallocv(ncomp, aux);
01451 str.n = ncomp;
01452 str.a = Mt->nodes[i].strain+id;
01453 Mt->give_nodal_coord(i, p);
01454 Outdm->lcs[transtra[ir]-1].evaluate_t(p, namevar, t);
01455 if (ncomp == 4)
01456 gl_engvectortransf(str, aux, t, planestrain, strain);
01457 if (ncomp == 6)
01458 gl_engvectortransf(str, aux, t, spacestress, strain);
01459 str.a = NULL;
01460 }
01461 for (j=0; j<ncomp; j++)
01462 {
01463 if (selnstra.presence_id(selstra,i,j))
01464 {
01465 if (transtra[ir] > 0)
01466 fprintf(out, " leps_%ld=% .*e", j+1, prstra, aux[j]);
01467 else
01468 fprintf(out, " eps_%ld=% .*e", j+1, prstra, Mt->nodes[i].strain[id+j]);
01469 }
01470 }
01471 if (transtra[ir] < 0)
01472 {
01473 vector eps(4), peps(3);
01474 matrix epst(3,3), pvect(3,3);
01475 fillv(0.0, eps);
01476 for (j=0; j<ncomp; j++)
01477 eps[j] = Mt->nodes[i].strain[j];
01478 if (ncomp == 4)
01479 vector_tensor (eps, epst, planestrain, strain);
01480 if (ncomp == 6)
01481 vector_tensor (eps, epst, spacestress, strain);
01482 princ_val (epst, peps, pvect, 20, 1.0e-4, Mp->zero, 3,1);
01483 if (Mt->nodes[i].pstra == NULL)
01484 Mt->nodes[i].pstra = new double [9];
01485 for (j=0; j<3; j++)
01486 {
01487 Mt->nodes[i].pstra[j] = peps[j];
01488 fprintf(out, " peps_%ld=% .*e", j+1, prstra, peps[j]);
01489 }
01490 for (j=0; j<3; j++)
01491 {
01492 Mt->nodes[i].pstra[3+j] = pvect[0][j];
01493 fprintf(out, " a_1%ld=% .*e", j+1, prstra, pvect[0][j]);
01494 }
01495 for (j=0; j<3; j++)
01496 {
01497 Mt->nodes[i].pstra[6+j] = pvect[2][j];
01498 fprintf(out, " a_3%ld=% .*e", j+1, prstra, pvect[2][j]);
01499 }
01500 }
01501 fprintf(out, "\n");
01502 }
01503 }
01504 fprintf(out, "\n");
01505 }
01506
01507
01508
01509
01510
01511
01512
01513
01514
01515
01516
01517
01518
01519
01520 void nodeoutm::print_stre(FILE *out, long lcid)
01521 {
01522 long i, ir, j, ncomp, id;
01523 vector aux;
01524 char *namevar[] = {"x", "y", "z"};
01525 matrix t;
01526 vector str, p;
01527
01528 if(Outdm->nlcs > 0)
01529 {
01530 allocv(3, p);
01531 allocm(3, 3, t);
01532 }
01533
01534 for (i=0; i<Mt->nn; i++)
01535 {
01536 if (Gtm->lnso[i]==0)
01537 continue;
01538 if (selnstre.presence_id(i, ir))
01539 {
01540 fprintf(out, " Node %7ld", i+1);
01541 ncomp = Mt->nodes[i].ncompstr;
01542 id = lcid*ncomp;
01543 if (transtre[ir] > 0)
01544 {
01545 reallocv(ncomp, aux);
01546 str.n = ncomp;
01547 str.a = Mt->nodes[i].strain+id;
01548 Mt->give_nodal_coord(i, p);
01549 Outdm->lcs[transtre[ir]-1].evaluate_t(p, namevar, t);
01550 if (ncomp == 4)
01551 gl_engvectortransf(str, aux, t, planestrain, stress);
01552 if (ncomp == 6)
01553 gl_engvectortransf(str, aux, t, spacestress, stress);
01554 str.a = NULL;
01555 }
01556 for (j=0; j<ncomp; j++)
01557 {
01558 if (selnstre.presence_id(selstre, i, j))
01559 {
01560 if (transtre[ir] > 0)
01561 fprintf(out, " lsig_%ld=% .*e", j+1, prstre, aux[j]);
01562 else
01563 fprintf(out, " sig_%ld=% .*e", j+1, prstre, Mt->nodes[i].stress[id+j]);
01564 }
01565 }
01566 if (transtre[ir] < 0)
01567 {
01568 vector sig(ncomp), psig(3);
01569 matrix sigt(3,3), pvect(3,3);
01570 fillv(0.0, sig);
01571 for (j=0; j<ncomp; j++)
01572 sig[j] = Mt->nodes[i].stress[j];
01573 if (ncomp == 4)
01574 vector_tensor (sig, sigt, planestrain, stress);
01575 if (ncomp == 6)
01576 vector_tensor (sig, sigt, spacestress, stress);
01577
01578 princ_val (sigt, psig, pvect, 20, 1.0e-4, Mp->zero, 3,1);
01579 if (Mt->nodes[i].pstre == NULL)
01580 Mt->nodes[i].pstre = new double [9];
01581 for (j=0; j<3; j++)
01582 {
01583 Mt->nodes[i].pstre[j] = psig[j];
01584 fprintf(out, " psig_%ld=% .*e", j+1, prstre, psig[j]);
01585 }
01586 fprintf(out, " tau_max=% .*e", prstre, (psig[2]-psig[0])/2);
01587 for (j=0; j<3; j++)
01588 {
01589 Mt->nodes[i].pstre[3+j] = pvect[0][j];
01590 fprintf(out, " a_1%ld=% .*e", j+1, prstre, pvect[0][j]);
01591 }
01592 for (j=0; j<3; j++)
01593 {
01594 Mt->nodes[i].pstre[6+j] = pvect[2][j];
01595 fprintf(out, " a_3%ld=% .*e", j+1, prstre, pvect[2][j]);
01596 }
01597 }
01598 fprintf(out, "\n");
01599 }
01600 }
01601 fprintf(out, "\n");
01602 }
01603
01604
01605
01606
01607
01608
01609
01610
01611
01612
01613
01614
01615
01616
01617 void nodeoutm::print_other(FILE *out)
01618 {
01619 long i, j, ncomp;
01620
01621 for (i=0; i<Mt->nn; i++)
01622 {
01623 if (Gtm->lnso[i]==0)
01624 continue;
01625 ncomp = Mt->nodes[i].ncompother;
01626 if (selnoth.presence_id(i))
01627 {
01628 fprintf(out, " Node %7ld", i+1);
01629 ncomp = Mt->nodes[i].ncompother;
01630 for (j=0; j<ncomp; j++)
01631 {
01632 if (selnoth.presence_id(seloth, i, j))
01633 fprintf(out, " other_%ld=% .*e", j+1, proth, Mt->nodes[i].other[j]);
01634 }
01635 fprintf(out, "\n");
01636 }
01637 }
01638 fprintf(out, "\n");
01639 }
01640
01641
01642
01643
01644
01645
01646
01647
01648
01649
01650
01651
01652
01653
01654 void nodeoutm::print_react(FILE *out, long lcid)
01655 {
01656 long i, j, ndofn;
01657
01658 for (i=0; i<Mt->nn; i++)
01659 {
01660 if (Gtm->lnso[i]==0)
01661 continue;
01662 if (Mt->nodes[i].react)
01663 {
01664
01665 fprintf(out, " %7ld", i+1);
01666 ndofn = Mt->give_ndofn(i);
01667 for (j=0; j<ndofn; j++)
01668 fprintf(out, " R_%ld=% .*e", j+1, prreac, Mt->nodes[i].r[lcid*ndofn+j]);
01669 fprintf(out, "\n");
01670 }
01671 }
01672 fprintf(out, "\n");
01673 }
01674
01675
01676
01677
01678
01679
01680
01681
01682
01683
01684
01685
01686
01687
01688 void nodeoutm::conv_sel_prop(siftop *top)
01689 {
01690 if (selndisp.st == sel_prop)
01691 selndisp.conv_selprop(top, gnod);
01692
01693 if (selnstra.st == sel_prop)
01694 selnstra.conv_selprop(top, gnod);
01695
01696 if (selnstre.st == sel_prop)
01697 selnstre.conv_selprop(top, gnod);
01698
01699 if (selnoth.st == sel_prop)
01700 selnoth.conv_selprop(top, gnod);
01701 }
01702
01703
01704
01705
01706
01707
01708
01709
01710
01711
01712
01713
01714
01715 nodeoutgm::nodeoutgm()
01716 {
01717 seldisp = selstra = selstre = seloth = selforce = NULL;
01718 transtra = transtre = NULL;
01719 }
01720
01721
01722
01723
01724
01725
01726
01727
01728 nodeoutgm::~nodeoutgm()
01729 {
01730 delete [] seldisp;
01731 delete [] selstra;
01732 delete [] selstre;
01733 delete [] seloth;
01734 delete [] selforce;
01735 delete [] transtra;
01736 delete [] transtre;
01737 }
01738
01739
01740
01741
01742
01743
01744
01745
01746
01747
01748
01749
01750
01751
01752
01753
01754
01755 long nodeoutgm::read(XFILE *in)
01756 {
01757 long i;
01758
01759 xfscanf(in, "%k", "sel_nodstep");
01760 dstep.read(in);
01761 if (dstep.st == sel_no)
01762 return 0;
01763 xfscanf(in, "%k", "sel_nodlc");
01764 sellc.read(in);
01765
01766
01767 xfscanf(in, "%k", "displ_nodes");
01768 selndisp.read(in);
01769 switch (selndisp.st)
01770 {
01771 case sel_no:
01772 break;
01773 case sel_all:
01774 case sel_range:
01775 case sel_list:
01776 xfscanf(in, "%k", "displ_comp");
01777 seldisp = new sel[selndisp.n];
01778 for (i=0; i<selndisp.n; i++)
01779 seldisp[i].read(in);
01780 break;
01781 default:
01782 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
01783 return 1;
01784 }
01785
01786
01787 xfscanf(in, "%k", "strain_nodes");
01788 selnstra.read(in);
01789 switch (selnstra.st)
01790 {
01791 case sel_no:
01792 break;
01793 case sel_all:
01794 case sel_range:
01795 case sel_list:
01796 xfscanf(in, "%k", "nodstrain_comp");
01797 Mp->straincomp = 1;
01798 Mp->strainpos = 2;
01799 Mp->strainaver = 1;
01800 transtra = new long[selnstra.n];
01801 memset(transtra, 0, sizeof(*transtra)*selnstra.n);
01802 selstra = new sel[selnstra.n];
01803 for(i=0; i<selnstra.n; i++)
01804 selstra[i].read(in);
01805 xfscanf(in, "%k", "nodstra_transfid");
01806 for(i=0; i<selnstra.n; i++)
01807 {
01808 if (xfscanf(in, "%ld", transtra+i) != 1)
01809 {
01810 print_err("cannot read strain selection", __FILE__, __LINE__, __func__);
01811 return 2;
01812 }
01813 }
01814 break;
01815 default:
01816 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
01817 return 2;
01818 }
01819
01820
01821
01822 xfscanf(in, "%k", "stress_nodes");
01823 selnstre.read(in);
01824 switch (selnstre.st)
01825 {
01826 case sel_no:
01827 break;
01828 case sel_all:
01829 case sel_range:
01830 case sel_list:
01831 xfscanf(in, "%k", "nodstress_comp");
01832 Mp->straincomp = 1;
01833 Mp->strainpos = 2;
01834 Mp->strainaver = 1;
01835 Mp->stresscomp = 1;
01836 Mp->stresspos = 2;
01837 Mp->stressaver = 1;
01838 transtre = new long[selnstre.n];
01839 memset(transtre, 0, sizeof(*transtre)*selnstre.n);
01840 selstre = new sel[selnstre.n];
01841 for(i=0; i<selnstre.n; i++)
01842 selstre[i].read(in);
01843 xfscanf(in, "%k", "nodstre_transfid");
01844 for(i=0; i<selnstre.n; i++)
01845 {
01846 if (xfscanf(in, "%ld", transtre+i) != 1)
01847 {
01848 print_err("cannot read stress selection", __FILE__, __LINE__, __func__);
01849 return 3;
01850 }
01851 }
01852 break;
01853 default:
01854 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
01855 return 3;
01856 }
01857
01858
01859 xfscanf(in, "%k", "other_nodes");
01860 selnoth.read(in);
01861 switch (selnoth.st)
01862 {
01863 case sel_no:
01864 break;
01865 case sel_all:
01866 case sel_range:
01867 case sel_list:
01868 xfscanf(in, "%k", "nodother_comp");
01869 if(Mp->othercomp == 0)
01870 Mp->othercomp = 1;
01871 if(Mp->otheraver == 0)
01872 {
01873 Mp->otherpos = 2;
01874 Mp->otheraver = 1;
01875 }
01876 seloth = new sel[selnoth.n];
01877 for (i=0; i < selnoth.n; i++)
01878 seloth[i].read(in);
01879 break;
01880 default:
01881 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
01882 return 4;
01883 }
01884
01885
01886 xfscanf(in, "%k", "force_nodes");
01887 selnforce.read(in);
01888 switch (selnforce.st)
01889 {
01890 case sel_no:
01891 break;
01892 case sel_all:
01893 case sel_range:
01894 case sel_list:
01895 xfscanf(in, "%k", "force_comp");
01896 selforce = new sel[selnforce.n];
01897 for (i=0; i<selndisp.n; i++)
01898 selforce[i].read(in);
01899 break;
01900 default:
01901 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
01902 return 5;
01903 }
01904
01905 return 0;
01906 }
01907
01908
01909
01910
01911
01912
01913
01914
01915
01916
01917
01918
01919 void nodeoutgm::print(FILE *out)
01920 {
01921 long i;
01922
01923
01924 dstep.print(out);
01925 if (dstep.st == sel_no)
01926 return;
01927 sellc.print(out);
01928 fprintf(out, "\n");
01929
01930
01931 selndisp.print(out);
01932 switch(selndisp.st)
01933 {
01934 case sel_no:
01935 break;
01936 case sel_all:
01937 case sel_range:
01938 case sel_list:
01939 for(i=0; i<selndisp.n; i++)
01940 seldisp[i].print(out);
01941 break;
01942 default:
01943 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
01944 return;
01945 }
01946
01947
01948
01949 selnstra.print(out);
01950 switch (selnstra.st)
01951 {
01952 case sel_no:
01953 break;
01954 case sel_all:
01955 case sel_range:
01956 case sel_list:
01957 for(i=0; i<selnstra.n; i++)
01958 selstra[i].print(out);
01959 for(i=0; i<selnstra.n; i++)
01960 fprintf(out, "%ld ", transtra[i]);
01961 fprintf(out, "\n");
01962 break;
01963 default:
01964 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
01965 return;
01966 }
01967
01968
01969 selnstre.print(out);
01970 switch (selnstre.st)
01971 {
01972 case sel_no:
01973 break;
01974 case sel_all:
01975 case sel_range:
01976 case sel_list:
01977 for(i=0; i<selnstre.n; i++)
01978 selstre[i].print(out);
01979 for(i=0; i<selnstre.n; i++)
01980 fprintf(out, "%ld ", transtre[i]);
01981 fprintf(out, "\n");
01982 break;
01983 default:
01984 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
01985 return;
01986 }
01987
01988
01989 selnoth.print(out);
01990 switch (selnoth.st)
01991 {
01992 case sel_no:
01993 break;
01994 case sel_all:
01995 case sel_range:
01996 case sel_list:
01997 for(i=0; i<selnoth.n; i++)
01998 seloth[i].print(out);
01999 break;
02000 default:
02001 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
02002 return;
02003 }
02004 selnforce.print(out);
02005 switch (selnforce.st)
02006 {
02007 case sel_no:
02008 break;
02009 case sel_all:
02010 case sel_range:
02011 case sel_list:
02012 for (i=0; i<selndisp.n; i++)
02013 selforce[i].print(out);
02014 break;
02015 default:
02016 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
02017 return;
02018 }
02019 }
02020
02021
02022
02023
02024
02025
02026
02027
02028
02029
02030
02031
02032
02033
02034
02035
02036
02037 void nodeoutgm::print_graphics(FILE *out, long lcid, const char *desclcid, graphfmt gf, double *ifor)
02038 {
02039 if (gf == grfmt_open_dx)
02040 return;
02041
02042 if (selndisp.st != sel_no)
02043 {
02044 if (gf == grfmt_gid)
02045 write_gid_displ(out, lcid, desclcid);
02046 else
02047 write_displ(out, lcid, desclcid);
02048 }
02049 print_gr_stra_scal(out, lcid, desclcid, gf);
02050 print_gr_stre_scal(out, lcid, desclcid, gf);
02051 print_gr_oth_scal(out, lcid, desclcid, gf);
02052
02053 print_gr_stra_vec(out, lcid, desclcid, gf);
02054 print_gr_stre_vec(out, lcid, desclcid, gf);
02055 print_gr_oth_vec(out, lcid, desclcid, gf);
02056
02057 print_gr_stra_mtx(out, lcid, desclcid, gf);
02058 print_gr_stre_mtx(out, lcid, desclcid, gf);
02059 print_gr_oth_mtx(out, lcid, desclcid, gf);
02060
02061 if (selnforce.st != sel_no)
02062 {
02063 if (gf == grfmt_gid)
02064 write_gid_nforces(out, lcid, desclcid, ifor);
02065 else
02066 write_nforces(out, lcid, desclcid, ifor);
02067 }
02068 }
02069
02070
02071
02072
02073
02074
02075
02076
02077
02078
02079
02080
02081
02082
02083
02084
02085
02086
02087 void nodeoutgm::print_graphics(const char *outfn, const char *mode, long lcid, const char *desclcid, graphfmt gf, double *ifor)
02088 {
02089 char fname[FNAMELEN+70];
02090 FILE *out;
02091
02092 if (gf != grfmt_gid_sep)
02093 {
02094 print_err("invalid graphics format is required", __FILE__, __LINE__, __func__);
02095 return;
02096 }
02097
02098 if (selndisp.st != sel_no)
02099 {
02100 sprintf(fname, "%s.displ.res", outfn);
02101 out = fopen(fname, mode);
02102 if (out == NULL)
02103 {
02104 print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname);
02105 abort();
02106 }
02107 fseek(out, 0, SEEK_END);
02108 if (ftell(out) == 0)
02109 fprintf(out, "GiD Post Results File 1.0\n");
02110 else
02111 write_gid_displ(out, lcid, desclcid);
02112 fclose(out);
02113 }
02114
02115 print_gr_stra_scal(outfn, mode, lcid, desclcid);
02116 print_gr_stre_scal(outfn, mode, lcid, desclcid);
02117 print_gr_oth_scal(outfn, mode, lcid, desclcid);
02118
02119 print_gr_stra_vec(outfn, mode, lcid, desclcid);
02120 print_gr_stre_vec(outfn, mode, lcid, desclcid);
02121 print_gr_oth_vec(outfn, mode, lcid, desclcid);
02122
02123 print_gr_stra_mtx(outfn, mode, lcid, desclcid);
02124 print_gr_stre_mtx(outfn, mode, lcid, desclcid);
02125 print_gr_oth_mtx(outfn, mode, lcid, desclcid);
02126
02127 if (selnforce.st != sel_no)
02128 {
02129 sprintf(fname, "%s.force.res", outfn);
02130 out = fopen(fname, mode);
02131 if (out == NULL)
02132 {
02133 print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname);
02134 abort();
02135 }
02136 fseek(out, 0, SEEK_END);
02137 if (ftell(out) == 0)
02138 fprintf(out, "GiD Post Results File 1.0\n");
02139 else
02140 write_gid_nforces(out, lcid, desclcid, ifor);
02141 fclose(out);
02142 }
02143 }
02144
02145
02146
02147
02148
02149
02150
02151
02152
02153
02154
02155
02156
02157
02158
02159 void nodeoutgm::print_gr_stra_scal(FILE *out, long lcid, const char *desclcid, graphfmt gf)
02160 {
02161 long i, j, k;
02162
02163 if (selnstra.st != sel_no)
02164 {
02165 for(i=0; i<Mm->max_ncompstrn; i++)
02166 {
02167 for (j=0; j<selnstra.n; j++)
02168 {
02169 if ((selstra[j].st == sel_mtx) || (selstra[j].st == sel_range_mtx) ||
02170 (selstra[j].st == sel_range_vec) || (selstra[j].st == sel_vec))
02171 continue;
02172 if (selstra[j].presence_id(i))
02173 {
02174 if (gf == grfmt_gid)
02175 write_gid_nodscalar(out, strain, lcid, i, desclcid);
02176 else
02177 write_nodscalar(out, strain, lcid, i, desclcid);
02178 break;
02179 }
02180 }
02181 }
02182 for (j=0; j<selnstra.n; j++)
02183 {
02184 if ((transtra[j] < 0) && (selstra[j].st != sel_mtx) &&
02185 (selstra[j].st != sel_range_mtx) && (selstra[j].st != sel_range_vec) &&
02186 (selstra[j].st != sel_vec))
02187 {
02188 for(k=0; k<3; k++)
02189 {
02190 if (gf == grfmt_gid)
02191 write_gid_nodscalar(out, pstrain, lcid, k, desclcid);
02192 else
02193 write_nodscalar(out, -k-1, desclcid);
02194 }
02195 break;
02196 }
02197 }
02198 }
02199 return;
02200 }
02201
02202
02203
02204
02205
02206
02207
02208
02209
02210
02211
02212
02213
02214
02215
02216 void nodeoutgm::print_gr_stre_scal(FILE *out, long lcid, const char *desclcid, graphfmt gf)
02217 {
02218 long i, j, k;
02219
02220 if (selnstre.st != sel_no)
02221 {
02222 for(i=0; i<Mm->max_ncompstrn; i++)
02223 {
02224 for (j=0; j<selnstre.n; j++)
02225 {
02226 if ((selstre[j].st == sel_mtx) || (selstre[j].st == sel_range_mtx) ||
02227 (selstre[j].st == sel_range_vec) || (selstre[j].st == sel_vec))
02228 continue;
02229 if (selstre[j].presence_id(i))
02230 {
02231 if (gf == grfmt_gid)
02232 write_gid_nodscalar(out, stress, lcid, i, desclcid);
02233 else
02234 write_nodscalar(out, stress, lcid, i, desclcid);
02235 break;
02236 }
02237 }
02238 }
02239 for (j=0; j<selnstre.n; j++)
02240 {
02241 if ((transtre[j] < 0) && (selstre[j].st != sel_mtx) && (selstre[j].st != sel_range_mtx) &&
02242 (selstre[j].st != sel_range_vec) && (selstre[j].st != sel_vec))
02243 {
02244 for(k=0; k<4; k++)
02245 {
02246 if (gf == grfmt_gid)
02247 write_gid_nodscalar(out, pstress, lcid, k, desclcid);
02248 else
02249 write_nodscalar(out, k, desclcid);
02250 }
02251 break;
02252 }
02253 }
02254 }
02255 return;
02256 }
02257
02258
02259
02260
02261
02262
02263
02264
02265
02266
02267
02268
02269
02270
02271
02272 void nodeoutgm::print_gr_oth_scal(FILE *out, long lcid, const char *desclcid, graphfmt gf)
02273 {
02274 long i, j;
02275
02276 if (selnoth.st != sel_no)
02277 {
02278 for(i=0; i<Mm->max_nncompo; i++)
02279 {
02280 for (j=0; j<selnoth.n; j++)
02281 {
02282 if ((seloth[j].st == sel_mtx) || (seloth[j].st == sel_range_mtx) ||
02283 (seloth[j].st == sel_range_vec) || (seloth[j].st == sel_vec))
02284 continue;
02285 if (seloth[j].presence_id(i))
02286 {
02287 if (gf == grfmt_gid)
02288 write_gid_nodscalar(out, other, lcid, i, desclcid);
02289 else
02290 write_nodscalar(out, other, lcid, i, desclcid);
02291 break;
02292 }
02293 }
02294 }
02295 }
02296 return;
02297 }
02298
02299
02300
02301
02302
02303
02304
02305
02306
02307
02308
02309
02310
02311
02312
02313 void nodeoutgm::print_gr_stra_vec(FILE *out, long lcid, const char *desclcid, graphfmt gf)
02314 {
02315 long j, id1, n;
02316 if (selnstra.st != sel_no)
02317 {
02318 for (j=0; j<selnstra.n; j++)
02319 {
02320 if (selstra[j].st != sel_range_vec)
02321 continue;
02322 id1 = selstra[j].id1[0];
02323 n = selstra[j].ncomp[0];
02324 if (id1+n-1 < Mm->max_ncompstrn)
02325 {
02326 if (gf == grfmt_gid)
02327 write_gid_nodvector(out, strain, lcid, j, desclcid);
02328 else
02329 {
02330 print_err("required export format of a strain vector is not supported", __FILE__, __LINE__ , __func__);
02331 abort();
02332 }
02333 }
02334 else
02335 {
02336 print_err("required index of strain vector exceeds limits\n"
02337 " selected range is id1=%ld, n=%ld, max ncompst=%ld",
02338 __FILE__, __LINE__, __func__, id1, n, Mm->max_ncompstrn);
02339 abort();
02340 }
02341 }
02342 }
02343 return;
02344 }
02345
02346
02347
02348
02349
02350
02351
02352
02353
02354
02355
02356
02357
02358
02359
02360 void nodeoutgm::print_gr_stre_vec(FILE *out, long lcid, const char *desclcid, graphfmt gf)
02361 {
02362 long j, id1, n;
02363 if (selnstre.st != sel_no)
02364 {
02365 for (j=0; j<selnstre.n; j++)
02366 {
02367 if (selstre[j].st != sel_range_vec)
02368 continue;
02369 id1 = selstre[j].id1[0];
02370 n = selstre[j].ncomp[0];
02371 if (id1+n-1 < Mm->max_ncompstrn)
02372 {
02373 if (gf == grfmt_gid)
02374 write_gid_nodvector(out, stress, lcid, j, desclcid);
02375 else
02376 {
02377 print_err("required export format of a stress vector is not supported\n", __FILE__, __LINE__, __func__);
02378 abort();
02379 }
02380 }
02381 else
02382 {
02383 print_err("required index of stress vector exceeds limits\n"
02384 " selected range is id1=%ld, n=%ld, max ncompst=%ld\n",
02385 __FILE__, __LINE__, __func__,id1, n, Mm->max_ncompstrn);
02386 abort();
02387 }
02388 }
02389 }
02390 return;
02391 }
02392
02393
02394
02395
02396
02397
02398
02399
02400
02401
02402
02403
02404
02405
02406
02407 void nodeoutgm::print_gr_oth_vec(FILE *out, long lcid, const char *desclcid, graphfmt gf)
02408 {
02409 long j, id1, n;
02410 if (selnoth.st != sel_no)
02411 {
02412 for (j=0; j<selnoth.n; j++)
02413 {
02414 if (seloth[j].st != sel_range_vec)
02415 continue;
02416 id1 = seloth[j].id1[0];
02417 n = seloth[j].ncomp[0];
02418 if (id1+n-1 < Mm->max_nncompo)
02419 {
02420 if (gf == grfmt_gid)
02421 write_gid_nodvector(out, other, lcid, j, desclcid);
02422 else
02423 {
02424 print_err("required export format of a other values vector is not supported\n", __FILE__, __LINE__, __func__);
02425 abort();
02426 }
02427 break;
02428 }
02429 else
02430 {
02431 print_err("required index of other values vector exceeds limits\n"
02432 " selected range is id1=%ld, n=%ld, max nncompo=%ld\n",
02433 __FILE__, __LINE__, __func__, id1, n, Mm->max_nncompo);
02434 abort();
02435 }
02436 }
02437 }
02438 return;
02439 }
02440
02441
02442
02443
02444
02445
02446
02447
02448
02449
02450
02451
02452
02453
02454
02455 void nodeoutgm::print_gr_stra_mtx(FILE *out, long lcid, const char *desclcid, graphfmt gf)
02456 {
02457 long j;
02458 if (selnstra.st != sel_no)
02459 {
02460 for (j=0; j<selnstra.n; j++)
02461 {
02462 if ((selstra[j].st != sel_mtx) && (selstra[j].st != sel_range_mtx))
02463 continue;
02464 if (selstra[j].st == sel_range_mtx)
02465 {
02466 print_err("sel_range_mtx selection type of a strain tensor is not supported, use sel_mtx(%d)", __FILE__, __LINE__, __func__, sel_mtx);
02467 abort();
02468 }
02469 if (gf == grfmt_gid)
02470 write_gid_nodtensor(out, strain, lcid, j, desclcid);
02471 else
02472 {
02473 print_err("required export format of a strain tensor is not supported", __FILE__, __LINE__, __func__);
02474 abort();
02475 }
02476 }
02477 }
02478 return;
02479 }
02480
02481
02482
02483
02484
02485
02486
02487
02488
02489
02490
02491
02492
02493
02494
02495 void nodeoutgm::print_gr_stre_mtx(FILE *out, long lcid, const char *desclcid, graphfmt gf)
02496 {
02497 long j;
02498 if (selnstre.st != sel_no)
02499 {
02500 for (j=0; j<selnstre.n; j++)
02501 {
02502 if ((selstre[j].st != sel_mtx) && (selstre[j].st != sel_range_mtx))
02503 continue;
02504 if (selstre[j].st == sel_range_mtx)
02505 {
02506 print_err("sel_range_mtx selection type of a stress tensor is not supported, use sel_mtx(%d)",
02507 __FILE__, __LINE__, __func__, sel_mtx);
02508 abort();
02509 }
02510 if (gf == grfmt_gid)
02511 write_gid_nodtensor(out, stress, lcid, j, desclcid);
02512 else
02513 {
02514 print_err("required export format of a stress tensor is not supported", __FILE__, __LINE__, __func__);
02515 abort();
02516 }
02517 }
02518 }
02519 return;
02520 }
02521
02522
02523
02524
02525
02526
02527
02528
02529
02530
02531
02532
02533
02534
02535
02536 void nodeoutgm::print_gr_oth_mtx(FILE *out, long lcid, const char *desclcid, graphfmt gf)
02537 {
02538 long j;
02539 if (selnoth.st != sel_no)
02540 {
02541 for (j=0; j<selnoth.n; j++)
02542 {
02543 if ((seloth[j].st != sel_mtx) && (seloth[j].st != sel_range_mtx))
02544 continue;
02545 if (seloth[j].st == sel_mtx)
02546 {
02547 print_err("sel_mtx selection type of a other values tensor is not supported, use sel_range_mtx(%d)",
02548 __FILE__, __LINE__, __func__, sel_range_mtx);
02549 abort();
02550 }
02551 if (gf == grfmt_gid)
02552 write_gid_nodtensor(out, other, lcid, j, desclcid);
02553 else
02554 {
02555 print_err("required export format of an other values is not supported", __FILE__, __LINE__, __func__);
02556 abort();
02557 }
02558 }
02559 }
02560 return;
02561 }
02562
02563
02564
02565
02566
02567
02568
02569
02570
02571
02572
02573
02574
02575
02576
02577
02578
02579
02580
02581
02582
02583
02584
02585
02586 void nodeoutgm::print_gr_stra_scal(const char *outfn, const char *mode, long lcid, const char *desclcid)
02587 {
02588 long i, j, k;
02589 char fname[FNAMELEN+70];
02590 FILE *out;
02591
02592 if (selnstra.st != sel_no)
02593 {
02594 for(i=0; i<Mm->max_ncompstrn; i++)
02595 {
02596 for (j=0; j<selnstra.n; j++)
02597 {
02598 if ((selstra[j].st == sel_mtx) || (selstra[j].st == sel_range_mtx) ||
02599 (selstra[j].st == sel_range_vec) || (selstra[j].st == sel_vec))
02600 continue;
02601 if (selstra[j].presence_id(i))
02602 {
02603 sprintf(fname, "%s.nodal_eps%ld.res", outfn, i+1);
02604 out = fopen(fname, mode);
02605 if (out == NULL)
02606 {
02607 print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname);
02608 abort();
02609 }
02610 fseek(out, 0, SEEK_END);
02611 if (ftell(out) == 0)
02612 fprintf(out, "GiD Post Results File 1.0\n");
02613 else
02614 write_gid_nodscalar(out, strain, lcid, i, desclcid);
02615 fclose(out);
02616 break;
02617 }
02618 }
02619 }
02620 for (j=0; j<selnstra.n; j++)
02621 {
02622 if ((transtra[j] < 0) && (selstra[j].st != sel_mtx) &&
02623 (selstra[j].st != sel_range_mtx) && (selstra[j].st != sel_range_vec) &&
02624 (selstra[j].st != sel_vec))
02625 {
02626 for(k=0; k<3; k++)
02627 {
02628 sprintf(fname, "%s.nodal_peps%ld.res", outfn, k+1);
02629 out = fopen(fname, mode);
02630 if (out == NULL)
02631 {
02632 print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname);
02633 abort();
02634 }
02635 fseek(out, 0, SEEK_END);
02636 if (ftell(out) == 0)
02637 fprintf(out, "GiD Post Results File 1.0\n");
02638 else
02639 write_gid_nodscalar(out, pstrain, lcid, k, desclcid);
02640 fclose(out);
02641 }
02642 break;
02643 }
02644 }
02645 }
02646 return;
02647 }
02648
02649
02650
02651
02652
02653
02654
02655
02656
02657
02658
02659
02660
02661
02662
02663
02664 void nodeoutgm::print_gr_stre_scal(const char *outfn, const char *mode, long lcid, const char *desclcid)
02665 {
02666 long i, j, k;
02667 char fname[FNAMELEN+70];
02668 FILE *out;
02669
02670 if (selnstre.st != sel_no)
02671 {
02672 for(i=0; i<Mm->max_ncompstrn; i++)
02673 {
02674 for (j=0; j<selnstre.n; j++)
02675 {
02676 if ((selstre[j].st == sel_mtx) || (selstre[j].st == sel_range_mtx) ||
02677 (selstre[j].st == sel_range_vec) || (selstre[j].st == sel_vec))
02678 continue;
02679 if (selstre[j].presence_id(i))
02680 {
02681 sprintf(fname, "%s.nodal_sig%ld.res", outfn, i+1);
02682 out = fopen(fname, mode);
02683 if (out == NULL)
02684 {
02685 print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname);
02686 abort();
02687 }
02688 fseek(out, 0, SEEK_END);
02689 if (ftell(out) == 0)
02690 fprintf(out, "GiD Post Results File 1.0\n");
02691 else
02692 write_gid_nodscalar(out, stress, lcid, i, desclcid);
02693 fclose(out);
02694 break;
02695 }
02696 }
02697 }
02698 for (j=0; j<selnstre.n; j++)
02699 {
02700 if ((transtre[j] < 0) && (selstre[j].st != sel_mtx) && (selstre[j].st != sel_range_mtx) &&
02701 (selstre[j].st != sel_range_vec) && (selstre[j].st != sel_vec))
02702 {
02703 for(k=0; k<4; k++)
02704 {
02705 sprintf(fname, "%s.nodal_psig%ld.res", outfn, k+1);
02706 out = fopen(fname, mode);
02707 if (out == NULL)
02708 {
02709 print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname);
02710 abort();
02711 }
02712 fseek(out, 0, SEEK_END);
02713 if (ftell(out) == 0)
02714 fprintf(out, "GiD Post Results File 1.0\n");
02715 else
02716 write_gid_nodscalar(out, pstress, lcid, k, desclcid);
02717 fclose(out);
02718 }
02719 break;
02720 }
02721 }
02722 }
02723 return;
02724 }
02725
02726
02727
02728
02729
02730
02731
02732
02733
02734
02735
02736
02737
02738
02739
02740
02741 void nodeoutgm::print_gr_oth_scal(const char *outfn, const char *mode, long lcid, const char *desclcid)
02742 {
02743 long i, j;
02744 char fname[FNAMELEN+70];
02745 FILE *out;
02746
02747 if (selnoth.st != sel_no)
02748 {
02749 for(i=0; i<Mm->max_nncompo; i++)
02750 {
02751 for (j=0; j<selnoth.n; j++)
02752 {
02753 if ((seloth[j].st == sel_mtx) || (seloth[j].st == sel_range_mtx) ||
02754 (seloth[j].st == sel_range_vec) || (seloth[j].st == sel_vec))
02755 continue;
02756 if (seloth[j].presence_id(i))
02757 {
02758 sprintf(fname, "%s.nodal_other%ld.res", outfn, i+1);
02759 out = fopen(fname, mode);
02760 if (out == NULL)
02761 {
02762 print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname);
02763 abort();
02764 }
02765 fseek(out, 0, SEEK_END);
02766 if (ftell(out) == 0)
02767 fprintf(out, "GiD Post Results File 1.0\n");
02768 else
02769 write_gid_nodscalar(out, other, lcid, i, desclcid);
02770 fclose(out);
02771 break;
02772 }
02773 }
02774 }
02775 }
02776 return;
02777 }
02778
02779
02780
02781
02782
02783
02784
02785
02786
02787
02788
02789
02790
02791
02792
02793
02794 void nodeoutgm::print_gr_stra_vec(const char *outfn, const char *mode, long lcid, const char *desclcid)
02795 {
02796 long j, id1, n;
02797 char fname[FNAMELEN+70];
02798 FILE *out;
02799
02800 if (selnstra.st != sel_no)
02801 {
02802 for (j=0; j<selnstra.n; j++)
02803 {
02804 if (selstra[j].st != sel_range_vec)
02805 continue;
02806 id1 = selstra[j].id1[0];
02807 n = selstra[j].ncomp[0];
02808 if (id1+n-1 < Mm->max_ncompstrn)
02809 {
02810 sprintf(fname, "%s.nodal_eps_v%ld-%ld_s%ld.res", outfn, id1+1, n, j+1);
02811 out = fopen(fname, mode);
02812 if (out == NULL)
02813 {
02814 print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname);
02815 abort();
02816 }
02817 fseek(out, 0, SEEK_END);
02818 if (ftell(out) == 0)
02819 fprintf(out, "GiD Post Results File 1.0\n");
02820 else
02821 write_gid_nodvector(out, strain, lcid, j, desclcid);
02822 fclose(out);
02823 }
02824 else
02825 {
02826 print_err("required index of strain vector exceeds limits\n"
02827 " selected range is id1=%ld, n=%ld, max ncompst=%ld\n",
02828 __FILE__, __LINE__, __func__, id1, n, Mm->max_ncompstrn);
02829 abort();
02830 }
02831 }
02832 }
02833 return;
02834 }
02835
02836
02837
02838
02839
02840
02841
02842
02843
02844
02845
02846
02847
02848
02849
02850
02851 void nodeoutgm::print_gr_stre_vec(const char *outfn, const char *mode, long lcid, const char *desclcid)
02852 {
02853 long j, id1, n;
02854 char fname[FNAMELEN+70];
02855 FILE *out;
02856
02857 if (selnstre.st != sel_no)
02858 {
02859 for (j=0; j<selnstre.n; j++)
02860 {
02861 if (selstre[j].st != sel_range_vec)
02862 continue;
02863 id1 = selstre[j].id1[0];
02864 n = selstre[j].ncomp[0];
02865 if (id1+n-1 < Mm->max_ncompstrn)
02866 {
02867 sprintf(fname, "%s.nodal_sig_v%ld-%ld_s%ld.res", outfn, id1+1, n, j+1);
02868 out = fopen(fname, mode);
02869 if (out == NULL)
02870 {
02871 print_err("cannot open graphics file '%s'",__FILE__, __LINE__, __func__, fname);
02872 abort();
02873 }
02874 fseek(out, 0, SEEK_END);
02875 if (ftell(out) == 0)
02876 fprintf(out, "GiD Post Results File 1.0\n");
02877 else
02878 write_gid_nodvector(out, stress, lcid, j, desclcid);
02879 fclose(out);
02880 }
02881 else
02882 {
02883 print_err("required index of stress vector exceeds limits\n"
02884 " selected range is id1=%ld, n=%ld, max ncompst=%ld\n",
02885 __FILE__, __LINE__, __func__, id1, n, Mm->max_ncompstrn);
02886 abort();
02887 }
02888 }
02889 }
02890 return;
02891 }
02892
02893
02894
02895
02896
02897
02898
02899
02900
02901
02902
02903
02904
02905
02906
02907
02908 void nodeoutgm::print_gr_oth_vec(const char *outfn, const char *mode, long lcid, const char *desclcid)
02909 {
02910 long j, id1, n;
02911 char fname[FNAMELEN+70];
02912 FILE *out;
02913
02914 if (selnoth.st != sel_no)
02915 {
02916 for (j=0; j<selnoth.n; j++)
02917 {
02918 if (seloth[j].st != sel_range_vec)
02919 continue;
02920 id1 = seloth[j].id1[0];
02921 n = seloth[j].ncomp[0];
02922 if (id1+n-1 < Mm->max_nncompo)
02923 {
02924 sprintf(fname, "%s.nodal_other_v%ld-%ld_s%ld.res", outfn, id1+1, n, j+1);
02925 out = fopen(fname, mode);
02926 if (out == NULL)
02927 {
02928 print_err("cannot open graphics file '%s'",__FILE__, __LINE__, __func__, fname);
02929 abort();
02930 }
02931 fseek(out, 0, SEEK_END);
02932 if (ftell(out) == 0)
02933 fprintf(out, "GiD Post Results File 1.0\n");
02934 else
02935 write_gid_nodvector(out, other, lcid, j, desclcid);
02936 fclose(out);
02937 }
02938 else
02939 {
02940 print_err("required index of other values vector exceeds limits\n"
02941 " selected range is id1=%ld, n=%ld, max nncompo=%ld\n",
02942 __FILE__, __LINE__, __func__, id1, n, Mm->max_nncompo);
02943 abort();
02944 }
02945 }
02946 }
02947 return;
02948 }
02949
02950
02951
02952
02953
02954
02955
02956
02957
02958
02959
02960
02961
02962
02963
02964 void nodeoutgm::print_gr_stra_mtx(const char *outfn, const char *mode, long lcid, const char *desclcid)
02965 {
02966 long j;
02967 char fname[FNAMELEN+70];
02968 FILE *out;
02969
02970 if (selnstra.st != sel_no)
02971 {
02972 for (j=0; j<selnstra.n; j++)
02973 {
02974 if ((selstra[j].st != sel_mtx) && (selstra[j].st != sel_range_mtx))
02975 continue;
02976 if (selstra[j].st == sel_range_mtx)
02977 {
02978 print_err("sel_range_mtx selection type of a strain tensor is not supported, use sel_mtx(%d)\n",
02979 __FILE__, __LINE__, __func__, sel_mtx);
02980 abort();
02981 }
02982 sprintf(fname, "%s.nodal_eps_m_s%ld.res", outfn, j+1);
02983 out = fopen(fname, mode);
02984 if (out == NULL)
02985 {
02986 print_err("cannot open graphics file '%s'",__FILE__, __LINE__, __func__, fname);
02987 abort();
02988 }
02989 fseek(out, 0, SEEK_END);
02990 if (ftell(out) == 0)
02991 fprintf(out, "GiD Post Results File 1.0\n");
02992 else
02993 write_gid_nodtensor(out, strain, lcid, j, desclcid);
02994 fclose(out);
02995 }
02996 }
02997 return;
02998 }
02999
03000
03001
03002
03003
03004
03005
03006
03007
03008
03009
03010
03011
03012
03013
03014 void nodeoutgm::print_gr_stre_mtx(const char *outfn, const char *mode, long lcid, const char *desclcid)
03015 {
03016 long j;
03017 char fname[FNAMELEN+70];
03018 FILE *out;
03019
03020 if (selnstre.st != sel_no)
03021 {
03022 for (j=0; j<selnstre.n; j++)
03023 {
03024 if ((selstre[j].st != sel_mtx) && (selstre[j].st != sel_range_mtx))
03025 continue;
03026 if (selstre[j].st == sel_range_mtx)
03027 {
03028 print_err("sel_range_mtx selection type of a stress tensor is not supported, use sel_mtx(%d)\n",
03029 __FILE__, __LINE__, __func__, sel_mtx);
03030 abort();
03031 }
03032 sprintf(fname, "%s.nodal_sig_m_s%ld.res", outfn, j+1);
03033 out = fopen(fname, mode);
03034 if (out == NULL)
03035 {
03036 print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname);
03037 abort();
03038 }
03039 fseek(out, 0, SEEK_END);
03040 if (ftell(out) == 0)
03041 fprintf(out, "GiD Post Results File 1.0\n");
03042 else
03043 write_gid_nodtensor(out, stress, lcid, j, desclcid);
03044 fclose(out);
03045 }
03046 }
03047 return;
03048 }
03049
03050
03051
03052
03053
03054
03055
03056
03057
03058
03059
03060
03061
03062
03063
03064 void nodeoutgm::print_gr_oth_mtx(const char *outfn, const char *mode, long lcid, const char *desclcid)
03065 {
03066 long j;
03067 char fname[FNAMELEN+70];
03068 FILE *out;
03069
03070 if (selnoth.st != sel_no)
03071 {
03072 for (j=0; j<selnoth.n; j++)
03073 {
03074 if ((seloth[j].st != sel_mtx) && (seloth[j].st != sel_range_mtx))
03075 continue;
03076 if (seloth[j].st == sel_mtx)
03077 {
03078 print_err("sel_mtx selection type of an other values tensor is not supported, use sel_range_mtx(%d)\n",
03079 __FILE__, __LINE__, __func__, sel_range_mtx);
03080 abort();
03081 }
03082 sprintf(fname, "%s.nodal_other_m%ld-%ld_s%ld.res", outfn, seloth[j].id1[0]+1, seloth[j].ncomp[0], j+1);
03083 out = fopen(fname, mode);
03084 if (out == NULL)
03085 {
03086 print_err("cannot open graphics file '%s'",__FILE__, __LINE__, __func__, fname);
03087 abort();
03088 }
03089 fseek(out, 0, SEEK_END);
03090 if (ftell(out) == 0)
03091 fprintf(out, "GiD Post Results File 1.0\n");
03092 else
03093 write_gid_nodtensor(out, other, lcid,j, desclcid);
03094 fclose(out);
03095 }
03096 }
03097 return;
03098 }
03099
03100
03101
03102
03103
03104
03105
03106
03107
03108
03109
03110
03111
03112
03113 void nodeoutgm::conv_sel_prop(siftop *top)
03114 {
03115 if (selndisp.st == sel_prop)
03116 selndisp.conv_selprop(top, gnod);
03117
03118 if (selnstra.st == sel_prop)
03119 selnstra.conv_selprop(top, gnod);
03120
03121 if (selnstre.st == sel_prop)
03122 selnstre.conv_selprop(top, gnod);
03123
03124 if (selnoth.st == sel_prop)
03125 selnoth.conv_selprop(top, gnod);
03126 }
03127
03128
03129
03130
03131
03132
03133
03134
03135
03136
03137 elemoutm::elemoutm()
03138 {
03139 selstra = selstre = seloth = NULL;
03140 transtra = transtre = NULL;
03141 }
03142
03143
03144
03145
03146
03147
03148
03149
03150
03151
03152 elemoutm::~elemoutm()
03153 {
03154 delete [] selstra;
03155 delete [] selstre;
03156 delete [] seloth;
03157 delete [] transtra;
03158 delete [] transtre;
03159 }
03160
03161
03162
03163
03164
03165
03166
03167
03168
03169
03170
03171
03172
03173
03174
03175
03176 long elemoutm::read(XFILE *in)
03177 {
03178 long i;
03179
03180 xfscanf(in, "%k", "sel_elemstep");
03181 dstep.read(in);
03182 if (dstep.st == sel_no)
03183 return 0;
03184 xfscanf(in, "%k", "sel_elemlc");
03185 sellc.read(in);
03186 if (sellc.st == sel_no)
03187 return 0;
03188
03189
03190
03191 xfscanf(in, "%k", "strain_elems");
03192 selestra.read(in);
03193 switch (selestra.st)
03194 {
03195 case sel_no:
03196 break;
03197 case sel_all:
03198 case sel_range:
03199 case sel_list:
03200 xfscanf(in, "%k", "elemstrain_comp");
03201 Mp->straincomp = 1;
03202 if (Mp->strainpos == 0)
03203 Mp->strainpos = 1;
03204 transtra = new long[selestra.n];
03205 memset(transtra, 0, sizeof(*transtra)*selestra.n);
03206 selstra = new sel[selestra.n];
03207 for(i=0; i<selestra.n; i++)
03208 selstra[i].read(in);
03209 xfscanf(in, "%k", "elemstra_transfid");
03210 for(i=0; i<selestra.n; i++)
03211 {
03212 if (xfscanf(in, "%ld", transtra+i) != 1)
03213 {
03214 print_err("cannot read strain selection", __FILE__, __LINE__, __func__);
03215 return 2;
03216 }
03217 }
03218 break;
03219 default:
03220 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
03221 return 2;
03222 }
03223
03224
03225
03226 xfscanf(in, "%k", "stress_elems");
03227 selestre.read(in);
03228 switch (selestre.st)
03229 {
03230 case sel_no:
03231 break;
03232 case sel_all:
03233 case sel_range:
03234 case sel_list:
03235 xfscanf(in, "%k", "elemstress_comp");
03236 Mp->straincomp = 1;
03237 if (Mp->strainpos == 0)
03238 Mp->strainpos = 1;
03239 Mp->stresscomp = 1;
03240 if (Mp->stresspos == 0)
03241 Mp->stresspos = 1;
03242 transtre = new long[selestre.n];
03243 memset(transtre, 0, sizeof(*transtre)*selestre.n);
03244 selstre = new sel[selestre.n];
03245 for(i=0; i<selestre.n; i++)
03246 selstre[i].read(in);
03247 xfscanf(in, "%k", "elemstre_transfid");
03248 for(i=0; i<selestre.n; i++)
03249 {
03250 if (xfscanf(in, "%ld", transtre+i) != 1)
03251 {
03252 print_err("cannot read stress selection", __FILE__, __LINE__, __func__);
03253 return 3;
03254 }
03255 }
03256 break;
03257 default:
03258 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
03259 return 3;
03260 }
03261
03262
03263 xfscanf(in, "%k", "other_elems");
03264 seleoth.read(in);
03265 switch (seleoth.st)
03266 {
03267 case sel_no:
03268 break;
03269 case sel_all:
03270 case sel_range:
03271 case sel_list:
03272 xfscanf(in, "%k", "elemother_comp");
03273 Mp->othercomp = 1;
03274 if (Mp->otherpos == 0)
03275 Mp->otherpos = 1;
03276 seloth = new sel[seleoth.n];
03277 for (i=0; i<seleoth.n; i++)
03278 seloth[i].read(in);
03279 break;
03280 default:
03281 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
03282 return 4;
03283 }
03284 return 0;
03285 }
03286
03287
03288
03289
03290
03291
03292
03293
03294
03295
03296
03297
03298 void elemoutm::print(FILE *out)
03299 {
03300 long i;
03301
03302
03303 dstep.print(out);
03304 if (dstep.st == sel_no)
03305 return;
03306 sellc.print(out);
03307 if (sellc.st == sel_no)
03308 return;
03309
03310
03311 selestra.print(out);
03312 switch (selestra.st)
03313 {
03314 case sel_no:
03315 break;
03316 case sel_all:
03317 case sel_range:
03318 case sel_list:
03319 for(i=0; i<selestra.n; i++)
03320 selstra[i].print(out);
03321 for(i=0; i<selestra.n; i++)
03322 fprintf(out, "%ld ", transtra[i]);
03323 fprintf(out, "\n");
03324 break;
03325 default:
03326 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
03327 return;
03328 }
03329
03330
03331 selestre.print(out);
03332 switch (selestre.st)
03333 {
03334 case sel_no:
03335 break;
03336 case sel_all:
03337 case sel_range:
03338 case sel_list:
03339 for(i=0; i<selestre.n; i++)
03340 selstre[i].print(out);
03341 for(i=0; i<selestre.n; i++)
03342 fprintf(out, "%ld ", transtre[i]);
03343 fprintf(out, "\n");
03344 break;
03345 default:
03346 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
03347 return;
03348 }
03349
03350
03351 seleoth.print(out);
03352 switch (seleoth.st)
03353 {
03354 case sel_no:
03355 break;
03356 case sel_all:
03357 case sel_range:
03358 case sel_list:
03359 for(i=0; i<seleoth.n; i++)
03360 seloth[i].print(out);
03361 break;
03362 default:
03363 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
03364 return;
03365 }
03366 }
03367
03368
03369
03370
03371
03372
03373
03374
03375
03376
03377
03378
03379
03380
03381 void elemoutm::print_out(FILE *out, long lcid)
03382 {
03383 if (selestra.st != sel_no)
03384 {
03385 fprintf(out, "** Element strains:\n\n");
03386 print_stra(out, lcid);
03387 }
03388 if (selestre.st != sel_no)
03389 {
03390 fprintf(out, "** Element stresses:\n\n");
03391 print_stre(out, lcid);
03392 }
03393 if (seleoth.st != sel_no)
03394 {
03395 fprintf(out, "** Element other values:\n\n");
03396 print_other(out);
03397 }
03398 }
03399
03400
03401
03402
03403
03404
03405
03406
03407
03408
03409
03410
03411
03412
03413 void elemoutm::print_stra(FILE *out, long lcid)
03414 {
03415 long i, j, k, ncomp, id, ipp, tnipe, ir;
03416 vector aux;
03417 char *namevar[] = {"x", "y", "z"};
03418 matrix t;
03419 vector str, p;
03420
03421 if(Outdm->nlcs > 0)
03422 {
03423 allocv(3, p);
03424 allocm(3, 3, t);
03425 }
03426
03427 for (i=0; i<Mt->ne; i++)
03428 {
03429 if (Gtm->leso[i]==0)
03430 continue;
03431 if (selestra.presence_id(i, ir))
03432 {
03433 ipp = Mt->elements[i].ipp[0][0];
03434 tnipe = Mt->give_totnip(i);
03435 fprintf(out, " Element %7ld, integration points %ld - %ld\n ", i+1, ipp+1, ipp+tnipe);
03436 ncomp = Mm->ip[ipp].ncompstr;
03437 id = lcid*ncomp;
03438 for (j=0; j<tnipe; j++)
03439 {
03440 if (transtra[ir] > 0)
03441 {
03442 reallocv(ncomp, aux);
03443 str.n = ncomp;
03444 str.a = Mm->ip[ipp+j].strain+id;
03445 ipcoord(Mm->elip[ipp+j], ipp+j, 0, 0, p);
03446 Outdm->lcs[transtra[ir]-1].evaluate_t(p, namevar, t);
03447 gl_engvectortransf(str, aux, t, planestrain, strain);
03448 str.a = NULL;
03449 }
03450 for (k=0; k<ncomp; k++)
03451 {
03452 if (selestra.presence_id(selstra, i, k))
03453 {
03454 if (transtra[ir] > 0)
03455 fprintf(out, " leps_%ld=% .*e", k+1, prstra, aux[k]);
03456 else
03457 fprintf(out, " eps_%ld=% .*e", k+1, prstra, Mm->ip[ipp+j].strain[id+k]);
03458 }
03459 }
03460 if (j < tnipe-1)
03461 fprintf(out, "\n ");
03462 else
03463 fprintf(out, "\n");
03464 }
03465 }
03466 }
03467 fprintf(out, "\n");
03468 }
03469
03470
03471
03472
03473
03474
03475
03476
03477
03478
03479
03480
03481 void elemoutm::print_stre(FILE *out, long lcid)
03482 {
03483 long i, j, k, ncomp, ipp, tnipe, id, ir;
03484 vector aux;
03485 char *namevar[] = {"x", "y", "z"};
03486 matrix t;
03487 vector str, p;
03488
03489 if(Outdm->nlcs > 0)
03490 {
03491 allocv(3, p);
03492 allocm(3, 3, t);
03493 }
03494
03495
03496 for (i=0; i<Mt->ne; i++)
03497 {
03498 if (Gtm->leso[i]==0)
03499 continue;
03500 if (selestre.presence_id(i, ir))
03501 {
03502 ipp = Mt->elements[i].ipp[0][0];
03503 tnipe = Mt->give_totnip(i);
03504 fprintf(out, " Element %7ld, integration points %ld - %ld\n ", i+1, ipp+1, ipp+tnipe);
03505 ncomp = Mm->ip[ipp].ncompstr;
03506 id = lcid*ncomp;
03507 for (j=0; j<tnipe; j++)
03508 {
03509 if (transtre[ir] > 0)
03510 {
03511 reallocv(ncomp, aux);
03512 str.n = ncomp;
03513 str.a = Mm->ip[ipp+j].stress+id;
03514 ipcoord(Mm->elip[ipp+j], ipp+j, 0, 0, p);
03515 Outdm->lcs[transtre[ir]-1].evaluate_t(p, namevar, t);
03516 gl_engvectortransf(str, aux, t, planestrain, strain);
03517 str.a = NULL;
03518 }
03519 for (k=0; k<ncomp; k++)
03520 {
03521 if (selestre.presence_id(selstre, i, k))
03522 {
03523 if (transtre[ir] > 0)
03524 fprintf(out, " lsig_%ld=% .*e", k+1, prstre, aux[k]);
03525 else
03526 fprintf(out, " sig_%ld=% .*e", k+1, prstre, Mm->ip[ipp+j].stress[id+k]);
03527 }
03528 }
03529 if (j < tnipe-1)
03530 fprintf(out, "\n ");
03531 else
03532 fprintf(out, "\n");
03533 }
03534 }
03535 }
03536 fprintf(out, "\n");
03537 }
03538
03539
03540
03541
03542
03543
03544
03545
03546
03547
03548
03549
03550
03551 void elemoutm::print_other(FILE *out)
03552 {
03553 long i, j, k, ncomp, ipp, tnipe;
03554
03555 for (i=0; i<Mt->ne; i++)
03556 {
03557 if (Gtm->leso[i]==0)
03558 continue;
03559 if (seleoth.presence_id(i))
03560 {
03561 ipp = Mt->elements[i].ipp[0][0];
03562 tnipe = Mt->give_totnip(i);
03563 fprintf(out, " Element %7ld, integration points %ld - %ld\n ", i+1, ipp+1, ipp+tnipe);
03564 ncomp = Mm->ip[ipp].ncompeqother;
03565 for (j=0; j<tnipe; j++)
03566 {
03567 for (k=0; k<ncomp; k++)
03568 {
03569 if (seleoth.presence_id(seloth, i, k))
03570 fprintf(out, " other_%ld=% .*e", k+1, proth, Mm->ip[ipp+j].eqother[k]);
03571 }
03572 if (j < tnipe-1)
03573 fprintf(out, "\n ");
03574 else
03575 fprintf(out, "\n");
03576 }
03577 }
03578 }
03579 fprintf(out, "\n");
03580 }
03581
03582
03583
03584
03585
03586
03587
03588
03589
03590
03591
03592
03593
03594
03595 void elemoutm::conv_sel_prop(siftop *top)
03596 {
03597 if (selestra.st == sel_prop)
03598 selestra.conv_selprop(top, gnod);
03599
03600 if (selestre.st == sel_prop)
03601 selestre.conv_selprop(top, gnod);
03602
03603 if (seleoth.st == sel_prop)
03604 seleoth.conv_selprop(top, gnod);
03605 }
03606
03607
03608
03609
03610
03611
03612
03613
03614
03615
03616 elemoutgm::elemoutgm()
03617 {
03618 selstra = selstre = seloth = NULL;
03619 transtra = transtre = NULL;
03620 ide1 = 1;
03621 }
03622
03623
03624
03625
03626
03627
03628
03629
03630 elemoutgm::~elemoutgm()
03631 {
03632 delete [] selstra;
03633 delete [] selstre;
03634 delete [] seloth;
03635 delete [] transtra;
03636 delete [] transtre;
03637 }
03638
03639
03640
03641
03642
03643
03644
03645
03646
03647
03648
03649
03650
03651
03652
03653
03654 long elemoutgm::read(XFILE *in)
03655 {
03656 long i;
03657
03658 xfscanf(in, "%k", "sel_elemstep");
03659 dstep.read(in);
03660 if (dstep.st == sel_no)
03661 return 0;
03662 xfscanf(in, "%k", "sel_elemlc");
03663 sellc.read(in);
03664 if (sellc.st == sel_no)
03665 return 0;
03666
03667
03668
03669 xfscanf(in, "%k", "strain_elems");
03670 selestra.read(in);
03671 switch (selestra.st)
03672 {
03673 case sel_no:
03674 break;
03675 case sel_all:
03676 case sel_range:
03677 case sel_list:
03678 xfscanf(in, "%k", "elemstrain_comp");
03679 Mp->straincomp = 1;
03680 if (Mp->strainpos == 0)
03681 Mp->strainpos = 1;
03682 transtra = new long[selestra.n];
03683 memset(transtra, 0, sizeof(*transtra)*selestra.n);
03684 selstra = new sel[selestra.n];
03685 for(i=0; i<selestra.n; i++)
03686 selstra[i].read(in);
03687 xfscanf(in, "%k", "elemstra_transfid");
03688 for(i=0; i<selestra.n; i++)
03689 {
03690 if (xfscanf(in, "%ld", transtra+i) != 1)
03691 {
03692 print_err("cannot read strain selection", __FILE__, __LINE__, __func__);
03693 return 2;
03694 }
03695 }
03696 break;
03697 default:
03698 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
03699 return 2;
03700 }
03701
03702
03703
03704 xfscanf(in, "%k", "stress_elems");
03705 selestre.read(in);
03706 switch (selestre.st)
03707 {
03708 case sel_no:
03709 break;
03710 case sel_all:
03711 case sel_range:
03712 case sel_list:
03713 xfscanf(in, "%k", "elemstress_comp");
03714 Mp->straincomp = 1;
03715 if (Mp->strainpos == 0)
03716 Mp->strainpos = 1;
03717 Mp->stresscomp = 1;
03718 if (Mp->stresspos == 0)
03719 Mp->stresspos = 1;
03720 transtre = new long[selestre.n];
03721 memset(transtre, 0, sizeof(*transtre)*selestre.n);
03722 selstre = new sel[selestre.n];
03723 for(i=0; i<selestre.n; i++)
03724 selstre[i].read(in);
03725 xfscanf(in, "%k", "elemstre_transfid");
03726 for(i=0; i<selestre.n; i++)
03727 {
03728 if (xfscanf(in, "%ld", transtre+i) != 1)
03729 {
03730 print_err("cannot read stress selection", __FILE__, __LINE__, __func__);
03731 return 3;
03732 }
03733 }
03734 break;
03735 default:
03736 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
03737 return 3;
03738 }
03739
03740
03741 xfscanf(in, "%k", "other_elems");
03742 seleoth.read(in);
03743 switch (seleoth.st)
03744 {
03745 case sel_no:
03746 break;
03747 case sel_all:
03748 case sel_range:
03749 case sel_list:
03750 xfscanf(in, "%k", "elemother_comp");
03751 Mp->othercomp = 1;
03752 if (Mp->otherpos == 0)
03753 Mp->otherpos = 1;
03754 seloth = new sel[seleoth.n];
03755 for (i=0; i<seleoth.n; i++)
03756 seloth[i].read(in);
03757 break;
03758 default:
03759 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
03760 return 4;
03761 }
03762 return 0;
03763 }
03764
03765
03766
03767
03768
03769
03770
03771
03772
03773
03774
03775
03776 void elemoutgm::print(FILE *out)
03777 {
03778 long i;
03779
03780
03781 dstep.print(out);
03782 if (dstep.st == sel_no)
03783 return;
03784 sellc.print(out);
03785 if (sellc.st == sel_no)
03786 return;
03787
03788
03789 selestra.print(out);
03790 switch (selestra.st)
03791 {
03792 case sel_no:
03793 break;
03794 case sel_all:
03795 case sel_range:
03796 case sel_list:
03797 for(i=0; i<selestra.n; i++)
03798 selstra[i].print(out);
03799 for(i=0; i<selestra.n; i++)
03800 fprintf(out, "%ld ", transtra[i]);
03801 fprintf(out, "\n");
03802 break;
03803 default:
03804 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
03805 return;
03806 }
03807
03808
03809 selestre.print(out);
03810 switch (selestre.st)
03811 {
03812 case sel_no:
03813 break;
03814 case sel_all:
03815 case sel_range:
03816 case sel_list:
03817 for(i=0; i<selestre.n; i++)
03818 selstre[i].print(out);
03819 for(i=0; i<selestre.n; i++)
03820 fprintf(out, "%ld ", transtre[i]);
03821 fprintf(out, "\n");
03822 break;
03823 default:
03824 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
03825 return;
03826 }
03827
03828
03829 seleoth.print(out);
03830 switch (seleoth.st)
03831 {
03832 case sel_no:
03833 break;
03834 case sel_all:
03835 case sel_range:
03836 case sel_list:
03837 for(i=0; i<seleoth.n; i++)
03838 seloth[i].print(out);
03839 break;
03840 default:
03841 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
03842 return;
03843 }
03844 }
03845
03846
03847
03848
03849
03850
03851
03852
03853
03854
03855
03856
03857
03858
03859
03860
03861
03862
03863 void elemoutgm::print_graphics(FILE *out, long lcid, const char *desclcid, graphfmt gf, long idelem1)
03864 {
03865 ide1 = idelem1;
03866 if (gf == grfmt_open_dx)
03867 return;
03868
03869 print_gr_stra_scal(out, lcid, desclcid, gf);
03870 print_gr_stre_scal(out, lcid, desclcid, gf);
03871 print_gr_oth_scal(out, lcid, desclcid, gf);
03872
03873 print_gr_stra_vec(out, lcid, desclcid, gf);
03874 print_gr_stre_vec(out, lcid, desclcid, gf);
03875 print_gr_oth_vec(out, lcid, desclcid, gf);
03876
03877 print_gr_stra_mtx(out, lcid, desclcid, gf);
03878 print_gr_stre_mtx(out, lcid, desclcid, gf);
03879 print_gr_oth_mtx(out, lcid, desclcid, gf);
03880
03881 }
03882
03883
03884
03885
03886
03887
03888
03889
03890
03891
03892
03893
03894
03895
03896
03897 void elemoutgm::print_gr_stra_scal(FILE *out, long lcid, const char *desclcid, graphfmt gf)
03898 {
03899 long i, j;
03900
03901 if (selestra.st != sel_no)
03902 {
03903 for(i=0; i<Mm->max_ncompstre; i++)
03904 {
03905 for (j=0; j<selestra.n; j++)
03906 {
03907 if ((selstra[j].st == sel_mtx) || (selstra[j].st == sel_range_mtx) ||
03908 (selstra[j].st == sel_range_vec) || (selstra[j].st == sel_vec))
03909 continue;
03910 if (selstra[j].presence_id(i))
03911 {
03912 if (gf == grfmt_gid)
03913 write_gid_elemscalar(out, strain, lcid, i, desclcid);
03914 if (gf == grfmt_femcad)
03915 write_elemscalar(out, strain, lcid, i, desclcid);
03916 break;
03917 }
03918 }
03919 }
03920 }
03921 }
03922
03923
03924
03925
03926
03927
03928
03929
03930
03931
03932
03933
03934
03935
03936
03937 void elemoutgm::print_gr_stre_scal(FILE *out, long lcid, const char *desclcid, graphfmt gf)
03938 {
03939 long i, j;
03940
03941 if (selestre.st != sel_no)
03942 {
03943 for(i=0; i<Mm->max_ncompstre; i++)
03944 {
03945 for (j=0; j<selestre.n; j++)
03946 {
03947 if ((selstre[j].st == sel_mtx) || (selstre[j].st == sel_range_mtx) ||
03948 (selstre[j].st == sel_range_vec) || (selstre[j].st == sel_vec))
03949 continue;
03950 if (selstre[j].presence_id(i))
03951 {
03952 if (gf == grfmt_gid)
03953 write_gid_elemscalar(out, stress, lcid, i, desclcid);
03954 if (gf == grfmt_femcad)
03955 write_elemscalar(out, stress, lcid, i, desclcid);
03956 break;
03957 }
03958 }
03959 }
03960 }
03961 }
03962
03963
03964
03965
03966
03967
03968
03969
03970
03971
03972
03973
03974
03975
03976
03977 void elemoutgm::print_gr_oth_scal(FILE *out, long lcid, const char *desclcid, graphfmt gf)
03978 {
03979 long i, j;
03980
03981 if (seleoth.st != sel_no)
03982 {
03983 for(i=0; i<Mm->max_encompo; i++)
03984 {
03985 for (j=0; j<seleoth.n; j++)
03986 {
03987 if ((seloth[j].st == sel_mtx) || (seloth[j].st == sel_range_mtx) ||
03988 (seloth[j].st == sel_range_vec) || (seloth[j].st == sel_vec))
03989 continue;
03990 if (seloth[j].presence_id(i))
03991 {
03992 if (gf == grfmt_gid)
03993 write_gid_elemscalar(out, other, lcid, i, desclcid);
03994 if (gf == grfmt_femcad)
03995 write_elemscalar(out, other, lcid, i, desclcid);
03996 break;
03997 }
03998 }
03999 }
04000 }
04001 }
04002
04003
04004
04005
04006
04007
04008
04009
04010
04011
04012
04013
04014
04015
04016
04017 void elemoutgm::print_gr_stra_vec(FILE *out, long lcid, const char *desclcid, graphfmt gf)
04018 {
04019 long j, id1, n;
04020
04021 if (selestra.st != sel_no)
04022 {
04023 for (j=0; j<selestra.n; j++)
04024 {
04025 if (selstra[j].st != sel_range_vec)
04026 continue;
04027 id1 = selstra[j].id1[0];
04028 n = selstra[j].ncomp[0];
04029 if (id1+n-1 < Mm->max_ncompstre)
04030 {
04031 if (gf == grfmt_gid)
04032 write_gid_elemvector(out, strain, lcid, j, desclcid);
04033 else
04034 {
04035 print_err("required export format of a strain vector is not supported", __FILE__, __LINE__, __func__);
04036 abort();
04037 }
04038 }
04039 else
04040 {
04041 print_err("required index of strain vector exceeds limits\n"
04042 " selected range is id1=%ld, n=%ld, max ncompst=%ld",
04043 __FILE__, __LINE__, __func__, id1, n, Mm->max_ncompstrn);
04044 abort();
04045 }
04046 }
04047 }
04048 }
04049
04050
04051
04052
04053
04054
04055
04056
04057
04058
04059
04060
04061
04062
04063
04064 void elemoutgm::print_gr_stre_vec(FILE *out, long lcid, const char *desclcid, graphfmt gf)
04065 {
04066 long j, id1, n;
04067
04068 if (selestre.st != sel_no)
04069 {
04070 for (j=0; j<selestre.n; j++)
04071 {
04072 if (selstre[j].st != sel_range_vec)
04073 continue;
04074 id1 = selstre[j].id1[0];
04075 n = selstre[j].ncomp[0];
04076 if (id1+n-1 < Mm->max_ncompstre)
04077 {
04078 if (gf == grfmt_gid)
04079 write_gid_elemvector(out, stress, lcid, j, desclcid);
04080 else
04081 {
04082 print_err("required export format of a stress vector is not supported", __FILE__, __LINE__, __func__);
04083 abort();
04084 }
04085 }
04086 else
04087 {
04088 print_err("required index of stress vector exceeds limits\n"
04089 " selected range is id1=%ld, n=%ld, max ncompst=%ld",
04090 __FILE__, __LINE__, __func__, id1, n, Mm->max_ncompstrn);
04091 abort();
04092 }
04093 }
04094 }
04095 }
04096
04097
04098
04099
04100
04101
04102
04103
04104
04105
04106
04107
04108
04109
04110
04111 void elemoutgm::print_gr_oth_vec(FILE *out, long lcid, const char *desclcid, graphfmt gf)
04112 {
04113 long j;
04114 long id1, n;
04115
04116 if (seleoth.st != sel_no)
04117 {
04118 for (j=0; j<seleoth.n; j++)
04119 {
04120 if (seloth[j].st != sel_range_vec)
04121 continue;
04122 id1 = seloth[j].id1[0];
04123 n = seloth[j].ncomp[0];
04124 if (id1+n-1 < Mm->max_encompo)
04125 {
04126 if (gf == grfmt_gid)
04127 write_gid_elemvector(out, other, lcid, j, desclcid);
04128 else
04129 {
04130 print_err("unsupported export format of an other values vector is required",__FILE__, __LINE__, __func__);
04131 abort();
04132 }
04133 }
04134 else
04135 {
04136 print_err("required index of other values vector exceeds limits\n"
04137 " selected range is id1=%ld, n=%ld, max encompo=%ld",
04138 __FILE__, __LINE__, __func__, id1, n, Mm->max_encompo);
04139 abort();
04140 }
04141 }
04142 }
04143 }
04144
04145
04146
04147
04148
04149
04150
04151
04152
04153
04154
04155
04156
04157
04158
04159 void elemoutgm::print_gr_stra_mtx(FILE *out, long lcid, const char *desclcid, graphfmt gf)
04160 {
04161 long j;
04162
04163 if (selestra.st != sel_no)
04164 {
04165 for (j=0; j<selestra.n; j++)
04166 {
04167 if ((selstra[j].st != sel_mtx) && (selstra[j].st != sel_range_mtx))
04168 continue;
04169 if (selstra[j].st == sel_range_mtx)
04170 {
04171 print_err("sel_range_mtx selection type of a strain tensor is not supported, use sel_mtx(%d)",
04172 __FILE__, __LINE__, __func__, sel_mtx);
04173 abort();
04174 }
04175 if (gf == grfmt_gid)
04176 write_gid_elemtensor(out, strain, lcid, j, desclcid);
04177 else
04178 {
04179 print_err("required export format of a strain tensor is not supported", __FILE__, __LINE__, __func__);
04180 abort();
04181 }
04182 }
04183 }
04184 }
04185
04186
04187
04188
04189
04190
04191
04192
04193
04194
04195
04196
04197
04198
04199
04200 void elemoutgm::print_gr_stre_mtx(FILE *out, long lcid, const char *desclcid, graphfmt gf)
04201 {
04202 long j;
04203
04204 if (selestre.st != sel_no)
04205 {
04206 for (j=0; j<selestre.n; j++)
04207 {
04208 if ((selstre[j].st != sel_mtx) && (selstre[j].st != sel_range_mtx))
04209 continue;
04210 if (selstre[j].st == sel_range_mtx)
04211 {
04212 print_err("sel_range_mtx selection type of a stress tensor is not supported, use sel_mtx(%d)",
04213 __FILE__, __LINE__, __func__, sel_mtx);
04214 abort();
04215 }
04216 if (gf == grfmt_gid)
04217 write_gid_elemtensor(out, stress, lcid, j, desclcid);
04218 else
04219 {
04220 print_err("required export format of a stress tensor is not supported", __FILE__, __LINE__, __func__);
04221 abort();
04222 }
04223 }
04224 }
04225 }
04226
04227
04228
04229
04230
04231
04232
04233
04234
04235
04236
04237
04238
04239
04240
04241 void elemoutgm::print_gr_oth_mtx(FILE *out, long lcid, const char *desclcid, graphfmt gf)
04242 {
04243 long j, id1, n;
04244
04245 if (seleoth.st != sel_no)
04246 {
04247 for (j=0; j<seleoth.n; j++)
04248 {
04249 if ((seloth[j].st != sel_mtx) && (seloth[j].st != sel_range_mtx))
04250 continue;
04251 if (seloth[j].st == sel_mtx)
04252 {
04253 print_err("sel_mtx selection type of an other values tensor is not supported, use sel_range_mtx(%d)",
04254 __FILE__, __LINE__, __func__, sel_range_mtx);
04255 abort();
04256 }
04257 id1 = seloth[j].id1[0];
04258 n = seloth[j].ncomp[0];
04259 if (id1+n-1 < Mm->max_encompo)
04260 {
04261 if (gf == grfmt_gid)
04262 write_gid_elemtensor(out, other, lcid, j, desclcid);
04263 else
04264 {
04265 print_err("required export format of an other values tensor is not supported", __FILE__, __LINE__, __func__);
04266 abort();
04267 }
04268 }
04269 else
04270 {
04271 print_err("required index of other values vector exceeds limits\n"
04272 " selected range is id1=%ld, n=%ld, max encompo=%ld\n",
04273 __FILE__, __LINE__, __func__, id1, n, Mm->max_encompo);
04274 abort();
04275 }
04276 }
04277 }
04278 }
04279
04280
04281
04282
04283
04284
04285
04286
04287
04288
04289
04290
04291
04292
04293
04294
04295
04296
04297
04298
04299 void elemoutgm::print_graphics(const char *outfn, const char *mode, long lcid, const char *desclcid, graphfmt gf, long idelem1)
04300 {
04301 ide1 = idelem1;
04302 if (gf != grfmt_gid_sep)
04303 {
04304 print_err("invalid graphics format is required", __FILE__, __LINE__, __func__);
04305 return;
04306 }
04307 print_gr_stra_scal(outfn, mode, lcid, desclcid);
04308 print_gr_stre_scal(outfn, mode, lcid, desclcid);
04309 print_gr_oth_scal(outfn, mode, lcid, desclcid);
04310
04311 print_gr_stra_vec(outfn, mode, lcid, desclcid);
04312 print_gr_stre_vec(outfn, mode, lcid, desclcid);
04313 print_gr_oth_vec(outfn, mode, lcid, desclcid);
04314
04315 print_gr_stra_mtx(outfn, mode, lcid, desclcid);
04316 print_gr_stre_mtx(outfn, mode, lcid, desclcid);
04317 print_gr_oth_mtx(outfn, mode, lcid, desclcid);
04318 return;
04319 }
04320
04321
04322
04323
04324
04325
04326
04327
04328
04329
04330
04331
04332
04333
04334
04335
04336 void elemoutgm::print_gr_stra_scal(const char *outfn, const char *mode, long lcid, const char *desclcid)
04337 {
04338 long i, j;
04339 char fname[FNAMELEN+70];
04340 FILE *out;
04341
04342 if (selestra.st != sel_no)
04343 {
04344 for(i=0; i<Mm->max_ncompstre; i++)
04345 {
04346 for (j=0; j<selestra.n; j++)
04347 {
04348 if ((selstra[j].st == sel_mtx) || (selstra[j].st == sel_range_mtx) ||
04349 (selstra[j].st == sel_range_vec) || (selstra[j].st == sel_vec))
04350 continue;
04351 if (selstra[j].presence_id(i))
04352 {
04353 sprintf(fname, "%s.elem_eps%ld.res", outfn, i+1);
04354 out = fopen(fname, mode);
04355 if (out == NULL)
04356 {
04357 print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname);
04358 abort();
04359 }
04360 fseek(out, 0, SEEK_END);
04361 if (ftell(out) == 0)
04362 {
04363 fprintf(out, "GiD Post Results File 1.0\n");
04364 export_gid_gauss_pt(out, ide1);
04365 }
04366 else
04367 write_gid_elemscalar(out, strain, lcid, i, desclcid);
04368 fclose(out);
04369 break;
04370 }
04371 }
04372 }
04373 }
04374 }
04375
04376
04377
04378
04379
04380
04381
04382
04383
04384
04385
04386
04387
04388
04389
04390
04391 void elemoutgm::print_gr_stre_scal(const char *outfn, const char *mode, long lcid, const char *desclcid)
04392 {
04393 long i, j;
04394 char fname[FNAMELEN+70];
04395 FILE *out;
04396
04397 if (selestre.st != sel_no)
04398 {
04399 for(i=0; i<Mm->max_ncompstre; i++)
04400 {
04401 for (j=0; j<selestre.n; j++)
04402 {
04403 if ((selstre[j].st == sel_mtx) || (selstre[j].st == sel_range_mtx) ||
04404 (selstre[j].st == sel_range_vec) || (selstre[j].st == sel_vec))
04405 continue;
04406 if (selstre[j].presence_id(i))
04407 {
04408 sprintf(fname, "%s.elem_sig%ld.res", outfn, i+1);
04409 out = fopen(fname, mode);
04410 if (out == NULL)
04411 {
04412 print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname);
04413 abort();
04414 }
04415 fseek(out, 0, SEEK_END);
04416 if (ftell(out) == 0)
04417 {
04418 fprintf(out, "GiD Post Results File 1.0\n");
04419 export_gid_gauss_pt(out, ide1);
04420 }
04421 else
04422 write_gid_elemscalar(out, stress, lcid, i, desclcid);
04423 fclose(out);
04424 break;
04425 }
04426 }
04427 }
04428 }
04429 }
04430
04431
04432
04433
04434
04435
04436
04437
04438
04439
04440
04441
04442
04443
04444
04445
04446 void elemoutgm::print_gr_oth_scal(const char *outfn, const char *mode, long lcid, const char *desclcid)
04447 {
04448 long i, j;
04449 char fname[FNAMELEN+70];
04450 FILE *out;
04451
04452 if (seleoth.st != sel_no)
04453 {
04454 for(i=0; i<Mm->max_encompo; i++)
04455 {
04456 for (j=0; j<seleoth.n; j++)
04457 {
04458 if ((seloth[j].st == sel_mtx) || (seloth[j].st == sel_range_mtx) ||
04459 (seloth[j].st == sel_range_vec) || (seloth[j].st == sel_vec))
04460 continue;
04461 if (seloth[j].presence_id(i))
04462 {
04463 sprintf(fname, "%s.elem_other%ld.res", outfn, i+1);
04464 out = fopen(fname, mode);
04465 if (out == NULL)
04466 {
04467 print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname);
04468 abort();
04469 }
04470 fseek(out, 0, SEEK_END);
04471 if (ftell(out) == 0)
04472 {
04473 fprintf(out, "GiD Post Results File 1.0\n");
04474 export_gid_gauss_pt(out, ide1);
04475 }
04476 else
04477 write_gid_elemscalar(out, other, lcid, i, desclcid);
04478 fclose(out);
04479 break;
04480 }
04481 }
04482 }
04483 }
04484 }
04485
04486
04487
04488
04489
04490
04491
04492
04493
04494
04495
04496
04497
04498
04499
04500
04501 void elemoutgm::print_gr_stra_vec(const char *outfn, const char *mode, long lcid, const char *desclcid)
04502 {
04503 long j, id1, n;
04504 char fname[FNAMELEN+70];
04505 FILE *out;
04506
04507 if (selestra.st != sel_no)
04508 {
04509 for (j=0; j<selestra.n; j++)
04510 {
04511 if (selstra[j].st != sel_range_vec)
04512 continue;
04513 id1 = selstra[j].id1[0];
04514 n = selstra[j].ncomp[0];
04515 if (id1+n-1 < Mm->max_ncompstre)
04516 {
04517 sprintf(fname, "%s.elem_eps_v%ld-%ld_s%ld.res", outfn, id1+1, n, j+1);
04518 out = fopen(fname, mode);
04519 if (out == NULL)
04520 {
04521 print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname);
04522 abort();
04523 }
04524 fseek(out, 0, SEEK_END);
04525 if (ftell(out) == 0)
04526 {
04527 fprintf(out, "GiD Post Results File 1.0\n");
04528 export_gid_gauss_pt(out, ide1);
04529 }
04530 else
04531 write_gid_elemvector(out, strain, lcid, j, desclcid);
04532 fclose(out);
04533 }
04534 else
04535 {
04536 print_err("required index of strain vector exceeds limits\n"
04537 " selected range is id1=%ld, n=%ld, max ncompst=%ld\n",
04538 __FILE__, __LINE__, __func__, id1, n, Mm->max_ncompstre);
04539 abort();
04540 }
04541 }
04542 }
04543 }
04544
04545
04546
04547
04548
04549
04550
04551
04552
04553
04554
04555
04556
04557
04558
04559
04560 void elemoutgm::print_gr_stre_vec(const char *outfn, const char *mode, long lcid, const char *desclcid)
04561 {
04562 long j, id1, n;
04563 char fname[FNAMELEN+70];
04564 FILE *out;
04565
04566 if (selestre.st != sel_no)
04567 {
04568 for (j=0; j<selestre.n; j++)
04569 {
04570 if (selstre[j].st != sel_range_vec)
04571 continue;
04572 id1 = selstre[j].id1[0];
04573 n = selstre[j].ncomp[0];
04574 if (id1+n-1 < Mm->max_ncompstre)
04575 {
04576 sprintf(fname, "%s.elem_sig_v%ld-%ld_s%ld.res", outfn, id1+1, n, j+1);
04577 out = fopen(fname, mode);
04578 if (out == NULL)
04579 {
04580 print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname);
04581 abort();
04582 }
04583 fseek(out, 0, SEEK_END);
04584 if (ftell(out) == 0)
04585 {
04586 fprintf(out, "GiD Post Results File 1.0\n");
04587 export_gid_gauss_pt(out, ide1);
04588 }
04589 else
04590 write_gid_elemvector(out, stress, lcid, j, desclcid);
04591 fclose(out);
04592 }
04593 else
04594 {
04595 print_err("required index of stress vector exceeds limits\n"
04596 " selected range is id1=%ld, n=%ld, max ncompst=%ld\n",
04597 __FILE__, __LINE__, __func__, id1, n, Mm->max_ncompstre);
04598 abort();
04599 }
04600 }
04601 }
04602 }
04603
04604
04605
04606
04607
04608
04609
04610
04611
04612
04613
04614
04615
04616
04617
04618
04619 void elemoutgm::print_gr_oth_vec(const char *outfn, const char *mode, long lcid, const char *desclcid)
04620 {
04621 long id1, n, j;
04622 char fname[FNAMELEN+70];
04623 FILE *out;
04624
04625 if (seleoth.st != sel_no)
04626 {
04627 for (j=0; j<seleoth.n; j++)
04628 {
04629 if (seloth[j].st != sel_range_vec)
04630 continue;
04631 id1 = seloth[j].id1[0];
04632 n = seloth[j].ncomp[0];
04633 if (id1+n-1 < Mm->max_encompo)
04634 {
04635 sprintf(fname, "%s.elem_other_v%ld-%ld_s%ld.res", outfn, id1+1, n, j+1);
04636 out = fopen(fname, mode);
04637 if (out == NULL)
04638 {
04639 print_err("cannot open graphics file '%s'",__FILE__, __LINE__, __func__, fname);
04640 abort();
04641 }
04642 fseek(out, 0, SEEK_END);
04643 if (ftell(out) == 0)
04644 {
04645 fprintf(out, "GiD Post Results File 1.0\n");
04646 export_gid_gauss_pt(out, ide1);
04647 }
04648 else
04649 write_gid_elemvector(out, other, lcid, j, desclcid);
04650 fclose(out);
04651 }
04652 else
04653 {
04654 print_err("required index of other values vector exceeds limits\n"
04655 " selected range is id1=%ld, n=%ld, max encompo=%ld\n",
04656 __FILE__, __LINE__, __func__, id1, n, Mm->max_encompo);
04657 abort();
04658 }
04659 }
04660 }
04661 }
04662
04663
04664
04665
04666
04667
04668
04669
04670
04671
04672
04673
04674
04675
04676
04677
04678 void elemoutgm::print_gr_stra_mtx(const char *outfn, const char *mode, long lcid, const char *desclcid)
04679 {
04680 long j;
04681 char fname[FNAMELEN+70];
04682 FILE *out;
04683
04684 if (selestra.st != sel_no)
04685 {
04686 for (j=0; j<selestra.n; j++)
04687 {
04688 if ((selstra[j].st != sel_mtx) && (selstra[j].st != sel_range_mtx))
04689 continue;
04690 if (selstra[j].st == sel_range_mtx)
04691 {
04692 print_err("sel_range_mtx selection type of a strain tensor is required, use sel_mtx(%d)\n",
04693 __FILE__, __LINE__, __func__, sel_mtx);
04694 abort();
04695 }
04696 sprintf(fname, "%s.elem_eps_m_s%ld.res", outfn, j+1);
04697 out = fopen(fname, mode);
04698 if (out == NULL)
04699 {
04700 print_err("cannot open graphics file '%s'",__FILE__, __LINE__, __func__, fname);
04701 abort();
04702 }
04703 fseek(out, 0, SEEK_END);
04704 if (ftell(out) == 0)
04705 {
04706 fprintf(out, "GiD Post Results File 1.0\n");
04707 export_gid_gauss_pt(out, ide1);
04708 }
04709 else
04710 write_gid_elemtensor(out, strain, lcid, j, desclcid);
04711 fclose(out);
04712 }
04713 }
04714 }
04715
04716
04717
04718
04719
04720
04721
04722
04723
04724
04725
04726
04727
04728
04729
04730
04731 void elemoutgm::print_gr_stre_mtx(const char *outfn, const char *mode, long lcid, const char *desclcid)
04732 {
04733 long j;
04734 char fname[FNAMELEN+70];
04735 FILE *out;
04736
04737 if (selestre.st != sel_no)
04738 {
04739 for (j=0; j<selestre.n; j++)
04740 {
04741 if ((selstre[j].st != sel_mtx) && (selstre[j].st != sel_range_mtx))
04742 continue;
04743 if (selstre[j].st == sel_range_mtx)
04744 {
04745 print_err("sel_range_mtx selection type of a stress tensor is not supported, use sel_mtx(%d)\n",
04746 __FILE__, __LINE__, __func__, sel_mtx);
04747 abort();
04748 }
04749 sprintf(fname, "%s.elem_sig_m_s%ld.res", outfn, j+1);
04750 out = fopen(fname, mode);
04751 if (out == NULL)
04752 {
04753 print_err("cannot open graphics file '%s'",__FILE__, __LINE__, __func__, fname);
04754 abort();
04755 }
04756 fseek(out, 0, SEEK_END);
04757 if (ftell(out) == 0)
04758 {
04759 fprintf(out, "GiD Post Results File 1.0\n");
04760 export_gid_gauss_pt(out, ide1);
04761 }
04762 else
04763 write_gid_elemtensor(out, stress, lcid, j, desclcid);
04764 fclose(out);
04765 }
04766 }
04767 }
04768
04769
04770
04771
04772
04773
04774
04775
04776
04777
04778
04779
04780
04781
04782
04783
04784 void elemoutgm::print_gr_oth_mtx(const char *outfn, const char *mode, long lcid, const char *desclcid)
04785 {
04786 long j, id1, n;
04787 char fname[FNAMELEN+70];
04788 FILE *out;
04789
04790 if (seleoth.st != sel_no)
04791 {
04792 for (j=0; j<seleoth.n; j++)
04793 {
04794 if ((seloth[j].st != sel_mtx) && (seloth[j].st != sel_range_mtx))
04795 continue;
04796 if (seloth[j].st == sel_mtx)
04797 {
04798 print_err("sel_mtx selection type of an other values tensor is not supported, use sel_range_mtx(%d)",
04799 __FILE__, __LINE__, __func__, sel_range_mtx);
04800 abort();
04801 }
04802 id1 = seloth[j].id1[0];
04803 n = seloth[j].ncomp[0];
04804 if (id1+n-1 < Mm->max_encompo)
04805 {
04806 sprintf(fname, "%s.elem_other_m%ld-%ld_s%ld.res", outfn, id1+1, n, j+1);
04807 out = fopen(fname, mode);
04808 if (out == NULL)
04809 {
04810 print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname);
04811 abort();
04812 }
04813 fseek(out, 0, SEEK_END);
04814 if (ftell(out) == 0)
04815 {
04816 fprintf(out, "GiD Post Results File 1.0\n");
04817 export_gid_gauss_pt(out, ide1);
04818 }
04819 else
04820 write_gid_elemtensor(out, other, lcid, j, desclcid);
04821 fclose(out);
04822 }
04823 else
04824 {
04825 print_err("required index of other values tensor exceeds limits\n"
04826 " selected range is id1=%ld, n=%ld, max encompo=%ld\n",
04827 __FILE__, __LINE__, __func__, id1, n, Mm->max_encompo);
04828 abort();
04829 }
04830 }
04831 }
04832 }
04833
04834
04835
04836
04837
04838
04839
04840
04841
04842
04843
04844
04845
04846
04847 void elemoutgm::conv_sel_prop(siftop *top)
04848 {
04849 if (selestra.st == sel_prop)
04850 selestra.conv_selprop(top, gnod);
04851
04852 if (selestre.st == sel_prop)
04853 selestre.conv_selprop(top, gnod);
04854
04855 if (seleoth.st == sel_prop)
04856 seleoth.conv_selprop(top, gnod);
04857 }
04858
04859
04860
04861
04862
04863
04864
04865
04866 pointoutm::pointoutm()
04867 {
04868 npnt = 0;
04869 ksi = eta = zeta = NULL;
04870 selpnt = selstra = selstre = seloth = NULL;
04871 transtra = transtre = NULL;
04872 }
04873
04874
04875
04876
04877
04878
04879
04880
04881 pointoutm::~pointoutm()
04882 {
04883 delete [] ksi;
04884 delete [] eta;
04885 delete [] zeta;
04886 delete [] selpnt;
04887 delete [] selstra;
04888 delete [] selstre;
04889 delete [] seloth;
04890 delete [] transtra;
04891 delete [] transtre;
04892 }
04893
04894
04895
04896
04897
04898
04899
04900
04901
04902
04903
04904
04905
04906
04907
04908
04909 long pointoutm::read(XFILE *in)
04910 {
04911 long i;
04912
04913 xfscanf(in, "%k", "sel_pointstep");
04914 dstep.read(in);
04915 if (dstep.st == sel_no)
04916 return 0;
04917 if (xfscanf(in, "%k%ld", "numpoints", &npnt) != 2)
04918 {
04919 print_err("cannot read number of points", __FILE__, __LINE__, __func__);
04920 return 1;
04921 }
04922 if (npnt == 0)
04923 return 0;
04924
04925 ksi = new double [npnt];
04926 eta = new double [npnt];
04927 zeta = new double [npnt];
04928 memset(ksi, 0, sizeof(*ksi)*npnt);
04929 memset(eta, 0, sizeof(*eta)*npnt);
04930 memset(zeta, 0, sizeof(*zeta)*npnt);
04931 for (i=0; i<npnt; i++)
04932 {
04933 if (xfscanf(in, "%k %le %k %le %k %le", "ksi", ksi+i, "eta", eta+i, "zeta", zeta+i) != 6)
04934 {
04935 print_err("cannot read coordinates of UDP", __FILE__, __LINE__, __func__);
04936 return 2;
04937 }
04938 }
04939
04940 selelem.read(in);
04941 switch(selelem.st)
04942 {
04943 case sel_no:
04944 return 0;
04945 case sel_all:
04946 case sel_range:
04947 case sel_list:
04948 selpnt = new sel[selelem.n];
04949 for (i=0; i<selelem.n; i++)
04950 selpnt[i].read(in);
04951 break;
04952 default:
04953 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
04954 return 3;
04955 }
04956
04957 sellc.read(in);
04958 if (sellc.st == sel_no)
04959 return 0;
04960
04961 selstra = new sel[npnt];
04962 selstre = new sel[npnt];
04963 seloth = new sel[npnt];
04964 transtra = new long[npnt];
04965 memset(transtra, 0, sizeof(transtra)*npnt);
04966 transtre = new long[npnt];
04967 memset(transtre, 0, sizeof(transtre)*npnt);
04968
04969 for (i=0; i<npnt; i++)
04970 {
04971
04972 selstra[i].read(in);
04973 if (xfscanf(in, "%k%ld", "transfid", transtra+i) != 2)
04974 {
04975 print_err("cannot read strain transformation id", __FILE__, __LINE__, __func__);
04976 return 4;
04977 }
04978
04979 selstre[i].read(in);
04980 if (xfscanf(in, "%k%ld", "transfid", transtre+i) != 2)
04981 {
04982 print_err("cannot read stress transformation id", __FILE__, __LINE__, __func__);
04983 return 4;
04984 }
04985
04986 seloth[i].read(in);
04987
04988
04989 if (selstra[i].st != sel_no)
04990 Mp->straincomp = 1;
04991 if (selstre[i].st != sel_no)
04992 Mp->stresscomp = 1;
04993
04994
04995 }
04996 return 0;
04997 }
04998
04999
05000
05001
05002
05003
05004
05005
05006
05007
05008
05009
05010 void pointoutm::print(FILE *out)
05011 {
05012 long i;
05013 dstep.print(out);
05014 if ((dstep.st == sel_no) || (npnt == 0))
05015 {
05016 fprintf(out, "\n");
05017 return;
05018 }
05019 fprintf(out, " %ld\n", npnt);
05020 if (npnt == 0)
05021 return;
05022
05023 for (i=0; i<npnt; i++)
05024 fprintf(out, "%e %e %e\n", ksi[i], eta[i], zeta[i]);
05025
05026
05027 selelem.print(out);
05028 switch(selelem.st)
05029 {
05030 case sel_no:
05031 return;
05032 case sel_all:
05033 case sel_range:
05034 case sel_list:
05035 for (i=0; i<selelem.n; i++)
05036 selpnt[i].print(out);
05037 break;
05038 default:
05039 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
05040 return;
05041 }
05042
05043 sellc.print(out);
05044 if (sellc.st == sel_no)
05045 return;
05046
05047 for (i=0; i<npnt; i++)
05048 {
05049
05050 selstra[i].print(out);
05051 fprintf(out, "%ld\n", transtra[i]);
05052
05053 selstre[i].print(out);
05054 fprintf(out, "%ld\n", transtre[i]);
05055
05056 seloth[i].print(out);
05057 }
05058 }
05059
05060
05061
05062
05063
05064
05065
05066
05067
05068
05069
05070
05071
05072
05073 void pointoutm::print_out(FILE *out, long lcid)
05074 {
05075 long i;
05076
05077 for (i=0; i<npnt; i++)
05078 {
05079 if (selstra[i].st != sel_no)
05080 fprintf(out, "** UDP strains:\n\n");
05081 }
05082 print_stra(out, lcid);
05083
05084 for (i=0; i<npnt; i++)
05085 {
05086 if (selstre[i].st != sel_no)
05087 fprintf(out, "** UDP stresses:\n\n");
05088 }
05089 print_stre(out, lcid);
05090
05091 for (i=0; i<npnt; i++)
05092 {
05093 if (seloth[i].st != sel_no)
05094 fprintf(out, "** UDP other values:\n\n");
05095 print_other(out, i);
05096 }
05097 }
05098
05099
05100
05101
05102
05103
05104
05105
05106
05107
05108
05109
05110
05111
05112 void pointoutm::print_stra(FILE *out, long lcid)
05113 {
05114 long i,j,k,l,n, ncomp, id;
05115
05116 for (i=0; i<Mt->ne; i++)
05117 {
05118 if (selelem.presence_id(i))
05119 {
05120 fprintf(out, " Element %7ld:\n",i+1);
05121 ncomp = Mt->give_tncomp(i);
05122 id = lcid*ncomp;
05123 switch(selelem.st)
05124 {
05125 case sel_no:
05126 n=0;
05127 break;
05128 case sel_all:
05129 case sel_range:
05130 case sel_list:
05131 n=selelem.n;
05132 break;
05133 default:
05134 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
05135 return;
05136 }
05137 for (j=0; j<n; j++)
05138 {
05139 for (k=0; k<npnt; k++)
05140 {
05141 if (selpnt[j].presence_id(k))
05142 {
05143 fprintf(out, " point %ld:", k+1);
05144 for (l=0; l<ncomp; l++)
05145 {
05146 if(selstra[k].presence_id(l))
05147 fprintf(out, " eps_%ld=% *e", l+1, prstra, Mm->stra.ev[i][k][id+l]);
05148 }
05149 fprintf(out, "\n");
05150 }
05151 }
05152 }
05153 fprintf(out, "\n");
05154 }
05155 }
05156 }
05157
05158
05159
05160
05161
05162
05163
05164
05165
05166
05167
05168
05169
05170
05171
05172 void pointoutm::print_stre(FILE *out, long lcid)
05173 {
05174 long i,j,k,l,n, ncomp, id;
05175
05176 for (i=0; i<Mt->ne; i++)
05177 {
05178 if (selelem.presence_id(i))
05179 {
05180 fprintf(out, " Element %7ld:\n", i+1);
05181 ncomp = Mt->give_tncomp(i);
05182 id = lcid*ncomp;
05183 switch(selelem.st)
05184 {
05185 case sel_no:
05186 n=0;
05187 break;
05188 case sel_all:
05189 case sel_range:
05190 case sel_list:
05191 n=selelem.n;
05192 break;
05193 default:
05194 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
05195 return;
05196 }
05197 for (j=0; j<n; j++)
05198 {
05199 for (k=0; k<npnt; k++)
05200 {
05201 if (selpnt[j].presence_id(k))
05202 {
05203 fprintf(out, " point %ld:", k+1);
05204 for (l=0; l<ncomp; l++)
05205 {
05206 if(selstra[k].presence_id(l))
05207 fprintf(out, " sig_%ld=% *e", l+1, prstre, Mm->stre.ev[i][k][id+l]);
05208 }
05209 fprintf(out, "\n");
05210 }
05211 }
05212 }
05213 fprintf(out, "\n");
05214 }
05215 }
05216 }
05217
05218
05219
05220
05221
05222
05223
05224
05225
05226
05227
05228
05229
05230
05231 void pointoutm::print_other(FILE *out, long pid)
05232 {
05233 long i,j,k,l,n, ncomp;
05234
05235 for (i=0; i<Mt->ne; i++)
05236 {
05237 if (selelem.presence_id(i))
05238 {
05239
05240 ncomp = Mm->ip[Mt->elements[i].ipp[0][0]].ncompother;
05241 switch(selelem.st)
05242 {
05243 case sel_no:
05244 n=0;
05245 break;
05246 case sel_all:
05247 case sel_range:
05248 case sel_list:
05249 n=selelem.n;
05250 break;
05251 default:
05252 print_err("unknown type of selection is required", __FILE__, __LINE__, __func__);
05253 return;
05254 }
05255 for (j=0; j<n; j++)
05256 {
05257 for (k=0; k<npnt; k++)
05258 {
05259 if (selpnt[j].presence_id(k))
05260 {
05261
05262 for (l=0; l<ncomp; l++)
05263 {
05264
05265
05266 }
05267
05268 }
05269 }
05270 }
05271
05272 }
05273 }
05274 }
05275
05276
05277
05278
05279
05280
05281
05282
05283
05284
05285
05286
05287
05288
05289
05290 void outdriverm::print_default_vtk(FILE *fname, long lcid, long istep, double lambda){
05291 long int i,j,nn;
05292 int tr[20];
05293 fprintf(fname, "# vtk DataFile Version 1.0\n");
05294 fprintf(fname, "Time step %ld time %lf\n",istep,lambda);
05295 fprintf(fname, "ASCII\n\n");
05296 fprintf(fname, "DATASET UNSTRUCTURED_GRID\n");
05297 fprintf(fname, "POINTS %ld float\n", Mt->nn);
05298 for (i=0; i<Mt->nn; i++){
05299 fprintf(fname, "%e %e %e\n", Gtm->gnodes[i].x, Gtm->gnodes[i].y, Gtm->gnodes[i].z);
05300 }
05301
05302 long int ncells = 0;
05303 for (i=0; i < Mt->ne; i++){
05304 ncells += Mt->give_nne (i);
05305 }
05306 fprintf(fname, "\nCELLS %ld %ld\n", Mt->ne, ncells+Mt->ne);
05307 for (i=0; i < Mt->ne; i++){
05308 fprintf(fname, "%ld ", Mt->give_nne(i));
05309 for(j=0;j<Mt->give_nne(i);j++){
05310 switch(Mt->elements[i].te){
05311 case linearhex:
05312 tr[0] = 6; tr[1] = 7; tr[2] = 4; tr[3] = 5;
05313 tr[4] = 2; tr[5] = 3; tr[6] = 0; tr[7] = 1;
05314 nn=tr[j];
05315 case quadrhex:
05316 tr[0] = 6; tr[1] = 7; tr[2] = 4; tr[3] = 5;
05317 tr[4] = 2; tr[5] = 3; tr[6] = 0; tr[7] = 1;
05318 tr[8] = 18; tr[9] = 19; tr[10] = 16; tr[11] = 17;
05319 tr[12] = 10; tr[13] = 11; tr[14] = 8; tr[15] = 9;
05320 tr[16] = 14; tr[17] = 15; tr[18] = 12; tr[19] = 13;
05321 nn=tr[j];
05322 break;
05323 default:
05324 nn=j;
05325 break;
05326 }
05327 fprintf(fname, "%ld ", Gtm->gelements[i].nodes[nn]);
05328 }
05329 fprintf(fname, "\n");
05330 }
05331
05332
05333 fprintf(fname, "\nCELL_TYPES %ld\n", Mt->ne);
05334 for (i=0; i < Mt->ne; i++){
05335 switch(Mt->elements[i].te){
05336 case bar2d:
05337 case beam2d:
05338 case bar3d:
05339 case beam3d:
05340 fprintf(fname, "3\n");
05341 break;
05342 case barq2d:
05343 case barq3d:
05344 fprintf(fname, "21\n");
05345 break;
05346 case planeelementlt:
05347 case axisymmlt:
05348 fprintf(fname, "5\n");
05349 break;
05350 case planeelementlq:
05351 case axisymmlq:
05352 fprintf(fname, "9\n");
05353 break;
05354 case planeelementqq:
05355 case axisymmqq:
05356 fprintf(fname, "23\n");
05357 break;
05358 case lineartet:
05359 fprintf(fname, "10\n");
05360 break;
05361 case linearhex:
05362 fprintf(fname, "12\n");
05363 break;
05364 case quadrhex:
05365 fprintf(fname, "25\n");
05366 break;
05367 default:
05368 print_err("unknown element type in VTK export", __FILE__, __LINE__, __func__);
05369 abort();
05370 break;
05371 }
05372 }
05373 }
05374
05375
05376
05377
05378
05379
05380
05381
05382
05383
05384
05385
05386
05387
05388
05389 void outdriverm::write_vtk_unkn(FILE *fname, long lcid, const char *desclcid){
05390 double *r;
05391 long i, j, k, ncomp;
05392 fprintf(fname, "\nPOINT_DATA %ld\n", Mt->nn);
05393
05394 if (nog.selndisp.st != sel_no){
05395 fprintf(fname, "VECTORS Nodal_displacements float\n");
05396 r = new double[3];
05397 for (i=0; i<Mt->nn; i++){
05398 r[0]=r[1]=r[2]=0;
05399 noddispl (lcid, r, i);
05400 fprintf(fname, "%e %e %e\n", r[0], r[1], r[2]);
05401 }
05402 delete [] r;
05403 fprintf(fname, "\n");
05404 }
05405
05406 if (nog.selnstra.st != sel_no){
05407 fprintf(fname, "TENSORS Strain float\n");
05408 for (i=0; i<Mt->nn; i++){
05409 ncomp = Mt->nodes[i].ncompstr;
05410 vector eps(4);
05411 matrix epst(3,3);
05412 fillv(0.0, eps);
05413 fillm(0.0, epst);
05414 for (j=0; j<ncomp; j++)
05415 eps[j] = Mt->nodes[i].strain[j];
05416 switch (ncomp){
05417 case 1:{
05418 vector_tensor (eps, epst, bar, strain);
05419 break;
05420 }
05421 case 4:{
05422 vector_tensor (eps, epst, planestrain, strain);
05423 break;
05424 }
05425 case 6:{
05426 vector_tensor (eps, epst, spacestress, strain);
05427 }
05428 }
05429 for (k=0; k<3; k++){
05430 fprintf(fname, "%e %e %e\n", epst[k][0], epst[k][1], epst[k][2]);
05431 }
05432 fprintf(fname, "\n");
05433 }
05434 }
05435
05436 if (nog.selnstre.st != sel_no){
05437 fprintf(fname, "TENSORS Stress float\n");
05438 for (i=0; i<Mt->nn; i++){
05439 ncomp = Mt->nodes[i].ncompstr;
05440 vector sig(4);
05441 matrix sigt(3,3);
05442 fillv(0.0, sig);
05443 fillm(0.0, sigt);
05444 for (j=0; j<ncomp; j++)
05445 sig[j] = Mt->nodes[i].stress[j];
05446 switch (ncomp){
05447 case 1:{
05448 vector_tensor (sig, sigt, bar, stress);
05449 break;
05450 }
05451 case 4:{
05452 vector_tensor (sig, sigt, planestrain, stress);
05453 break;
05454 }
05455 case 6:{
05456 vector_tensor (sig, sigt, spacestress, stress);
05457 }
05458 }
05459 for (k=0; k<3; k++){
05460 fprintf(fname, "%e %e %e\n", sigt[k][0], sigt[k][1], sigt[k][2]);
05461 }
05462 fprintf(fname, "\n");
05463 }
05464 }
05465
05466 if (nog.selnoth.st != sel_no){
05467
05468
05469
05470
05471
05472
05473
05474
05475
05476
05477
05478
05479
05480
05481
05482
05483
05484
05485
05486
05487
05488
05489
05490
05491
05492
05493
05494 }
05495
05496 }