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

📄 dbcrs.cpp

📁 Finite element program for mechanical problem. It can solve various problem in solid problem
💻 CPP
字号:
#include "dbcrs.h"#include "../../GEFEL/intools.h"#include <string.h>csec :: csec(void)/**   Constructor which initializes data members with null or zero values.   Created by Tomas Koudelka koudelka@cml.fsv.cvut.cz, 11. 2001*/{  type   = crsectype(-1);  nprop  = 0;  prop   = NULL;  propu  = NULL;  ridx   = NULL;  npropu = 0;}csec :: ~csec(void)/**   Destructor which deletes each string with cross-section properties.   Created by Tomas Koudelka koudelka@cml.fsv.cvut.cz, 11. 2001*/{  long i;  for (i=0; i < nprop; i++)    delete [] prop[i];  delete [] prop;  delete [] propu;}long csec :: read(FILE *in)/**   This method reads one type crosssection with different parameters from the opened text file in.   @param in - opened text file with cross-section data.   @retval 0 - on succes   @retval 1 - error reading cross-section type and number of different parametre sets of given cross-section type   @retval 2 - error reading cross-section properties string   Created by Tomas Koudelka koudelka@cml.fsv.cvut.cz, 11. 2001*/{  long i;  if (getint(in, (int &)type) || getlong(in, nprop))  // reading cross-section type number and number of indeces  {    fprintf(stderr, "\nError reading cross-section parameters (type, num)\n");    return(1);  }  // allocating apropriate ammount of memory  prop = new char*[nprop];  memset(prop, 0, sizeof(*prop)*nprop);  propu = new long[nprop];  memset(propu, 0, sizeof(*propu)*nprop);  ridx = new long[nprop];  memset(ridx, 0, sizeof(*ridx)*nprop);  // Reading strings with cross-section properties for each cross-section index  //  each line in the input file corresponds to one string with cross-section  //  properties of one index  for (i=0; i < nprop; i++)  {    prop[i] = new char[1025];    if (getstring(in, prop[i], 1024))    {      fprintf(stderr, "\nError reading cross-section parameters (properties string)\n");      return(2);    }  }  for (i = 0; i < nprop; i++)  {    if (prop[i][strlen(prop[i])-1] == '\n')    // replace last character with 0 if equal newline      prop[i][strlen(prop[i])-1] = '\0';  }  return(0);}dbcrs :: dbcrs(void)/**   Constructor which initializes data members with null or zero values.   Created by Tomas Koudelka koudelka@cml.fsv.cvut.cz, 11. 2001*/{  numt = 0;  crs = NULL;}dbcrs :: ~dbcrs(void)/**   Destructor which deletes cross-section database.   Created by Tomas Koudelka koudelka@cml.fsv.cvut.cz, 11. 2001*/{  delete [] crs;}long dbcrs :: search_crs(crsectype ce, long ci)/**   This method searches database whether contains cross-section with    type number ce and type index number ci.   @param ce - cross-section type number   @param ci - cross-section type index   Returns :    @retval If the cross-section with given parameters exists in the database function returns     index of given cross-section in the array crs else returns -1.   Created by Tomas Koudelka koudelka@cml.fsv.cvut.cz, 11. 2001*/{  long i,ret = -1;  for (i = 0; i < numt; i++)  {    if ((crs[i].type == ce) && ((ci >= 0) && (ci < crs[i].nprop)))    {      ret = i;      break;    }  }  return(ret);}

⌨️ 快捷键说明

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