Commit f05e2791 authored by Quentin Khan's avatar Quentin Khan

testFmmAlgorithmBalanced: print costzones costs

testFmmAlgorithmBalancedUtils: added function to print costzones costs
parent 5c4e14d0
......@@ -103,14 +103,17 @@ int main(int argc, char** argv)
}
/**************************************************************************/
std::cerr << ("Running the costzones algorithm") << std::endl;
std::cerr << "Running the costzones algorithm" << std::endl;
/* Run the costzone algorithm *********************************************/
FCostZones<OctreeClass, CellClass> costzones(&tree, args.zoneCount());
costzones.run();
writeZones(args, costzones);
if (args.verboseLevel() == -1) {
printZonesCosts(tree, costzones);
}
/**************************************************************************/
std::cerr << ("Done") << std::endl;
std::cerr << "Done" << std::endl;
/* Run the balanced algorithm *********************************************/
......
......@@ -100,4 +100,47 @@ void loadTree(OctreeClass& tree, FRandomLoader<FReal>& loader)
}
}
template <typename OctreeClass, typename CellClass>
void printZonesCosts(OctreeClass& tree, FCostZones<OctreeClass, CellClass>& costzones)
{
using CostType = typename CellClass::costtype;
//using BoundClass = typename FCostZones<OctreeClass, CellClass>::BoundClass;
typename OctreeClass::Iterator it(&tree);
// auto leafZoneBounds = costzones.getLeafZoneBounds();
// auto internalZoneBounds = costzones.getZoneBounds();
auto zones = costzones.getZones();
// Zones costs (internal, leaf)
std::vector<std::tuple<CostType,CostType>> zonecosts(zones.size());
int zoneIdx = 0;
for(auto z : zones) {
for(auto cell : z) {
std::get<0>(zonecosts.at(zoneIdx)) += cell.second->getCost();
std::get<1>(zonecosts.at(zoneIdx)) += cell.second->getNearCost();
}
zoneIdx++;
}
zoneIdx = 0;
for(auto z : zonecosts) {
std::cout << "@@"
<< zoneIdx << " "
<< std::get<0>(z) << " "
<< std::get<1>(z)
<< std::endl;
zoneIdx++;
}
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment