本文整理汇总了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;
}
示例2: clear
void clear() {
t.fill(0);
l.fill(-1);
r.fill(n);
}
示例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;
}
}
示例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);
}