[Gridflow-cvs] [svn] commit: r6271 - in /trunk: doc/flow_classes/#compress-help.pd src/classes3.cxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Tue Sep 14 22:27:23 EDT 2010


Author: matju
Date: Tue Sep 14 22:27:21 2010
New Revision: 6271

Log:
introducing [#compress]

Added:
    trunk/doc/flow_classes/#compress-help.pd
Modified:
    trunk/src/classes3.cxx

Modified: trunk/src/classes3.cxx
==============================================================================
--- trunk/src/classes3.cxx (original)
+++ trunk/src/classes3.cxx Tue Sep 14 22:27:21 2010
@@ -1472,6 +1472,33 @@
 \end class {install("#tabwrite",2,0);}
 
 //****************************************************************
+\class GridCompress : FObject {
+	void *tmp;
+	PtrGrid r;
+	\constructor (Grid *r=0) {
+		this->r.constrain(expect_one_dim);
+		this->r=r?r:new Grid(Dim(0),int32_e,true);
+	}
+	\grin 0
+	\grin 1 int32
+};
+GRID_INLET(0) {
+	if (in.dim.n!=1) RAISE("need 1 dimension");
+	if (in.dim!=r->dim) RAISE("left dimension needs to be the same as right dimension");
+	tmp = new vector<T>;
+} GRID_FLOW {
+	vector<T> &tmp2 = *(vector<T> *)tmp;
+	int32 *data2 = (int32 *)*r+in.dex;
+	for (typeof(n) i=0; i<n; i++) if (data2[i]) tmp2.push_back(data[i]);
+} GRID_FINISH {
+	vector<T> &tmp2 = *(vector<T> *)tmp;
+	GridOut out(this,0,Dim(tmp2.size()),in.nt);
+	out.send(tmp2.size(),tmp2.data());
+} GRID_END
+GRID_INPUT(1,r) {} GRID_END
+\end class {install("#compress",2,1);}
+
+//****************************************************************
 void startup_classes3 () {
 	op_os8 = OP(*>>8);
 	\startall



More information about the Gridflow-cvs mailing list