[Gridflow-cvs] [svn] commit: r5610 - in /trunk/src: classes1.cxx classes3.cxx gridflow.hxx sdl.cxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Wed May 5 22:40:49 EDT 2010


Author: matju
Date: Wed May  5 22:40:49 2010
New Revision: 5610

Log:
Dim,GridInlet&

Modified:
    trunk/src/classes1.cxx
    trunk/src/classes3.cxx
    trunk/src/gridflow.hxx
    trunk/src/sdl.cxx

Modified: trunk/src/classes1.cxx
==============================================================================
--- trunk/src/classes1.cxx (original)
+++ trunk/src/classes1.cxx Wed May  5 22:40:49 2010
@@ -939,7 +939,7 @@
 \def 0 bang () {
 	SAME_TYPE(*from,to);
 	SAME_TYPE(*from,step);
-	if (!from->dim.equal(to->dim) || !to->dim.equal(step->dim))
+	if (from->dim!=to->dim || to->dim!=step->dim)
 		RAISE("dimension mismatch: from:%s to:%s step:%s",from->dim.to_s(),to->dim.to_s(),step->dim.to_s());
 #define FOO(T) trigger((T)0);
 	TYPESWITCH(from->nt,FOO,);

Modified: trunk/src/classes3.cxx
==============================================================================
--- trunk/src/classes3.cxx (original)
+++ trunk/src/classes3.cxx Wed May  5 22:40:49 2010
@@ -643,7 +643,7 @@
 	margy = (db[0]-1)/2;
 	margx = (db[1]-1)/2;
 	//if (a) post("for %p, a->dim=%s da=%s",this,a->dim.to_s(),da->to_s());
-	if (!a || !a->dim.equal(da)) a=new Grid(da,in.nt); // with this condition it's 2% faster on Linux but takes more RAM.
+	if (!a || a->dim != da) a=new Grid(da,in.nt); // with this condition it's 2% faster on Linux but takes more RAM.
 	//a=new Grid(da,in.nt); // with this condition it's 2% faster but takes more RAM.
 	int v[da.n]; COPY(v,da.v,da.n);
 	if (!wrap) {v[0]-=db[0]-1; v[1]-=db[1]-1;}
@@ -721,7 +721,7 @@
 } GRID_FLOW {
 	int rowsize = in.dim.prod(1);
 	T buf[rowsize*scalex];
-	int chans = in.dim.get(2);
+	int chans = in.dim[2];
 	#define Z(z) buf[p+z]=data[i+z]
 	for (; n>0; data+=rowsize, n-=rowsize) {
 		int p=0;
@@ -1324,7 +1324,7 @@
 	COPY(v,r->dim.v,r->dim.n-1);
 	v[r->dim.n-1]=1;
 	Dim t = Dim(r->dim.n,v);
-	if (!t.equal(in.dim)) RAISE("left %s must be equal to right %s except last dimension should be 1",in.dim.to_s(),r->dim.to_s());
+	if (t != in.dim) RAISE("left %s must be equal to right %s except last dimension should be 1",in.dim.to_s(),r->dim.to_s());
 	in.set_chunk(0);
 	int32 w[2] = {numClusters,r->dim[r->dim.n-1]};
 	sums   = new Grid(Dim(2,w),r->nt,  true);

Modified: trunk/src/gridflow.hxx
==============================================================================
--- trunk/src/gridflow.hxx (original)
+++ trunk/src/gridflow.hxx Wed May  5 22:40:49 2010
@@ -347,10 +347,10 @@
 		if(c) COPY(v+a->n+b->n,c->v,c->n);
 	}
 	Card count() {return n;}
-	Card get       (Card i) const {return v[i];}
+	//Card get     (Card i) const {return v[i];}
 	Card operator[](Card i) const {return v[i];}
-	const Dim & operator *() const {return *this;}
-	      Dim & operator *()       {return *this;}
+	//const Dim & operator *() const {return *this;}
+	//      Dim & operator *()       {return *this;}
 	//const Dim *operator ->() const {return this;}
 	//      Dim *operator ->()       {return this;}
 /*	Dim *range(Card i, Card j) {return new Dim(...);} */
@@ -362,11 +362,12 @@
 		return tot;
 	}
 	char *to_s() const; // should be std::string
-	bool equal(const Dim &o) {
+	bool operator==(const Dim &o) const {
 		if (n!=o.n) return false;
 		for (Card i=0; i<n; i++) if (v[i]!=o[i]) return false;
 		return true;
 	}
+	bool operator!=(const Dim &o) const {return !operator==(o);}
 };
 
 //****************************************************************

Modified: trunk/src/sdl.cxx
==============================================================================
--- trunk/src/sdl.cxx (original)
+++ trunk/src/sdl.cxx Wed May  5 22:40:49 2010
@@ -188,7 +188,7 @@
 	if (in.dim[2] != 3) RAISE("expecting 3 channels: red,green,blue (got %d)",in.dim[2]);
 	int sx = in.dim[1], osx = dim[1];
 	int sy = in.dim[0], osy = dim[0];
-	in->set_chunk(1);
+	in.set_chunk(1);
 	if (sx!=osx || sy!=osy) resize_window(sx,sy);
 } GRID_FLOW {
 	int bypl = screen->pitch;



More information about the Gridflow-cvs mailing list