1515#include " correlationUtils.hpp"
1616#include " generalUtils.hpp"
1717#include " threadPool.hpp"
18+ #include " loco_io.h"
1819
1920// vector of positions of the dimensions that contribute to a subspace
2021typedef std::vector<int > subSpace;
@@ -268,16 +269,16 @@ class GraphData
268269 {
269270 if (!distancesPrecalculated)
270271 {
271- std::cerr << " requesting to return distances from adjacency list, but they have not been precalcualted!\n " ;
272- exit (EXIT_FAILURE);
272+ LOCO_ERR << " requesting to return distances from adjacency list, but they have not been precalcualted!\n " ;
273+ LOCO_EXIT (EXIT_FAILURE);
273274 }
274275
275276 std::vector<int > adjNodes;
276277 const OrderedNeighborDistanceHash neighbors = get_adjacent_nodes (node);
277278 if (knn > neighbors.size ())
278279 {
279- std::cerr << " Requesting more neighbors from node than it has!!!\n " ;
280- std::cerr << knn << " requested, but only" << neighbors.size () << " neighbors exist\n " ;
280+ LOCO_ERR << " Requesting more neighbors from node than it has!!!\n " ;
281+ LOCO_ERR << knn << " requested, but only" << neighbors.size () << " neighbors exist\n " ;
281282 }
282283 size_t count = 0 ;
283284 for (const std::pair<nodePtr, const double > neighbor : neighbors)
@@ -293,15 +294,15 @@ class GraphData
293294 {
294295 if (!distancesPrecalculated)
295296 {
296- std::cerr << " requesting to return distances from adjacency list, but they have not been precalcualted!\n " ;
297- exit (EXIT_FAILURE);
297+ LOCO_ERR << " requesting to return distances from adjacency list, but they have not been precalcualted!\n " ;
298+ LOCO_EXIT (EXIT_FAILURE);
298299 }
299300
300301 std::vector<nodePtr> adjNodes;
301302 const OrderedNeighborDistanceHash neighbors = get_adjacent_nodes (node);
302303 if (knn > neighbors.size ())
303304 {
304- std::cerr << " Requesting more neighbors from node than it has!!!\n " ;
305+ LOCO_ERR << " Requesting more neighbors from node than it has!!!\n " ;
305306 }
306307 size_t count = 0 ;
307308 for (const std::pair<const nodePtr, const double > neighbor : neighbors)
@@ -320,7 +321,7 @@ class GraphData
320321 {
321322 if (distancesPrecalculated)
322323 {
323- std::cout << " WARNING: requesting to return distances from KD-tree but distances were precalcualted!\n " ;
324+ LOCO_OUT << " WARNING: requesting to return distances from KD-tree but distances were precalcualted!\n " ;
324325 }
325326
326327 std::vector<int > adjNodes;
@@ -358,7 +359,7 @@ class GraphData
358359 {
359360 if (distancesPrecalculated)
360361 {
361- std::cout << " WARNING: requesting to return distances from KD-tree but distances were precalcualted!\n " ;
362+ LOCO_OUT << " WARNING: requesting to return distances from KD-tree but distances were precalcualted!\n " ;
362363 }
363364 std::vector<nodePtr> adjNodes;
364365
@@ -412,15 +413,15 @@ class GraphData
412413 // writes edges between nodes to terminal
413414 void print_adjacency_by_name () const
414415 {
415- std::cout << " ADJ LIST:\n " << " _______________\n " ;
416+ LOCO_OUT << " ADJ LIST:\n " << " _______________\n " ;
416417 for (nodePtr nodeTmp : nodes)
417418 {
418- std::cout << " FROM: " << nodeTmp->get_name () << " \n " ;
419+ LOCO_OUT << " FROM: " << nodeTmp->get_name () << " \n " ;
419420 for (const std::pair<const nodePtr, const double > neighbor : get_adjacent_nodes (nodeTmp))
420421 {
421- std::cout << neighbor.first ->get_name () << " (" << std::to_string (neighbor.second ) << " )" << " - " ;
422+ LOCO_OUT << neighbor.first ->get_name () << " (" << std::to_string (neighbor.second ) << " )" << " - " ;
422423 }
423- std::cout << " \n " ;
424+ LOCO_OUT << " \n " ;
424425 }
425426 }
426427 void print_adjacency_by_order () const
@@ -431,21 +432,21 @@ class GraphData
431432 for (size_t j = 0 ; j < nodes.size (); ++j)
432433 {
433434 double dist = nodeNeighborList.at (nodes.at (j));
434- std::cout << std::to_string (i) << " " << std::to_string (j) << " " << std::to_string (dist) << " \n " ;
435+ LOCO_OUT << std::to_string (i) << " " << std::to_string (j) << " " << std::to_string (dist) << " \n " ;
435436 }
436437 }
437438 }
438439
439440 // writes nodes and their values to terminal
440441 void print_data ()
441442 {
442- std::cout << " NODE VECTORS:\n " << " _______________\n " ;
443+ LOCO_OUT << " NODE VECTORS:\n " << " _______________\n " ;
443444 for (nodePtr nodeTmp : nodes)
444445 {
445- std::cout << " #: " << nodeTmp->get_name () << " \n " ;
446+ LOCO_OUT << " #: " << nodeTmp->get_name () << " \n " ;
446447 for ( const double & dim : nodeTmp->all_values ())
447448 {
448- std::cout << std::to_string (dim) << " \n " ;
449+ LOCO_OUT << std::to_string (dim) << " \n " ;
449450 }
450451 }
451452 }
0 commit comments