Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r1984 - trunk/Model/Groups


Chronological Thread 
  • From: boulos@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [Manta] r1984 - trunk/Model/Groups
  • Date: Wed, 9 Jan 2008 18:09:30 -0700 (MST)

Author: boulos
Date: Wed Jan  9 18:09:29 2008
New Revision: 1984

Modified:
   trunk/Model/Groups/DynBVH.cc
   trunk/Model/Groups/DynBVH.h
Log:
Model/Groups/DynBVH.cc
Model/Groups/DynBVH.h

 Adding a bool for whether or not you'd like the BVH to print out the
 build stats. On by default to maintain old behavior (but I'd be glad
 to see it change the other way if nobody wants this by default)


Modified: trunk/Model/Groups/DynBVH.cc
==============================================================================
--- trunk/Model/Groups/DynBVH.cc        (original)
+++ trunk/Model/Groups/DynBVH.cc        Wed Jan  9 18:09:29 2008
@@ -700,7 +700,8 @@
   // TODO(boulos/bigler/thiago/wald/sparker): Parallel rebuild ;)
   if (proc > 0) return;
 
-  cerr << "\nDynBVH::preprocess START (" << currGroup->size() << " 
objects)\n";
+  if (print_info)
+    cerr << "\nDynBVH::preprocess START (" << currGroup->size() << " 
objects)\n";
   double start = Time::currentSeconds();
 
   if(currGroup->size() > object_ids.size()) {
@@ -725,11 +726,13 @@
   double updateBound_start = Time::currentSeconds();
   updateBounds(context, 0);
   double end = Time::currentSeconds();
-  cerr << "\nDynBVH build time: Total ("<<end-start<<")\n"
-       << "object_ids initialization ("<<build_start-start<<")\n"
-       << "build ("<<updateBound_start-build_start<<")\n"
-       << "updateBounds ("<<end-updateBound_start<<")\n"
-       << "BBox = ("<<nodes[0].bounds.getMin()<<", 
"<<nodes[0].bounds.getMax()<<")\n\n";
+  if (print_info) {
+    cerr << "\nDynBVH build time: Total ("<<end-start<<")\n"
+         << "object_ids initialization ("<<build_start-start<<")\n"
+         << "build ("<<updateBound_start-build_start<<")\n"
+         << "updateBounds ("<<end-updateBound_start<<")\n"
+         << "BBox = ("<<nodes[0].bounds.getMin()<<", 
"<<nodes[0].bounds.getMax()<<")\n\n";
+  }
 
   // NOTE(boulos): As of 17-Aug-2007 we don't have a parallel build so
   // this is implicity proc0 anyway and requires no barrier.
@@ -742,8 +745,7 @@
 {
 
   if (objectEnd <= objectBegin) {
-    printf("ERROR! Tried building BVH over %d,%d\n",objectBegin,objectEnd);
-    exit(-1);
+    throw InternalError("Tried building BVH over invalid range");
   }
 
   BVHNode& node = nodes[nodeID];
@@ -781,8 +783,8 @@
     build(context, node.child+1, split, objectEnd,nextFree,depth+1);
   }
 
-  if (depth == 0) {
-    printf("DynBVH Build Complete (used %d nodes)\n", nextFree);
+  if (depth == 0 && print_info) {
+    cerr << "DynBVH Build Complete (used " << nextFree << " nodes)\n";
   }
 }
 

Modified: trunk/Model/Groups/DynBVH.h
==============================================================================
--- trunk/Model/Groups/DynBVH.h (original)
+++ trunk/Model/Groups/DynBVH.h Wed Jan  9 18:09:29 2008
@@ -77,8 +77,10 @@
     char* callback_memory;
     size_t cur_callback;
 
+    bool print_info;
+
   public:
-    DynBVH() : currGroup(NULL), group_changed(false), barrier("DynBVH 
barrier")
+    DynBVH(bool print = true) : currGroup(NULL), group_changed(false), 
barrier("DynBVH barrier"), print_info(print)
     {}
 
     void setGroup(Group* new_group);




  • [Manta] r1984 - trunk/Model/Groups, boulos, 01/09/2008

Archive powered by MHonArc 2.6.16.

Top of page