← Back to team overview

yade-dev team mailing list archive

[svn] r1902 - in trunk/pkg: lattice/DataClass/PhysicalParameters lattice/Engine/StandAloneEngine lattice/PreProcessor snow/PreProcessor/Voxel

 

Author: cosurgi
Date: 2009-07-29 13:05:36 +0200 (Wed, 29 Jul 2009)
New Revision: 1902

Modified:
   trunk/pkg/lattice/DataClass/PhysicalParameters/LatticeBeamParameters.hpp
   trunk/pkg/lattice/Engine/StandAloneEngine/NodeRecorder.cpp
   trunk/pkg/lattice/PreProcessor/LatticeExample.cpp
   trunk/pkg/lattice/PreProcessor/LatticeExample.hpp
   trunk/pkg/snow/PreProcessor/Voxel/Config.cpp
   trunk/pkg/snow/PreProcessor/Voxel/Config.hpp
   trunk/pkg/snow/PreProcessor/Voxel/DataVoxel.cpp
   trunk/pkg/snow/PreProcessor/Voxel/GrainSurface.cpp
   trunk/pkg/snow/PreProcessor/Voxel/SafeVectors3.cpp
   trunk/pkg/snow/PreProcessor/Voxel/SafeVectors3.hpp
   trunk/pkg/snow/PreProcessor/Voxel/VoxelEnvelope.cpp
Log:
- fix all my warnings
- lattice generator improvements wrt concrete with steel fibres



Modified: trunk/pkg/lattice/DataClass/PhysicalParameters/LatticeBeamParameters.hpp
===================================================================
--- trunk/pkg/lattice/DataClass/PhysicalParameters/LatticeBeamParameters.hpp	2009-07-29 09:17:45 UTC (rev 1901)
+++ trunk/pkg/lattice/DataClass/PhysicalParameters/LatticeBeamParameters.hpp	2009-07-29 11:05:36 UTC (rev 1902)
@@ -18,7 +18,7 @@
 		Real                     strain_;
 	public :
 		// element
-		unsigned int             id1
+		int                      id1
 					,id2;
 		// state		
 		Real  			 initialLength

Modified: trunk/pkg/lattice/Engine/StandAloneEngine/NodeRecorder.cpp
===================================================================
--- trunk/pkg/lattice/Engine/StandAloneEngine/NodeRecorder.cpp	2009-07-29 09:17:45 UTC (rev 1901)
+++ trunk/pkg/lattice/Engine/StandAloneEngine/NodeRecorder.cpp	2009-07-29 11:05:36 UTC (rev 1902)
@@ -176,7 +176,7 @@
 				++count;
 				
 				//(*(ncb->bodies))[*i]->geometricalModel->diffuseColor = Vector3r(((float)((region+3)%5))/5.0,1.0,((float)region)/5.0); // FIXME [1]
-				Vector3r col;
+				Vector3r col(0,0,0);
 				switch(region%6)
 				{       //                    0 0 0
 					case 0 : col=Vector3r(0,0,1);break;
@@ -204,4 +204,4 @@
 	// GLDrawSomething can just put a getClassName()
 }
 
-YADE_PLUGIN("NodeRecorder");
\ No newline at end of file
+YADE_PLUGIN("NodeRecorder");

Modified: trunk/pkg/lattice/PreProcessor/LatticeExample.cpp
===================================================================
--- trunk/pkg/lattice/PreProcessor/LatticeExample.cpp	2009-07-29 09:17:45 UTC (rev 1901)
+++ trunk/pkg/lattice/PreProcessor/LatticeExample.cpp	2009-07-29 11:05:36 UTC (rev 1902)
@@ -59,6 +59,10 @@
         nodeGroupMask           = 1;
         beamGroupMask           = 2;
 	quadGroupMask		= 4;
+	fibreGroupMask		= 8;
+	aggGroupMask		= 16;
+	fibreBondGroupMask	= 32;
+	bondGroupMask		= 64;
         
         speciemen_size_in_meters = Vector3r(0.1,0.1,0.0001);
         cellsizeUnit_in_meters   = 0.01;//0.003;
@@ -176,7 +180,7 @@
 	CT			 = 1;
 
         useAggregates            = false;
-	no_Agg_outside		 = true;
+	no_Agg_outside		 = false;
         aggregatePercent         = 40;
         aggregateMeanDiameter    = cellsizeUnit_in_meters*1;
         aggregateSigmaDiameter   = cellsizeUnit_in_meters*2;
@@ -274,6 +278,9 @@
 
 bool LatticeExample::generate()
 {
+	no_Agg_outside = false;
+	std::cerr << "no_Agg_outside parameter is not used.\n";
+
 	fibres_total=0;
 	matrix_total=0;
 	beam_total=0;
@@ -393,6 +400,7 @@
 					}
 				}
 			}
+			setStatus("Delaunay 2d... done");
 		}
 		else
 		{
@@ -420,6 +428,7 @@
 					}
 				}
 			}
+			setStatus("Delaunay 3d... done");
 		}
 
 	}
@@ -482,6 +491,7 @@
 	} // beams are created
 
 
+	setStatus("strain recorder nodes...");
         { // subscribe two nodes, that are monitored by strain recoder to get a measure of length
                 bi    = rootBody->bodies->begin();
                 biEnd = rootBody->bodies->end();
@@ -506,6 +516,7 @@
                 measurePoisson->upper  =node2Id; // upper
         }
         
+	setStatus("poisson recorder nodes...");
         { // subscribe two nodes, that are monitored by MeasurePoisson to get a measure of poisson
                 bi    = rootBody->bodies->begin();
                 biEnd = rootBody->bodies->end();
@@ -532,9 +543,15 @@
 
         bi    = bc.begin();
         biEnd = bc.end();
-        for(  ; bi!=biEnd ; ++bi )  // loop over all newly created beams ...
+	float all_bodies = bc.size();
+	setStatus("Copy beam data...");
+        for( int curr=0 ; bi!=biEnd ; ++bi,++curr )  // loop over all newly created beams ...
         {
-		if(shouldTerminate()) return false;
+		if(curr % 100 == 0)
+		{
+			if(shouldTerminate()) return false;
+			setProgress((float)(curr)/(float)(all_bodies));
+		}
 
                 shared_ptr<Body> b = *bi;
                 rootBody->bodies->insert(b); // .. to insert them into rootBody
@@ -559,16 +576,22 @@
         measurePoisson->vertical                =   (*(rootBody->bodies))[subscribedBodies[1]]->physicalParameters->se3.position[1] 
                                                   - (*(rootBody->bodies))[subscribedBodies[0]]->physicalParameters->se3.position[1];
                 
+	setStatus("Find neighbours...");
         { // remember what node is in contact with what beams
                 //    node                   beams
 		connections.resize(totalNodesCount);
 		
 		bi    = rootBody->bodies->begin();
 		biEnd = rootBody->bodies->end();
+		float all_bodies = rootBody->bodies->size();
 		
-		for(  ; bi!=biEnd ; ++bi )  // loop over all beams
+		for( int curr=0 ; bi!=biEnd ; ++bi,++curr )  // loop over all beams
 		{
-			if(shouldTerminate()) return false;
+			if(curr % 100 == 0)
+			{
+				if(shouldTerminate()) return false;
+				setProgress((float)(curr)/(float)(all_bodies));
+			}
 
 			Body* body = (*bi).get();
 			if( ! ( body->getGroupMask() & beamGroupMask ) )
@@ -585,17 +608,14 @@
 		bi    = rootBody->bodies->begin();
 		biEnd = rootBody->bodies->end();
 		float all_bodies = rootBody->bodies->size();
-		int current = 0;
-		for(  ; bi!=biEnd ; ++bi )  // loop over all beams
+		for( int curr=0 ; bi!=biEnd ; ++bi,++curr )  // loop over all beams
 		{
-			if(shouldTerminate()) return false;
-
-			if( ++current % 100 == 0 )
+			if(curr % 100 == 0)
 			{
-				//cerr << "angular springs: " << current << " , " << ((static_cast<float>(current)/all_bodies)*100.0) << " %\n";
-				setProgress(((float)(current)/all_bodies));
+				if(shouldTerminate()) return false;
+				setProgress((float)(curr)/(float)(all_bodies));
 			}
-				
+
 			Body* body = (*bi).get();
 			if( ! ( body->getGroupMask() & beamGroupMask ) )
 				continue; // skip non-beams
@@ -1377,18 +1397,30 @@
         }
 }
 
-
 /////////////////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////////////////
 
-bool LatticeExample::overlaps(Circle& cc,std::vector<Circle>& c)
+int LatticeExample::overlapCount(std::vector<Circle>& c,float threshold)
 {
+	int res=0;
+	for(size_t i=0 ; i<c.size() ; ++i)
+		if(overlaps(c[i],c,true,threshold))
+			++res;
+	return res;
+};
+
+bool LatticeExample::overlaps(Circle& cc,std::vector<Circle>& c,bool no_self_overlap,float threshold)
+{
 	// check with circles
         std::vector<Circle>::iterator end=c.end();
         for(std::vector<Circle>::iterator i=c.begin();i!=end;++i)
         {
                 float dist2 = std::pow(i->x - cc.x ,2)+std::pow(i->y - cc.y,2)+std::pow(i->z - cc.z,2);
-                float r2    = std::pow( 1.1*(i->d+cc.d)/2.0 ,2); // FIXME - 1.1 is hardcoded. van Mier's min distance is 1.1*(D1+D2)/2
+
+		if(no_self_overlap && (dist2 == 0) && ((i->x==cc.x) && (i->y==cc.y) && (i->z==cc.z) && (i->d==cc.d)))
+			continue;
+
+                float r2    = std::pow( threshold*(i->d+cc.d)/2.0 ,2); // FIXME - 1.1 is hardcoded. van Mier's min distance is 1.1*(D1+D2)/2
                 if(dist2<r2)
                         return true;
         }
@@ -1416,20 +1448,20 @@
 	}
 
 	// check if it's outside the concrete
-	if(no_Agg_outside)
-	{
-		Real AGGREGATES_X=speciemen_size_in_meters[0];
-	        Real AGGREGATES_Y=speciemen_size_in_meters[1];
-	        Real AGGREGATES_Z=speciemen_size_in_meters[2];
-		for(Real A=std::max(0.0,cc.x-cc.d*0.5) ; A<=std::min(AGGREGATES_X,cc.x+cc.d*0.5) ; A+=cellsizeUnit_in_meters*0.2)
-		for(Real B=std::max(0.0,cc.y-cc.d*0.5) ; B<=std::min(AGGREGATES_Y,cc.y+cc.d*0.5) ; B+=cellsizeUnit_in_meters*0.2)
-		for(Real C=std::max(0.0,cc.z-cc.d*0.5) ; C<=std::min(AGGREGATES_Z,cc.z+cc.d*0.5) ; C+=cellsizeUnit_in_meters*0.2)
-			if(! notDeleted(Vector3r(A,B,C)) )
-			{
-				if( std::pow(cc.x - A,2.0) + std::pow(cc.y - B,2.0) + std::pow(cc.z - C,2.0) < cc.d*cc.d*0.25 )
-					return true;
-			}
-	}
+//	if(no_Agg_outside)
+//	{
+//		Real AGGREGATES_X=speciemen_size_in_meters[0];
+//	        Real AGGREGATES_Y=speciemen_size_in_meters[1];
+//	        Real AGGREGATES_Z=speciemen_size_in_meters[2];
+//		for(Real A=std::max(0.0,cc.x-cc.d*0.5) ; A<=std::min(AGGREGATES_X,cc.x+cc.d*0.5) ; A+=cellsizeUnit_in_meters*0.2)
+//		for(Real B=std::max(0.0,cc.y-cc.d*0.5) ; B<=std::min(AGGREGATES_Y,cc.y+cc.d*0.5) ; B+=cellsizeUnit_in_meters*0.2)
+//		for(Real C=std::max(0.0,cc.z-cc.d*0.5) ; C<=std::min(AGGREGATES_Z,cc.z+cc.d*0.5) ; C+=cellsizeUnit_in_meters*0.2)
+//			if(! notDeleted(Vector3r(A,B,C)) )
+//			{
+//				if( std::pow(cc.x - A,2.0) + std::pow(cc.y - B,2.0) + std::pow(cc.z - C,2.0) < cc.d*cc.d*0.25 )
+//					return true;
+//			}
+//	}
 
         return false;
 };
@@ -1505,15 +1537,21 @@
 	setStatus(  "generating aggregates...");
         do
         {
-		if(shouldTerminate()) return;
+		if(shouldTerminate())
+		{
+			setTerminate(false);
+			break;
+		}
 
                 Circle cc;
                 cc.x=random1()*AGGREGATES_X, cc.y=random1()*AGGREGATES_Y, cc.z=AGGREGATES_Z==0?0:random1()*AGGREGATES_Z;
                 do { cc.d=randomN(); } while (cc.d>=MAX_DIAMETER || cc.d<=MIN_DIAMETER);
                 for(int i=0 ; i<1000 ; ++i)
+		/* IGNORE OVERLAPPING FOR NOW, just add as much as we need to!
                         if(overlaps(cc,c))
                                 cc.x=random1()*AGGREGATES_X, cc.y=random1()*AGGREGATES_Y, cc.z=AGGREGATES_Z==0?0:random1()*AGGREGATES_Z;
                         else
+		*/
                         {
                                 c.push_back(cc);
                 //              std::cerr << cc.x << " " << cc.y << " " << cc.d << "\n";
@@ -1526,7 +1564,140 @@
         }
         //while(aggregatePercent/100.0 > aggsAreas(c)/(AGGREGATES_X*AGGREGATES_Y) );
         while( progress() < 1.0 );
+        
+	
+	std::cerr << "placing aggregates with repulsion ... ";
+	setStatus(   "aggregates repulsion ...");
+	setProgress(0);
 
+	int overlap_count;
+	overlap_count=overlapCount(c,1.05);
+	int begin_overlap_count = overlap_count;
+
+// repulsion !!
+	for( ; overlap_count > 0 ; )
+	{
+		overlap_count=overlapCount(c,1.05);
+
+		setStatus(std::string("repulsion ")+boost::lexical_cast<std::string>(overlap_count));
+		setProgress(1.0 - (float)(overlap_count)/(float)(begin_overlap_count));
+
+		std::vector<Vector3r > moves;
+		moves.clear();
+		for(unsigned int i = 0 ; i < c.size() ; ++i )
+		{
+			Vector3r d(0,0,0);
+
+			Vector3r c1(c[i].x,c[i].y,c[i].z);
+
+			//emulate periodic boundary
+			for(int px = -1 ; px < 2 ; ++px )
+			for(int py = -1 ; py < 2 ; ++py )
+			for(int pz = ((AGGREGATES_Z==0)?0:-1) ; pz < ((AGGREGATES_Z==0)?1:2) ; ++pz )
+			{
+				Vector3r PERIODIC_DELTA(px*AGGREGATES_X,py*AGGREGATES_Y,pz*AGGREGATES_Z);
+				for(unsigned int j = 0 ; j < fibres.size() ; ++j )
+					if(i != j)
+					{
+						Vector3r c2 = Vector3r(c[j].x, c[j].y, c[j].z) + PERIODIC_DELTA;
+
+						Vector3r dir=c1-c2;
+						Real r = dir.Normalize(); // dir is unit vector, r is a distance
+						if(r < cellsizeUnit_in_meters)
+						{
+							r=cellsizeUnit_in_meters;
+							dir[0]=random1()-0.5, dir[1]=random1()-0.5, dir[2]=((AGGREGATES_Z==0)?(0):(random1()-0.5));
+							dir.Normalize();
+						}
+						d += dir * 1/(r*r);
+
+						// strong repulsion when they are intersecting
+						if(2*r < (c[i].d+c[j].d)*1.1)
+							d += (dir * 1/(r*r))*10;
+					}
+			}
+
+			// repulsion from walls.
+			Vector3r MAX(AGGREGATES_X, AGGREGATES_Y, AGGREGATES_Z);
+			for(int I=0 ; I<((AGGREGATES_Z==0)?2:3) ; ++I)
+			{
+				if(c1[I] > 0 && c1[I] < MAX[I])
+					d[I] += (1/(c1[I]*c1[I]) - 1/((MAX[I]-c1[I])*(MAX[I]-c1[I])))*0.5;
+				//else
+				//	std::cerr << "fibre " << i << " is escaping\n";
+			}
+
+			// check with fibres
+			if(fibre_count > 0)
+			{
+				for(int I = 0 ; I < fibre_count ; ++I)
+				{
+					Vector3r pos = fibres[I].first;
+					Vector3r del = fibres[I].second;
+					for(int J = 0 ; J < beams_per_fibre ; ++J)
+					{
+						Vector3r c2(
+							pos[0] + 1.0*J*del[0],
+							pos[1] + 1.0*J*del[1],
+							pos[2] + 1.0*J*del[2] );
+						
+						Vector3r dir=c1-c2;
+						
+						Real r = dir.Normalize(); // dir is unit vector, r is a distance
+						if(r < cellsizeUnit_in_meters)
+						{
+							r=cellsizeUnit_in_meters;
+							dir[0]=random1()-0.5, dir[1]=random1()-0.5, dir[2]=((AGGREGATES_Z==0)?(0):(random1()-0.5));
+							dir.Normalize();
+						}
+						d += dir * 1/(r*r);
+
+						// strong repulsion when they are intersecting
+						if(2*r < (c[i].d)*1.1)
+							d += (dir * 1/(r*r))*10;
+					}
+				}
+			}
+
+			moves.push_back(d);
+		}
+
+		assert(moves.size() == c.size() );
+		Real maxl=0;
+		for(unsigned int i = 0 ; i < moves.size() ; ++i )
+			maxl = std::max(moves[i].Length(),maxl);
+		for(unsigned int i = 0 ; i < moves.size() ; ++i )
+			moves[i] = cellsizeUnit_in_meters*moves[i]/maxl;
+	
+		for(unsigned int i = 0 ; i < moves.size() ; ++i )
+		{
+			c[std::floor(((float)(i)))].x+=moves[i][0];
+			c[std::floor(((float)(i)))].y+=moves[i][1];
+			c[std::floor(((float)(i)))].z+=moves[i][2];
+		}
+	
+		for(unsigned int i = 0 ; i < c.size() ; ++i )
+		{
+			Vector3r c1(c[i].x, c[i].y, c[i].z);
+			if(   c1[0] < 0 
+			   || c1[1] < 0 
+			   || c1[2] < 0
+			   || c1[0] > AGGREGATES_X
+			   || c1[1] > AGGREGATES_Y
+			   || c1[2] > AGGREGATES_Z)
+			{
+				std::cerr << "aggregate: putting again randomly\n";
+				c[i].x = random1()*AGGREGATES_X;
+				c[i].y = random1()*AGGREGATES_Y;
+				c[i].z = ((AGGREGATES_Z==0)?(0):(random1()*AGGREGATES_Z));
+			}
+		}
+		
+	//std::cerr << "frame= " << frame++ << "\n";
+
+		if(shouldTerminate()) return;
+	}
+
         std::cerr << "done. " << c.size() << " area: " << aggsAreas(c)/(AGGREGATES_X*AGGREGATES_Y) << " vol: " << aggsVolumes(c)/(AGGREGATES_X*AGGREGATES_Y*AGGREGATES_Z) << "\n";
 
 /*
@@ -1568,7 +1739,7 @@
                         Body* body = (*bi).get();
                         if( ! ( body->getGroupMask() & beamGroupMask ) )
                                 continue; // skip non-beams
-
+			
                         LatticeBeamParameters* beam     = static_cast<LatticeBeamParameters*>(body->physicalParameters.get());
                         int ovv = aggInside(     (*(rootBody->bodies))[beam->id1]->physicalParameters->se3.position
                                                 ,(*(rootBody->bodies))[beam->id2]->physicalParameters->se3.position
@@ -1580,6 +1751,8 @@
                                 beam->torsionalStiffness        = agg_torsStiffness_noUnit;
                                 beam->criticalTensileStrain     = agg_critTensileStrain;
                                 beam->criticalCompressiveStrain = agg_critCompressStrain;
+			
+				body->groupMask = beamGroupMask + aggGroupMask;
                 
 //                                (*(rootBody->bodies))[beam->id1]->geometricalModel->diffuseColor = Vector3r(0.6,0.2,0.0);
 //                                (*(rootBody->bodies))[beam->id2]->geometricalModel->diffuseColor = Vector3r(0.6,0.2,0.0);
@@ -1592,6 +1765,8 @@
                                 beam->criticalTensileStrain     = bond_critTensileStrain;
                                 beam->criticalCompressiveStrain = bond_critCompressStrain;
                 
+				body->groupMask = beamGroupMask + bondGroupMask;
+                
 //                                (*(rootBody->bodies))[beam->id1]->geometricalModel->diffuseColor = Vector3r(0.6,0.6,0.0);
 //                                (*(rootBody->bodies))[beam->id2]->geometricalModel->diffuseColor = Vector3r(0.6,0.6,0.0);
                         }
@@ -1635,6 +1810,8 @@
 // new method - equally balance fibres over volume using repulsion
 void LatticeExample::makeFibres()
 {
+	setStatus("balancing fibres...");
+	std::cerr << "fibres: ";
 	fibres.clear();
 
         Real AGGREGATES_X=speciemen_size_in_meters[0];
@@ -1781,8 +1958,8 @@
 			{
 				if(c1[I] > 0 && c1[I] < MAX[I])
 					d[I] += (1/(c1[I]*c1[I]) - 1/((MAX[I]-c1[I])*(MAX[I]-c1[I])))*0.5;
-				else
-					std::cerr << "fibre " << i << " is escaping\n";
+				//else
+				//	std::cerr << "fibre " << i << " is escaping\n";
 			}
 			moves.push_back(d);
 		}
@@ -1812,13 +1989,21 @@
 			   || c1[0] > AGGREGATES_X
 			   || c1[1] > AGGREGATES_Y
 			   || c1[2] > AGGREGATES_Z)
-				std::cerr << "putting again randomly\n", fibres[i].first = Vector3r(random1()*AGGREGATES_X, random1()*AGGREGATES_Y, ((AGGREGATES_Z==0)?(0):(random1()*AGGREGATES_Z)));
+			{
+				//std::cerr << "putting again randomly\n";
+				fibres[i].first = Vector3r(random1()*AGGREGATES_X, random1()*AGGREGATES_Y, ((AGGREGATES_Z==0)?(0):(random1()*AGGREGATES_Z)));
+			}
 		}
 		
 	//std::cerr << "frame= " << frame++ << "\n";
-		setStatus("balancing fibres...");
+
+		if(shouldTerminate()) return;
 		setProgress(1.0*frame/(1.0*fibre_balancing_iterations));
+		if( (int)(progress() * 10.0)%10==0)
+			std::cerr << (int)(progress() * 10.0) << "...";
+
 	}
+	std::cerr << "\n";
 
 /*
 	for(unsigned int i = 0 ; i < fibres.size() ; ++i )
@@ -1900,6 +2085,8 @@
 //                        	(*(rootBody->bodies))[beam->id1]->geometricalModel->diffuseColor = Vector3r(2.0,2.0,0.0);
 //                        	(*(rootBody->bodies))[beam->id2]->geometricalModel->diffuseColor = Vector3r(2.0,2.0,0.0);
 				
+				body->groupMask = beamGroupMask + fibreGroupMask;
+
 				fibres_total+=1.0;
 			}
 			if(fibreNodes==1) // bond
@@ -1909,6 +2096,9 @@
                                 beam->torsionalStiffness	= fibre_bond_torsStiffness_noUnit;
                                 beam->criticalTensileStrain     = fibre_bond_critTensileStrain;
                                 beam->criticalCompressiveStrain = fibre_bond_critCompressStrain;
+				
+				body->groupMask = beamGroupMask + fibreBondGroupMask;
+
 			}
                 }
         }

Modified: trunk/pkg/lattice/PreProcessor/LatticeExample.hpp
===================================================================
--- trunk/pkg/lattice/PreProcessor/LatticeExample.hpp	2009-07-29 09:17:45 UTC (rev 1901)
+++ trunk/pkg/lattice/PreProcessor/LatticeExample.hpp	2009-07-29 11:05:36 UTC (rev 1902)
@@ -23,7 +23,8 @@
 class LatticeExample : public FileGenerator
 {
 	private :
-		int 		nodeGroupMask,beamGroupMask,quadGroupMask;
+		int 		 nodeGroupMask,beamGroupMask,quadGroupMask
+				,fibreGroupMask,aggGroupMask,fibreBondGroupMask,bondGroupMask;
 		
 	// mesh generation	
 		Vector3r 	 speciemen_size_in_meters 	// size
@@ -109,7 +110,8 @@
 {
         float x,y,z,d;
 };
-		bool overlaps(Circle& cc,std::vector<Circle>& c);
+		bool overlaps(Circle& cc,std::vector<Circle>& c,bool no_self_overlap=false,float threshold=1.1);
+		int overlapCount(std::vector<Circle>& c,float);
 		int aggInside(Vector3r& a,Vector3r& b,std::vector<Circle>& c, Real cellsizeUnit_in_meters);
 		float aggsAreas(std::vector<Circle>& c);
 		float aggsVolumes(std::vector<Circle>& c);

Modified: trunk/pkg/snow/PreProcessor/Voxel/Config.cpp
===================================================================
--- trunk/pkg/snow/PreProcessor/Voxel/Config.cpp	2009-07-29 09:17:45 UTC (rev 1901)
+++ trunk/pkg/snow/PreProcessor/Voxel/Config.cpp	2009-07-29 11:05:36 UTC (rev 1902)
@@ -5,7 +5,6 @@
 namespace po = boost::program_options;
 
 Config::Config(int argc, char** argv) : 
-	opts("Snow data reader options"), 
 	m_draw_with_names(false),
 	m_display_selection(false),
 	m_time_draw_limit(true),
@@ -13,7 +12,8 @@
 	m_draw_backfaces(false),
 	m_draw_surface_or_contact_or_all(2),
 	m_auto_center(false),
-	m_transparency(false)
+	m_transparency(false),
+	opts("Snow data reader options")
 {
 	opts.add_options()
 		("help,h","display this help.")
@@ -27,7 +27,7 @@
 			"start slice number to be loaded.")
 		(",e",po::value<int>(&m_end)->default_value(610),
 			"end slice number to be loaded.")
-		(",n",po::value<int>(&m_digits)->default_value(4),
+		(",n",po::value<unsigned int>(&m_digits)->default_value(4),
 			"number of digits in slice name eg. four is: _0000.txt.")
 		(",g",po::value<int>(&m_grains)->default_value(120),
 			"number of grains the sample.")

Modified: trunk/pkg/snow/PreProcessor/Voxel/Config.hpp
===================================================================
--- trunk/pkg/snow/PreProcessor/Voxel/Config.hpp	2009-07-29 09:17:45 UTC (rev 1901)
+++ trunk/pkg/snow/PreProcessor/Voxel/Config.hpp	2009-07-29 11:05:36 UTC (rev 1902)
@@ -26,7 +26,7 @@
 		std::string	m_file_basename;
 		int		m_start;
 		int		m_end;
-		int		m_digits;
+		unsigned int	m_digits;
 		int		m_grains;
 		int		m_display_steps;
 		std::set<int>	m_selection;
@@ -75,7 +75,7 @@
 		std::string	file_basename(){return m_file_basename;};
 		int		start(){return m_start;};
 		int		end(){return m_end;};
-		int		digits(){return m_digits;};
+		unsigned int	digits(){return m_digits;};
 		int		grains(){return m_grains;};
 
 		int		display_steps(){return m_display_steps;};

Modified: trunk/pkg/snow/PreProcessor/Voxel/DataVoxel.cpp
===================================================================
--- trunk/pkg/snow/PreProcessor/Voxel/DataVoxel.cpp	2009-07-29 09:17:45 UTC (rev 1901)
+++ trunk/pkg/snow/PreProcessor/Voxel/DataVoxel.cpp	2009-07-29 11:05:36 UTC (rev 1902)
@@ -148,9 +148,9 @@
 int  DataVoxel::volume_of_grain_id(const t_voxel_data& data, int GRAIN_ID)
 {
 	int result=0;
-	for(int i = 0 ; i < data.size() ; ++i)
-		for( int x = 0 ; x < data[i].size() ; ++x)
-			for( int y = 0 ; y < data[i][x].size() ; ++y)
+	for(size_t i = 0 ; i < data.size() ; ++i)
+		for( size_t x = 0 ; x < data[i].size() ; ++x)
+			for( size_t y = 0 ; y < data[i][x].size() ; ++y)
 				if(data[i][x][y] == GRAIN_ID)
 					++result;
 	return result;
@@ -234,18 +234,18 @@
 		{
 			// clean this one off
 			std::cerr << "grain " << id << " too small - removing\n";
-			for(int i = 0 ; i < m_voxel_data.size() ; ++i)
-				for( int x = 0 ; x < m_voxel_data[i].size() ; ++x)
-					for( int y = 0 ; y < m_voxel_data[i][x].size() ; ++y)
+			for(size_t i = 0 ; i < m_voxel_data.size() ; ++i)
+				for( size_t x = 0 ; x < m_voxel_data[i].size() ; ++x)
+					for( size_t y = 0 ; y < m_voxel_data[i][x].size() ; ++y)
 						if(m_voxel_data[i][x][y] == id)
 							m_voxel_data[i][x][y] = 0;
 		}
 	}
 
 	needs_to_be_checked.clear();
-	for(int i = 0 ; i < m_voxel_data.size() ; ++i)
-		for( int x = 0 ; x < m_voxel_data[i].size() ; ++x)
-			for( int y = 0 ; y < m_voxel_data[i][x].size() ; ++y)
+	for(size_t i = 0 ; i < m_voxel_data.size() ; ++i)
+		for( size_t x = 0 ; x < m_voxel_data[i].size() ; ++x)
+			for( size_t y = 0 ; y < m_voxel_data[i][x].size() ; ++y)
 				if(m_voxel_data[i][x][y] != experimental[i][x][y] && m_voxel_data[i][x][y] == 0)
 					needs_to_be_checked.push_back(Vector3<int>(i,x,y));
 
@@ -271,7 +271,7 @@
 			}
 		}
 		last_checked = checked_end;
-		for(int D = 0 ; D < needs_to_be_checked.size() ; ++D)
+		for(size_t D = 0 ; D < needs_to_be_checked.size() ; ++D)
 		{
 			if(checked[D] != 0)
 				continue;
@@ -288,7 +288,7 @@
 				m_voxel_data[i  ][x  ][y-1] != 0
 			)
 			{
-				for(int ZZ = 0 ; ZZ < s.size() ; ++ZZ) 
+				for(size_t ZZ = 0 ; ZZ < s.size() ; ++ZZ) 
 					s[ZZ] = 0;
 
 				if(m_voxel_data[i+1][x  ][y  ] != 0){ s[m_voxel_data[i+1][x  ][y  ]] += 1; };
@@ -300,7 +300,7 @@
 
 				int max_id=0;
 				int max_contact = 0;
-				for(int ZZ = 0 ; ZZ < s.size() ; ++ZZ)
+				for(size_t ZZ = 0 ; ZZ < s.size() ; ++ZZ)
 				{
 					if(s[ZZ] > max_contact)
 					{
@@ -338,13 +338,13 @@
 	{// change owners due to overhelming contact surface
 		std::vector<int>  surfaces;
 		surfaces.resize(config.grains()+10,0);
-		for(int ZZ = 0 ; ZZ < surfaces.size() ; ++ZZ) 
+		for(size_t ZZ = 0 ; ZZ < surfaces.size() ; ++ZZ) 
 			surfaces[ZZ] = 0;
 		int total_surface = 0;
 
-		for(int i = 0 ; i < m_voxel_data.size() ; ++i)
-			for( int x = 0 ; x < m_voxel_data[i].size() ; ++x)
-				for( int y = 0 ; y < m_voxel_data[i][x].size() ; ++y)
+		for(size_t i = 0 ; i < m_voxel_data.size() ; ++i)
+			for( size_t x = 0 ; x < m_voxel_data[i].size() ; ++x)
+				for( size_t y = 0 ; y < m_voxel_data[i][x].size() ; ++y)
 					if(m_voxel_data[i][x][y] == id)
 					{
 						// calculate surface of this grain, and surface of contact with other grains
@@ -363,9 +363,9 @@
 					}
 		int max_id=0;
 		int max_contact = 0;
-		for(int ZZ = 1 ; ZZ < surfaces.size() ; ++ZZ)
+		for(size_t ZZ = 1 ; ZZ < surfaces.size() ; ++ZZ)
 		{
-			if(surfaces[ZZ] > max_contact && ZZ != id)
+			if(surfaces[ZZ] > max_contact && ZZ != (unsigned int)(id))
 			{
 				max_id = ZZ;
 				max_contact = surfaces[max_id];
@@ -376,9 +376,9 @@
 			std::cerr << "grain " << id << " has contact with grain "<< max_id <<" bigger than 0.3 of its total surface ( " << max_contact << "/" << total_surface << " = "<<100*max_contact/total_surface<<" \% ) - removing\n";
 			// clean this one off
 			removed.insert(max_id);
-			for(int i = 0 ; i < m_voxel_data.size() ; ++i)
-				for( int x = 0 ; x < m_voxel_data[i].size() ; ++x)
-					for( int y = 0 ; y < m_voxel_data[i][x].size() ; ++y)
+			for(size_t i = 0 ; i < m_voxel_data.size() ; ++i)
+				for( size_t x = 0 ; x < m_voxel_data[i].size() ; ++x)
+					for( size_t y = 0 ; y < m_voxel_data[i][x].size() ; ++y)
 						if(m_voxel_data[i][x][y] == id)
 							m_voxel_data[i][x][y] = max_id;
 		}
@@ -398,13 +398,13 @@
 		boost::mutex::scoped_lock scoped_lock(m_voxel_mutex);
 		// first resize to other's size
 		m_voxel_data.resize(other.size());
-		for(int i = 0 ; i < m_voxel_data.size() ; ++i)
+		for(size_t i = 0 ; i < m_voxel_data.size() ; ++i)
 		{
 			m_voxel_data[i].resize(other[0].size());
-			for( int x = 0 ; x < m_voxel_data[i].size() ; ++x)
+			for( size_t x = 0 ; x < m_voxel_data[i].size() ; ++x)
 			{
 				m_voxel_data[i][x].resize(other[0][0].size() , 0);
-				for( int y = 0 ; y < m_voxel_data[i][x].size() ; ++y)
+				for( size_t y = 0 ; y < m_voxel_data[i][x].size() ; ++y)
 					m_voxel_data[i][x][y] = 0;
 			}
 		}
@@ -668,13 +668,13 @@
 		boost::mutex::scoped_lock scoped_lock(m_voxel_mutex);
 		// first resize to other's size
 		m_voxel_data.resize(other.size());
-		for(int i = 0 ; i < m_voxel_data.size() ; ++i)
+		for(size_t i = 0 ; i < m_voxel_data.size() ; ++i)
 		{
 			m_voxel_data[i].resize(other[0].size());
-			for( int x = 0 ; x < m_voxel_data[i].size() ; ++x)
+			for( size_t x = 0 ; x < m_voxel_data[i].size() ; ++x)
 			{
 				m_voxel_data[i][x].resize(other[0][0].size() , 0);
-				for( int y = 0 ; y < m_voxel_data[i][x].size() ; ++y)
+				for( size_t y = 0 ; y < m_voxel_data[i][x].size() ; ++y)
 					m_voxel_data[i][x][y] = 0;
 			}
 		}

Modified: trunk/pkg/snow/PreProcessor/Voxel/GrainSurface.cpp
===================================================================
--- trunk/pkg/snow/PreProcessor/Voxel/GrainSurface.cpp	2009-07-29 09:17:45 UTC (rev 1901)
+++ trunk/pkg/snow/PreProcessor/Voxel/GrainSurface.cpp	2009-07-29 11:05:36 UTC (rev 1902)
@@ -187,7 +187,7 @@
 	short int       draw_what_surfaces    = config.draw_surface_or_contact_or_all();
 	int             DD                    = config.display_steps();
 	float           d2                    = DD*0.5;	
-	int             CC;
+	int             CC(0);
 	bool            bottom=false;
 	switch(side)
 	{
@@ -224,7 +224,7 @@
 							if(!config.display_selection())
 								config.light_selection(m_own_id);
 						}
-						int i,x,y;
+						int i(0),x(0),y(0);
 						switch(side)
 						{
 							case I_BOT : 

Modified: trunk/pkg/snow/PreProcessor/Voxel/SafeVectors3.cpp
===================================================================
--- trunk/pkg/snow/PreProcessor/Voxel/SafeVectors3.cpp	2009-07-29 09:17:45 UTC (rev 1901)
+++ trunk/pkg/snow/PreProcessor/Voxel/SafeVectors3.cpp	2009-07-29 11:05:36 UTC (rev 1902)
@@ -20,7 +20,7 @@
 	std::cerr << myname << " file loaded\n";
 }
 
-Vector3r SafeVectors3::operator[](int i)const
+Vector3r SafeVectors3::operator[](size_t i)const
 {
 	if(i>=0 && i<m_data.size()) {
 		return m_data[i];

Modified: trunk/pkg/snow/PreProcessor/Voxel/SafeVectors3.hpp
===================================================================
--- trunk/pkg/snow/PreProcessor/Voxel/SafeVectors3.hpp	2009-07-29 09:17:45 UTC (rev 1901)
+++ trunk/pkg/snow/PreProcessor/Voxel/SafeVectors3.hpp	2009-07-29 11:05:36 UTC (rev 1902)
@@ -25,6 +25,6 @@
 		SafeVectors3() : m_myname("undefined") {};
 		SafeVectors3(int size,std::string myname,std::string fname,bool has_id);
 		SafeVectors3(int size,std::string myname):m_myname(myname){m_data.resize(size+1,Vector3r(0,0,0));};
-		Vector3r operator[](int i)const;
+		Vector3r operator[](size_t i)const;
 };
 

Modified: trunk/pkg/snow/PreProcessor/Voxel/VoxelEnvelope.cpp
===================================================================
--- trunk/pkg/snow/PreProcessor/Voxel/VoxelEnvelope.cpp	2009-07-29 09:17:45 UTC (rev 1901)
+++ trunk/pkg/snow/PreProcessor/Voxel/VoxelEnvelope.cpp	2009-07-29 11:05:36 UTC (rev 1902)
@@ -3,13 +3,13 @@
 #include "VoxelEnvelope.hpp"
 
 VoxelEnvelope::VoxelEnvelope(Config& c, std::string name) : 
-	m_data_voxel(), 
-	m_axes(c.grains(),"c axes",c.axis_file(),true), 
-	m_colors(c.grains(),"colors",c.color_file(),false),
 	m_centers_calculated(false),
 	m_grain_voxel_surfaces_calculated(false),
 	m_bad_grain_count(""),
-	m_myname(name)
+	m_myname(name),
+	m_data_voxel(), 
+	m_axes(c.grains(),"c axes",c.axis_file(),true), 
+	m_colors(c.grains(),"colors",c.color_file(),false)
 {
 	m_centers.clear();
 }