\ io \ \ io_space \ class of space (a hp_ component) created for the piece io. \ \ \ usage: \ \ the simulation can be altered in the following ways: \ \ parameter normal modify random mirror \ \ number of particles xx xx xx xx \ \ methods: \ \ MODIFY.MANY: ( indx -- ) \ \ SET.MIN.MANY: ( n -- ) \ MIN.MANY: ( n -- ) \ \ in the above methods, "n" is the number of particles, and the argument \ "indx" is the transformation selector. For these selectors, the following \ constants have been defined: \ \ hp_norm \ zero or normalize \ hp_incr \ increment \ hp_decr \ decrement \ hp_rand \ randomize \ hp_flip \ mirror or flip \ \ \ see the file io_hp for the use of this component. \ \ see the file io_top for more information on io itself. \ \ \ constructor: Han-earl Park \ copyright 2008 buster & friends' C-ALTO Labs \ \ www.busterandfriends.com/io \ \ (Edinburgh, November 1996 - \ (London, August 1997 - \ (Den Haag, October 1997 - \ (Valencia, March 1999 - \ (Southampton, May 2000 - \ (Cork, April 2006 - \ \ (Cork, October 2008 - \ \ REV: 0.0.1 alpha (Southampton, October 2000) \ REV: 0.0.1 beta (Southampton, November 2000) \ REV: 0.0.1 alpha++ (Southampton, July 2004) \ REV: 0.0.1 beta++ (Cork, May 2010) \ \ \ MOD: HeP 04/04/00 Trash instance object iv-space-particles used to keep \ track of total number of particles. \ MOD: HeP 04/19/00 Add io_particle component. \ MOD: HeP 04/30/00 Redefine FREE.HIERARCHY: to take into account the variable \ number of particles. \ MOD: HeP 05/03/00 Sets instance variables to 0 when FREE:ed. \ MOD: HeP 05/25/00 Base particle coord around 0 (the "origin"). This \ simplifies mirror transformation of position. \ MOD: HeP 05/28/00 Add iv-space-mid-many to keep track of mid (normal) value \ to help some of the transformations (mirror, etc). \ MOD: HeP 06/01/00 Add the particle.list class that does what the io.space \ class used to do -- distribute messages to the particles. \ See file io_particles for more details. \ MOD: HeP 06/07/00 Change stack behavior of the MODIFY...: methods from \ ( n indx -- ) to ( indx -- ). \ Replace the hp_modify selector with hp_incr and hp_decr. \ Rename (condense) the names of the other selectors. \ Remove the pass through methods for modifying particles \ from the space object, since this is now handles by the \ particle.holder class. Also remove PAUSE: and RESUME: \ REV: 0.0.1 alpha __________________________________________________________ \ REV: 0.0.1 beta __________________________________________________________ \ MOD: HeP 05-01-04 Move all includes (and conditional includes) from the \ individual files to load_io. \ REV: 0.0.1 a ++ __________________________________________________________ \ REV: 0.0.1 b ++ __________________________________________________________ \ Version for performance at Blackrock Castle Observatory, \ Cork, Ireland, May 25, 2010. \ \ \ ToDo: FREEALL: may be a redundant method. \ ToDo: Override the CUSTOM.EXEC: and TERMINATE: methods to account for the \ variable number of particles! \ ToDo: Is this a redundant class?!? anew task-io_space method MODIFY.MANY: method SET.MIN.MANY: method MIN.MANY: :class OB.IO.SPACE iv-space-min-many 0 iv=> iv-space-max-many 0 iv=> iv-space-mid-many ;m :m DEFAULT: ( -- ) default: super \ many: self ?dup IF 0 DO i get: self default: [] LOOP THEN ;m :m FREE: ( -- ) free: super 0 iv=> iv-space-min-many 0 iv=> iv-space-max-many 0 iv=> iv-space-mid-many ;m : SPACE.SET.MANY ( -- ) iv-space-max-many iv-space-min-many - 2/ iv-space-min-many + \ iv=> iv-space-mid-many ; \ we only redefine ADD: and }STUFF: so the more elaborate methods of the \ elmnts or list class are not supported with the MODIFY.MANY: method. :m ADD: ( addr -- , add element to end ) add: super iv-many iv=> iv-space-max-many \ space.set.many ;m :m }STUFF: ( stuff... -- , stuff data and set many ) }stuff: super iv-many iv=> iv-space-max-many \ space.set.many ;m :m SET.MIN.MANY: ( n -- , set minimum number of particles ) dup 0>= IF dup iv=> iv-space-min-many iv-space-max-many MAX iv=> iv-space-max-many \ space.set.many ELSE " set.min.many:" " minimum number of particles cannot be set to 0 or less" er_warning ob.report.error drop THEN ;m :m MIN.MANY: ( -- n , return minimum number of particles ) iv-space-min-many ;m :m FREE.HIERARCHY: ( -- , sends free: to force and particles ) iv-space-max-many 0 DO i get: self ?dup IF free: [] THEN LOOP \ iv-space-force IF iv-space-force free: [] THEN \ free: self ;m \ modify number of particles : NORM.MANY ( -- ) iv-space-mid-many set.many: self ; : INCR.MANY ( -- ) many: self 1+ iv-space-max-many MIN set.many: self ; : DECR.MANY ( -- ) many: self 1- iv-space-min-many MAX set.many: self ; : RAND.MANY ( -- ) iv-space-max-many iv-space-min-many wchoose set.many: self ; : FLIP.MANY ( -- ) iv-space-mid-many 2* many: self - \ flip around mid point iv-space-min-many iv-space-max-many clipto set.many: self ; :m MODIFY.MANY: ( indx -- ) CASE hp_norm OF norm.many ENDOF hp_incr OF incr.many ENDOF hp_decr OF decr.many ENDOF hp_rand OF rand.many ENDOF hp_flip OF flip.many ENDOF \ " modify.many:" io.hp.report.error ENDCASE ;m \ execution :m CUSTOM.EXEC: ( -- flag , start tasking ) many: self 0> IF false iv=> iv-col-done? iv-jb-instrument ?dup IF open: [] THEN \ many: self 0 DO i get: self open: [] \ open each particle LOOP \ self ao.post false ELSE vtime@ true THEN ;m :m TERMINATE: ( time -- , stop tasking ) iv-if-active IF job.stop \ many: self 0 DO i get: self close: [] \ close each particle LOOP \ morph.stop ELSE drop THEN ;m \ print :m PRINT.ELEMENT: ( elm# -- ) get: self dup name: [] tab .class: [] ;m :m PRINT: ( -- ) many: self iv-space-max-many set.many: self \ print: super \ set.many: self \ ." #Particles:" cr ." minimum = " iv-space-min-many 3 .r cr ." maximum = " iv-space-max-many 3 .r cr ." normal = " iv-space-mid-many 3 .r cr ." current = " many: self 3 .r cr ;m ;class