← Back to team overview

yade-dev team mailing list archive

[svn] r1748 - trunk/extra/mgpost/src

 

Author: richefeu
Date: 2009-04-06 17:45:13 +0200 (Mon, 06 Apr 2009)
New Revision: 1748

Modified:
   trunk/extra/mgpost/src/colors.h
   trunk/extra/mgpost/src/display.c
   trunk/extra/mgpost/src/display_funcs.c
   trunk/extra/mgpost/src/display_funcs.h
   trunk/extra/mgpost/src/files.c
   trunk/extra/mgpost/src/memory.c
   trunk/extra/mgpost/src/mgpost.c
   trunk/extra/mgpost/src/mgpost.h
Log:
Increase the number of colors for the display of body's groupMasks from 6 to 10


Modified: trunk/extra/mgpost/src/colors.h
===================================================================
--- trunk/extra/mgpost/src/colors.h	2009-04-06 15:42:25 UTC (rev 1747)
+++ trunk/extra/mgpost/src/colors.h	2009-04-06 15:45:13 UTC (rev 1748)
@@ -178,12 +178,13 @@
 
 /* Coloration de groupe de grains */
 MGuchar nbcolgrp=0;
-MGuchar colIsShown[6] = {0,0,0,0,0,0};
-char colorName[6][30];
+MGuchar nbcolgrpMaxi = 10;
+MGuchar colIsShown[10] = {0,0,0,0,0,0,0,0,0,0};
+char colorName[10][30];
 
-float rcolor[6]={0., 0., 1., 1., 0., 1.};
-float gcolor[6]={0., 1., 0., 1., 1., 0.};
-float bcolor[6]={1., 0., 0., 0., 1., 1.};
+float rcolor[10]={0., 0., 1., 1., 0., 1., 0.67 , 1.,  0.53, 0.8};
+float gcolor[10]={0., 1., 0., 1., 1., 0., 0.41 , 0.62, 0.5 , 0.8};
+float bcolor[10]={1., 0., 0., 0., 1., 1., 0.95, 0.1,  0.1 , 0.8};
 
 
 #endif

Modified: trunk/extra/mgpost/src/display.c
===================================================================
--- trunk/extra/mgpost/src/display.c	2009-04-06 15:42:25 UTC (rev 1747)
+++ trunk/extra/mgpost/src/display.c	2009-04-06 15:45:13 UTC (rev 1748)
@@ -116,7 +116,12 @@
     glTranslatef (-xvec, zvec, -yvec);
     glCallList(repere);
   }
-  
+
+  if (isBiP)
+  {
+	disp_CellBiP();
+  }
+
   if (afftime)
     disp_time();
   

Modified: trunk/extra/mgpost/src/display_funcs.c
===================================================================
--- trunk/extra/mgpost/src/display_funcs.c	2009-04-06 15:42:25 UTC (rev 1747)
+++ trunk/extra/mgpost/src/display_funcs.c	2009-04-06 15:45:13 UTC (rev 1748)
@@ -44,6 +44,11 @@
 
 void disp_boundaries ()
 {
+  if (isBiP)
+  {
+	disp_CellBiP();
+	return;
+  }
   GLdouble Xcam = Xviewp * TRANS_CAM_FACTOR, Ycam = Yviewp * TRANS_CAM_FACTOR;
   char txt[128];
   int ii;
@@ -98,6 +103,73 @@
   glEnable (GL_LIGHTING);
 }
 
+void disp_CellBiP()
+{
+  GLdouble Xcam = Xviewp * TRANS_CAM_FACTOR, Ycam = Yviewp * TRANS_CAM_FACTOR;
+  double extendx,extendy;
+  /*unsigned int i;*/
+  
+  glLoadIdentity ();
+  gluLookAt (Xcam, Ycam, distance, Xcam, Ycam, 0.0f, 0.0f, 1.0f, 0.0f);
+  glRotatef (phi, 1.0f, 0.0f, 0.0f);
+  glRotatef (theta, 0.0f, 0.0f, 1.0f);
+  
+  glLineWidth (1.0f);
+  
+  glDisable (GL_LIGHTING);
+  glColor3f (fg_color.r, fg_color.v, fg_color.b);
+
+  extendx = 0.5 * (hxx+hxy);
+  extendy = 0.5 * (hyx+hyy);
+  
+  glBegin (GL_LINE_LOOP);
+  glVertex3f (-extendx * adim, 0.0f, -extendy * adim);
+  glVertex3f (-extendx * adim, 0.0f, extendy * adim);
+  glVertex3f (extendx * adim, 0.0f, extendy * adim);
+  glVertex3f (extendx * adim, 0.0f, -extendy * adim);
+  glVertex3f (-extendx * adim, 0.0f, -extendy * adim);
+  glEnd();
+ 
+  glEnable (GL_LIGHTING);
+/*
+  
+  for (i = 0; i < nbel; i++)	
+	{ 
+	  glLoadIdentity ();
+	  gluLookAt (Xcam, Ycam, distance, Xcam, Ycam, 0.0f, 0.0f, 1.0f, 0.0f);
+	  glRotatef (phi, 1.0f, 0.0f, 0.0f);
+	  glRotatef (theta, 0.0f, 0.0f, 1.0f);
+	  glTranslatef ((x[i][state]+hxx) * adim, 0.0f, (y[i][state]+hxy) * adim);
+	  glColor4f(0.5f,0.5f,0.5f,0.1f);
+	  mgbodyselect_plein (i, state);
+	  
+	  glLoadIdentity ();
+	  gluLookAt (Xcam, Ycam, distance, Xcam, Ycam, 0.0f, 0.0f, 1.0f, 0.0f);
+	  glRotatef (phi, 1.0f, 0.0f, 0.0f);
+	  glRotatef (theta, 0.0f, 0.0f, 1.0f);
+	  glTranslatef ((x[i][state]-hxx) * adim, 0.0f, (y[i][state]-hxy) * adim);
+	  glColor4f(0.5f,0.5f,0.5f,0.1f);
+	  mgbodyselect_plein (i, state);
+	  glLoadIdentity ();
+	  
+	  gluLookAt (Xcam, Ycam, distance, Xcam, Ycam, 0.0f, 0.0f, 1.0f, 0.0f);
+	  glRotatef (phi, 1.0f, 0.0f, 0.0f);
+	  glRotatef (theta, 0.0f, 0.0f, 1.0f);
+	  glTranslatef ((x[i][state]+hyx) * adim, 0.0f, (y[i][state]+hyy) * adim);
+	  mgbodyselect_plein (i, state);
+	  glLoadIdentity ();
+	  
+	  gluLookAt (Xcam, Ycam, distance, Xcam, Ycam, 0.0f, 0.0f, 1.0f, 0.0f);
+	  glRotatef (phi, 1.0f, 0.0f, 0.0f);
+	  glRotatef (theta, 0.0f, 0.0f, 1.0f);
+	  glTranslatef ((x[i][state]-hyx) * adim, 0.0f, (y[i][state]-hyy) * adim);
+	  mgbodyselect_plein (i, state);
+	  
+	}
+	*/
+}
+
+
 void disp_outline () /* Only for spheres */
 {
   int i;
@@ -524,7 +596,7 @@
       {
       coul = color[i];
       if (!colIsShown[coul]) continue;
-      else if (coul < 0 || coul > 5) continue;
+	  else if (coul < 0 || coul > nbcolgrpMaxi-1 /*5*/) continue;
       glColor4f (rcolor[coul], gcolor[coul], bcolor[coul], alpha_color);
 
       glLoadIdentity ();
@@ -4725,7 +4797,7 @@
   
   nd=0;
   for (i = 0; i < nbel; ++i)
-    if (bdyty[i]==MGP_SPHER)  
+	if (bdyty[i]==MGP_SPHER && radius[i][state]>0.0)  
       {
       d[nd]=2.*radius[i][state];
       passing[nd]=nd;
@@ -4737,7 +4809,7 @@
   graph_position((int)((double)W / 6.0), (int)(5.0 * (double)W / 6.0),
                  (int)((double)H / 6.0), (int)(5.0 * (double)H / 6.0) );
   graph_open();
-  graph_trace_buffer (d, passing, nd, 1, 0);
+  graph_trace_buffer (d, passing, nd, 0, 0);
   graph_close();
   
   free (d);

Modified: trunk/extra/mgpost/src/display_funcs.h
===================================================================
--- trunk/extra/mgpost/src/display_funcs.h	2009-04-06 15:42:25 UTC (rev 1747)
+++ trunk/extra/mgpost/src/display_funcs.h	2009-04-06 15:45:13 UTC (rev 1748)
@@ -28,6 +28,7 @@
 void disp_func_name ();
 void disp_points ();
 void disp_boundaries ();
+void disp_CellBiP();
 void disp_obstacles ();
 void disp_shapes ();
 void disp_discrim ();

Modified: trunk/extra/mgpost/src/files.c
===================================================================
--- trunk/extra/mgpost/src/files.c	2009-04-06 15:42:25 UTC (rev 1747)
+++ trunk/extra/mgpost/src/files.c	2009-04-06 15:45:13 UTC (rev 1748)
@@ -390,7 +390,14 @@
 		
                     i++;
                     nbel++;
-                  }	
+                  }
+				  
+				  if (!strcmp((const char *) token,"CellBiP"))
+				  {
+					fscanf(his_file, "%lf %lf %lf %lf",
+							&hxx,&hxy,&hyx,&hyy);		
+                    isBiP = MG_TRUE;
+				  }	
 		}
 	}
 
@@ -406,11 +413,23 @@
                   if (!strcmp((const char *) token,"dkdk")) 
                   {
                     fscanf(his_file, "%d %d",&ip,&jp);
-                    nbneighbors[ip-dec][0] += 1; 
+                    nbneighbors[ip-dec][0] += 1;
+					//bghty[nbint] == 0;
                     neighbor[nbint][0] = jp-dec+1;
                     fscanf(his_file, "%*f %*f %lf %lf %*f",&Fn[nbint][0],&Ft[nbint][0]);
                     nbint++;
-                  }	
+                  }
+				  /*
+				  if (!strcmp((const char *) token,"dkdkP"))
+				  {
+					fscanf(his_file, "%d %d",&ip,&jp);
+					nbneighbors[ip-dec][0] += 1;
+					//bghty[nbint] == 1;
+					neighbor[nbint][0] = jp-dec+1;
+					fscanf(his_file, "%*f %*f %lf %lf %*f",&Fn[nbint][0],&Ft[nbint][0]);
+					nbint++;
+				  }
+				  */
 		}	
 	}	
         
@@ -481,7 +500,7 @@
       }
       
       if (!strcmp((const char *)node->name, "newcolor")) {
-        if (nbcolgrp < 6) nbcolgrp++;
+		if (nbcolgrp < nbcolgrpMaxi) nbcolgrp++;
         else break;
         strcpy(colorName[nbcolgrp-1],(const char *) xmlGetProp(node, (const xmlChar *) "name"));
         colIsShown[nbcolgrp-1] = MG_TRUE;

Modified: trunk/extra/mgpost/src/memory.c
===================================================================
--- trunk/extra/mgpost/src/memory.c	2009-04-06 15:42:25 UTC (rev 1747)
+++ trunk/extra/mgpost/src/memory.c	2009-04-06 15:45:13 UTC (rev 1748)
@@ -155,6 +155,7 @@
 
   nbneighbors = AllocInt (nbbodies, nbtimes);
   neighbor = AllocInt (nbbodies * nbcontacts, nbtimes);
+  //nghty = (unsigned char *) calloc ((size_t) (nbbodies*nbcontacts), sizeof (unsigned char));
   Crot = AllocDouble (nbbodies * nbcontacts, nbtimes);
   Vliq = AllocDouble (nbbodies * nbcontacts, nbtimes);
 

Modified: trunk/extra/mgpost/src/mgpost.c
===================================================================
--- trunk/extra/mgpost/src/mgpost.c	2009-04-06 15:42:25 UTC (rev 1747)
+++ trunk/extra/mgpost/src/mgpost.c	2009-04-06 15:45:13 UTC (rev 1748)
@@ -72,7 +72,7 @@
   }
   
   /* couleurs de groupe */
-  for (c=0;c<6;++c)
+  for (c=0;c<nbcolgrpMaxi;++c)
     strcpy(colorName[c],"Nothing");
 
   strcpy(num_file_format,"%03d");

Modified: trunk/extra/mgpost/src/mgpost.h
===================================================================
--- trunk/extra/mgpost/src/mgpost.h	2009-04-06 15:42:25 UTC (rev 1747)
+++ trunk/extra/mgpost/src/mgpost.h	2009-04-06 15:45:13 UTC (rev 1748)
@@ -261,6 +261,7 @@
 double         *datas;
 
 MGuchar  *bdyty;
+MGuchar  *nghty;
 
 #define MGP_DISKx 0
 #define MGP_SPHER 1
@@ -269,6 +270,7 @@
 #define MGP_JONCx 4
 #define MGP_POLYE 5
 #define MGP_PICKT 10
+#define MGP_CELLBiP 20
 #define MGP_MURX0 100
 #define MGP_MURX1 101
 #define MGP_MURY0 102
@@ -278,6 +280,10 @@
 #define MGP_MBR2D 200
 #define MGP_CYLYx 250
 
+MGuchar isBiP = MG_FALSE;
+double BiP_bandwidth = 0.0;
+double hxx,hxy,hyx,hyy;
+
 MGuchar  *bdyclass;
 
 #define MGP_GRAIN 0