[Gridflow-cvs] [svn] commit: r6533 - /trunk/src/classes1.cxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Thu Feb 3 23:26:46 EST 2011


Author: matju
Date: Thu Feb  3 23:26:46 2011
New Revision: 6533

Log:
[#inner]: seedless mode

Modified:
    trunk/src/classes1.cxx

Modified: trunk/src/classes1.cxx
==============================================================================
--- trunk/src/classes1.cxx (original)
+++ trunk/src/classes1.cxx Thu Feb  3 23:26:46 2011
@@ -686,7 +686,7 @@
 	\constructor (Grid *r=0) {
 		this->op = op_mul;
 		this->fold = op_add;
-		this->seed = new Grid(Dim(),int32_e,true);
+		this->seed = 0;
 		this->r    = r ? r : new Grid(Dim(),int32_e,true);
 	}
 	\grin 0
@@ -720,11 +720,11 @@
 #define MAX_PACKET_SIZE 4096
 GRID_INLET(0) {
 	SAME_TYPE(in,r);
-	SAME_TYPE(in,seed);
+	if (seed) SAME_TYPE(in,seed);
 	Dim &a=in.dim, &b=r->dim;
 	if (a.n<1) RAISE("a: minimum 1 dimension");
 	if (b.n<1) RAISE("b: minimum 1 dimension");
-	if (seed->dim.n != 0) RAISE("seed must be a scalar");
+	if (seed && seed->dim.n != 0) RAISE("seed must be a scalar");
 	int n = a.n+b.n-2;
 	SAME_DIM(1,a,a.n-1,b,0);
 	int32 v[n];
@@ -740,7 +740,7 @@
 	for (long i=0; i<sj; i++)
 		for (long j=0; j<chunk; j++)
 			COPY(buf3+(j+i*chunk)*sk,rdata+i*sk,sk);
-	use_dot = op==op_mul && fold==op_add && seed->dim.n==0 && *(T *)*seed==0;
+	use_dot = op==op_mul && fold==op_add && (!seed || (seed->dim.n==0 && *(T *)*seed==0));
 } GRID_FLOW {
     long sjk=r->dim.prod(), sj=in.dim.prod(in.dim.n-1), sk=sjk/sj;
     long chunk = max(1L,MAX_PACKET_SIZE/sjk), off=chunk;
@@ -771,7 +771,7 @@
     } else {
 	while (n) {
 		if (chunk*sj>n) chunk=n/sj;
-		op_put->map(chunk*sk,buf2,*(T *)*seed);
+		op_put->map(chunk*sk,buf2, seed ? *(T *)*seed : T(0));
 		for (long i=0; i<sj; i++) {
 			switch (sk) {
 			case 1:  inner_child_b<T,1>(buf,data+i,sj,chunk); break;



More information about the Gridflow-cvs mailing list