Example #1
0
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;
}
Example #2
0
 void clear() {
   t.fill(0);
   l.fill(-1);
   r.fill(n);
 }
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;
	}
}
Example #4
0
	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);
	}