📄 outdriverm.cpp
字号:
} // stresses selestre.print(out); switch (selestre.st) { case sel_no: break; case sel_all: case sel_range: case sel_list: for(i=0; i<selestre.n; i++) selstre[i].print(out); for(i=0; i<selestre.n; i++) fprintf(out, "%ld ", transtre[i]); fprintf(out, "\n"); break; default: fprintf(stderr, "\n\nUnknown type of selection is required in function elemoutm::print\n"); fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__); return; } // other values seleoth.print(out); switch (seleoth.st) { case sel_no: break; case sel_all: case sel_range: case sel_list: for(i=0; i<seleoth.n; i++) seloth[i].print(out); break; default: fprintf(stderr, "\n\nUnknown type of selection is required in function elemoutm::print\n"); fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__); return; }}/** Function prints required output values for selected elements and for given load case and step to the output grahics file. @param out - pointer to the opened grahics file @param lcid - load case id @param desclcid - load case description @param gf - graphics format */void elemoutgm::print_graphics(FILE *out, long lcid, char *desclcid, graphfmt gf){ long i, j; if (gf == grfmt_open_dx) return; if (selestra.st != sel_no) { for(i=0; i<Mm->max_ncompstre; i++) { for (j=0; j<selestra.n; j++) { if (selstra[j].presence_id(i)) { if (gf == grfmt_gid) write_gid_elemscalar(out, strain, lcid, i, desclcid); if (gf == grfmt_femcad) write_elemscalar(out, strain, lcid, i, desclcid); break; } } } } if (selestre.st != sel_no) { for(i=0; i<Mm->max_ncompstre; i++) { for (j=0; j<selestre.n; j++) { if (selstre[j].presence_id(i)) { if (gf == grfmt_gid) write_gid_elemscalar(out, stress, lcid, i, desclcid); if (gf == grfmt_femcad) write_elemscalar(out, stress, lcid, i, desclcid); break; } } } } if (seleoth.st != sel_no) { for(i=0; i<Mm->max_encompo; i++) { for (j=0; j<seleoth.n; j++) { if (seloth[j].presence_id(i)) { if (gf == grfmt_gid) write_gid_elemscalar(out, other, lcid, i, desclcid); if (gf == grfmt_femcad) write_elemscalar(out, other, lcid, i, desclcid); break; } } } }}/** Function prints required output values for selected elements and for given load case and step to the several output grahics files named by printed quantity component. If the opening mode is "wt", than the output graphics files are only opened and header is printed, no data are written. @param outfn - string with file name part @param mode - opening mode for graphics files @param lcid - load case id @param desclcid - load case description @param gf - graphics format */void elemoutgm::print_graphics(char *outfn, char *mode, long lcid, char *desclcid, graphfmt gf){ long i, j, sl; char fname[FNAMELEN+70]; FILE *out; sl = strlen(outfn); if (gf != grfmt_gid_sep) { fprintf(stderr, "\nInvalid graphics format is required in function nodeoutm::print_graphics\n"); fprintf(stderr, "(file %s, line %d)", __FILE__, __LINE__); return; } if (selestra.st != sel_no) { for(i=0; i<Mm->max_ncompstre; i++) { for (j=0; j<selestra.n; j++) { if (selstra[j].presence_id(i)) { sprintf(fname, "%s.elem_eps%ld.flavia.res", outfn, i+1); out = fopen(fname, mode); if (out == NULL) { fprintf(stderr, "\n\nUnable to open graphics file '%s' in function nodeoutm::print_graphics\n", fname); fprintf(stderr, " (file %s, line %d)\n", __FILE__, __LINE__); abort(); } if (ftell(out) == 0) { fprintf(out, "GiD Post Results File 1.0\n"); export_gid_gauss_pt(out); } else write_gid_elemscalar(out, strain, lcid, i, desclcid); fclose(out); break; } } } } if (selestre.st != sel_no) { for(i=0; i<Mm->max_ncompstre; i++) { for (j=0; j<selestre.n; j++) { if (selstre[j].presence_id(i)) { sprintf(fname, "%s.elem_sig%ld.flavia.res", outfn, i+1); out = fopen(fname, mode); if (out == NULL) { fprintf(stderr, "\n\nUnable to open graphics file '%s' in function nodeoutm::print_graphics\n", fname); fprintf(stderr, " (file %s, line %d)\n", __FILE__, __LINE__); abort(); } if (ftell(out) == 0) { fprintf(out, "GiD Post Results File 1.0\n"); export_gid_gauss_pt(out); } else write_gid_elemscalar(out, stress, lcid, i, desclcid); fclose(out); break; } } } } if (seleoth.st != sel_no) { for(i=0; i<Mm->max_encompo; i++) { for (j=0; j<seleoth.n; j++) { if (seloth[j].presence_id(i)) { sprintf(fname, "%s.elem_other%ld.flavia.res", outfn, i+1); out = fopen(fname, mode); if (out == NULL) { fprintf(stderr, "\n\nUnable to open graphics file '%s' in function nodeoutm::print_graphics\n", fname); fprintf(stderr, " (file %s, line %d)\n", __FILE__, __LINE__); abort(); } if (ftell(out) == 0) { fprintf(out, "GiD Post Results File 1.0\n"); export_gid_gauss_pt(out); } else write_gid_elemscalar(out, other, lcid, i, desclcid); fclose(out); break; } } } }}/** Constructor initializes data to zero values*/pointoutm::pointoutm(){ npnt = 0; ksi = eta = zeta = NULL; selpnt = selstra = selstre = seloth = NULL; transtra = transtre = NULL; }/** Destructor deallocates used memory*/pointoutm::~pointoutm(){ delete [] ksi; delete [] eta; delete [] zeta; delete [] selpnt; delete [] selstra; delete [] selstre; delete [] seloth; delete [] transtra; delete [] transtre;}/** Function reads data with description for output of user defined point values from the text file. @param in - pointer to the opened text file @retval 0 - on success @retval 1 - error reading step or number of points @retval 2 - error reading natural coordinates @retval 3 - error reading sets of points on elements @retval 4 - error reading transformation id */long pointoutm::read(XFILE *in){ long i; // step and number of points dstep.read(in); if (dstep.st == sel_no) return 0; if (xfscanf(in, "%k%ld", "numpoints", &npnt) != 2) { fprintf(stderr, "\n\nError reading number of points\n"); fprintf(stderr, " in function pointoutm::read, (file %s, line %d)\n", __FILE__, __LINE__); return 1; } if (npnt == 0) return 0; ksi = new double [npnt]; eta = new double [npnt]; zeta = new double [npnt]; memset(ksi, 0, sizeof(*ksi)*npnt); memset(eta, 0, sizeof(*eta)*npnt); memset(zeta, 0, sizeof(*zeta)*npnt); for (i=0; i<npnt; i++) { if (xfscanf(in, "%k %le %k %le %k %le", "ksi", ksi+i, "eta", eta+i, "zeta", zeta+i) != 6) { fprintf(stderr, "\n\nError reading coordinates of UDP\n"); fprintf(stderr, " in function pointoutm::read, (file %s, line %d)\n", __FILE__, __LINE__); return 2; } } selelem.read(in); switch(selelem.st) { case sel_no: return 0; case sel_all: case sel_range: case sel_list: selpnt = new sel[selelem.n]; for (i=0; i<selelem.n; i++) selpnt[i].read(in); break; default: fprintf(stderr, "\n\nUnknown type of selection is required in function pointoutm::read\n"); fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__); return 3; } sellc.read(in); if (sellc.st == sel_no) return 0; selstra = new sel[npnt]; selstre = new sel[npnt]; seloth = new sel[npnt]; for (i=0; i<npnt; i++) { // strains selstra[i].read(in); if (xfscanf(in, "%k%ld", "transfid", transtra+i) != 2) { fprintf(stderr, "\n\nError reading strain transformation id\n"); fprintf(stderr, " in function pointoutm::read, (file %s, line %d)\n", __FILE__, __LINE__); return 4; } // stresses selstre[i].read(in); if (xfscanf(in, "%k%ld", "transfid", transtre+i) != 2) { fprintf(stderr, "\n\nError reading stress transformation id\n"); fprintf(stderr, " in function pointoutm::read, (file %s, line %d)\n", __FILE__, __LINE__); return 4; } // other values seloth[i].read(in); // setup of flags if (selstra[i].st != sel_no) Mp->straincomp = 1; if (selstre[i].st != sel_no) Mp->stresscomp = 1; if (seloth[i].st != sel_no) Mp->othercomp = 1; } return 0;}/** Function prints data with description for output of element values to the text file. @param out - pointer to the opened tetx file*/void pointoutm::print(FILE *out){ long i; dstep.print(out); if ((dstep.st == sel_no) || (npnt == 0)) { fprintf(out, "\n"); return; } fprintf(out, " %ld\n", npnt); if (npnt == 0) return; for (i=0; i<npnt; i++) fprintf(out, "%e %e %e\n", ksi[i], eta[i], zeta[i]); selelem.print(out); switch(selelem.st) { case sel_no: return; case sel_all: case sel_range: case sel_list: for (i=0; i<selelem.n; i++) selpnt[i].print(out); break; default: fprintf(stderr, "\n\nUnknown type of selection is required in function pointoutm::read\n"); fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__); return; } sellc.print(out); if (sellc.st == sel_no) return; for (i=0; i<npnt; i++) { // strains selstra[i].print(out); fprintf(out, "%ld\n", transtra[i]); // stresses selstre[i].print(out); fprintf(out, "%ld\n", transtre[i]); // other values seloth[i].print(out); }}/** Function prints required output values for user defined point and for given load case to the output text file. @param out - pointer to the opened text file @param lcid - load case id */void pointoutm::print_out(FILE *out, long lcid){ long i; for (i=0; i<npnt; i++) { if (selstra[i].st != sel_no) fprintf(out, "** UDP strains :\n\n"); } print_stra(out, lcid); for (i=0; i<npnt; i++) { if (selstre[i].st != sel_no) fprintf(out, "** UDP stresses :\n\n"); } print_stre(out, lcid); for (i=0; i<npnt; i++) { if (seloth[i].st != sel_no) fprintf(out, "** UDP other values :\n\n"); print_other(out, i); }}/** Function prints required strains for user defined point and for given load case to the output text file. @param out - pointer to the opened text file @param lcid - load case id */void pointoutm::print_stra(FILE *out, long lcid){ long i,j,k,l,n, ncomp, id; for (i=0; i<Mt->ne; i++) { if (selelem.presence_id(i)) { fprintf(out, " Element %7ld:\n",i+1); ncomp = Mt->give_ncomp(i); id = lcid*ncomp; switch(selelem.st) { case sel_no: n=0; break; case sel_all: case sel_range: case sel_list: n=selelem.n; break; default: fprintf(stderr, "\n\nUnknown type of selection is required in function pointoutm::print_stra\n"); fprintf(stderr, " (file %s, line %d)", __FILE__, __LINE__); return; } for (j=0; j<n; j++) { for (k=0; k<npnt; k++) { if (selpnt[j].presence_id(k)) { fprintf(out, " point %ld:", k+1); for (l=0; l<ncomp; l++) { if(selstra[k].presence_id(l)) fprintf(out, " eps_%ld=% *e", l+1, prstra, Mm->stra.ev[i][k][id+l]); } fprintf(out, "\n"); } } } fprintf(out, "\n"); } } }/** Function prints required stresses for user defined point and for given load case to the output text file. @param out - pointer to the opened text file @param lcid - load case id @param pid - user defined point id */void pointoutm::print_stre(FILE *out, long lcid){ long i,j,k,l,n, ncomp, id; for (i=0; i<Mt->ne; i++) { if (selelem.presence_id
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -