00001 #include "globprept.h"
00002 #include "outputt.h"
00003 #include "elementt.h"
00004 #include <string.h>
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 long outputt(FILE *out, descript *d)
00021 {
00022
00023 long err;
00024
00025 fprintf(stdout, "\nProblem model output :\n");
00026 Dbmatt->renumber_id();
00027 Dbcrst->renumber_id();
00028 fprintf(stdout, " writing nodes . . .");
00029 err = wr_nodest(out);
00030 fflush(out);
00031 if (err)
00032 return(7);
00033 fprintf(stdout, " O.K.\n");
00034
00035 fprintf(stdout, " writing boundary conditions . . .");
00036 err = wr_bocont(out);
00037 fflush(out);
00038 if (err)
00039 return(7);
00040 fprintf(stdout, " O.K.\n");
00041
00042 fprintf(stdout, " writing elements . . .");
00043 err = wr_elementst(out, d);
00044 fflush(out);
00045 if (err)
00046 return(7);
00047 fprintf(stdout, " O.K.\n");
00048
00049 if (d->paral)
00050 {
00051 fprintf(stdout, " writing global node numbers . . .");
00052 err = wr_globnodnumt(out);
00053 fflush(out);
00054 if (err)
00055 return(7);
00056 fprintf(stdout, " O.K.\n");
00057 }
00058
00059 fprintf(stdout, " writing materials . . .");
00060 err = wr_materialst(out, d);
00061 fflush(out);
00062 if (err)
00063 return(7);
00064 fprintf(stdout, " O.K.\n");
00065
00066 fprintf(stdout, " writing cross-sections . . .");
00067 err = wr_crsecst(out, d);
00068 fflush(out);
00069 if (err)
00070 return(7);
00071 fprintf(stdout, " O.K.\n");
00072
00073 fprintf(stdout, " writing load cases . . .");
00074 err = wr_loadcaset(out);
00075 fflush(out);
00076 if (err)
00077 return(7);
00078 fprintf(stdout, " O.K.\n");
00079
00080 fprintf(stdout, " writing initial conditions . . .");
00081 err = wr_initcondt(out);
00082 fflush(out);
00083 if (err)
00084 return(7);
00085 fprintf(stdout, " O.K.\n");
00086
00087 long i, j;
00088 bocont *bc;
00089 sourcet *src;
00090 bnodvalt *bnv;
00091 climatcond *cc;
00092 climatcond2 *cc2;
00093 char *ccf;
00094 answertype *trcc;
00095 long ndof = Tp->ntm;
00096
00097
00098 for (i=0; i<Top->nn; i++)
00099 {
00100 delete [] Nod_bocon[i];
00101 delete [] Nod_ccn[i];
00102 delete [] Nod_inicd[i];
00103 if (Nod_sourcet)
00104 delete [] Nod_sourcet[i];
00105 }
00106 delete [] Nod_bocon;
00107 delete [] Nod_ccn;
00108 delete [] Nod_cst;
00109 delete [] Nod_csti;
00110 delete [] Nod_cstdbi;
00111 delete [] Nod_inicd;
00112 if (Nod_sourcet)
00113 delete [] Nod_sourcet;
00114
00115 for(i=0; i < Nod_bclst.count(); i++)
00116 {
00117 bc = (bocont *)(Nod_bclst.at(i));
00118 delete bc;
00119 }
00120 for(i=0; i < Nod_srclst.count(); i++)
00121 {
00122 src = (sourcet *)(Nod_srclst.at(i));
00123 delete src;
00124 }
00125
00126
00127 for (i=0; i<Top->ne; i++)
00128 {
00129 delete [] El_mattype[i];
00130 delete [] El_matid[i];
00131 delete [] El_matdbi[i];
00132 if (El_sourcet)
00133 delete [] El_sourcet[i];
00134
00135 for (j=0; j<ndof; j++)
00136 delete El_loadt[i][j];
00137
00138 delete [] El_loadt[i];
00139 delete [] El_loadtln[i];
00140 delete [] El_loadtcol[i];
00141 }
00142 delete [] El_type;
00143 delete [] El_nmat;
00144 delete [] El_mattype;
00145 delete [] El_matid;
00146 delete [] El_matdbi;
00147 delete [] El_cst;
00148 delete [] El_csti;
00149 delete [] El_cstdbi;
00150 delete [] El_sourcet;
00151 if (El_loadt)
00152 {
00153 delete [] El_loadt;
00154 delete [] El_loadtln;
00155 delete [] El_loadtcol;
00156
00157 for (i=0; i<ndof; i++)
00158 {
00159 for(j=0; j < El_nv_lst[i].count(); j++)
00160 {
00161 bnv = (bnodvalt *)(El_nv_lst[i].at(j));
00162 delete bnv;
00163 }
00164
00165 for(j=0; j < El_trc_lst[i].count(); j++)
00166 {
00167 bnv = (bnodvalt *)(El_trc_lst[i].at(j));
00168 delete bnv;
00169 }
00170
00171 for(j=0; j < El_trr_lst[i].count(); j++)
00172 {
00173 bnv = (bnodvalt *)(El_trr_lst[i].at(j));
00174 delete bnv;
00175 }
00176
00177 for(j=0; j < El_trcc_lst[i].count(); j++)
00178 {
00179 trcc = (answertype *)(El_trcc_lst[i].at(j));
00180 delete trcc;
00181 }
00182 for(j=0; j < El_cc_lst[i].count(); j++)
00183 {
00184 cc = (climatcond *)(El_cc_lst[i].at(j));
00185 delete cc;
00186 }
00187 for(j=0; j < El_ccf_lst[i].count(); j++)
00188 {
00189 ccf = (char *)(El_ccf_lst[i].at(j));
00190 delete ccf;
00191 }
00192 for(j=0; j < El_gtrcc_lst[i].count(); j++)
00193 {
00194 trcc = (answertype *)(El_gtrcc_lst[i].at(j));
00195 delete trcc;
00196 }
00197 for(j=0; j < El_gcc_lst[i].count(); j++)
00198 {
00199 cc2 = (climatcond2 *)(El_gcc_lst[i].at(j));
00200 delete cc2;
00201 }
00202 for(j=0; j < El_gccf_lst[i].count(); j++)
00203 {
00204 ccf = (char *)(El_gccf_lst[i].at(j));
00205 delete ccf;
00206 }
00207 }
00208 delete [] El_nv_lst;
00209 delete [] El_trc_lst;
00210 delete [] El_trr_lst;
00211 delete [] El_trcc_lst;
00212 delete [] El_cc_lst;
00213 delete [] El_ccf_lst;
00214 delete [] El_gtrcc_lst;
00215 delete [] El_gcc_lst;
00216 delete [] El_gccf_lst;
00217 }
00218 delete [] El_tfunc;
00219
00220 for(i=0; i < El_srclst.count(); i++)
00221 {
00222 src = (sourcet *)(El_srclst.at(i));
00223 delete src;
00224 }
00225
00226
00227 if (Dbmatt) delete Dbmatt;
00228 if (Dbcrst) delete Dbcrst;
00229 if (Tft) delete [] Tft;
00230
00231 return (0);
00232 }
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248 long wr_nodest(FILE *out)
00249 {
00250 long i, ndofn;
00251
00252 ndofn = Tp->ntm;
00253 fprintf(out, "# sections of nodes\n");
00254
00255 fprintf(out, "%ld\n", Top->nn);
00256 for (i = 0; i < Top->nn; i++)
00257 {
00258
00259 fprintf(out, "%6ld % .10e % .10e % .10e", i+1, Top->nodes[i].x, Top->nodes[i].y, Top->nodes[i].z);
00260 fprintf(out, " %ld %d", ndofn, Nod_cst[i]);
00261 if (Nod_cst[i])
00262 fprintf(out, " %ld\n", Dbcrst->crs[Nod_cstdbi[i]].ridx[Nod_csti[i]-1]);
00263 else
00264 fprintf(out, "\n");
00265 }
00266 fprintf(out, "\n");
00267 return(0);
00268 }
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283 long wr_bocont(FILE *out)
00284 {
00285 long i, k, nbc, ndof;
00286 char emsg[200];
00287
00288 nbc = 0;
00289 ndof = Tp->ntm;
00290
00291 fprintf(out, "# boundary conditions at nodes\n");
00292 for (i = 0; i < Top->nn; i++)
00293 {
00294 if (Nod_bocon[i])
00295
00296 nbc++;
00297 if (Nod_ccn[i])
00298
00299 nbc++;
00300
00301 }
00302 fprintf(out, "%ld\n", nbc);
00303 for (i = 0; i < Top->nn; i++)
00304 {
00305 if ((Nod_bocon[i]) || (Nod_ccn[i]))
00306
00307 {
00308 fprintf(out, "%ld", i+1);
00309 for (k = 0; k < ndof; k++)
00310 {
00311
00312 if (Nod_bocon[i] && Nod_ccn[i])
00313 {
00314 if ((Nod_bocon[i][k]) && (Nod_ccn[i][k]))
00315 {
00316 sprintf(emsg, "node %ld has prescribed boundary condition and common code number\n"
00317 " for the same loadcase\n.", i+1);
00318 print_err(emsg, __FILE__, __LINE__, __func__);
00319 return(1);
00320 }
00321 if ((Nod_bocon[i][k] == 0) && (Nod_ccn[i][k] == 0))
00322
00323 {
00324 fprintf(out, " 1");
00325 continue;
00326 }
00327 }
00328 if (Nod_bocon[i])
00329 {
00330 if (Nod_bocon[i][k] == 0)
00331
00332 {
00333 fprintf(out, " 1");
00334 continue;
00335 }
00336 else
00337
00338 {
00339 fprintf(out, " %ld", -Nod_bocon[i][k]);
00340 continue;
00341 }
00342 }
00343 if (Nod_ccn[i])
00344
00345 {
00346 if (Nod_ccn[i][k])
00347 {
00348 fprintf(out, " %ld", Nod_ccn[i][k]);
00349 continue;
00350 }
00351 else
00352 {
00353 if ((Tp->tprob == growing_np_problem) || (Tp->tprob == growing_np_problem_nonlin))
00354 fprintf(out, " 0");
00355 else
00356 fprintf(out, " 1");
00357 continue;
00358 }
00359 }
00360 }
00361 fprintf(out, "\n");
00362 }
00363 }
00364 fprintf(out, "\n");
00365 return(0);
00366 }
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382 long wr_elementst(FILE *out, descript *d)
00383 {
00384 long i, j, k;
00385 char emsg[200];
00386 elemtypet et;
00387
00388
00389 fprintf(out, "# section of elements\n");
00390 fprintf(out, "%ld\n", Top->ne);
00391 for (i = 0; i < Top->ne; i++)
00392 {
00393 if (((Tp->tprob == growing_np_problem) || (Tp->tprob == growing_np_problem_nonlin))
00394 && (El_tfunc[i] == 0))
00395 {
00396 sprintf(emsg, "element number %ld has not assigned a time function", i+1);
00397 print_err(emsg, __FILE__, __LINE__, __func__);
00398 return(2);
00399 }
00400
00401
00402 et = El_type[i];
00403 fprintf(out, "%6ld %3d", i+1, et);
00404
00405
00406 for (j = 0; j < Top->elements[i].nne; j++)
00407 {
00408
00409
00410
00411
00412 fprintf(out, " %6ld", Top->elements[i].nodes[j]+1);
00413 }
00414
00415
00416
00417
00418
00419
00420
00421 fprintf(out, " 0");
00422
00423
00424 if ((Tp->tprob == growing_np_problem) || (Tp->tprob == growing_np_problem_nonlin))
00425 fprintf(out, " %ld", El_tfunc[i]);
00426
00427 fprintf(out, " %d", El_cst[i]);
00428 if (El_cst[i] > 0)
00429 fprintf(out, " %ld", Dbcrst->crs[El_cstdbi[i]].ridx[El_csti[i]-1]);
00430
00431 for (k = 0; k < El_nmat[i]; k++)
00432 fprintf(out, " %d %ld", El_mattype[i][k], Dbmatt->mat[El_matdbi[i][k]].ridx[El_matid[i][k]-1]);
00433 fprintf(out, "\n");
00434 }
00435 return(0);
00436 }
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449 long wr_globnodnumt(FILE *out)
00450 {
00451 fprintf(out, "# definition of global node numbers\n");
00452 for (long i = 0; i < Top->nn; i++)
00453 fprintf(out, "%ld\n", Top->gnn[i]);
00454 return(0);
00455 }
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469 long wr_materialst(FILE *out, descript *d)
00470 {
00471 long i, j, wrt;
00472
00473 fprintf(out, "# definition of materials\n");
00474 fprintf(out, "%ld\n", Dbmatt->nmatu);
00475 for (i = 0; i < Dbmatt->numt; i++)
00476 {
00477 wrt = 1;
00478 for (j = 0; j < Dbmatt->mat[i].ninst; j++)
00479 {
00480 if (Dbmatt->mat[i].instu[j])
00481 {
00482 if (wrt)
00483 {
00484 fprintf(out, "%d %ld\n", Dbmatt->mat[i].type, Dbmatt->mat[i].ninstu);
00485 wrt = 0;
00486 }
00487 if (d->matstr == yes)
00488
00489 fprintf(out, "%ld %s\n", Dbmatt->mat[i].ridx[j], Dbmatt->mat[i].inst[j]);
00490 else
00491 {
00492
00493 fprintf(out, "%ld ", Dbmatt->mat[i].ridx[j]);
00494 Tm->printmatchar(out, Dbmatt->mat[i].type, j);
00495 fprintf(out, "\n");
00496 }
00497 }
00498 }
00499 }
00500 fprintf(out, "\n");
00501 return(0);
00502 }
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516 long wr_crsecst(FILE *out, descript *d)
00517 {
00518 long i, j, wrt;
00519
00520 fprintf(out, "# definition of cross-sections\n");
00521 fprintf(out, "%ld\n", Dbcrst->ncrsu);
00522 for (i = 0; i < Dbcrst->numt; i++)
00523 {
00524 wrt = 1;
00525 for (j = 0; j < Dbcrst->crs[i].ninst; j++)
00526 {
00527 if (Dbcrst->crs[i].instu[j])
00528 {
00529 if (wrt)
00530 {
00531 fprintf(out, "%d %ld\n", Dbcrst->crs[i].type, Dbcrst->crs[i].ninstu);
00532 wrt = 0;
00533 }
00534 if (d->crsstr == yes)
00535
00536 fprintf(out, "%ld %s\n", Dbcrst->crs[i].ridx[j], Dbcrst->crs[i].inst[j]);
00537 else
00538 {
00539
00540 fprintf(out, "%ld ", Dbcrst->crs[i].ridx[j]);
00541 Tc->printcrschar(out, Dbcrst->crs[i].type, j);
00542 fprintf(out, "\n");
00543 }
00544 }
00545 }
00546 }
00547 fprintf(out, "\n");
00548 return(0);
00549 }
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563 long wr_loadcaset(FILE *out)
00564 {
00565 long i, err;
00566
00567 fprintf(out, "# section with load ceses\n");
00568 fprintf(out, "%ld\n\n", Tp->ntm);
00569
00570 for (i = 0; i < Tp->ntm; i++)
00571 {
00572 fprintf(out, "#\n# loadcase number %ld\n#\n", i+1);
00573 switch (Tp->tprob)
00574 {
00575 case stationary_problem:
00576 case nonlinear_stationary_problem:
00577 wr_prescquant(out);
00578 wr_sources(out, i);
00579 wr_loadelt(out, i);
00580 fflush(out);
00581 break;
00582 case nonstationary_problem:
00583 case growing_np_problem:
00584 case nonlinear_nonstationary_problem:
00585 case growing_np_problem_nonlin:
00586 wr_prescquant(out);
00587 wr_sources(out, i);
00588 wr_loadelt(out, i);
00589 fflush(out);
00590 break;
00591 case discont_nonstat_problem:
00592 case discont_nonlin_nonstat_problem:
00593 case hermes:
00594 wr_prescquant(out);
00595 wr_sources(out, i);
00596 wr_loadelt(out, i);
00597 fflush(out);
00598 break;
00599 default:
00600 print_err("unknown problem type is required",__FILE__,__LINE__,__func__);
00601 }
00602 err = wr_climatcond(out, i);
00603 if (err)
00604 return 1;
00605 err = wr_climatcond2(out, i);
00606 if (err)
00607 return 1;
00608
00609 fprintf (out,"# scaling time functions\n");
00610 fprintf (out,"0 \n");
00611 }
00612
00613 return(0);
00614 }
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629 long wr_prescquant(FILE *out)
00630 {
00631 long i;
00632 long npq = Nod_bclst.count();
00633 bocont *bc;
00634
00635 fprintf(out, "# prescribed quantities\n");
00636 fprintf(out, "%ld\n", npq);
00637 if (npq == 0)
00638 return(0);
00639
00640 for (i = 0; i < npq; i++)
00641 {
00642 bc = (bocont*)(Nod_bclst.at(i));
00643 bc->print(out);
00644 }
00645 fprintf(out, "\n");
00646 return(0);
00647 }
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661 long wr_sources(FILE *out, long nlc)
00662 {
00663 long i, nsrc;
00664 sourcet *aux;
00665 long nns = Nod_srclst.count();
00666 long nes = El_srclst.count();
00667 long *nsl, *esl;
00668 long nuns, nues;
00669
00670 nsl = new long[nns];
00671 memset(nsl, 0, sizeof(*nsl)*nns);
00672 esl = new long[nes];
00673 memset(esl, 0, sizeof(*esl)*nes);
00674
00675
00676 nuns = 0;
00677 if (Nod_sourcet)
00678 {
00679 for (i = 0; i < Top->nn; i++)
00680 {
00681 if (Nod_sourcet[i])
00682 {
00683 if (Nod_sourcet[i][nlc])
00684 {
00685 nuns++;
00686 nsl[Nod_sourcet[i][nlc]-1] = 1;
00687 }
00688 }
00689 }
00690 }
00691
00692
00693 nues = 0;
00694 if (El_sourcet)
00695 {
00696 for (i = 0; i < Top->ne; i++)
00697 {
00698 if (El_sourcet[i])
00699 {
00700 if (El_sourcet[i][nlc])
00701 {
00702 nues++;
00703 esl[El_sourcet[i][nlc]-1] = 1;
00704 }
00705 }
00706 }
00707 }
00708
00709
00710 nsrc = nuns + nues;
00711
00712 fprintf(out, "# list of sources\n");
00713 fprintf(out, "%ld\n\n", nsrc);
00714 if (nsrc)
00715 {
00716 fprintf(out, "# list of sources for nodes\n");
00717 for (i = 0; i < Nod_srclst.count(); i++)
00718 {
00719 aux = (sourcet*)(Nod_srclst.at(i));
00720
00721 if (nsl[i])
00722 aux->print(out);
00723 }
00724 fprintf(out, "# list of sources for elements\n");
00725 for (i = 0; i < El_srclst.count(); i++)
00726 {
00727 aux = (sourcet*)(El_srclst.at(i));
00728
00729 if (esl[i])
00730 aux->print(out);
00731 }
00732
00733 fprintf(out, "# sources at nodes\n");
00734 fprintf(out, "%ld\n", nuns);
00735 if (nuns)
00736 {
00737 for (i = 0; i < Top->nn; i++)
00738 {
00739 if (Nod_sourcet[i])
00740 fprintf(out, "%ld %ld\n", i+1, Nod_sourcet[i][nlc]);
00741 }
00742 }
00743
00744 fprintf(out, "# sources at elements\n");
00745 fprintf(out, "%ld\n", nues);
00746 if (nues)
00747 {
00748 for (i = 0; i < Top->ne; i++)
00749 {
00750 if (El_sourcet[i])
00751 fprintf(out, "%ld %ld\n", i+1, El_sourcet[i][nlc]);
00752 }
00753 }
00754 }
00755
00756 fprintf(out, "\n");
00757
00758 delete [] nsl;
00759 delete [] esl;
00760
00761 return(0);
00762 }
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776 long wr_loadelt(FILE *out, long nlc)
00777 {
00778 long nnv, ntrc, ntrr;
00779 bnodvalt *tmp;
00780 fprintf(out, "# load of elements\n");
00781 long i, nle;
00782
00783 nnv = El_nv_lst[nlc].count();
00784 ntrc = El_trc_lst[nlc].count();
00785 ntrr = El_trr_lst[nlc].count();
00786
00787 for (i = 0, nle = 0; i < Top->ne; i++)
00788 {
00789 if (El_loadt[i])
00790 {
00791 if(El_loadt[i][nlc])
00792 {
00793 nle++;
00794
00795
00796
00797 El_loadt[i][nlc]->renumber_id(nnv, ntrc);
00798 }
00799 }
00800 }
00801
00802
00803 fprintf(out, "%ld\n", nle);
00804 for (i = 0; i < Top->ne; i++)
00805 {
00806 if (El_loadt[i])
00807 {
00808 if (El_loadt[i][nlc])
00809 {
00810
00811 El_loadt[i][nlc]->print(out, nlc);
00812 }
00813 }
00814 }
00815 fprintf(out, "\n");
00816
00817 fprintf(out, "# list of nodal values\n");
00818 fprintf(out, "%ld\n", nnv+ntrc+ntrr);
00819 fprintf(out, "# list of general nodal values (%ld obj.)\n", El_nv_lst[nlc].count());
00820 for (i=0; i<El_nv_lst[nlc].count(); i++)
00821 {
00822 tmp = (bnodvalt *)(El_nv_lst[nlc].at(i));
00823 tmp->print(out);
00824 }
00825
00826 fprintf(out, "# list of nodal values for transmission coefficients (%ld obj.)\n", El_trc_lst[nlc].count());
00827 for (i=0; i<El_trc_lst[nlc].count(); i++)
00828 {
00829 tmp = (bnodvalt *)(El_trc_lst[nlc].at(i));
00830 tmp->print(out);
00831 }
00832
00833 fprintf(out, "# list of nodal values for radiation coefficients (%ld obj.)\n", El_trr_lst[nlc].count());
00834 for (i=0; i<El_trr_lst[nlc].count(); i++)
00835 {
00836 tmp = (bnodvalt *)(El_trr_lst[nlc].at(i));
00837 tmp->print(out);
00838 }
00839
00840 return(0);
00841 }
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857 long wr_climatcond(FILE *out, long nlc)
00858 {
00859 long i, ncc;
00860 climatcond *cc;
00861 char *ccf;
00862 answertype trcc, aux;
00863 long trcc_id;
00864
00865
00866 ncc = El_trcc_lst[nlc].count();
00867 fprintf (out,"# climatic conditions (%ld obj.)\n", ncc);
00868 fprintf (out, "%ld", ncc);
00869
00870 if (ncc == 0)
00871 {
00872 fprintf(out, "\n");
00873 return 0;
00874 }
00875
00876
00877
00878 trcc = *((answertype *)El_trcc_lst[nlc].at(0));
00879 if (trcc == no)
00880 {
00881 trcc_id = 1;
00882 fprintf (out, " %ld\n", trcc_id);
00883 }
00884 else
00885 {
00886 trcc_id = 2;
00887 fprintf (out, " %ld\n", trcc_id);
00888 }
00889 for(i=0; i<El_trcc_lst[nlc].count(); i++)
00890 {
00891 aux = *((answertype *)El_trcc_lst[nlc].at(i));
00892 if (trcc != aux)
00893
00894 {
00895 print_err("type %ld of climatcond object %ld does not correspond to the original one %ld\n"
00896 "(TRFEL cannot still handle mixed types)", __FILE__, __LINE__, __func__, trcc_id, i+1, aux);
00897 return 1;
00898 }
00899 fprintf(out, "\n%ld", i+1);
00900 cc = (climatcond *)El_cc_lst[nlc].at(i);
00901 ccf = (char*)El_ccf_lst[nlc].at(i);
00902 if ((cc == NULL) && (ccf == NULL))
00903
00904 {
00905 print_err("no climatcond object nor file name for climatcond was specified\n"
00906 "for the climatcond id %ld (error is in the inputt.cpp source code)", __FILE__, __LINE__, __func__, i+1);
00907 return 2;
00908 }
00909 if (cc)
00910 {
00911 fprintf(out, "\n");
00912 cc->print(out);
00913 }
00914 else
00915 fprintf(out, " %s\n", ccf);
00916 }
00917 return 0;
00918 }
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934 long wr_climatcond2(FILE *out, long nlc)
00935 {
00936 long i, ncc;
00937 climatcond2 *cc;
00938 char *ccf;
00939 answertype trcc, aux;
00940 long trcc_id;
00941
00942
00943 ncc = El_gtrcc_lst[nlc].count();
00944 fprintf (out,"# general climatic conditions (%ld obj.)\n", ncc);
00945 fprintf (out, "%ld", ncc);
00946
00947 if (ncc == 0)
00948 {
00949 fprintf(out, "\n");
00950 return 0;
00951 }
00952
00953
00954
00955 trcc = *((answertype *)El_gtrcc_lst[nlc].at(0));
00956 if (trcc == no)
00957 {
00958 trcc_id = 1;
00959 fprintf (out, " %ld\n", trcc_id);
00960 }
00961 else
00962 {
00963 trcc_id = 2;
00964 fprintf (out, " %ld\n", trcc_id);
00965 }
00966 for(i=0; i<El_gtrcc_lst[nlc].count(); i++)
00967 {
00968 aux = *((answertype *)El_gtrcc_lst[nlc].at(i));
00969 if (trcc != aux)
00970
00971 {
00972 print_err("type %ld of climatcond2 object %ld does not correspond to the original one %ld\n"
00973 "(TRFEL cannot still handle mixed types)", __FILE__, __LINE__, __func__, trcc_id, i+1, aux);
00974 return 1;
00975 }
00976 fprintf(out, "\n%ld", i+1);
00977 cc = (climatcond2 *)El_gcc_lst[nlc].at(i);
00978 ccf = (char*)El_gccf_lst[nlc].at(i);
00979 if ((cc == NULL) && (ccf == NULL))
00980
00981 {
00982 print_err("no climatcond2 object nor file name for climatcond was specified\n"
00983 "for the climatcond2 id %ld (error is in the inputt.cpp source code)", __FILE__, __LINE__, __func__, i+1);
00984 return 2;
00985 }
00986 if (cc)
00987 cc->print(out);
00988 else
00989 fprintf(out, "%s\n", ccf);
00990 }
00991 return 0;
00992 }
00993
00994
00995
00996
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006 long wr_initcondt(FILE *out)
01007 {
01008 long i, j;
01009
01010 fprintf(out, "# initial conditions\n");
01011 if (Nod_inicd[0])
01012 {
01013 for (i = 0; i < Top->nn; i++)
01014 {
01015
01016 fprintf(out, "%6ld", i+1);
01017 for (j=0; j<Tp->ntm; j++)
01018 fprintf(out, " %le", Nod_inicd[i][j]);
01019 fprintf(out, "\n");
01020 }
01021 fprintf(out, "\n");
01022 }
01023 return(0);
01024 }