本文整理汇总了C++中Particles::addParticle_global方法的典型用法代码示例。如果您正苦于以下问题:C++ Particles::addParticle_global方法的具体用法?C++ Particles::addParticle_global怎么用?C++ Particles::addParticle_global使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Particles
的用法示例。
在下文中一共展示了Particles::addParticle_global方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
//cout<<"start part init done"<<endl;
part_simple_info particles_global_info;
part_simple_dataType particles_dataType;
particles_global_info.mass=0.1;
particles_global_info.relativistic=false;
set_parts_typename(&particles_global_info,"part_simple");
Particles<part_simple,part_simple_info,part_simple_dataType> parts;
parts.initialize(particles_global_info,particles_dataType,&lat_part,boxSize);
//cout<<"init done"<<endl;
part_simple part;
long index =0;
/*
for(int i=0;i<numparts;i++)
for(int j=0;j<numparts;j++)
for(int k=0;k<numparts;k++){
part.ID=index;
part.pos[0]= (Real)i * (Real)boxSize[0] / (Real)numparts;
part.pos[1]= (Real)j * (Real)boxSize[1] / (Real)numparts;
part.pos[2]= (Real)k * (Real)boxSize[2] / (Real)numparts;
part.vel[0]=1.0;
part.vel[1]=1.0;
part.vel[2]=1.0;
//part.mass=0.22;
parts.addParticle_global(part);
index++;
}
*/
int ratio = numparts/npts;
ratio;
Site xp(lat_part);
for(xp.first();xp.test();xp.next())
{
for(int i=0;i<ratio;i++)
for(int j=0;j<ratio;j++)
for(int k=0;k<ratio;k++){
part.ID=index;
part.pos[0]= (Real)xp.coord(0) * (Real)boxSize[0] / (Real)npts;
part.pos[1]= (Real)xp.coord(1) * (Real)boxSize[1] / (Real)npts;
part.pos[2]= (Real)xp.coord(2) * (Real)boxSize[2] / (Real)npts;
part.vel[0]=1.0;
part.vel[1]=1.0;
part.vel[2]=1.0;
//part.mass=0.22;
parts.addParticle_global(part);
index++;
}
}
cout<<"implementation done"<<endl;
#ifdef EXTERNAL_IO
while( !ioserver.openOstream());
parts.saveHDF5_server_open("data/bench_part_server");
#endif