本文整理汇总了C++中KDTree::BuildTree方法的典型用法代码示例。如果您正苦于以下问题:C++ KDTree::BuildTree方法的具体用法?C++ KDTree::BuildTree怎么用?C++ KDTree::BuildTree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KDTree
的用法示例。
在下文中一共展示了KDTree::BuildTree方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetUp
//=================================================================================================
// TreeTest::Setup
//=================================================================================================
void TreeTest::SetUp(void)
{
// Create all objects for test
partdata = new SphParticle<3>[Npart];
randnumb = new XorshiftRand(rseed);
kdtree = new KDTree<3,SphParticle,KDTreeCell>(Nleafmax, thetamaxsqd, kernrange,
macerror, gravity_mac, multipole);
// Create some simple particle configuration (random population of a cube)
for (int i=0; i<Npart; i++) {
for (int k=0; k<3; k++) partdata[i].r[k] = 1.0 - 2.0*randnumb->floatrand();
partdata[i].m = 1.0 / (FLOAT) Npart;
partdata[i].h = 0.2*randnumb->floatrand();
}
for (int k=0; k<3; k++) {
simbox.boxmin[k] = -1.0;
simbox.boxmax[k] = 1.0;
simbox.boxsize[k] = 2.0;
simbox.boxhalf[k] = 1.0;
}
// Now build the tree using the particle configuration
kdtree->Ntot = Npart;
kdtree->Ntotmaxold = 0;
kdtree->Ntotmax = Npart;
kdtree->ifirst = 0;
kdtree->ilast = Npart - 1;
kdtree->BuildTree(0, Npart-1, Npart, Npart, partdata, 0.0);
kdtree->StockTree(kdtree->celldata[0], partdata);
return;
}