当前位置: 首页>>代码示例>>C++>>正文


C++ array::fill方法代码示例

本文整理汇总了C++中array::fill方法的典型用法代码示例。如果您正苦于以下问题:C++ array::fill方法的具体用法?C++ array::fill怎么用?C++ array::fill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在array的用法示例。


在下文中一共展示了array::fill方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MakeProjection

void MakeProjection(array<float, 16> & result, float left, float right, float bottom, float top)
{
  result.fill(0.0f);

  float width = right - left;
  float height = top - bottom;
  float depth = maxDepth - minDepth;

  result[0] = 2.0f / width;
  result[3] = -(right + left) / width;
  result[5] = 2.0f / height;
  result[7] = -(top + bottom) / height;
  result[10] = -2.0f / depth;
  result[11] = -(maxDepth + minDepth) / depth;
  result[15] = 1.0;
}
开发者ID:DINKIN,项目名称:omim,代码行数:16,代码来源:projection.cpp

示例2: clear

 void clear() {
   t.fill(0);
   l.fill(-1);
   r.fill(n);
 }
开发者ID:markysha,项目名称:SP,代码行数:5,代码来源:set_no_erase.cpp

示例3: read_his_cal

void read_his_cal(){ // Reading history.sol and calculating /////////
	ifstream in_vcc(name_in_vcc);
	if(! in_vcc.is_open()) error(1, "in_vcc was not open");
	ifstream in_sol(name_in_sol);
	if(! in_sol.is_open()) error(1, "in_sol was not open");
	cout << name_in_sol << " is now reading to calculate csize..." << endl;

	int ns;
	while(in_sol >> ns){
		in_sol.ignore();
		vector <int> i_will; // the indexs list which will update cid later

		// READING and UPDATE STATES ARRAY
		char c_T[3];
		in_sol >> c_T >> timestep >> realtime;
		if(strcmp("T:", c_T) !=0) error(1, "(reading history) the format is incorrect"); // check
	
		states.fill(1);
		for(int a=0; a< ns; a ++){
			int sltcp; // from and to ltcp of solute atoms
			in_sol >> sltcp;

			states[sltcp]= -1;
			i_will.push_back(sltcp);
		}

		read_his_vcc(in_vcc, i_will);
		// READING and UPDATE STATES ARRAY

		// UPDATE CLUSTER ID
		if(0==timestep%sample_cltr){
			id_cltr.fill(0); cid= 0;
			bool is_updated[nx*ny*nz]= {false};
			for(int a=0; a<i_will.size(); a++){
				int x1= (int) (i_will.at(a)/nz)/ny;
				int y1= (int) (i_will.at(a)/nz)%ny;
				int z1= (int)  i_will.at(a)%nz;
	
				update_cid(x1, y1, z1, is_updated);
				
				for(int b=0; b<n1nbr; b ++){
					int x2= pbc(x1+v1nbr[b][0], nx);
					int y2= pbc(y1+v1nbr[b][1], ny);
					int z2= pbc(z1+v1nbr[b][2], nz);
					int index= x2*ny*nz + y2*nz + z2;
					
					update_cid(x2, y2, z2, is_updated);
				}
			}
			
			sum_csize();
		}
		// UPDATE CLUSTER ID

		// PROPERTIES CALCULATIONS
		if(0==timestep%sample_msd)  cal_msd();
		if(0==timestep%sample_sro)  cal_sro();
		if(0==timestep%sample_lro)  cal_lro();
		if(0==timestep%sample_lce)  cal_lce();
		// PROPERTIES CALCULATIONS

		if(0==timestep%100000) cout << "T: " << timestep << " " << realtime << endl;
	}
}
开发者ID:muskyhuang,项目名称:analysis_tools,代码行数:64,代码来源:cal_cluster.cpp

示例4: bor

	Vertex(Bor &bor, int index, char lastChar, int parent, int suffixLink = -1) : bor(bor), index(index), parent(parent), lastChar(lastChar), suffixLink(suffixLink) {
		next.fill(-1);
	}
开发者ID:dima74,项目名称:Seminars,代码行数:3,代码来源:I.cpp


注:本文中的array::fill方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。