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

📄 intpoints.cpp

📁 Finite element program for mechanical problem. It can solve various problem in solid problem
💻 CPP
字号:
#include <string.h>#include "global.h"#include "intpoints.h"#include "microM4.h"#include "microSIM.h"#include "microfiber.h"intpoints::intpoints (){  tm = NULL;  idm = NULL;  nm = 0; hmt = 0;  ncompstr=0;  ncompother=0;  ssst = (strastrestate) 0;  strain = NULL;  stress = NULL;  other = NULL;  eqother = NULL;   nonloc = NULL;}intpoints::~intpoints (void){  delete [] tm;      delete [] idm;  delete [] strain;  delete [] stress;  delete [] other;   delete [] eqother;  delete [] nonloc;}void intpoints::read (FILE *in){  long i, idx, idxt;    fscanf (in, "%ld", &nm);  tm  = new mattype[nm];  idm = new long[nm];  memset (tm,  0, sizeof(*tm)*nm);  memset (idm, 0, sizeof(*idm)*nm);  idx = 0;  idxt = nm-1;  for (i = 0; i < nm; i++)  {    fscanf (in, "%d %ld", (int*)(tm+idx), idm+idx);    idm[idx]--;    if (tm[idx] == therisodilat || tm[idx] == therisodilattime){      Mp->temperature=1;      tm[idxt] = tm[idx];      idm[idxt] = idm[idx];      hmt ^= 1;      idxt--;      idx--;    }        idx++;  }}/**  This function returns index of elastic material in the tm and idm arrays     TK, 28.5.2003*/long intpoints::gemid(void){  long ret = nm - 1; // normally the elastic material is on the last position  if (hmt & 1) // the material has thermal dilatancy    ret--;  return ret;}/**  This function returns index of the nonlocal material in the tm and idm arrays  If no nonlocal material is present it returns -1.  TK, 28.5.2003*//*long intpoints::gnlmid(void){  long ret;  if (hmt & 2) // the material is nonlocal  {    ret = nm - 1; // normally it is on the last position    if (hmt & 1)  // the material has thermal dilatancy      ret--;  }  else    ret = -1;  return ret;}*//**   function allocates memory for stress, strain and other arrays   for material with the index 0      @param nlc - number of load cases   @param ipp - number of integration point*/void intpoints::alloc (long nlc,long ipp){  long ncompo = 0,ncompeqo = 0;    //fprintf (Out,"\n ncompstr %ld  nlc %ld",ncompstr,nlc);  //  number of components of array eqother  ncompeqo = Mm->givencompeqother(ipp, 0);  ncompeqother = ncompeqo;    //  number of components of array other  ncompo = Mm->givencompother(ipp, 0);  ncompother = ncompo;    strain = new double [nlc*ncompstr];  stress = new double [nlc*ncompstr];  memset(strain, 0, sizeof(*strain)*nlc*ncompstr);  memset(stress, 0, sizeof(*stress)*nlc*ncompstr);      if (ncompeqo > 0)    {      eqother = new double[ncompeqo];      memset(eqother, 0, sizeof(*eqother)*ncompeqo);    }  if (ncompo > 0)    {      other   = new double[ncompo];      memset(other, 0, sizeof(*other)*ncompo);    }}/**   function allocates array for strains      @param nlc - number of load cases      JK, 25.9.2004*/void intpoints::alloc_strains (long nlc){  strain = new double [nlc*ncompstr];}/**   function allocates array for stresses      @param nlc - number of load cases      JK, 25.9.2004*/void intpoints::alloc_stresses (long nlc){  stress = new double [nlc*ncompstr];}/**   function allocates array for stresses      JK, 25.9.2004*/void intpoints::alloc_other (long ipp){    //  number of components of array eqother  ncompeqother = Mm->givencompeqother(ipp, 0);    //  number of components of array other  ncompother = Mm->givencompother(ipp, 0);    if (ncompeqother > 0){    eqother = new double[ncompeqother];    memset(eqother, 0, sizeof(*eqother)*ncompeqother);  }  if (ncompother > 0){    other   = new double[ncompother];    memset(other, 0, sizeof(*other)*ncompother);  }  }/**   function cleans all arrays defined at integration point      @param nlc - number of load cases      JK, 25.9.2004*/void intpoints::clean (long nlc){  long i;  for (i=0;i<nlc*ncompstr;i++){    strain[i]=0.0;    stress[i]=0.0;  }  for (i=0;i<ncompeqother;i++){    eqother[i]=0.0;  }  for (i=0;i<ncompother;i++){    other[i]=0.0;  }}/**   function cleans strain array defined at integration point      @param nlc - number of load cases      JK, 25.9.2004*/void intpoints::clean_strains (long nlc){  long i;  for (i=0;i<nlc*ncompstr;i++){    strain[i]=0.0;  }}/**   function cleans stress array defined at integration point      @param nlc - number of load cases      JK, 25.9.2004*/void intpoints::clean_stresses (long nlc){  long i;  for (i=0;i<nlc*ncompstr;i++){    stress[i]=0.0;  }}/**   function cleans arrays other and eqother defined at integration point      JK, 25.9.2004*/void intpoints::clean_other (){  long i;  for (i=0;i<ncompeqother;i++){    eqother[i]=0.0;  }  for (i=0;i<ncompother;i++){    other[i]=0.0;  }}/**   function saves all arrays into the auxiliary file      @param aux - pointer to auxiliary file   @param nlc - number of load cases      JK, 19.9.2004*/void intpoints::save_data (FILE *aux,long nlc, long ido1, long ncompo){  long i;    for (i=0;i<nlc*ncompstr;i++){    fprintf (aux,"%e\n",strain[i]);  }  for (i=0;i<nlc*ncompstr;i++){    fprintf (aux,"%e\n",stress[i]);  }  for (i=ido1;i<ncompo;i++){    fprintf (aux,"%e\n",eqother[i]);  }  }/**   function restores all arrays from the auxiliary file      @param aux - pointer to auxiliary file   @param nlc - number of load cases      JK, 19.9.2004*/void intpoints::restore_data (FILE *aux,long nlc, long ido1, long ncompo, long tncompo){  long i, j;  double tmp;    for (i=0;i<nlc*ncompstr;i++){    fscanf (aux,"%le",&strain[i]);  }  for (i=0;i<nlc*ncompstr;i++){    fscanf (aux,"%le",&stress[i]);  }  j = 0;  for (i=0;i<tncompo;i++){    if ((i >= ido1) && (i < ido1+ncompo))    {      fscanf (aux,"%le",&eqother[j]);      j++;    }    else      fscanf (aux,"%le",&tmp);  }  }

⌨️ 快捷键说明

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