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

📄 inicd.cpp

📁 Finite element program for mechanical problem. It can solve various problem in solid problem
💻 CPP
字号:
#include <string.h>#include "inicd.h"/**  This constructor inializes attributes to zero values.*/inicd :: inicd (void){  val = NULL;  nval = 0L;  type = none;}/**  This destructor deallocates used memory.*/inicd :: ~inicd(void){  delete [] val;}/**  This function reads initial conditions form the opened text file  @param in - pointer to the opened text file  @retval 0 - on success  @retval 1 - error reading type of initial condition  @retval 2 - error reading number of initial conditions  @retval 3 - error reading value of the initial condition*/long inicd :: read(XFILE *in){  if (xfscanf(in, "%d", (int*)&type) != 1)  {    fprintf (stderr,"\n\n Error reading type of inital condition\n in function initcond::read (%s, line %d).\n",__FILE__,__LINE__);    return 1;  }  if (xfscanf(in, "%ld", &nval) != 1)  {    fprintf (stderr,"\n\n Error reading number of values of inital condition\n in function initcond::read (%s, line %d).\n",__FILE__,__LINE__);    return 2;  }  val = new double[nval];  memset(val, 0, sizeof(*val)*nval);  for (long i = 0; i < nval; i++)  {    if (xfscanf(in, "%le", val+i) != 1)    {      fprintf (stderr,"\n\n Error reading %ld-th values of inital condition\n in function initcond::read (%s, line %d).\n",i+1,__FILE__,__LINE__);      return 3;    }  }  return 0;}

⌨️ 快捷键说明

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