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

📄 sortlist.h

📁 c++的数学物理方程数值算法源程序。这是"Numerical Methods for Physics"第二版的源程序。
💻 H
字号:
class SortList {public:// Class data (sorting lists)
int ncell, npart, *cell_n, *index, *Xref;

// Default Constructor. SortList() {
  initLists(1,1);}// Regular Constructor. SortList(int ncell_in, int npart_in) {
  initLists(ncell_in,npart_in);
}

// Destructor. Called when a SortList object goes out of scope.~SortList() {  delete [] cell_n;   // Release allocated memory
  delete [] index;
  delete [] Xref;}
//*********************************************************

private:
// Initialization routine
void initLists(int ncell_in, int npart_in) {
  ncell = ncell_in;
  npart = npart_in;
  cell_n = new int [ncell+1];  // Allocate memory
  index = new int [ncell+1];
  Xref = new int [npart+1];
  int i;
  for( i=1; i<=ncell; i++ ) {
	cell_n[i] = 0;
	index[i] = 0;
  }
  for( i=1; i<=npart; i++ )
	Xref[i] = 0;
}
}; // Class SortList

⌨️ 快捷键说明

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