📄 output.cpp
字号:
{ if(Lel[j]->nlc == nlc+1) nle++; } } } } nle += search_loadedg_el(nprope, nlc); nle += search_loadsurf_el(nprope, nlc); // writing overall number of element loads entries fprintf(out, "%ld\n", nle*nl); for (i = 0; i < Top->elements; i++) { for (n = 0; n < nl; n++) { for (j = 0; j < nprope; j++) { if (Top->E[i].property == Nep[j]) { if (Lel[j]) { if (Lel[j]->nlc == nlc+1) { // writing element number fprintf(out, "%6ld", nl*i+n+1); // writing load type fprintf(out, " %d", (int)volume); for (k = 0; k < Top->E[i].size; k++) { for (l = 0; l < Lel[j]->ndl; l++) // loop for writing values of load in single directions fprintf(out, " %e", Lel[j]->nodval[k*Lel[j]->ndl+l]); } fprintf(out, "\n"); } } } } } } wr_loadeledg(out, nprope, nlc); wr_loadelsurf(out, nprope, nlc); fprintf(out, "\n"); return(0);}/** Function computes number of elements with loaded edges @param nprop - number of entries in the input property file @param nlc - number of loading case which will be written @retval number of elements with a loaded edge */long search_loadedg_el(long nprop, long nlc){ long i, j, k; long nl = 0; long *elel; elel = new long[Top->elements]; memset(elel, 0, sizeof(*elel)*Top->elements); for (i = 0; i < nprop; i++) { if (Edgl[i]) { if (Edgl[i]->nlc == nlc+1) { for (j = 0; j < Top->elements; j++) { for (k = 0; k < Top->E[j].ned; k++) { if (Top->E[j].propedg[k] == Nep[i]) { if (elel[j] == 0) nl++; elel[j] = 1; break; } } } } } } delete [] elel; return (nl);}/** Function writes element edge load to the text file given by out @param out - pointer to the opened text file, where the data will be written @param nprop - number of entries in the input property file @param nlc - number of loading case which will be written @retval 0 : on succes*/long wr_loadeledg(FILE *out, long nprop, long nlc){ long i, j, k, l, ll, n, nl, id; long ned, napfun, nned; long *enod = NULL; double *nodvals = NULL; double *nv; snode *tn; nl = Nlay; if (nl == 0) nl = 1; for (i = 0; i < Top->elements; i++) { ned = Mt->give_ned(i); nned = Mt->give_nned(i); napfun = Mt->give_napfun(i); for (j = 0; j < nprop; j++) { if (Edgl[j]) { if (Edgl[j]->nlc == nlc+1) { for (k = 0; k < ned; k++) { enod = new long[nned]; if (Top->E[i].propedg[k] == Nep[j]) { if (nodvals == NULL) { nodvals = new double [ned*nned*napfun]; memset(nodvals, 0, sizeof(*nodvals)*ned*nned*napfun); } Mt->give_edge_nodes(i, k, enod); nv = new double[napfun]; for (l = 0; l < nned; l++) { memset(nv, 0, sizeof(*nv)*napfun); tn = &Top->N[enod[l]-1]; Edgl[j]->getval(tn, nv); id = k*nned*napfun + l*napfun; for (ll = 0; ll < napfun; ll++) nodvals[id+ll] = nv[ll];// memcpy(nodvals+id, nv, sizeof(*nv)*napfun); } delete [] nv; } delete [] enod; } } } } if (nodvals) { for (n = 0; n < nl; n++) { id = 0; fprintf(out, "%ld", nl*i+n+1); fprintf(out, " %d", (int)edge); for (j = 0; j < ned; j++) { fprintf(out, " 1"); for (k = 0; k < nned; k++) { for (l = 0; l < napfun; l++) { fprintf(out, " %e", nodvals[id]); id++; } } fprintf(out, "\n"); } } delete [] nodvals; nodvals = NULL; } } fprintf(out, "\n"); return (0);}/** Function computes number of elements with loaded surfaces @param nprop - number of entries in the input property file @param nlc - number of loading case which will be written @retval number of elements with a loaded surface*/long search_loadsurf_el(long nprop, long nlc){ long i, j, k; long nl = 0; long *slel; slel = new long[Top->elements]; memset(slel, 0, sizeof(*slel)*Top->elements); for (i = 0; i < nprop; i++) { if (Surfl[i]) { if (Surfl[i]->nlc == nlc+1) { for (j = 0; j < Top->elements; j++) { for (k = 0; k < Mt->give_nsurf(j); k++) { if (Top->E[j].propsurf[k] == Nep[i]) { if (slel[j] == 0) nl++; slel[j] = 1; break; } } } } } } for (i = 0; i < nprop; i++) { if (Elsurfl[i]) { if (Elsurfl[i]->nlc == nlc+1) { for (j = 0; j < Top->elements; j++) { for (k = 0; k < Mt->give_nsurf(j); k++) { if (Top->E[j].property == Nep[i]) { if (slel[j] == 0) nl++; slel[j] = 1; break; } } } } } } delete [] slel; return (nl);}/** Function writes element surface load to the text file given by out @param out - pointer to the opened text file, where the data will be written @param nprop - number of entries in the input property file @param nlc - number of loading case which will be written @retval 0 : on succes*/long wr_loadelsurf(FILE *out, long nprop, long nlc){ long i, j, k, l, n; long wel; for (i = 0; i < Top->elements; i++) { for (j = 0; j < nprop; j++) { wel = 0; if (Surfl[j]) { if (Surfl[j]->nlc == nlc+1) { for (k=0; k<Mt->give_nsurf(i); k++) { if ((Top->E[i].propsurf[k] == Nep[j]) && Surfl[j]) { wel += 1; break; } } } } if (Elsurfl[j]) { if (Elsurfl[j]->nlc == nlc+1) { for (k=0; k<Mt->give_nsurf(i); k++) { if ((Top->E[i].property == Nep[j]) && Elsurfl[j]) { wel += 1; break; } } } } if (wel == 0) continue; if (wel == 2) { fflush(stderr); fprintf(stderr, "\n\n Unsupported combination of surface load and element surface load\n"); fprintf(stderr, " in function wr_loadelsurf (file : %s, line : %d)\n", __FILE__, __LINE__); abort(); } // writing element id fprintf(out, "%ld", i+1); // writing load type fprintf(out, " %d\n", (int)surface); for (k=0; k<Mt->give_nsurf(i); k++) { if (Surfl[j]) { if (Top->E[i].propsurf[k] == Nep[j]) { fprintf(out, "%ld", Surfl[j]->lgcs); if (Surfl[j]->lgcs) { for (l = 0; l < Mt->give_nnsurf(i); l++) { for (n = 0; n < Surfl[j]->ndir; n++) fprintf(out, " %e", Surfl[j]->f[n]); } } fprintf(out, "\n"); } else fprintf(out, "0\n"); } if (Elsurfl[j]) { if (Top->E[i].property == Nep[j]) { fprintf(out, "%ld", Elsurfl[j]->lgcs[k]); if (Elsurfl[j]->lgcs[k]) { for (l = 0; l < Mt->give_nnsurf(i); l++) { for (n = 0; n < Elsurfl[j]->ndir; n++) fprintf(out, " %e", Elsurfl[j]->f[k*Elsurfl[j]->ndir+n]); } } fprintf(out, "\n"); } else fprintf(out, "0\n"); } } } } return (0);}long wr_dloadel(FILE *out, long nprop, long nlc)/* NOT IMPLEMENTED YET Function writes section with description of dynamic element load to the text file given by out @param out - pointer to the opened text file, where the data will be written @param nprop - number of entries in the input property file @param nlc - number of loading case which will be written @retval 0 : on succes*/{/* long i, j, k, l, nle; for (i = 0, nle = 0; i < Top->elements; i++) // countig overall number of element loads { for (j = 0; j < nprop; j++) { if (Top->E[i].property == Nep[j]) { if ((Lel[j]) && (Lel[j]->nlc == nlc+1)) nle++; } } } // writing overall number of element loads entries fprintf(out, "%ld\n", nle); for (i = 0; i < Top->elements; i++) { for (j = 0; j < nprop; j++) { if (Top->E[i].property == Nep[j]) { if ((Lel[j]) && (Lel[j]->nlc == nlc+1)) { // writing element number fprintf(out, "%6ld", i+1); for (k = 0; k < Top->E[i].size; k++) { for (l = 0; l < Lel[j]->ndl; l++) // loop for writing values of load in single directions fprintf(out, " %e", Lel[j]->f[k*Lel[j]->ndl+l]); } fprintf(out, "\n"); } } } } fprintf(out, "\n");*/ return(0);}/** Function writes section with description of nodal prescribed displacement load to the text file given by out. @param out - pointer to the opened text file, where the data will be written @param nprop - number of entries in the input property file @param nlc - number of loading case which will be written @retval 0 : on succes*/long wr_prescdisp(FILE *out, long nprop, long nlc){ long i, j, n; fprintf(out, "%ld\n", Nspd); if (Nspd == 0) return(0); for (n = 0; n < Nspd; n++) { for (i = 0; i < nprop; i++) // loop over all properties from input { if (Boc[i]) // test if any boundary condition is prescribed { for (j = 0; j < Boc[i]->ndir; j++) // loop for writing bc // if direction has bc, write p.d. number and value { if (Boccn[i][j] != n+1) continue; if ((Boc[i]->dir[j] >= 0) && (Boc[i]->con[j] != 0.0)) fprintf(out, " %e\n", Boc[i]->con[j]); } } } } fprintf(out, "\n"); return(0);}/** Function writes section with description of dynamic nodal prescribed displacement load to the text file given by out. @param out - pointer to the opened text file, where the data will be written @param nprop - number of entries in the input property file @param nlc - number of loading case which will be written @retval 0 : on succes*/long wr_dprescdisp(FILE *out, long nprop, long nlc){ long i, j, n; fprintf(out, "%ld\n", Ndpd); if (Ndpd == 0) return(0); for (n = 0; n < Ndpd; n++) { for (i = 0; i < nprop; i++) // loop over all properties from input { if (Boc[i]) // test if any boundary condition is prescribed { for (j = 0; j < Boc[i]->ndir; j++) // loop for writing bc // if direction has bc, write p.d. number and value { if (Boccn[i][j] != n+1) continue; if ((Boc[i]->dir[j] >= 0) && (Boc[i]->con[j] != 0.0) && (Boc[i]->expr[j] != NULL)) fprintf(out, " %e %s\n", Boc[i]->con[j], Boc[i]->expr[j]); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -