← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2556: 1. Fix chunkSize=1 builds (bug introduced by changing include paths)

 

------------------------------------------------------------
revno: 2556
fixes bug(s): https://launchpad.net/bugs/676037
committer: Václav Šmilauer <eu@xxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-11-17 12:25:26 +0100
message:
  1. Fix chunkSize=1 builds (bug introduced by changing include paths)
  2. Add octree visualization engine (for debugging clump computation)
  3. Make editor of sequence of serializables resize more intelligently
modified:
  gui/qt4/SerializableEditor.py
  pkg/dem/DomainLimiter.cpp
  pkg/dem/DomainLimiter.hpp
  pkg/dem/Ip2_FrictMat_FrictMat_CapillaryPhys.cpp
  pkg/dem/NewtonIntegrator.cpp
  pkg/dem/ScGeom.cpp
  yadeSCons.py


--
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 'gui/qt4/SerializableEditor.py'
--- gui/qt4/SerializableEditor.py	2010-11-05 14:13:01 +0000
+++ gui/qt4/SerializableEditor.py	2010-11-17 11:25:26 +0000
@@ -360,7 +360,7 @@
 			# sequence of serializables
 			T=entry.T[0]
 			if (issubclass(T,Serializable) or T==Serializable):
-				widget=SeqSerializable(self,getter,setter,T,path=(self.path+'.'+entry.name if self.path else None))
+				widget=SeqSerializable(self,getter,setter,T,path=(self.path+'.'+entry.name if self.path else None),shrink=True)
 				return widget
 			if (T in _fundamentalEditorMap):
 				widget=SeqFundamentalEditor(self,getter,setter,T)
@@ -415,9 +415,9 @@
 	return ret
 
 class SeqSerializableComboBox(QFrame):
-	def __init__(self,parent,getter,setter,serType,path=None):
+	def __init__(self,parent,getter,setter,serType,path=None,shrink=False):
 		QFrame.__init__(self,parent)
-		self.getter,self.setter,self.serType,self.path=getter,setter,serType,path
+		self.getter,self.setter,self.serType,self.path,self.shrink=getter,setter,serType,path,shrink
 		self.layout=QVBoxLayout(self)
 		topLineFrame=QFrame(self)
 		topLineLayout=QHBoxLayout(topLineFrame);
@@ -427,6 +427,7 @@
 		buttonSlots=(self.newSlot,self.killSlot,self.upSlot,self.downSlot) # same order as buttons
 		for b in buttons: b.setStyleSheet('QPushButton { font-size: 15pt; }'); b.setFixedWidth(30); b.setFixedHeight(30)
 		self.combo=QComboBox(self)
+		self.combo.setSizeAdjustPolicy(QComboBox.AdjustToContents)
 		for w in buttons[0:2]+[self.combo,]+buttons[2:4]: topLineLayout.addWidget(w)
 		self.layout.addWidget(topLineFrame) # nested layout
 		self.scroll=QScrollArea(self); self.scroll.setWidgetResizable(True)
@@ -454,9 +455,19 @@
 			ser=currSeq[ix]
 			self.seqEdit=SerializableEditor(ser,parent=self,showType=seqSerializableShowType,path=(self.path+'['+str(ix)+']' if self.path else None))
 			self.scroll.setWidget(self.seqEdit)
+			if self.shrink:
+				self.sizeHint=lambda: QSize(100,1000)
+				self.scroll.sizeHint=lambda: QSize(100,1000)
+				self.sizePolicy().setVerticalPolicy(QSizePolicy.Expanding)
+				self.scroll.sizePolicy().setVerticalPolicy(QSizePolicy.Expanding)
+				self.setMinimumHeight(min(300,self.seqEdit.height()+self.combo.height()+10))
+				self.setMaximumHeight(100000)
+				self.scroll.setMaximumHeight(100000)
 		else:
 			self.scroll.setWidget(QFrame())
-			#self.scroll.sizeHint=lambda: QSize(0,0)
+			if self.shrink:
+				self.setMaximumHeight(self.combo.height()+10);
+				self.scroll.setMaximumHeight(0)
 	def serLabel(self,ser,i=-1):
 		return ('' if i<0 else str(i)+'. ')+str(ser)[1:-1].replace('instance at ','')
 	def refreshEvent(self,forceIx=-1):

=== modified file 'pkg/dem/DomainLimiter.cpp'
--- pkg/dem/DomainLimiter.cpp	2010-11-07 11:46:20 +0000
+++ pkg/dem/DomainLimiter.cpp	2010-11-17 11:25:26 +0000
@@ -3,7 +3,7 @@
 
 YADE_PLUGIN((DomainLimiter)(LawTester)
 	#ifdef YADE_OPENGL
-		(GlExtra_LawTester)
+		(GlExtra_LawTester)(GlExtra_OctreeCubes)
 	#endif
 );
 
@@ -286,4 +286,42 @@
 	glLineWidth(1.);
 }
 
+
+void GlExtra_OctreeCubes::postLoad(GlExtra_OctreeCubes&){
+	if(boxesFile.empty()) return;
+	boxes.clear();
+	ifstream txt(boxesFile.c_str());
+	while(!txt.eof()){
+		Real data[8];
+		for(int i=0; i<8; i++){ if(i<7 && txt.eof()) goto done; txt>>data[i]; }
+		OctreeBox ob; Vector3r mn(data[0],data[1],data[2]), mx(data[3],data[4],data[5]);
+		ob.center=.5*(mn+mx); ob.extents=(.5*(mx-mn)); ob.level=(int)data[6]; ob.fill=(int)data[7];
+		// for(int i=0; i<=ob.level; i++) cerr<<"\t"; cerr<<ob.level<<": "<<mn<<"; "<<mx<<"; "<<ob.center<<"; "<<ob.extents<<"; "<<ob.fill<<endl;
+		boxes.push_back(ob);
+	}
+	done:
+	std::cerr<<"GlExtra_OctreeCubes::postLoad: loaded "<<boxes.size()<<" boxes."<<std::endl;
+}
+
+void GlExtra_OctreeCubes::render(){
+	FOREACH(const OctreeBox& ob, boxes){
+		if(ob.fill<fillRangeDraw[0] || ob.fill>fillRangeDraw[1]) continue;
+		if(ob.level<levelRangeDraw[0] || ob.level>levelRangeDraw[1]) continue;
+		bool doFill=(ob.fill>=fillRangeFill[0] && ob.fill<=fillRangeFill[1] && (ob.fill!=0 || !noFillZero));
+		// -2: empty
+		// -1: recursion limit, empty
+		// 0: subdivided
+		// 1: recursion limit, full
+		// 2: full
+		Vector3r color=(ob.fill==-2?Vector3r(1,0,0):(ob.fill==-1?Vector3r(1,1,0):(ob.fill==0?Vector3r(0,0,1):(ob.fill==1)?Vector3r(0,1,0):(ob.fill==2)?Vector3r(0,1,1):Vector3r(1,1,1))));
+		glColor3v(color);
+		glPushMatrix();
+			glTranslatev(ob.center);
+			glScalef(2*ob.extents[0],2*ob.extents[1],2*ob.extents[2]);
+		 	if (doFill) glutSolidCube(1);
+			else glutWireCube(1);
+		glPopMatrix();
+	}
+}
+
 #endif /* YADE_OPENGL */

=== modified file 'pkg/dem/DomainLimiter.hpp'
--- pkg/dem/DomainLimiter.hpp	2010-11-07 11:46:20 +0000
+++ pkg/dem/DomainLimiter.hpp	2010-11-17 11:25:26 +0000
@@ -70,5 +70,21 @@
 	);
 };
 REGISTER_SERIALIZABLE(GlExtra_LawTester);
+
+class GlExtra_OctreeCubes: public GlExtraDrawer{
+	public:
+	struct OctreeBox{ Vector3r center, extents; int fill; int level; };
+	std::vector<OctreeBox> boxes;
+	void postLoad(GlExtra_OctreeCubes&);
+	virtual void render();
+	YADE_CLASS_BASE_DOC_ATTRS(GlExtra_OctreeCubes,GlExtraDrawer,"Render boxed read from file",
+		((string,boxesFile,,Attr::triggerPostLoad,"File to read boxes from; ascii files with ``x0 y0 z0 x1 y1 z1 c`` records, where ``c`` is an integer specifying fill (0 for wire, 1 for filled)."))
+		((Vector2i,fillRangeFill,Vector2i(2,2),,"Range of fill indices that will be filled."))
+		((Vector2i,fillRangeDraw,Vector2i(-2,2),,"Range of fill indices that will be rendered."))
+		((Vector2i,levelRangeDraw,Vector2i(-2,2),,"Range of levels that will be rendered."))
+		((bool,noFillZero,true,,"Do not fill 0-fill boxed (those that are further subdivided)"))
+	);
+};
+REGISTER_SERIALIZABLE(GlExtra_OctreeCubes);
 #endif
 

=== modified file 'pkg/dem/Ip2_FrictMat_FrictMat_CapillaryPhys.cpp'
--- pkg/dem/Ip2_FrictMat_FrictMat_CapillaryPhys.cpp	2010-11-12 08:03:16 +0000
+++ pkg/dem/Ip2_FrictMat_FrictMat_CapillaryPhys.cpp	2010-11-17 11:25:26 +0000
@@ -8,9 +8,11 @@
 
 #include"Ip2_FrictMat_FrictMat_CapillaryPhys.hpp"
 #include<yade/pkg/dem/ScGeom.hpp>
-#include <yade/pkg/dem/CapillaryPhys.hpp>
+#include<yade/pkg/dem/CapillaryPhys.hpp>
 #include<yade/pkg/dem/FrictPhys.hpp>
 #include<yade/pkg/common/ElastMat.hpp>
+#include<yade/pkg/common/Dispatching.hpp>
+
 #include<yade/core/Omega.hpp>
 #include<yade/core/Scene.hpp>
 

=== modified file 'pkg/dem/NewtonIntegrator.cpp'
--- pkg/dem/NewtonIntegrator.cpp	2010-11-15 17:18:44 +0000
+++ pkg/dem/NewtonIntegrator.cpp	2010-11-17 11:25:26 +0000
@@ -10,7 +10,6 @@
 #include<yade/core/Scene.hpp>
 #include<yade/pkg/dem/Clump.hpp>
 #include<yade/pkg/common/VelocityBins.hpp>
-#include<yade/pkg/dem/Shop.hpp>
 #include<yade/lib/base/Math.hpp>
 		
 YADE_PLUGIN((NewtonIntegrator));

=== modified file 'pkg/dem/ScGeom.cpp'
--- pkg/dem/ScGeom.cpp	2010-11-12 19:16:09 +0000
+++ pkg/dem/ScGeom.cpp	2010-11-17 11:25:26 +0000
@@ -3,7 +3,7 @@
 // © 2008 Václav Šmilauer <eudoxos@xxxxxxxx>
 // © 2006 Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>
 
-#include "ScGeom.hpp"
+#include<yade/pkg/dem/ScGeom.hpp>
 #include<yade/core/Omega.hpp>
 #include<yade/core/Scene.hpp>
 

=== modified file 'yadeSCons.py'
--- yadeSCons.py	2010-11-07 11:37:58 +0000
+++ yadeSCons.py	2010-11-17 11:25:26 +0000
@@ -26,7 +26,7 @@
 	for l in open(root+'/'+f):
 		if re.match(r'\s*#endif.*$',l): skipping=False; continue
 		if skipping: continue
-		m=re.match(r'^\s*#include\s*<yade/([^/]*)/(.*)>.*$',l)
+		m=re.match(r'^\s*#include\s*<yade/([^/]+/[^/]+)/(.*)>.*$',l)
 		if m:
 			incMod=m.group(1); baseName=m.group(2).split('.')[0];
 			if incMod=='core' or incMod.startswith('lib/'): continue
@@ -67,7 +67,7 @@
 						cond,feat=m.group(1),m.group(2).lower()
 						if (cond=='ifdef' and feat not in features) or (cond=='ifndef' and feat in features): skipping=True
 					if re.match(r'\s*YADE_PLUGIN\(.*',l): isPlugin=True
-					m=re.match(r'^\s*#include\s*<yade/([^/]*)/(.*)>.*$',l)
+					m=re.match(r'^\s*#include\s*<yade/([^/]+/[^/]+)/(.*)>.*$',l)
 					if m:
 						incMod=m.group(1); incHead=m.group(2); baseName=incHead.split('.')[0]; assert(len(incHead.split('.'))==2)
 						if incMod=='core' or incMod.startswith('lib/'): continue


Follow ups