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

📄 outdiagm.cpp

📁 Finite element program for mechanical problem. It can solve various problem in solid problem
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    {      case pr_displ :        print_displacements(out, lcid, i);        break;      case pr_strains :        print_strains(out, lcid, i);        break;      case pr_stresses :        print_stresses(out, lcid, i);        break;      case pr_forces :        print_forces(out, i, fi);        break;      case pr_react :        print_reactions(out, lcid, i);        break;      case pr_stepid :        fprintf(out, "%ld ", istep);        break;      case pr_appload :	if(Mp->tpr == seconds)	  fprintf(out, "% e ", lambda);	if(Mp->tpr == minutes)	  fprintf(out, "% e ", lambda/60.0);	if(Mp->tpr == hours)	  fprintf(out, "% e ", lambda/3600.0);	if(Mp->tpr == days)	  fprintf(out, "% e ", lambda/86400.0);        break;      case pr_other :        print_others(out, lcid, i);        break;      default:        fprintf(stderr, "\n\nUnknown type of value for diagram is required\n");        fprintf(stderr, " in node or ip number %ld, (file %s, line %d)\n", pid[i]+1, __FILE__, __LINE__);        return 2;    }  }  fprintf(out, "\n");  return 0;}/**  This function prints displacement at required point to the output file out.  It supposes that values in the nodes are actualized and valid.  @param out - pointer to opened output text file  @param lcid - load case id  @param idp - required component of displacement  @retval 0 - on success  @retval 1 - in case that value at integration point is required*/long outdiagm::print_displacements(FILE *out, long lcid, long idp){  double *r;  switch (nif[idp])  {    case atxyz:    case atnode:      r = new double [Gtm->gnodes[pid[idp]].ndofn];      noddispl (lcid, r, pid[idp]);      fprintf(out, "% e ", r[ipu[idp]]);      delete [] r;      break;    case atip:      fprintf (stderr, "\n\nUnsupported combination of printed values is required -\n");       fprintf(stderr, " displacements in ip number %ld, outdiagm::print_displacements (file %s, line %d)\n", pid[idp]+1, __FILE__, __LINE__);      return 1;    default:      fprintf(stderr, "\n\nUnknown type of point is required in function outdiagm::print_displacements\n");      fprintf(stderr, " point number %ld (file %s, line %d)\n", pid[idp]+1, __FILE__, __LINE__);       return 1;  }  return  0;}/**  This function prints strain at required point to the output file out.  It supposes that values in the integration points and nodes are actualized and valid.  @param out - pointer to opened output text file  @param lcid - load case id  @param idp - required component of strain  @retval 0 - on success  @retval 1 - in case that unknown type of point is required  @retval 2 - in case that unknown component of strain is required*/long outdiagm::print_strains(FILE *out, long lcid, long idp){  switch (nif[idp])  {    case atxyz:    case atnode:      if (ipu[idp] < Mt->nodes[pid[idp]].ncompstr)        fprintf(out, "% e ", Mt->nodes[pid[idp]].strain[ipu[idp]]);      else      {        fprintf(stderr, "\n\nInvalid component number is required in function outdiagm::print_strains\n");        fprintf(stderr, " node number %ld (file %s, line %d)\n", pid[idp]+1, __FILE__, __LINE__);         return 2;      }      break;    case atip:      if (ipu[idp] < Mm->ip[pid[idp]].ncompstr)        fprintf(out, "% e ", Mm->ip[pid[idp]].strain[ipu[idp]]);      else      {        fprintf(stderr, "\n\nInvalid component number is required in function outdiagm::print_strains\n");        fprintf(stderr, " integration point number %ld (file %s, line %d)\n", pid[idp]+1, __FILE__, __LINE__);         return 2;      }      break;    default:      fprintf(stderr, "\n\nUnknown type of point is required in function outdiagm::print_strains\n");      fprintf(stderr, " point number %ld (file %s, line %d)\n", pid[idp]+1, __FILE__, __LINE__);       return 1;  }  return 0;}/**  This function prints stress at required point to the output file out.  It supposes that values in the integration points and nodes are actualized and valid.  @param out - pointer to opened output text file  @param lcid - load case id  @param idp - required component of stress  @retval 0 - on success  @retval 1 - in case that unknown type of point is required  @retval 2 - in case that unknown component of strain is required*/long outdiagm::print_stresses(FILE *out, long lcid, long idp){  switch (nif[idp])  {    case atxyz:    case atnode:      if (ipu[idp] < Mt->nodes[pid[idp]].ncompstr)        fprintf(out, "% e ", Mt->nodes[pid[idp]].stress[ipu[idp]]);      else      {        fprintf(stderr, "\n\nInvalid component number is required in function outdiagm::print_stresses\n");        fprintf(stderr, " node number %ld (file %s, line %d)\n", pid[idp]+1, __FILE__, __LINE__);         return 2;      }      break;    case atip:      if (ipu[idp] < Mm->ip[pid[idp]].ncompstr)        fprintf(out, "% e ", Mm->ip[pid[idp]].stress[ipu[idp]]);      else      {        fprintf(stderr, "\n\nInvalid component number is required in function outdiagm::print_stresses\n");        fprintf(stderr, " integration point number %ld (file %s, line %d)\n", pid[idp]+1, __FILE__, __LINE__);         return 2;      }      break;    default:      fprintf(stderr, "\n\nUnknown type of point is required in function outdiagm::print_stresses\n");      fprintf(stderr, " point number %ld (file %s, line %d)\n", pid[idp]+1, __FILE__, __LINE__);       return 1;  }  return 0;}/**  This function prints forces at required node to the output file out.  Value from load vector fi is used and printed.  @param out - pointer to opened output text file  @param idp - required component of force  @retval 0 - on success  @retval 1 - in case that point type is atip  @retval 2 - in case that unknown component of force is required*/long outdiagm::print_forces(FILE *out, long idp, double *fi){  long ii;  switch (nif[idp])  {    case atxyz:    case atnode:      ii=Mt->give_dof(pid[idp], ipu[idp]);      if (ii > 0)        fprintf(out, "% e ", fi[ii-1]);      else            {        fprintf(stderr, "\n\nInvalid component number is required in function outdiagm::print_forces\n");        fprintf(stderr, " node number %ld (file %s, line %d)\n", pid[idp]+1, __FILE__, __LINE__);         return 2;      }      break;    case atip:      fprintf (stderr, "\n\nUnsupported combination of printed values is required -\n");       fprintf(stderr, " forces in ip number %ld, outdiagm::print_forces (file %s, line %d)\n", pid[idp]+1, __FILE__, __LINE__);      return 1;    default:      fprintf(stderr, "\n\nUnknown type of point is required in function outdiagm::print_forces\n");      fprintf(stderr, " point number %ld (file %s, line %d)\n", pid[idp]+1, __FILE__, __LINE__);       return 1;  }  return 0;}/**  This function prints reaction at required node to the output file out.  It supposes that values in the nodes are actualized and valid.  @param out - pointer to opened output text file  @param lcid - load case id  @param idp - required component of reaction  @retval 0 - on success  @retval 1 - in case that unknown type of point is required*/long outdiagm::print_reactions(FILE *out, long lcid, long idp){  switch (nif[idp])  {    case atxyz:    case atnode:      if (Mt->nodes[pid[idp]].react)        fprintf(out, "% e ", Mt->nodes[pid[idp]].r[ipu[idp]]);      break;    case atip:      fprintf (stderr, "\n\nUnsupported combination of printed values is required -\n");       fprintf(stderr, " forces in ip number %ld, outdiagm::print_reactions (file %s, line %d)\n", pid[idp]+1, __FILE__, __LINE__);      return 1;    default:      fprintf(stderr, "\n\nUnknown type of point is required in function outdiagm::print_reactions\n");      fprintf(stderr, " point number %ld (file %s, line %d)\n", pid[idp]+1, __FILE__, __LINE__);       return 1;  }  return 0;}/**  This function prints other value at required point to the output file out.  It supposes that values in the integration points and nodes are actualized and valid.  @param out - pointer to opened output text file  @param lcid - load case id  @param idp - required component of other array  @retval 0 - on success  @retval 1 - in case that unknown type of point is required  @retval 2 - in case that unknown component of strain is required*/long outdiagm::print_others(FILE *out, long lcid, long idp){  switch (nif[idp])  {    case atxyz:    case atnode:      if (ipu[idp] < Mt->nodes[pid[idp]].ncompother)        fprintf(out, "% e ", Mt->nodes[pid[idp]].other[ipu[idp]]);      else      {        fprintf(stderr, "\n\nInvalid component number is required in function outdiagm::print_others\n");        fprintf(stderr, " node number %ld (file %s, line %d)\n", pid[idp]+1, __FILE__, __LINE__);         return 2;      }      break;    case atip:      if (ipu[idp] < Mm->ip[pid[idp]].ncompeqother)        fprintf(out, "% e ", Mm->ip[pid[idp]].eqother[ipu[idp]]);      else      {        fprintf(stderr, "\n\nInvalid component number is required in function outdiagm::print_others\n");        fprintf(stderr, " integration point number %ld (file %s, line %d)\n", pid[idp]+1, __FILE__, __LINE__);         return 2;      }      break;    default:      fprintf(stderr, "\n\nUnknown type of point is required in function outdiagm::print_others\n");      fprintf(stderr, " point number %ld (file %s, line %d)\n", pid[idp]+1, __FILE__, __LINE__);       return 1;  }  return 0;}

⌨️ 快捷键说明

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