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

📄 input.cpp

📁 Finite element program for mechanical problem. It can solve various problem in solid problem
💻 CPP
📖 第 1 页 / 共 3 页
字号:
#include <string.h>#include "intools.h"#include "iotools.h"#include "vector.h"#include "siftop.h"#include "import_T3d.h"#include "alias.h"#include "global.h"#include "loadn.h"#include "dloadn.h"#include "loadel.h"#include "input.h"#include "bocon.h"#include "inicon.h"#include "dbcrs.h"#include "dbmat.h"#include "edgeload.h"#include "elsurfload.h"#include "surfload.h"#include "pointset.h"#include "tempload.h"#include "gfunct.h"siftop    *Top;     ///< Sifel topologylong       Npropn;  ///< number of entries with nodal propertylong       Nprope;  ///< number of entries with element property// Folowing arrays have size equal to number of lines with property description//  of nodes(elements).// This numbers are specified in the input file on the first line before section//  described nodals or elements propertylong      *Nnp;     ///< property numbers for nodeslong      *Nep;     ///< property numbers for elementslong      *Ndofn;   ///< array of number of dof for nodesbocon    **Boc;     ///< array of pointers to the nodal boundary conditions structureslong     **Boccn;   /**< array with bocon squence number (0 : if Bocon[i] == NULL)                         (positive number : if Bocon[i] != NULL)*/loadel   **Lel;     ///< array of pointers to the element load structuresloadn    **Lno;     ///< array of pointers to the nodal load structures// dloadel  **Dlel;   ///< array of pointers to the dynamic element load structuresdloadn   **Dlno;    ///< array of pointers to the dynamic nodal load structureselemtype  *Tel;     ///< array of element typesstrastrestate *Ssse;///< stress strain state for plane elementlong      *Sel;     ///< array of shape element numberlong      *Nmel;    ///< number of materials on the elementmattype  **Mel;     ///< array of material typeslong     **Melid;   ///< array of material indecescrsectype *Ncs;     ///< array of cross-section types in the nodeslong      *Ncsi;    ///< array of cross-section indeces in the nodeslong     **Nccn;    ///< array of pointers to common code numbers in the nodestempload **Ntemp;   ///< array of pointers temperature load of nodes structureslong       Ntempl;  ///< indicator whether temperature load is given in the current problemcrsectype *Ecs;     ///< array of cross-section types in the elementslong      *Ecsi;    ///< array of cross-section indeces in the elementsvector   **Nlsv;    ///< array of vectors of local systems in the nodesvector   **Elsv;    ///< array of vectors of local systems in the elementslong       Nels;    ///< number of local coordinate systems in the integration pointsdbmat     *Dbmat;   ///< database of materials and their parametersdbcrs     *Dbcrs;   ///< database of cross-sections and their parameterslong      *Tndofn;  ///< array of number of dof for every nodeelemtype  *Tet;     ///< array of element type for each elementlong      *Nmu;     ///< array with indicators of used material types from material databaselong      *Ncu;     ///< array with indicators of used cross-section types from cross-section databaselong       Nlc;     ///< number of loading caseslong       Nslc;    ///< number of loading cases in time dependent mechanical problemslong       Nlay;    ///< number of layers for layered problemslong       Nspd;    ///< number of values of static prescribed displacementslong       Ndpd;    ///< number of values of dynamic prescribed displacementslong       Csrin;   ///< number of renumbered index in function wr_nodesinicon   **Inic;    ///< array of pointers to the nodal initial conditions structureslong       Ninic;   ///< indicator whether initial conditions are given in the current problemlong      *Enip;    ///< array with number of integration point for each elementedgeload **Edgl;    ///< array with edge loadsurfload **Surfl;   ///< array with surface loadelsurfload  **Elsurfl; ///< array with surface load on elementselemposition *Eep;     ///< array with position indicator of point where stresses and strains will be evaluatedpointset    **Eps;     ///< array with position point setsgfunct       *Tf;      ///< array of time functions used in time dependent mechanical problems for each load casedynload       Tdynload;///< type of dynamic loadlong         *Tfel;    ///< array of indeces of time functions for elements in growing structure problems/** Function   reads problem data from file in a writes it to file out in SIFEL format. @param in   - pointer to opened input file with problem description @param outf - pointer to string with name of output file @retval 0 - on succes @retval 1 - unable to open temporary file @retval 2 - if fails reading number of loading cases @retval 3 - if fails reading topology @retval 4 - if fails reading materials @retval 5 - if fails reading cross-sections @retval 6 - if fails reading property file @retval 7 - if fails writing output file*/long input(XFILE *in, descrip *d){  long i;  long npropn, nprope;  long err, tlc;  long nl;  // reading number of loading cases  xfscanf(in, "%ld", &Nlc);  tlc = Nlc / 2;  Nlay = 0;  switch (Mp->tprob)  {    case mat_nonlinear_statics :    {      if (tlc * 2 != Nlc)      {        fprintf(stderr, "\n\nError reading number of loading cases");        fprintf(stderr, "\n Number of loading cases is %ld", Nlc);        fprintf(stderr, "\n Number of loading cases has to be odd");        fprintf(stderr, "\n because you request to solve mat_nonlinear statics.");	fprintf (stderr,"\n %s, line %d\n",__FILE__,__LINE__);        return (2);      }      break;    }    case eigen_dynamics :    {      if (Nlc > 0)      {        fprintf(stderr, "\n\nError reading number of load cases");        fprintf(stderr, "\n Number of load cases is %ld", Nlc);        fprintf(stderr, "\n Number of load cases has to be zero");        fprintf(stderr, "\n you request to solve eigen dynamics.");	fprintf (stderr,"\n %s, line %d\n",__FILE__,__LINE__);        return (2);      }      break;    }    case forced_dynamics :    {      if (tlc * 2 != Nlc)      {        fprintf(stderr, "\n\nError reading number of load cases");        fprintf(stderr, "\n Number of load cases is %ld", Nlc);        fprintf(stderr, "\n Number of load cases has to be odd");        fprintf(stderr, "\n because you request to solve forced dynamics.");	fprintf (stderr,"\n %s, line %d\n",__FILE__,__LINE__);        return (2);      }      // reading number of loading cases      xfscanf(in, "%ld", &Nslc);      if (Nslc > 0)      {        if (tlc != 1)        {          fprintf(stderr, "\n\nError reading number of load cases");          fprintf(stderr, "\n Number of load cases is %ld", Nlc);          fprintf(stderr, "\n Number of load cases has to be 1");          fprintf(stderr, "\n because you request to solve forced dynamics");          fprintf(stderr, "\n with subloadcases.");          fprintf (stderr,"\n %s, line %d\n",__FILE__,__LINE__);          return (2);        }        //  allocation of array of time functions        Tf = new gfunct [Nslc];         for (i=0;i<Nslc;i++){          Tf[i].read_prop (in->file);        }      }      else        xfscanf(in, "%d", &Tdynload);      break;    }  case growing_mech_structure:  case mech_timedependent_prob:{    // reading number of loading cases    xfscanf(in, "%ld", &Nslc);    //  allocation of array of time functions    Tf = new gfunct [Nslc];    for (i=0;i<Nslc;i++){      Tf[i].read(in);    }    break;  }    case layered_linear_statics :    {      xfscanf(in, "%ld", Nlay);      if (Nlay == 0)      {        fprintf(stderr, "\n\nError reading number of layers");	fprintf (stderr,"\n %s, line %d\n",__FILE__,__LINE__);        return(2);      }      break;    }    default :      break;  }  // reading topology  err = input_siftop(d);  if (err)    return(3);  // reading material database  err = input_materials(d->matf);  if (err)    return(4);  // reading cross-section elements  err = input_crs(d->crf);  if (err)    return(5);  // reading nodal and element properties  err = input_prop(in, npropn, nprope, nl);  switch (err)  {    case 1 :      fprintf(stderr, "\n\nError reading nodal properties\n");      fprintf(stderr, " reading property type of node fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 2 :      fprintf(stderr, "\n\nError reading nodal properties\n");      fprintf(stderr, " reading property ndof of node fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 3 :      fprintf(stderr, "\n\nError reading nodal properties\n");      fprintf(stderr, " property ndof of node hasn't been entered before proprety, which it needs.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 4 :      fprintf(stderr, "\n\nError reading nodal properties\n");      fprintf(stderr, " reading boundary condition of nodes fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 5 :      fprintf(stderr, "\n\nError reading nodal properties\n");      fprintf(stderr, " reading nodal load fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 6 :      fprintf(stderr, "\n\nError reading nodal properties\n");      fprintf(stderr, " reading cross-section of node fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 7 :      fprintf(stderr, "\n\nError reading nodal properties\n");      fprintf(stderr, " reading transformation vectors of local system in the node fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 8 :      fprintf(stderr, "\n\nError reading nodal properties\n");      fprintf(stderr, " reading dynamic nodal load fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 9 :      fprintf(stderr, "\n\nError reading nodal properties\n");      fprintf(stderr, " reading initial nodal conditions fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 10 :      fprintf(stderr, "\n\nError reading nodal properties\n");      fprintf(stderr, " reading common nodal code numbers fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 11 :      fprintf(stderr, "\n\nError reading nodal properties\n");      fprintf(stderr, " reading nodal temperature load fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 12 :      fprintf(stderr, "\n\nError reading nodal properties\n");      fprintf(stderr, " reading nodal time function fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 13 :      fprintf(stderr, "\n\nError reading nodal properties\n");      fprintf(stderr, " reading nodal time function fails - timefunction number is less than 1.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 21 :      fprintf(stderr, "\n\nError reading element properties\n");      fprintf(stderr, " reading property type of element fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 22 :      fprintf(stderr, "\n\nError reading element properties\n");      fprintf(stderr, " reading element type property of element fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 23 :      fprintf(stderr, "\n\nError reading element properties\n");      fprintf(stderr, " reading material property of element fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 24 :      fprintf(stderr, "\n\nError reading element properties\n");      fprintf(stderr, " reading cross-section property of element fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 25 :      fprintf(stderr, "\n\nError reading element properties\n");      fprintf(stderr, " reading load property of element fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 26 :      fprintf(stderr, "\n\nError reading element properties\n");      fprintf(stderr, " reading dynamic load property of element fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 27 :      fprintf(stderr, "\n\nError reading element properties\n");      fprintf(stderr, " reading local coordinates system property of element fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 28 :      fprintf(stderr, "\n\nError reading element properties\n");      fprintf(stderr, " reading edge load property of element fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 29 :      fprintf(stderr, "\n\nError reading element properties\n");      fprintf(stderr, " reading surface load property of element fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    case 32 :      fprintf(stderr, "\n\nError reading element properties\n");      fprintf(stderr, " reading number of entries of section with properties of elements fails.\n");      fprintf(stderr, " Program terminated.\n");      return(6);    default :      break;  }  in->line += nl;  Npropn = npropn;  Nprope = nprope;  return(0);}/** Function reads topology file(T3D format) with name stored in in_t3d

⌨️ 快捷键说明

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