samplist.h

来自「c++的数学物理方程数值算法源程序。这是"Numerical Methods f」· C头文件 代码 · 共 54 行

H
54
字号
class SampList {public:// Class data (sorting lists)
int ncell, nsamp;
double *ave_n, *ave_ux, *ave_uy, *ave_uz, *ave_T;

// Default Constructor. SampList() {
  initLists(1);}// Regular Constructor. SampList(int ncell_in) {
  initLists(ncell_in);
}

// Destructor. Called when a SampList object goes out of scope.~SampList() {  delete [] ave_n;   // Release allocated memory
  delete [] ave_ux;
  delete [] ave_uy;
  delete [] ave_uz;
  delete [] ave_T;
}
//*********************************************************

private:
// Initialization routine
void initLists(int ncell_in) {
  ncell = ncell_in;
  nsamp = 0;
  ave_n = new double [ncell+1];  // Allocate memory
  ave_ux = new double [ncell+1];
  ave_uy = new double [ncell+1];
  ave_uz = new double [ncell+1];
  ave_T = new double [ncell+1];
  int i;
  for( i=1; i<=ncell; i++ ) {
	ave_n[i] = 0;
	ave_ux[i] = 0;
	ave_uy[i] = 0;
	ave_uz[i] = 0;
	ave_T[i] = 0;
  }
}
}; // Class SampList

⌨️ 快捷键说明

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