← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 1955: - missing files in previous commit

 

------------------------------------------------------------
revno: 1955
committer: Bruno Chareyre <bchareyre@r1arduina>
branch nick: trunk
timestamp: Mon 2010-01-11 13:05:56 +0100
message:
  - missing files in previous commit
  - fix a member's name in TW
modified:
  lib/triangulation/TesselationWrapper.cpp
  lib/triangulation/TesselationWrapper.h
  pkg/common/Engine/GlobalEngine/PersistentTriangulationCollider.cpp
  pkg/common/Engine/GlobalEngine/PersistentTriangulationCollider.hpp
  pkg/dem/Engine/GlobalEngine/MicroMacroAnalyser.cpp
  pkg/dem/Engine/GlobalEngine/TesselationWrapper.cpp
  pkg/dem/Engine/GlobalEngine/TesselationWrapper.hpp


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription.
=== modified file 'lib/triangulation/TesselationWrapper.cpp'
--- lib/triangulation/TesselationWrapper.cpp	2010-01-11 10:42:16 +0000
+++ lib/triangulation/TesselationWrapper.cpp	2010-01-11 12:05:56 +0000
@@ -160,12 +160,10 @@
 	Tes->ComputeVolumes();
 }
 
-unsigned int TesselationWrapper::InitFacetIter(void)
+unsigned int TesselationWrapper::NumberOfFacets(bool initIters)
 {
-	facet_begin = Tes->Triangulation().finite_edges_begin ();
-	facet_end = Tes->Triangulation().finite_edges_end ();
-	facet_it = facet_begin;
-	return Tes->Triangulation().number_of_finite_edges ();
+	if (initIters) InitIter();
+	return Tes->Triangulation().number_of_finite_edges();
 }
 
 void TesselationWrapper::InitIter(void)

=== modified file 'lib/triangulation/TesselationWrapper.h'
--- lib/triangulation/TesselationWrapper.h	2010-01-11 10:42:16 +0000
+++ lib/triangulation/TesselationWrapper.h	2010-01-11 12:05:56 +0000
@@ -67,7 +67,7 @@
 	double	Volume	(unsigned int id);
 	
 	/// number of facets in the tesselation (finite branches of the triangulation)
-	unsigned int InitFacetIter(void);
+	unsigned int NumberOfFacets(bool initIters=false);
 	/// set first and last facets, set facet_it = facet_begin
 	void InitIter(void);
 	/// set facet = (body1->id,body2->id), returns facet_it==facet_begin

=== modified file 'pkg/common/Engine/GlobalEngine/PersistentTriangulationCollider.cpp'
--- pkg/common/Engine/GlobalEngine/PersistentTriangulationCollider.cpp	2010-01-10 09:09:32 +0000
+++ pkg/common/Engine/GlobalEngine/PersistentTriangulationCollider.cpp	2010-01-11 12:05:56 +0000
@@ -13,8 +13,8 @@
 #include<utility>
 #include<vector>
 #include<yade/pkg-common/Sphere.hpp>
-#include<yade/pkg-common/ElastMat.hpp>
-#include<yade/lib-triangulation/TesselationWrapper.h>
+#include<yade/pkg-common/ElasticMat.hpp>
+#include<yade/pkg-dem/TesselationWrapper.hpp>
 
 YADE_REQUIRE_FEATURE(CGAL)
 
@@ -23,7 +23,7 @@
 	noTransientIfPersistentExists=false;
 	haveDistantTransient=false;
 	isTriangulated = false;
-	Tes = new ( CGT::TesselationWrapper );
+	Tes = new ( TesselationWrapper );
 
 	nbObjects=0;
 	xBounds.clear();
@@ -106,7 +106,7 @@
 		unsigned int& id1 = interaction_pair.first;
 		unsigned int& id2 = interaction_pair.second;
 
-		unsigned int numberOfInteractions = Tes->NumberOfFacets();
+		unsigned int numberOfInteractions = Tes->NumberOfFacets(true);
 		for ( unsigned int i=0; i<numberOfInteractions; ++i )
 		{
 			Tes->nextFacet ( interaction_pair );

=== modified file 'pkg/common/Engine/GlobalEngine/PersistentTriangulationCollider.hpp'
--- pkg/common/Engine/GlobalEngine/PersistentTriangulationCollider.hpp	2009-12-18 09:48:16 +0000
+++ pkg/common/Engine/GlobalEngine/PersistentTriangulationCollider.hpp	2010-01-11 12:05:56 +0000
@@ -15,7 +15,7 @@
 #include <vector>
 #include <algorithm>
 
-#include<yade/lib-triangulation/TesselationWrapper.h>
+#include<yade/pkg-dem/TesselationWrapper.hpp>
 
 
 /*! \brief Collision detection engine based on regular triangulation.
@@ -33,7 +33,7 @@
 {
 	private :
 	
-		CGT::TesselationWrapper* Tes;	
+		TesselationWrapper* Tes;	
 		// represent an extrmity of an Axis ALigned bounding box
 		struct AABBBound
 		{

=== modified file 'pkg/dem/Engine/GlobalEngine/MicroMacroAnalyser.cpp'
--- pkg/dem/Engine/GlobalEngine/MicroMacroAnalyser.cpp	2010-01-11 10:42:16 +0000
+++ pkg/dem/Engine/GlobalEngine/MicroMacroAnalyser.cpp	2010-01-11 12:05:56 +0000
@@ -7,10 +7,10 @@
 *************************************************************************/
 
 
-#include<yade/pkg-common/ElastMat.hpp>
+#include<yade/pkg-common/ElasticMat.hpp>
 #include<yade/pkg-dem/ScGeom.hpp>
 
-#include<yade/pkg-dem/FrictPhys.hpp>
+#include<yade/pkg-dem/ElasticContactInteraction.hpp>
 
 #include<yade/core/Omega.hpp>
 #include<yade/core/Scene.hpp>
@@ -124,7 +124,7 @@
 		else {//then it is a sphere (not a wall)
 			++Ng;
 			const Sphere* s = YADE_CAST<Sphere*> ( ( *bi )->shape.get() );
-			//const FrictMat* p = YADE_CAST<FrictMat*> ( ( *bi )->material.get() );
+			//const GranularMat* p = YADE_CAST<GranularMat*> ( ( *bi )->material.get() );
 			const Vector3r& pos = (*bi)->state->pos;
 			Real rad = s->radius;
 
@@ -178,8 +178,8 @@
 // 								 ( grains[id2].sphere.weight() *c->normal ) );
 
 
-			c->fn = YADE_CAST<FrictPhys*> ( ( ( *ii )->interactionPhysics.get() ) )->normalForce.Dot ( ( YADE_CAST<ScGeom*> ( ( *ii )->interactionGeometry.get() ) )->normal );
-			Vector3r fs = YADE_CAST<FrictPhys*> ( ( *ii )->interactionPhysics.get() )->shearForce;
+			c->fn = YADE_CAST<ElasticContactInteraction*> ( ( ( *ii )->interactionPhysics.get() ) )->normalForce.Dot ( ( YADE_CAST<ScGeom*> ( ( *ii )->interactionGeometry.get() ) )->normal );
+			Vector3r fs = YADE_CAST<ElasticContactInteraction*> ( ( *ii )->interactionPhysics.get() )->shearForce;
 			c->fs = CGT::Vecteur ( fs.X(),fs.Y(),fs.Z() );
 			c->old_fn = c->fn;
 			c->old_fs = c->fs;

=== modified file 'pkg/dem/Engine/GlobalEngine/TesselationWrapper.cpp'
--- pkg/dem/Engine/GlobalEngine/TesselationWrapper.cpp	2010-01-11 10:42:16 +0000
+++ pkg/dem/Engine/GlobalEngine/TesselationWrapper.cpp	2010-01-11 12:05:56 +0000
@@ -25,13 +25,11 @@
 			return Gt::Less_x_3()(* (p.first),* (q.first));
 		}
 	};
-
 	struct Less_y_3 {
 		bool operator()(const Point_3& p,const Point_3& q) const {
 			return Gt::Less_y_3()(* (p.first),* (q.first));
 		}
 	};
-
 	struct Less_z_3 {
 		bool operator()(const Point_3& p,const Point_3& q) const {
 			return Gt::Less_z_3()(* (p.first),* (q.first));
@@ -67,7 +65,7 @@
 			const Sphere* s = YADE_CAST<Sphere*> ((*bi)->shape.get());
 			const Vector3r& pos = (*bi)->state->pos;
 			const Real rad = s->radius;
-			CGT::Sphere sp (CGT::Point(pos[0],pos[1],pos[2]),rad*rad);
+			CGT::Sphere sp(CGT::Point(pos[0],pos[1],pos[2]),rad*rad);
 			spheres.push_back(sp);
 			pointsPtrs.push_back(std::make_pair(&(spheres[Ng]/*.point()*/),(*bi)->getId()));
 			Ng++;
@@ -81,7 +79,7 @@
 	spatial_sort(pointsPtrs.begin(),pointsPtrs.end(), RTraits_for_spatial_sort()/*, CGT::RTriangulation::Weighted_point*/);
 
 	CGT::RTriangulation::Cell_handle hint;
-	
+
 	long Nt = 0;
 	for (std::vector<std::pair<const CGT::Sphere*,body_id_t> >::const_iterator
 			p = pointsPtrs.begin();p != pointsPtrs.end(); ++p) {
@@ -89,11 +87,11 @@
 		CGT::RTriangulation::Cell_handle c;
 		int li, lj;
 		c = T.locate(* (p->first), lt, li, lj, hint);
-		CGT::RTriangulation::Vertex_handle v = T.insert(* (p->first), lt, c, li, lj);
+		CGT::RTriangulation::Vertex_handle v = T.insert(*(p->first),lt,c,li,lj);
 		if (v==CGT::RTriangulation::Vertex_handle())
 			hint=c;
 		else {
-			v->info() =  (const unsigned int) p->second;
+			v->info() = (const unsigned int) p->second;
 			//Vh->info().isFictious = false;//false is the default
 			Tes.max_id = std::max(Tes.max_id,(const unsigned int) p->second);
 			hint=v->cell();
@@ -113,25 +111,25 @@
 static CGT::Point Pmin;
 static CGT::Point Pmax;
 static double inf = 1e10;
- double pminx=0;
- double pminy=0;
- double pminz=0;
- double pmaxx=0;
- double pmaxy=0;
- double pmaxz=0;
- double thickness = 0;
+double pminx=0;
+double pminy=0;
+double pminz=0;
+double pmaxx=0;
+double pmaxy=0;
+double pmaxz=0;
+double thickness = 0;
 
-//  Finite_edges_iterator facet_it;	//an edge in a triangulation is a facet in corresponding tesselation, remember...
-					//That explain the name.
+//  Finite_edges_iterator facet_it; //an edge in a triangulation is a facet in corresponding tesselation, remember...
+//That explain the name.
 
 TesselationWrapper::TesselationWrapper()
 {
 	Tes = new CGT::Tesselation;
 	inf = 1e10;
 	clear();
-	facet_begin = Tes->Triangulation().finite_edges_begin ();
-	facet_end = Tes->Triangulation().finite_edges_end ();
-	facet_it = Tes->Triangulation().finite_edges_begin ();
+	facet_begin = Tes->Triangulation().finite_edges_begin();
+	facet_end = Tes->Triangulation().finite_edges_end();
+	facet_it = Tes->Triangulation().finite_edges_begin();
 }
 
 
@@ -139,54 +137,44 @@
 {
 	delete Tes;
 }
-  
- void TesselationWrapper::clear(void)
- {
- 	Tes->Clear();
+
+void TesselationWrapper::clear(void)
+{
+	Tes->Clear();
 	Pmin = CGT::Point(inf, inf, inf);
 	Pmax = CGT::Point(-inf, -inf, -inf);
 	mean_radius = 0;
 	n_spheres = 0;
 	rad_divided = false;
 	bounded = false;
-	facet_it = Tes->Triangulation().finite_edges_end ();
-	
- }
-
- 
- 
- void TesselationWrapper::clear2(void) //for testing purpose
- {
- 	Tes->Clear();
- 	
-//  	Pmin = Point(inf, inf, inf);
-// 	Pmax = Point(-inf, -inf, -inf);
-// 	mean_radius = 0;
-// 	n_spheres = 0;
-// 	rad_divided = false;
-//	bounded = false;
-// 	facet_it = Tes->Triangulation().finite_edges_end ();
- } 
-
- bool TesselationWrapper::insertSceneSpheres(const Scene* scene)
- {
-	 const shared_ptr<BodyContainer>& bodies = scene->bodies;
-	 build_triangulation_with_ids(bodies, *this);
-	 return 1;
- }
- 
- 
- 
-double TesselationWrapper::Volume( unsigned int id )
-{
-	return Tes->Volume(id);
-
-}
+	facet_it = Tes->Triangulation().finite_edges_end();
+}
+
+void TesselationWrapper::clear2(void) //for testing purpose
+{
+	Tes->Clear();
+
+//   Pmin = Point(inf, inf, inf);
+//  Pmax = Point(-inf, -inf, -inf);
+//  mean_radius = 0;
+//  n_spheres = 0;
+//  rad_divided = false;
+// bounded = false;
+//  facet_it = Tes->Triangulation().finite_edges_end ();
+}
+
+bool TesselationWrapper::insertSceneSpheres(const Scene* scene)
+{
+	const shared_ptr<BodyContainer>& bodies = scene->bodies;
+	build_triangulation_with_ids(bodies, *this);
+	return 1;
+}
+
+double TesselationWrapper::Volume(unsigned int id) {return Tes->Volume(id);}
 
 bool TesselationWrapper::insert(double x, double y, double z, double rad, unsigned int id)
 {
 	using namespace std;
-
 	Pmin = CGT::Point(min(Pmin.x(), x-rad),
 					  min(Pmin.y(), y-rad),
 					  min(Pmin.z(), z-rad));
@@ -195,161 +183,151 @@
 					  max(Pmax.z(), z+rad));
 	mean_radius += rad;
 	++n_spheres;
-
 	return (Tes->insert(x,y,z,rad,id)!=NULL);
 }
 
 void TesselationWrapper::checkMinMax(double x, double y, double z, double rad)
-{	
+{
 	using namespace std;
-	Pmin = CGT::Point( min(Pmin.x(), x-rad),
-							min(Pmin.y(), y-rad),
-							min(Pmin.z(), z-rad) );
-	Pmax = CGT::Point( max(Pmax.x(), x+rad),
-							max(Pmax.y(), y+rad),
-							max(Pmax.z(), z+rad) );
-		mean_radius += rad;
-		++n_spheres;
-		
-		//return (Tes->insert(x,y,z,rad,id)!=NULL);
+	Pmin = CGT::Point(min(Pmin.x(), x-rad),
+					  min(Pmin.y(), y-rad),
+					  min(Pmin.z(), z-rad));
+	Pmax = CGT::Point(max(Pmax.x(), x+rad),
+					  max(Pmax.y(), y+rad),
+					  max(Pmax.z(), z+rad));
+	mean_radius += rad;
+	++n_spheres;
 }
 
 
 bool TesselationWrapper::move(double x, double y, double z, double rad, unsigned int id)
-{	
+{
 	using namespace std;
 
-	Pmin = CGT::Point( min(Pmin.x(), x-rad),
-							min(Pmin.y(), y-rad),
-							min(Pmin.z(), z-rad) );
-	Pmax = CGT::Point( max(Pmax.x(), x+rad),
-							max(Pmax.y(), y+rad),
-							max(Pmax.z(), z+rad) );
-		mean_radius += rad;
-				
-		if (Tes->move(x,y,z,rad,id)!=NULL)		
+	Pmin = CGT::Point(min(Pmin.x(), x-rad),
+					  min(Pmin.y(), y-rad),
+					  min(Pmin.z(), z-rad));
+	Pmax = CGT::Point(max(Pmax.x(), x+rad),
+					  max(Pmax.y(), y+rad),
+					  max(Pmax.z(), z+rad));
+	mean_radius += rad;
+
+	if (Tes->move(x,y,z,rad,id)!=NULL)
 		return true;
-		else {
-		cerr << "Tes->move(x,y,z,rad,id)==NULL" << endl; return false;}
+	else {
+		cerr << "Tes->move(x,y,z,rad,id)==NULL" << endl; return false;
+	}
 }
 
 
-void TesselationWrapper::ComputeTesselation( void )
+void TesselationWrapper::ComputeTesselation(void)
 {
 	if (!rad_divided) {
 		mean_radius /= n_spheres;
-		rad_divided = true;}
-	Tes->Compute();	
+		rad_divided = true;
+	}
+	Tes->Compute();
 }
- void TesselationWrapper::ComputeTesselation( double pminx, double pmaxx, double pminy, double pmaxy, double pminz, double pmaxz, double dt)
-{	
- 	AddBoundingPlanes( pminx, pmaxx,  pminy,  pmaxy, pminz, pmaxz, dt);
+void TesselationWrapper::ComputeTesselation(double pminx, double pmaxx, double pminy, double pmaxy, double pminz, double pmaxz, double dt)
+{
+	AddBoundingPlanes(pminx, pmaxx,  pminy,  pmaxy, pminz, pmaxz, dt);
 	ComputeTesselation();
 }
 
 void TesselationWrapper::ComputeVolumes(void)
 {
-  	ComputeTesselation();
+	ComputeTesselation();
 	Tes->ComputeVolumes();
 }
-
-unsigned int TesselationWrapper::InitFacetIter(void)
+unsigned int TesselationWrapper::NumberOfFacets(bool initIters)
 {
-	facet_begin = Tes->Triangulation().finite_edges_begin ();
-	facet_end = Tes->Triangulation().finite_edges_end ();
-	facet_it = facet_begin;
-	return Tes->Triangulation().number_of_finite_edges ();
+	if (initIters) InitIter();
+	return Tes->Triangulation().number_of_finite_edges();
 }
 
 void TesselationWrapper::InitIter(void)
 {
-	facet_begin = Tes->Triangulation().finite_edges_begin ();
-	facet_end = Tes->Triangulation().finite_edges_end ();
+	facet_begin = Tes->Triangulation().finite_edges_begin();
+	facet_end = Tes->Triangulation().finite_edges_end();
 	facet_it = facet_begin;
 }
 
-bool TesselationWrapper::nextFacet (std::pair<unsigned int,unsigned int>& facet)
-{	
+bool TesselationWrapper::nextFacet(std::pair<unsigned int,unsigned int>& facet)
+{
 	if (facet_end==facet_it) return false;
-	facet.first = facet_it->first->vertex ( facet_it->second )->info().id();
-	facet.second = facet_it->first->vertex ( (facet_it)->third )->info().id();
+	facet.first = facet_it->first->vertex(facet_it->second)->info().id();
+	facet.second = facet_it->first->vertex((facet_it)->third)->info().id();
 	++facet_it;
 	return true;
 }
 
 
- 
+
 void TesselationWrapper::AddBoundingPlanes(double pminx, double pmaxx, double pminy, double pmaxy, double pminz, double pmaxz,double dt)
-{	
-// 	cout << " pminx                                                    " << pminx << endl;
-// 	cout << " pminy                                                    " << pminy << endl;
-// 	cout << " pminz                                                    " << pminz << endl;
-// 	cout << " pmaxx                                                    " << pmaxx << endl;
-// 	cout << " pmaxy                                                    " << pmaxy << endl;
-// 	cout << " pmaxz                                                    " << pmaxz << endl;
-	if (dt == 0)
-	{
-// 	cout << "thickness               =               " << dt << endl;
-// 	thickness = -1*pminx;
+{
+//  cout << " pminx                                                    " << pminx << endl;
+//  cout << " pminy                                                    " << pminy << endl;
+//  cout << " pminz                                                    " << pminz << endl;
+//  cout << " pmaxx                                                    " << pmaxx << endl;
+//  cout << " pmaxy                                                    " << pmaxy << endl;
+//  cout << " pmaxz                                                    " << pmaxz << endl;
+	if (dt == 0) {
+//  cout << "thickness               =               " << dt << endl;
+//  thickness = -1*pminx;
 		thickness = -1*pminx;
 	}
-// 	cout << "thickness               =               " << thickness << endl;
-	if (!bounded) {
-	if (!rad_divided) {
-		mean_radius /= n_spheres;
-		rad_divided = true;}
-	double FAR = 10000;
-	
-	Tes->redirect();
-	//Add big bounding spheres with isFictious=true
-	
-	Tes->vertexHandles[0]=Tes->insert(0.5*(pminx+pmaxx), pminy-FAR*(pmaxx-pminx), 0.5*(pmaxz-pminz), FAR*(pmaxx-pminx)+thickness, 0, true);
-	Tes->vertexHandles[1]=Tes->insert(0.5*(pminx+pmaxx), pmaxy+FAR*(pmaxx-pminx), 0.5*(pmaxz-pminz), FAR*(pmaxx-pminx)+thickness, 1, true);
-	Tes->vertexHandles[2]=Tes->insert(pminx-FAR*(pmaxy-pminy), 0.5*(pmaxy-pminy), 0.5*(pmaxz-pminz), FAR*(pmaxy-pminy)+thickness, 2, true);
-	Tes->vertexHandles[3]=Tes->insert(pmaxx+FAR*(pmaxx-pminy), 0.5*(pmaxy-pminy), 0.5*(pmaxz-pminz), FAR*(pmaxy-pminy)+thickness, 3, true);
-	Tes->vertexHandles[4]=Tes->insert(0.5*(pminx+pmaxx), 0.5*(pmaxy-pminy), pminz-FAR*(pmaxy-pminy), FAR*(pmaxy-pminy)+thickness, 4, true);
-	Tes->vertexHandles[5]=Tes->insert(0.5*(pminx+pmaxx), 0.5*(pmaxy-pminy), pmaxz+FAR*(pmaxy-pminy), FAR*(pmaxy-pminy)+thickness, 5, true);
-	bounded = true;
-
-
-	}
-
-}
-
-
- 
-
-
-void 	TesselationWrapper::AddBoundingPlanes (void)
-{	
-
-	if (!bounded) {
-	if (!rad_divided) {
-		mean_radius /= n_spheres;
-		rad_divided = true;}
-	double FAR = 10000;
-	
-	Tes->redirect();
-	//Add big bounding spheres with isFictious=true
-	
-	Tes->vertexHandles[0]=Tes->insert(0.5*(Pmin.x()+Pmax.x()), Pmin.y()-FAR*(Pmax.x()-Pmin.x()), 0.5*(Pmax.z()-Pmin.z()), FAR*(Pmax.x()-Pmin.x()), 0, true);
-	Tes->vertexHandles[1]=Tes->insert(0.5*(Pmin.x()+Pmax.x()), Pmax.y()+FAR*(Pmax.x()-Pmin.x()), 0.5*(Pmax.z()-Pmin.z()), FAR*(Pmax.x()-Pmin.x()), 1, true);
-	Tes->vertexHandles[2]=Tes->insert(Pmin.x()-FAR*(Pmax.y()-Pmin.y()), 0.5*(Pmax.y()-Pmin.y()), 0.5*(Pmax.z()-Pmin.z()), FAR*(Pmax.y()-Pmin.y()), 2, true);
-	Tes->vertexHandles[3]=Tes->insert(Pmax.x()+FAR*(Pmax.y()-Pmin.y()), 0.5*(Pmax.y()-Pmin.y()), 0.5*(Pmax.z()-Pmin.z()), FAR*(Pmax.y()-Pmin.y()), 3, true);
-	Tes->vertexHandles[4]=Tes->insert(0.5*(Pmin.x()+Pmax.x()), 0.5*(Pmax.y()-Pmin.y()), Pmin.z()-FAR*(Pmax.y()-Pmin.y()), FAR*(Pmax.y()-Pmin.y()), 4, true);
-	Tes->vertexHandles[5]=Tes->insert(0.5*(Pmin.x()+Pmax.x()), 0.5*(Pmax.y()-Pmin.y()), Pmax.z()+FAR*(Pmax.y()-Pmin.y()), FAR*(Pmax.y()-Pmin.y()), 5, true);
-	bounded = true;
-	}
-	
-
-	
-} 
-
-
-void 	TesselationWrapper::RemoveBoundingPlanes (void)
-{
-
-	cerr << "start redirection";	
+//  cout << "thickness               =               " << thickness << endl;
+	if (!bounded) {
+		if (!rad_divided) {
+			mean_radius /= n_spheres;
+			rad_divided = true;
+		}
+		double FAR = 10000;
+
+		Tes->redirect();
+		//Add big bounding spheres with isFictious=true
+
+		Tes->vertexHandles[0]=Tes->insert(0.5*(pminx+pmaxx), pminy-FAR*(pmaxx-pminx), 0.5*(pmaxz-pminz), FAR*(pmaxx-pminx)+thickness, 0, true);
+		Tes->vertexHandles[1]=Tes->insert(0.5*(pminx+pmaxx), pmaxy+FAR*(pmaxx-pminx), 0.5*(pmaxz-pminz), FAR*(pmaxx-pminx)+thickness, 1, true);
+		Tes->vertexHandles[2]=Tes->insert(pminx-FAR*(pmaxy-pminy), 0.5*(pmaxy-pminy), 0.5*(pmaxz-pminz), FAR*(pmaxy-pminy)+thickness, 2, true);
+		Tes->vertexHandles[3]=Tes->insert(pmaxx+FAR*(pmaxx-pminy), 0.5*(pmaxy-pminy), 0.5*(pmaxz-pminz), FAR*(pmaxy-pminy)+thickness, 3, true);
+		Tes->vertexHandles[4]=Tes->insert(0.5*(pminx+pmaxx), 0.5*(pmaxy-pminy), pminz-FAR*(pmaxy-pminy), FAR*(pmaxy-pminy)+thickness, 4, true);
+		Tes->vertexHandles[5]=Tes->insert(0.5*(pminx+pmaxx), 0.5*(pmaxy-pminy), pmaxz+FAR*(pmaxy-pminy), FAR*(pmaxy-pminy)+thickness, 5, true);
+		bounded = true;
+	}
+}
+
+void  TesselationWrapper::AddBoundingPlanes(void)
+{
+
+	if (!bounded) {
+		if (!rad_divided) {
+			mean_radius /= n_spheres;
+			rad_divided = true;
+		}
+		double FAR = 10000;
+
+		Tes->redirect();
+		//Add big bounding spheres with isFictious=true
+
+		Tes->vertexHandles[0]=Tes->insert(0.5*(Pmin.x()+Pmax.x()), Pmin.y()-FAR*(Pmax.x()-Pmin.x()), 0.5*(Pmax.z()-Pmin.z()), FAR*(Pmax.x()-Pmin.x()), 0, true);
+		Tes->vertexHandles[1]=Tes->insert(0.5*(Pmin.x()+Pmax.x()), Pmax.y()+FAR*(Pmax.x()-Pmin.x()), 0.5*(Pmax.z()-Pmin.z()), FAR*(Pmax.x()-Pmin.x()), 1, true);
+		Tes->vertexHandles[2]=Tes->insert(Pmin.x()-FAR*(Pmax.y()-Pmin.y()), 0.5*(Pmax.y()-Pmin.y()), 0.5*(Pmax.z()-Pmin.z()), FAR*(Pmax.y()-Pmin.y()), 2, true);
+		Tes->vertexHandles[3]=Tes->insert(Pmax.x()+FAR*(Pmax.y()-Pmin.y()), 0.5*(Pmax.y()-Pmin.y()), 0.5*(Pmax.z()-Pmin.z()), FAR*(Pmax.y()-Pmin.y()), 3, true);
+		Tes->vertexHandles[4]=Tes->insert(0.5*(Pmin.x()+Pmax.x()), 0.5*(Pmax.y()-Pmin.y()), Pmin.z()-FAR*(Pmax.y()-Pmin.y()), FAR*(Pmax.y()-Pmin.y()), 4, true);
+		Tes->vertexHandles[5]=Tes->insert(0.5*(Pmin.x()+Pmax.x()), 0.5*(Pmax.y()-Pmin.y()), Pmax.z()+FAR*(Pmax.y()-Pmin.y()), FAR*(Pmax.y()-Pmin.y()), 5, true);
+		bounded = true;
+	}
+
+
+
+}
+
+
+void  TesselationWrapper::RemoveBoundingPlanes(void)
+{
+
+	cerr << "start redirection";
 	Tes->redirect();
 	cerr << " | start redirection" << endl;
 	Tes->remove(0);
@@ -375,24 +353,24 @@
 
 // int main()
 // {
-// 	std::list<Point> input;
-// 
-// 	input.push_back ( Point ( 0,0,0 ) );
-// 	input.push_back ( Point ( 1,0,0 ) );
-// 	input.push_back ( Point ( 0,1,0 ) );
-// 	input.push_back ( Point ( 0,0,1 ) );
-// 	input.push_back ( Point ( 2,2,2 ) );
-// 	input.push_back ( Point ( -1,0,1 ) );
-// 
-// 	Delaunay T;
-// 
-// 	build_triangulation_with_indices ( input.begin(),input.end(),T );
-// 
-// 	Delaunay::Finite_vertices_iterator vit;
-// 	for ( vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit )
-// 		std::cout << vit->info() << "\n"; //prints the position in input
-// 
-// 	return 0;
+//  std::list<Point> input;
+//
+//  input.push_back ( Point ( 0,0,0 ) );
+//  input.push_back ( Point ( 1,0,0 ) );
+//  input.push_back ( Point ( 0,1,0 ) );
+//  input.push_back ( Point ( 0,0,1 ) );
+//  input.push_back ( Point ( 2,2,2 ) );
+//  input.push_back ( Point ( -1,0,1 ) );
+//
+//  Delaunay T;
+//
+//  build_triangulation_with_indices ( input.begin(),input.end(),T );
+//
+//  Delaunay::Finite_vertices_iterator vit;
+//  for ( vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit )
+//   std::cout << vit->info() << "\n"; //prints the position in input
+//
+//  return 0;
 // }
 
 

=== modified file 'pkg/dem/Engine/GlobalEngine/TesselationWrapper.hpp'
--- pkg/dem/Engine/GlobalEngine/TesselationWrapper.hpp	2010-01-11 10:42:16 +0000
+++ pkg/dem/Engine/GlobalEngine/TesselationWrapper.hpp	2010-01-11 12:05:56 +0000
@@ -37,10 +37,11 @@
     	bool insert(double x, double y, double z, double rad, unsigned int id);
 	/// A faster version of insert
 	bool insertSceneSpheres(const Scene* scene);
-	/// Move one sphere to the new position and maintain triangulation (invalidates the tesselation)
+	/// Move one sphere to the new position (x,y,z) and maintain triangulation (invalidates the tesselation)
 	bool move (double x, double y, double z, double rad, unsigned int id);
 	
     	void checkMinMax(double x, double y, double z, double rad);//for experimentation purpose	
+	/// Reset the triangulation
     	void clear(void);
     	void clear2(void);
     	    	
@@ -60,10 +61,10 @@
 	double	Volume	(unsigned int id);
 	
 	/// number of facets in the tesselation (finite branches of the triangulation)
-	unsigned int InitFacetIter(void);
+	unsigned int NumberOfFacets(bool initIters=false);
 	/// set first and last facets, set facet_it = facet_begin
 	void InitIter(void);
-	/// set facet = (body1->id,body2->id), returns facet_it==facet_begin
+	/// set facet = next pair (body1->id,body2->id), returns facet_it==facet_end
 	bool nextFacet (std::pair<unsigned int, unsigned int>& facet);
 	
 private: