📄 auxdatout.cpp
字号:
#include "auxdatout.h"#include "global.h"#include "gtopology.h"#include "loadcase.h"#include "element.h"#include "intpoints.h"auxdatout::auxdatout (void){ nnoddispl=0; noddispl=NULL; nelemstra=0; elemstra=NULL; nelemstre=0; elemstre=NULL; nelemother=0; elemother=NULL; elemnseg=NULL; eleminit=NULL; elemfin=NULL;}auxdatout::~auxdatout (void){ delete [] noddispl; delete [] elemstra; delete [] elemstre; delete [] elemother; delete [] elemnseg; delete [] eleminit; delete [] elemfin;}/** function reads numbers of nodes and elements with prescribed print of displacements, strains, stresses and array other*/void auxdatout::read (FILE *in){ long i,j; // node displacements fscanf (in,"%ld",&nnoddispl); noddispl = new long [nnoddispl]; for (i=0;i<nnoddispl;i++){ fscanf (in,"%ld",noddispl+i); noddispl[i]--; } // element strains fscanf (in,"%ld",&nelemstra); elemstra = new long [nelemstra]; for (i=0;i<nelemstra;i++){ fscanf (in,"%ld",elemstra+i); elemstra[i]--; } // element stresses fscanf (in,"%ld",&nelemstre); elemstre = new long [nelemstre]; for (i=0;i<nelemstre;i++){ fscanf (in,"%ld",elemstre+i); elemstre[i]--; } // element other array fscanf (in,"%ld",&nelemother); elemother = new long [nelemother]; elemnseg = new long [nelemother]; eleminit = new long* [nelemother]; elemfin = new long* [nelemother]; for (i=0;i<nelemother;i++){ fscanf (in,"%ld %ld",elemother+i,elemnseg+i); elemother[i]--; eleminit[i] = new long [elemnseg[i]]; elemfin[i] = new long [elemnseg[i]]; for (j=0;j<elemnseg[i];j++){ fscanf (in,"%ld %ld",&eleminit[i][j],&elemfin[i][j]); eleminit[i][j]--; } } }/** function prints necessary data for preprocessor*/void auxdatout::printin (FILE *out){ long i,j; // node displacements fprintf (out,"\n%ld\n",nnoddispl); for (i=0;i<nnoddispl;i++){ fprintf (out,"%ld ",noddispl[i]+1); } // element strain fprintf (out,"\n%ld\n",nelemstra); for (i=0;i<nelemstra;i++){ fprintf (out,"%ld ",elemstra[i]+1); } // element stress fprintf (out,"\n%ld\n",nelemstre); for (i=0;i<nelemstre;i++){ fprintf (out,"%ld ",elemstre[i]+1); } // element other array fprintf (out,"\n%ld\n",nelemother); for (i=0;i<nelemother;i++){ fprintf (out,"%ld %ld ",elemother[i]+1,elemnseg[i]); for (j=0;j<elemnseg[i];j++){ fprintf (out,"%ld %ld ",eleminit[i][j]+1,elemfin[i][j]); } fprintf (out,"\n"); } }/** function prints auxiliary results during computation @param out - output stream @param step - number of step of iterative algorithm @param lambda - parameterof nonlinear solver @param lcid - load case id */void auxdatout::print (FILE *out,long step,double lambda,long lcid){ long i,j,k,l,m,ndofn,nip,nsip,ipp,ncomp; fprintf (out,"\n%ld %f\n",step,lambda); // displacements printing fprintf (out,"\n DISPLACEMENTS\n"); for (i=0;i<nnoddispl;i++){ fprintf (out,"%ld",noddispl[i]+1); ndofn=Mt->give_ndofn (noddispl[i]); for (j=0;j<ndofn;j++){ k=Mt->give_dof (noddispl[i],j); if (k>0) fprintf (out," %f",Lsrs->lhs[lcid*Ndofm+k-1]); if (k==0) fprintf (out," %f",0.0); if (k<0) fprintf (out," %f",Mb->lc[lcid].pd[0-k-1]); } fprintf (out,"\n"); } // strains printing fprintf (out,"\n\nSTRAINS\n"); for (i=0;i<nelemstra;i++){ fprintf (out,"%ld\n",elemstra[i]); nsip=Mt->give_nb (i); for (l=0;l<nsip;l++){ nip=Mt->give_nip (elemstra[i],l,l); ipp=Mt->elements[elemstra[i]].ipp[l][l]; for (j=0;j<nip;j++){ ncomp=Mm->ip[ipp].ncompstr; for (k=0;k<ncomp;k++){ fprintf (out," %20.10f",Mm->ip[ipp].strain[k]); } fprintf (out,"\n"); ipp++; } } } // stress printing fprintf (out,"\n\nSTRESSES\n"); for (i=0;i<nelemstre;i++){ fprintf (out,"%ld\n",elemstre[i]); nsip=Mt->give_nb (i); for (l=0;l<nsip;l++){ nip=Mt->give_nip (elemstre[i],l,l); ipp=Mt->elements[elemstre[i]].ipp[l][l]; for (j=0;j<nip;j++){ ncomp=Mm->ip[ipp].ncompstr; for (k=0;k<ncomp;k++){ fprintf (out," %20.10f",Mm->ip[ipp].stress[k]); } fprintf (out,"\n"); ipp++; } } } // other printing fprintf (out,"\n\nARRAY OTHER\n"); for (i=0;i<nelemother;i++){ fprintf (out,"%ld\n",elemother[i]); nsip=Mt->give_nb (i); for (m=0;m<nsip;m++){ nip=Mt->give_nip (elemother[i],m,m); ipp=Mt->elements[elemother[i]].ipp[m][m]; for (j=0;j<nip;j++){ for (k=0;k<elemnseg[i];k++){ for (l=eleminit[i][k];l<elemfin[i][k];l++){ fprintf (out," %20.10f",Mm->ip[ipp].other[l]); } fprintf (out," "); } fprintf (out,"\n"); ipp++; } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -