Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] Patch: remove Objects from Group


Chronological Thread 
  • From: Li-Ta Lo < >
  • To:
  • Cc: Boonthanome Nouanesengsy < >
  • Subject: [Manta] Patch: remove Objects from Group
  • Date: Tue, 08 Jul 2008 15:46:45 -0600
  • Organization: Los Alamos National Lab

Hi,

Can someone add this into the official tree? I am generating
and deleting Manta objects from VTK dynamically. It creates
memory leak if I can't remove old objects from the world 
group.


Boonth,

This is patch is what you need for the current vtkManta.

Ollie

Index: Mesh.cc
===================================================================
--- Mesh.cc	(revision 2297)
+++ Mesh.cc	(working copy)
@@ -172,6 +172,12 @@
   throw InternalError(string("Illegal call to ") + MANTA_FUNC);
 }
 
+void Mesh::remove(Object* obj)
+{
+  //I don't think this should be allowed.
+  throw InternalError(string("Illegal call to ") + MANTA_FUNC);
+}
+
 void Mesh::set( int i, Object *obj )
 {
   //I don't think this should be allowed.
Index: Group.cc
===================================================================
--- Group.cc	(revision 2297)
+++ Group.cc	(working copy)
@@ -117,6 +117,13 @@
   dirtybbox = true;
 }
 
+void Group::remove(Object* obj)
+{
+  vector<Object*>::iterator iter = find(objs.begin(), objs.end(), obj);
+  if (iter != objs.end())
+    objs.erase(iter);    
+}
+
 void Group::set(size_t i, Object* obj) {
   ASSERT( i < objs.size() );
   objs[i] = obj;
Index: Mesh.h
===================================================================
--- Mesh.h	(revision 2297)
+++ Mesh.h	(working copy)
@@ -72,6 +72,7 @@
 
     //should not be allowed to use Group's add and set.
     virtual void add(Object* obj);
+    virtual void remove(Object* obj);
     virtual void set( int i, Object *obj );
 
     inline MeshTriangle* get( size_t i ) {
Index: Group.h
===================================================================
--- Group.h	(revision 2297)
+++ Group.h	(working copy)
@@ -60,6 +60,7 @@
     virtual bool isParallel() const { return true; }
 
     virtual void add(Object* obj);
+    virtual void remove(Object* obj);
     virtual void set( size_t i, Object* obj );
 
     inline Object* get( size_t i ) {



Archive powered by MHonArc 2.6.16.

Top of page