⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 probdesc.cpp

📁 Finite element program for mechanical problem. It can solve various problem in solid problem
💻 CPP
📖 第 1 页 / 共 2 页
字号:
      {        xfscanf (in, "%ld", &niep);        loadcoef = new double[niep];        memset(loadcoef, 0, niep*sizeof(*loadcoef));        for (i = 0; i < niep; i++)          xfscanf(in, "%le", loadcoef+i);		//  manager of solver of nonlinear equations	nlman.read (in,Mespr);		//  type of storage of stiffness matrix	//  type of stiffness matrix (initial, tangent)	xfscanf (in,"%d %d",(int*)&tstorsm,(int*)&stmat);	//  data about solver of system of linear equations	ssle.read (in,Mespr);	break;      }      default :        fprintf(stderr, "\n\nUknown type of earth pressure is required\n");        fprintf(stderr, " in function probdesc::read, (file %s, line %d)\n", __FILE__, __LINE__);    }    break;  }  // **********************************  //  LAYERED LINEAR STATICS PROBLEMS  // **********************************  case layered_linear_statics:{    if (Mespr==1)  fprintf (stdout,"\n linear layered static problem");        //  tstorsm - type of storage of stiffness matrix    xfscanf (in,"%d",(int*)&tstorsm);        //  data about solver of system of linear equations    ssle.read (in,Mespr);        break;  }      // *************************************  //  LINEAR FLOATING SUBDOMAIN PROBLEMS  // *************************************  case lin_floating_subdomain:{    if (Mespr==1)  fprintf (stdout,"\n linear floating subdomain problem");        //  tstorsm - type of storage of stiffness matrix    xfscanf (in,"%d",(int*)&tstorsm);        //  estimated number of rigid body motions (dimension of kernel of stiffness matrix)    xfscanf (in,"%d %le",&ense,&limit);        //  data about conjugate gradient method    ssle.read (in,Mespr);    break;  }  // *************************************  //  NONLINEAR FLOATING SUBDOMAIN PROBLEMS  // *************************************  case nonlin_floating_subdomain:{    if (Mespr==1)  fprintf (stdout,"\n nonlinear floating subdomain problem");        //  data about nonlinear solver    //nlman.read (in,Mespr);    //  type of storage of stiffness matrix    //  type of stiffness matrix (initial, tangent)    xfscanf (in,"%d %d",(int*)&tstorsm,(int*)&stmat);        //  estimated number of rigid body motions (dimension of kernel of stiffness matrix)    xfscanf (in,"%d %le %d",&ense,&limit,&nincr);        //  data about conjugate gradient method    ssle.read (in,Mespr);    break;  }    // *******************************    //  METHOD OF VARIABLE STIFFNESS    // *******************************  case var_stiff_method:{    if (Mespr==1)  fprintf (stdout,"\n variable stiffness problem");        //  tstorsm - type of storage of stiffness matrix    xfscanf (in,"%d",(int*)&tstorsm);        //  data about solver of system of linear equations    ssle.read (in,Mespr);        xfscanf (in,"%ld",&nivsm);    break;  }  case nonlinear_dynamics:{    if (Mespr==1)  fprintf (stdout,"\n problem of nonlinear dynamics");            break;  }      default:{    fprintf (stderr,"\n\n unknown problem type is required in function probdesc::read (file %s, line %d).\n",__FILE__,__LINE__);  }  }  }/**   function prints data for pre-processor   @param out - output stream*/void probdesc::print (FILE *out){  long i;  //  problem name  fprintf (out, "%s\n", name);  //  detail messages  fprintf (out, "%ld\n", Mespr);  //  problem type  fprintf (out, "%d\n", (int)tprob);    //  computation of strains  fprintf (out,"%ld ",straincomp);  if (straincomp==1)  fprintf (out,"%ld %ld ",strainpos,strainaver);    //  computation of stresses  fprintf (out,"%ld ",stresscomp);  if (stresscomp==1)  fprintf (out,"%ld %ld ",stresspos,stressaver);    //  computation of reactions  fprintf (out,"%ld\n",reactcomp);    //  adaptivity computation  fprintf (out,"%ld ",adaptivity);  if (adaptivity>0){        switch (tprob){    case linear_statics:{    fprintf (out," %ld %f %f",adaptflag,adapt_accuracy,corr);          break; }    case mat_nonlinear_statics:{ fprintf (out," %ld %f %f %f %f %f",adaptflag,adapt_accuracy,corr,limf,clos,plra);  break; }    default:{      fprintf (stderr,"\n\n unknown problem type is required in function probdesc::read (file %s, line %d).\n",__FILE__,__LINE__);    }    }  }  fprintf (out,"\n");    //  stochastic or fuzzy computation  fprintf (out,"%ld\n",stochasticcalc);    //  homogenization procedures  fprintf (out,"%ld\n",homog);    //  renumbering of the nodes  fprintf (out,"%d\n",Gtm->nodren);      switch (tprob){    // *****************    //  LINEAR STATICS    // *****************  case linear_statics:{        //  tstorsm - type of storage of stiffness matrix    //  tlinsol - type of solver of linear equation system    //fprintf (out, "%d %d\n", (int)tstorsm, (int)tlinsol);    fprintf (out, "%d\n", (int)tstorsm);        ssle.print (out);    //print_linsoltype (out);        fprintf(out, "\n");    break;  }        // *********************************************************************************    //  EIGENDYNAMICS - EIGENVALUES AND EIGENVECTORS (EIGENFREQUENCIES AND EIGENMODES)    // *********************************************************************************  case eigen_dynamics:{    fprintf (out, "%d %d\n", (int)tstorsm, (int)tstormm);        //  data about solver of eigenvalues and eigenvectors    eigsol.print (out);    //  data about solver of system of linear equations    ssle.print (out);        break;  }    // ******************    //  FORCED DYNAMICS    // ******************  case forced_dynamics:    {      fprintf (out,"%d\n",(int)tforvib);            switch (tforvib){      case newmark:{        fprintf (out, "%f %f",alphafvn, deltafvn);        break;      }      case findiff:{        break;      }      default:{        fprintf (stderr,"\n\n unknown solver of forced vibration is required");        fprintf (stderr,"\n in function probdesc::print (%s, line %d).\n",__FILE__,__LINE__);      }      }                  fprintf (out,"%d\n",(int)damp);            switch (damp){      case nodamp:{	break;      }      case massdamp:{	fprintf (out,"%f\n",dmass);	break;      }      case stiffdamp:{	fprintf (out,"%f\n",dstiff);	break;      }      case rayleighdamp:{	fprintf (out,"%f %f\n",dstiff,dmass);	break;      }      default:{	fprintf (stderr,"\n\n unknown type of damping is required in function probdesc::print (file %s, line %d),\n",__FILE__,__LINE__);      }      }            fprintf (out,"%d %d\n",(int)tstorsm,(int)tstormm);      timecon.print (out);      ssle.print (out);     break;    }    // ********************    //  NONLINEAR STATICS    // ********************  case mat_nonlinear_statics:    {      nlman.print (out);            fprintf (out, "%d %d\n", (int)tstorsm,(int)stmat);            ssle.print (out);            break;    }    // *********************************************************************    //  TIME-DEPENDENT MECHANICAL PROBLEMS WITH NEGLIGIBLE INERTIAL FORCES    // *********************************************************************  case mech_timedependent_prob:{    //  time controller    timecon.print (out);        fprintf (out,"%d %d\n",(int)tstorsm,(int)stmat);        ssle.print (out);        break;  }            // **********************************************************************************************    //  TIME-DEPENDENT MECHANICAL PROBLEMS WITH NEGLIGIBLE INERTIAL FORCES AND GRADUAL CONSTRUCTION    // **********************************************************************************************  case growing_mech_structure:{        //  time controller    timecon.print (out);        fprintf (out,"%d %d\n",(int)tstorsm,(int)stmat);        ssle.print (out);        break;  }            // **************************    //  EARTH PRESSURE PROBLEMS    // **************************  case earth_pressure:{    fprintf(out, "%d", (int)tepsol);    switch (tepsol)      {      case gep_sol :	{	  fprintf (out,"%ld %lf %lf %lf",niep,errep,stepep,rlerrep);	  	  	  nlman.print (out);	  	  //  type of storage of stiffness matrix	  fprintf (out,"%d ",(int)tstorsm);	  //  data about solver of system of linear equations	  ssle.print (out);	  break;  	}      case gepvarsup_sol :	{	  fprintf (out,"%ld %e %e\n",niep,errep,rlerrep);	  	  nlman.print (out);	  	  fprintf (out, "%ld\n", nselnodep);	  if (niep < nselnodep)	    {	      fprintf(stderr, "\n\n Number of iteration steps is less then number of selected nodes");	      fprintf(stderr, "\n in file %s, line %d", __FILE__, __LINE__);	    }	  for (i = 0; i < nselnodep; i++)	    fprintf (out, "%ld ", selnodep[i]);	  //  type of storage of stiffness matrix	  fprintf (out,"\n%d ",(int)tstorsm);	  //  data about solver of system of linear equations	  ssle.print (out);	  break;  	}      case epplast_sol :	{	  fprintf (out, " %ld\n", niep);	  for (i = 0; i < niep; i++)	    fprintf (out, "%f ", loadcoef[i]);	  	  nlman.print (out);	  	  //  type of storage of stiffness matrix	  //  type of stiffness matrix (initial, tangent)	  fprintf (out,"%d %d\n",(int)tstorsm,(int)stmat);	  //  data about solver of system of linear equations	  ssle.print (out);	  break;	}      default :        fprintf(stderr, "\n\nUknown type of earth pressure is required\n");        fprintf(stderr, " in function probdesc::print, (file %s, line %d)\n", __FILE__, __LINE__);      }    break;  }  // **********************************  //  LAYERED LINEAR STATICS PROBLEMS  // **********************************  case layered_linear_statics:{    //  tstorsm - type of storage of stiffness matrix    //  tlinsol - type of solver of linear equation system    //fprintf (out, "%d %d\n", (int)tstorsm, (int)tlinsol);    fprintf (out, "%d\n", (int)tstorsm);        ssle.print (out);    //print_linsoltype (out);        fprintf(out, "\n");        break;  }        // *******************************    //  METHOD OF VARIABLE STIFFNESS    // *******************************  case var_stiff_method:{    if (Mespr==1)  fprintf (stdout,"\n variable stiffness problem");        //  tstorsm - type of storage of stiffness matrix    fprintf (out,"%d",tstorsm);        //  data about solver of system of linear equations    ssle.print (out);        fprintf (out,"%ld",nivsm);    break;  }        // *************************************    //  LINEAR FLOATING SUBDOMAIN PROBLEMS    // *************************************  case lin_floating_subdomain:{            fprintf (out, "%d\n", (int)tstorsm);            fprintf (out,"%ld %le\n",ense,limit);      ssle.print (out);        break;  }    // *************************************    //  NONLINEAR FLOATING SUBDOMAIN PROBLEMS    // *************************************  case nonlin_floating_subdomain:{      nlman.print (out);            fprintf (out, "%d %d\n", (int)tstorsm,(int)stmat);            fprintf (out,"%ld %le\n",ense,limit);      ssle.print (out);        break;  }      case nonlinear_dynamics:{    if (Mespr==1)  fprintf (stdout,"\n problem of nonlinear dynamics");            break;  }      default:{    fprintf (stdout,"\n\n unknown type of problem in function print (file %s, line %d).\n",__FILE__,__LINE__);    break;  }  }    fprintf (out,"\n");}/**   Function decomposes name of file(with path) to path,filemane and suffix.   ppp/ppp/fff.sss.sss -> path = "ppp/ppp" , name = "fff" , suffix = ".sss.sss"      @param file - decomposed name of file   @param path,name,suffix - components of name of file      created  1.4.2003, Ladislav Svoboda, termit@cml.fsv.cvut.cz */void probdesc::filename_decomposition (const char *file,char *&pathm,char *&namem,char *&suffixm){  char *fix;  pathm = new char[strlen(file)+1];  namem = new char[strlen(file)+1];  suffixm = new char[strlen(file)+1];    strcpy (pathm,file);  fix = strrchr(pathm,'/');  if (fix==NULL){    strcpy (namem,pathm);    pathm[0] = '\0';  }  else{    strcpy (namem,fix+1);    fix[1] = '\0';  }    fix = strchr(namem,'.');  if (fix==NULL)    suffixm[0] = '\0';  else{    strcpy (suffixm,fix);    fix[0] = '\0';  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -