本文整理汇总了C++中Particles::selectInside_noindex方法的典型用法代码示例。如果您正苦于以下问题:C++ Particles::selectInside_noindex方法的具体用法?C++ Particles::selectInside_noindex怎么用?C++ Particles::selectInside_noindex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Particles
的用法示例。
在下文中一共展示了Particles::selectInside_noindex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calculateBoo
void calculateBoo(Particles &parts, const string& filename, const bool noZ=false, bool quiet=false)
{
const string inputPath = filename.substr(0,filename.find_last_of("."));
const string ext = filename.substr(filename.find_last_of(".")+1);
const string head = filename.substr(0,filename.rfind("_t"));
const string neck = filename.substr(head.size(), inputPath.size()-head.size());
//select interesting particles and load (or make) bonds
vector<size_t> inside, secondInside;
try
{
BondSet bonds = loadBonds(inputPath+".bonds");
parts.makeNgbList(bonds);
inside = parts.selectInside_noindex(1.3*parts.radius, noZ);
secondInside = parts.selectInside_noindex(2.0*1.3*parts.radius, noZ);
}
catch(invalid_argument &e)
{
if(!quiet) cout<<"bond network ";
boost::progress_timer *ti;
if(!quiet) ti = new boost::progress_timer();
parts.makeRTreeIndex();
parts.makeNgbList(1.3);
BondSet bonds = parts.getBonds();
ofstream bondFile((inputPath+".bonds").c_str(), ios::out | ios::trunc);
for(BondSet::const_iterator b=bonds.begin(); b!= bonds.end();++b)
bondFile<<b->low()<<" "<<b->high()<<"\n";
inside = parts.selectInside(1.3*parts.radius, noZ);
secondInside = parts.selectInside(2.0*1.3*parts.radius, noZ);
if(!quiet) delete ti;
}
const bool empty = inside.empty(), empty2 = secondInside.empty();
if(empty)
for(size_t p=0; p<parts.size(); ++p)
inside.insert(inside.end(), p);
if(empty2)
for(size_t p=0; p<parts.size(); ++p)
secondInside.insert(secondInside.end(), p);
//calculate and export qlm
vector<BooData> qlm, qlm_cg, qlm_sf;
{
boost::progress_timer *ti;
if(!quiet)
{
cout<<"boo with and without surface bonds for "<<inside.size()<<" particles ";
ti = new boost::progress_timer();
}
parts.getBOOs_SurfBOOs(qlm, qlm_sf);
if(!empty)
{
parts.removeOutside(inside, qlm);
parts.removeOutside(inside, qlm_sf);
}
if(!quiet) delete ti;
}
{
if(!quiet) cout<<"coarse grained for "<<secondInside.size()<<" particles ";
boost::progress_timer* ti;
if(!quiet) ti = new boost::progress_timer();
parts.getCgBOOs(secondInside, qlm, qlm_cg);
if(!quiet) delete ti;
}
ofstream qlmFile((inputPath+".qlm").c_str(), ios::out | ios::trunc);
copy(
qlm.begin(), qlm.end(),
ostream_iterator<BooData>(qlmFile,"\n")
);
qlmFile.close();
ofstream qlmcgFile((head+"_space"+neck+".qlm").c_str(), ios::out | ios::trunc);
copy(
qlm_cg.begin(), qlm_cg.end(),
ostream_iterator<BooData>(qlmcgFile,"\n")
);
qlmcgFile.close();
//calculate and export invarients
ofstream cloudFile((inputPath+".cloud").c_str(), ios::out | ios::trunc);
cloudFile<<"#q4\tq6\tq8\tq10\tw4\tw6\tw8\tw10"<<endl;
transform(
qlm.begin(), qlm.end(),
ostream_iterator<string>(cloudFile,"\n"),
cloud_exporter()
);
cloudFile.close();
ofstream cloud_cgFile((head+"_space"+neck+".cloud").c_str(), ios::out | ios::trunc);
cloud_cgFile<<"#Q4\tQ6\tQ8\tQ10\tW4\tW6\tW8\tW10"<<endl;
transform(
qlm_cg.begin(), qlm_cg.end(),
ostream_iterator<string>(cloud_cgFile,"\n"),
cloud_exporter()
);
cloud_cgFile.close();
ofstream cloud_sfFile((head+"_surf"+neck+".cloud").c_str(), ios::out | ios::trunc);
cloud_cgFile<<"#Q4\tQ6\tW4\tW6"<<endl;
transform(
//.........这里部分代码省略.........