[Gridflow-cvs] [svn] commit: r4021 - in /trunk: base/flow_objects.c base/grid.c gridflow.h

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Fri Jul 11 18:42:15 EDT 2008


Author: matju
Date: Fri Jul 11 18:42:14 2008
New Revision: 4021

Log:
remove GridInlet::set_factor and some stuff related to GRID_ALLOC/GridOutlet::ask

Modified:
    trunk/base/flow_objects.c
    trunk/base/grid.c
    trunk/gridflow.h

Modified: trunk/base/flow_objects.c
==============================================================================
--- trunk/base/flow_objects.c (original)
+++ trunk/base/flow_objects.c Fri Jul 11 18:42:14 2008
@@ -581,8 +581,6 @@
 	if (op->size>1 && (in->dim->get(in->dim->n-1)!=op->size || r->dim->get(r->dim->n-1)!=op->size))
 		RAISE("using %s requires Dim(...,%d) in both inlets but got: left=%s right=%s",
 			op->name,op->size,in->dim->to_s(),r->dim->to_s());
-} GRID_ALLOC {
-	//out->ask(in->allocn,(T * &)in->alloc,in->allocfactor,in->allocmin,in->allocmax);
 } GRID_FLOW {
 	T *rdata = (T *)*r;
 	long loop = r->dim->prod();

Modified: trunk/base/grid.c
==============================================================================
--- trunk/base/grid.c (original)
+++ trunk/base/grid.c Fri Jul 11 18:42:14 2008
@@ -106,24 +106,14 @@
 // must be set before the end of GRID_BEGIN phase, and so cannot be changed
 // afterwards. This is to allow some optimisations. Anyway there is no good reason
 // why this would be changed afterwards.
-void GridInlet::set_factor(long factor) {
-	if(!dim) RAISE("huh?");
-	if(factor<=0) RAISE("%s: factor=%d should be >= 1",ARGS(parent),factor);
-	int i;
-	for (i=0; i<=dim->n; i++) if (dim->prod(i)==factor) break;
-	if (i>dim->n) RAISE("%s: set_factor: expecting dim->prod(i) for some i, "
-		"but factor=%ld and dim=%s",ARGS(parent),factor,dim->to_s());
-	if (factor > 1) {
-		buf=new Grid(new Dim(factor), nt);
-		bufi=0;
-	} else {
-		buf=0;
-	}
-}
-
 void GridInlet::set_chunk(long whichdim) {
 	long n = dim->prod(whichdim);
-	if (n) set_factor(n);
+	if (!n) n=1;
+	if(!dim) RAISE("huh?");
+	if (n>1) {
+		buf=new Grid(new Dim(n), nt);
+		bufi=0;
+	} else buf=0;
 }
 
 bool GridInlet::supports_type(NumberTypeE nt) {

Modified: trunk/gridflow.h
==============================================================================
--- trunk/gridflow.h (original)
+++ trunk/gridflow.h Fri Jul 11 18:42:14 2008
@@ -688,7 +688,7 @@
 /* macro for defining a gridinlet's behaviour as just storage (no backstore) */
 // V is a PtrGrid instance-var
 #define GRID_INPUT(I,V) \
-	GRID_INLET(I) { V=new Grid(in->dim,NumberTypeE_type_of(data)); } GRID_FLOW {COPY((T *)*(V)+in->dex,data,n);} GRID_FINISH
+	GRID_INLET(I) {V=new Grid(in->dim,NumberTypeE_type_of(data));} GRID_FLOW {COPY((T *)*(V)+in->dex,data,n);} GRID_FINISH
 
 // macro for defining a gridinlet's behaviour as just storage (with backstore)
 // V is a PtrGrid instance-var
@@ -723,21 +723,16 @@
 	long bufi;   // buffer index: how much of buf is filled
 public:
 	int mode; // 0=ignore; 4=ro
-//	long allocfactor,allocmin,allocmax,allocn;
-//	uint8 *alloc;
-
 	GridInlet(FObject *parent_, const GridHandler *gh_) :
-		parent(parent_), gh(gh_), sender(0),
-		dim(0), nt(int32_e), dex(0), bufi(0), mode(4) {}
+		parent(parent_), gh(gh_), sender(0), dim(0), nt(int32_e), dex(0), bufi(0), mode(4) {}
 	~GridInlet() {}
-	void set_factor(long factor); // obsolete
 	void set_chunk(long whichdim);
 	void set_mode(int mode_) {mode=mode_;}
 	int32 factor() {return buf?buf->dim->prod():1;}
 	void begin(GridOutlet *back_out);
 	void finish(); /* i thought this should be private but maybe it shouldn't. */
 
-	// n=-1 is begin, and n=-2 is finish; GF-0.9 may have n=-3 meaning alloc (?).
+	// n=-1 is begin, and n=-2 is finish.
 	template <class T> void flow(int mode, long n, T *data);
 	void from_list(VA, NumberTypeE nt=int32_e) {Grid t(argc,argv,nt); from_grid(&t);}
 	void from_atom(VA) {Grid t(argv[0]); from_grid(&t);}



More information about the Gridflow-cvs mailing list