本文整理汇总了C++中CONFIG::shift方法的典型用法代码示例。如果您正苦于以下问题:C++ CONFIG::shift方法的具体用法?C++ CONFIG::shift怎么用?C++ CONFIG::shift使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CONFIG
的用法示例。
在下文中一共展示了CONFIG::shift方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Convolution
unsigned Convolution(CONFIG &config)
{
time_t time1, time2;
time(&time1);
int dim;
cout << "Add " << config.atoms_box << " atoms to the box" << endl;
for(int i = 0; i < config.atoms_box; i++) // check all atoms of this grain
{
for(dim=0; dim < 3; dim++)
{
if (config.atom_box[i].r(dim) > config.shift(dim)) config.atom_box[i].r(dim) -= config.l(dim);
else
if (config.atom_box[i].r(dim) < -config.shift(dim)) config.atom_box[i].r(dim) += config.l(dim);
}
}
time(&time2);
if (config.time) cout << "Done in " << time2-time1 << " s." << endl;
return 0;
}
示例2: IniGrainCenters
unsigned IniGrainCenters(CONFIG& config)
{
Vector3d a;
Vector3d rotv;
Vector3d rtmp;
double angle;
time_t time1, time2;
time(&time1);
cout << "Initialize grain centers ";
for (int ig=0; ig<config.grains; ig++)
{
for (int dim=0; dim<3; dim++)
{
config.grain[ig].r(dim) = config.shift(dim) * (rand()%2000000/1000000. - 1);
}
for (unsigned j=0; j<3; j++)
{
config.grain[ig].angle(j) = 2.0 * M_PI * (rand()%1000000/1000000.);
}
a = config.grain[ig].angle;
rotv << 1/cos(a(0))*sin(a(1)), 1/sin(a(0))*sin(a(1)), 1/cos(a(1));
angle = -a(2);
rtmp = -config.grain[ig].r;
config.grain[ig].rotvT = rtmp * cos(angle) + rotv.cross(rtmp) * sin(angle) + (1 - cos(angle)) * rotv *(rotv.dot(rtmp)) + config.grain[ig].r; // Rodrigue's rotation formula
cout << ".";
}
time(&time2);
if (config.time) cout << endl << "Done in " << time2-time1 << " s.";
cout << endl;
return 0;
}