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

📄 output.cpp

📁 Finite element program for mechanical problem. It can solve various problem in solid problem
💻 CPP
📖 第 1 页 / 共 5 页
字号:
  nl = Nlay;  if (nl == 0)    nl = 1;  // countig number of elements with l.c. system  for (i = 0; i < Top->elements; i++)  {    for (j = 0; j < nprop; j++)    {      if (Top->E[i].property == Nep[j])      {        if (Elsv[j])        {          nells++;          break;        }      }    }  }  // indexing l. c. system  for (i = 0; i < nprop; i++)  {    if (Elsv[i])    {      telsvi++;      elsvi[i] = telsvi;    }  }  fprintf(out, "%ld\n", nells);  for (i = 0; i < Top->elements; i++)  {    ips = -1;    // searching type of auxiliary points on element    for (j = 0; j < nprop; j++)    {      if ((Top->E[i].property == Nep[j]) && (Sel[j] == Top->E[i].type))      {        if (Eep[j])        {          tep = Eep[j];          tps = Eps[j];          ips = j;          break;        }      }    }    if (ips < 0)    {      fprintf(stderr, "\n\nError - element hasn't assigned position of auxiliary points");      fprintf(stderr, "\nfunction wr_ellcsys() (output.cpp)\n");      return(1);    }    for (n = 0; n < nl; n++)    {      for (j = 0; j < nprop; j++)      {        if (Top->E[i].property == Nep[j])        {          if (Elsv[j])          {            switch (tep)            {              case nowhere :              {                fprintf(out, "%ld %ld\n", i*nl+n+1, 0L);                break;              }              case intpts :              {                fprintf(out, "%ld %ld ", i*nl+n+1, Enip[i]);                for (k = 0; k < Enip[i]; k++)                  fprintf(out, " %ld %ld", k+1, elsvi[j]);                fprintf(out, "\n");                break;              }              case enodes :              {                fprintf(out, "%ld %ld", i*nl+n+1, Top->E[i].size);                for (k = 0; k < Top->E[i].size; k++)                  fprintf(out, " %ld %ld", k+1, elsvi[j]);                fprintf(out, "\n");                break;              }              case userdefined :              {                fprintf(out, "%ld %ld", i*nl+n+1, Eps[j]->np);                for (k = 0; k < Eps[j]->np; k++)                  fprintf(out, " %ld %ld", k+1, elsvi[j]);                fprintf(out, "\n");                break;              }              default :              {                fprintf(stderr, "\n\nError - unknown type of position of auxiliary points");                fprintf(stderr, "\nfunction wr_ellcsys() (output.cpp)\n");                break;              }            }          }        }      }    }  }  // print base vectors of local coordinate system  fprintf (out, "%ld\n", telsvi);  for (i = 0; i < telsvi; i++)  {    fprintf(out, "%ld", Elsv[i][0].n*Elsv[i][0].n);    for (j = 0; j < Elsv[i][0].n; j++)    {      for (k = 0; k < Elsv[i][0].n; k++)        fprintf (out, " %e", Elsv[i][j][k]);    }    fprintf(out, "\n");  }  fprintf(out, "\n");  delete [] elsvi;  return(0);}/** Function writes cross-sections and thier parameters to the file given by the out.  @param out - pointer to the opened text file, where the data will be written  @retval 0 : on succes*/long wr_crsecs(FILE *out){  long i, j, wrt, nctu;//  fprintf(out, "%ld", Ecsn+Ncsn);  for(i = 0, nctu = 0; i < Dbcrs->numt; i++)  // countig number of used cross-section types  {    if (Ncu[i])      nctu++;  }  fprintf(out, "%ld\n", nctu);    // writing number of cs types  for (i = 0; i < Dbcrs->numt; i++)  {    wrt = 1;    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, i, j;  switch (Mp->tprob){  case linear_statics:  case layered_linear_statics:  case lin_floating_subdomain:{    fprintf(out, "%ld\n\n\n", Nlc);  // writing number of load cases    tnlc = Nlc;    break;  }  case eigen_dynamics:{    break;  }  case forced_dynamics:{    fprintf(out, "%ld\n\n\n", Nlc/2);  // writing number of load cases    tnlc = Nlc/2;    break;  }  case mat_nonlinear_statics:{    fprintf(out, "%ld\n\n\n", Nlc/2);  // writing number of load cases    tnlc = Nlc;    break;  }  case growing_mech_structure:  case mech_timedependent_prob:{    fprintf(out, "%ld \n", Nlc);  // writing number of load cases    tnlc = Nlc;    break;  }  default:{    fprintf (stderr,"\n\n unknown problem type is required in function  (file %s, line %d).\n",__FILE__,__LINE__);  }  }    for (i = 0; i < tnlc; i++)  {    switch (Mp->tprob){    case linear_statics:    case lin_floating_subdomain:    {      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      wr_tempload(out, npropn, i);      fflush(out);      break;    }    case eigen_dynamics:{      break;    }    case mat_nonlinear_statics:    {      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      wr_tempload(out, npropn, i);      if (i%2 == 1)        wr_initcond(out, npropn, i+1);   // writing initial conditions      fflush(out);      break;    }    case forced_dynamics:      {	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	wr_tempload(out, npropn, i);	fprintf(out, "\n");        if (Nslc == 0)	{          fprintf(out, "\n %d\n", int(Tdynload));          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	}        else	{          for (j = 0; j < Nslc; j++)	  {            fprintf(out, "\n 1\n");            // writing nodal load            wr_loadn(out, npropn, i+j);            // writing element load            wr_loadel(out, nprope, npropn, i+j);            // writing prescribed displacements            wr_prescdisp(out, npropn, i+j);            wr_tempload(out, npropn, i+j);                  Tf[i].print(out);	  }	}        fflush(out);	break;      }    case growing_mech_structure:    case mech_timedependent_prob:{      //  type of dynamic load; 1-usual load case, 10-seismic load      if (Nslc > 0)      {        fprintf (out,"\n1\n%ld\n", Nslc);        for (j = 0; j < Nslc; j++)        {          // writing nodal load          wr_loadn(out, npropn, i);          // writing element load          wr_loadel(out, nprope, npropn, i);          // writing prescribed displacements          wr_prescdisp(out, npropn, i);          wr_tempload(out, npropn, i);                Tf[i].print(out);        }      }      else      {        fprintf (out,"\n 20\n");        // writing dynamic nodal load        wr_dloadn(out, npropn, i+1);        // writing dynamic element load        wr_dloadel(out, nprope, i+1);        // writing dynamic prescribed displacements        wr_dprescdisp(out, npropn, i+1);       }      fflush(out);      break;    }    default:{      fprintf (stderr,"\n\n wrong problem type is required in function wr_load (file %s, line %d).\n",__FILE__,__LINE__);    }    }  }  // eigen strains  fprintf(out, "\n0\n");    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, n, nl, nln;  nl = Nlay;  if (nl == 0)    nl = 1;  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*nl);  // 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))        {          for (n = 0; n < nl; n++)          {            // writing node number            fprintf(out, "%6ld", i*nl+n+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, n, nl, nln;  nl = Nlay;  if (nl == 0)    nl = 1;  for (i = 0, nln = 0; i < Top->nodes; i++)  // counting of overall number of nodal loads  {    for (j = 0; j < nprop; j++)    {      if (Top->N[i].property == Nnp[j])      {        if (Dlno[j]) 	{          if ((Dlno[j]->nlc == nlc+1) ||              ((Mp->tprob == mech_timedependent_prob) && (Dlno[j]->nlc == nlc)) ||              ((Mp->tprob == growing_mech_structure) && (Dlno[j]->nlc == nlc)))          {            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]) 	{          if ((Dlno[j]->nlc == nlc+1) ||              ((Mp->tprob == mech_timedependent_prob) && (Dlno[j]->nlc == nlc)) ||              ((Mp->tprob == growing_mech_structure) && (Dlno[j]->nlc == nlc)))          {            for (n = 0; n < nl; n++)            {              // writing node number              fprintf(out, "\n%6ld ", i*nl+n+1);              Dlno[j]->print_prop(out, Tndofn[i]);             }	  }        }      }    }  }  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, n, nl, nle;  nl = Nlay;  if (nl == 0)    nl = 1;  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])

⌨️ 快捷键说明

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