📄 output1.cpp
字号:
for (j = 0; j < Dbcrs->crs[i].nprop; j++) { if (Dbcrs->crs[i].propu[j]) // cs type index is used (<> 0) { if (wrt) // for the first time write cs type number and number of used indeces { fprintf(out, "%d %ld\n", Dbcrs->crs[i].type, Dbcrs->crs[i].npropu); wrt = 0; // next time don't write } // write cs type index and property string fprintf(out, "%ld %s\n", Dbcrs->crs[i].ridx[j], Dbcrs->crs[i].prop[j]); } } } fprintf(out, "\n"); return(0);}/** Function writes section with description of load to the text file given by out @param out - pointer to the opened text file, where the data will be written @param npropn - number of entries in the nodal section of property file @param nprope - number of entries in the element section of property file @retval 0 : on success*/long wr_load(FILE *out, long npropn, long nprope){ long tnlc; if ((Mp->tprob == nonlinear_statics) || (Mp->tprob == forced_dynamics)) { fprintf(out, "%ld\n\n\n", Nlc/2); // writing number of load cases tnlc = Nlc/2; } else { fprintf(out, "%ld\n\n\n", Nlc); // writing number of load cases tnlc = Nlc; } for (long i = 0; i < tnlc; i++) { wr_loadn(out, npropn, i); // writing nodal load wr_loadel(out, nprope, npropn, i); // writing element load wr_prescdisp(out, npropn, i); // writing prescribed displacements fprintf(out, "\n"); if (Mp->tprob == forced_dynamics) { wr_dloadn(out, npropn, i+1); // writing dynamic nodal load wr_dloadel(out, nprope, i+1); // writing dynamic element load wr_dprescdisp(out, npropn, i+1); // writing dynamic prescribed displacements wr_initcond(out, npropn, i+1); // writing initial conditions fprintf(out, "\n"); fflush(out); } } return(0);}/* Function writes section with description of dynamic load to the text file given by out @param out - pointer to the opened text file, where the data will be written @param npropn - number of entries in the nodal section of property file @param nprope - number of entries in the element section of property file @retval 0 : on success*//*long wr_dload(FILE *out, long npropn, long nprope){ for (long i = 0; i < Nlc; i++) { wr_dloadn(out, npropn, i); // writing dynamic nodal load wr_dloadel(out, nprope, i); // writing dynamic element load wr_dprescdisp(out, npropn, i); // writing dynamic prescribed displacements if (Mp->tprob == forced_dynamics) wr_initcond(out, npropn, i); // writing initial conditions fprintf(out, "\n"); } return(0);}*//** Function writes section with description of nodal 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_loadn(FILE *out, long nprop, long nlc){ long i, j, k, nln; for (i = 0, nln = 0; i < Top->nodes; i++) // countig overall number of nodal loads { for (j = 0; j < nprop; j++) { if (Top->N[i].property == Nnp[j]) { if ((Lno[j]) && (Lno[j]->nlc == nlc+1)) nln++; } } } fprintf(out, "%ld\n", nln); // writing overall number of nodal loading entries for (i = 0; i < Top->nodes; i++) { for (j = 0; j < nprop; j++) { if (Top->N[i].property == Nnp[j]) { if ((Lno[j]) && (Lno[j]->nlc == nlc+1)) { // writing node number fprintf(out, "%6ld", i+1); for (k = 0; k < Tndofn[i]; k++) // loop for writing values of load in single directions fprintf(out, " %e", Lno[j]->f[k]); fprintf(out, "\n"); } } } } fprintf(out, "\n"); return(0);}/** Function writes section with description of dynamic nodal 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_dloadn(FILE *out, long nprop, long nlc){ long i, j, k, nln; for (i = 0, nln = 0; i < Top->nodes; i++) // countig overall number of nodal loads { for (j = 0; j < nprop; j++) { if (Top->N[i].property == Nnp[j]) { if ((Dlno[j]) && (Dlno[j]->nlc == nlc+1)) nln++; } } } fprintf(out, "%ld\n", nln); // writing overall number of nodal loading entries for (i = 0; i < Top->nodes; i++) { for (j = 0; j < nprop; j++) { if (Top->N[i].property == Nnp[j]) { if ((Dlno[j]) && (Dlno[j]->nlc == nlc+1)) { // writing node number fprintf(out, "%6ld 1", i+1); for (k = 0; k < Tndofn[i]; k++) // loop for writing values of load in single directions { fprintf(out, "%6c %e", ' ', Dlno[j]->f[k]); fprintf(out, "%6c %s\n", ' ', Dlno[j]->func[k]); } fprintf(out, "\n"); } } } } fprintf(out, "\n"); return(0);}/** Function writes section with description of 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 wr_loadel(FILE *out, long nprope, long npropn, long nlc){ 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 < nprope; j++) { if (Top->E[i].property == Nep[j]) { if (Lel[j]) { if(Lel[j]->nlc == nlc+1) nle++; } } } } nle += search_loadedg_el(nprope, nlc); // writing overall number of element loads entries fprintf(out, "%ld\n", nle); for (i = 0; i < Top->elements; i++) { 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", i+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); fprintf(out, "\n"); return(0);}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);}long wr_loadeledg(FILE *out, long nprop, long nlc){ long i, j, k, l, ll, id; long ned, napfun, nned; long *enod = NULL; double *nodvals = NULL; double *nv; snode *tn; for (i = 0; i < Top->elements; i++) { ned = Mt->get_ned(i); nned = Mt->get_nned(i); napfun = Mt->get_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->get_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) { id = 0; fprintf(out, "%ld", i+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, " %le", nodvals[id]); id++; } } fprintf(out, "\n"); } delete [] nodvals; nodvals = NULL; } } fprintf(out, "\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; fprintf(out, "%ld\n", Nspd); if (Nspd == 0) return(0); 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 ((Boc[i]->dir[j] >= 0) && (Boc[i]->con[j] != 0.0)) fprintf(out, " %ld %e\n", Boccn[i][j], 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; fprintf(out, "%ld\n", Ndpd); if (Ndpd == 0) return(0); 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 ((Boc[i]->dir[j] >= 0) && (Boc[i]->con[j] != 0.0) && (Boc[i]->expr[j] != NULL)) fprintf(out, " %ld %e %s\n", Boccn[i][j], Boc[i]->con[j], Boc[i]->expr[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_initcond(FILE *out, long nprop, long nlc){ long i, j, k; for (i = 0; i < Top->nodes; i++) { for (j = 0; j < nprop; j++) { if (Top->N[i].property == Nnp[j]) { if (Inic[j]) { if (Inic[j]->nlc == nlc+1) { // writing node number fprintf(out, "%6ld ", i+1); for (k = 0; k < Tndofn[i]; k++) // loop for writing values of initial conditions in single directions fprintf(out, "%e ", Inic[j]->con[k]); fprintf(out, "\n"); } } } } } fprintf(out, "\n"); return(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -