Changeset 30620 in project
 Timestamp:
 03/31/14 17:01:18 (7 years ago)
 Location:
 release/4/npccl/trunk
 Files:

 3 edited
Legend:
 Unmodified
 Added
 Removed

release/4/npccl/trunk/examples/GL.npccl
r30618 r30620 22 22 23 23 ( 24 25 (const xExtent = 1500) 26 (const yExtent = 1000) 24 27 25 28 (const PFlength = 1500) … … 55 58 (const AAtoGoCzone = 5.0) 56 59 60 (const nGC = 400) 61 (const nGoC = 1) 62 57 63 (component (type localcellforest) (name GC) 58 64 … … 60 66 (component (type layout) (name GranuleTcoordinates) 61 67 62 (s = (PointsFromFile ("GCTcoordinates.sorted.dat"))) 68 (b = (Bounds (yExtent 0. 0. xExtent))) 69 70 (s = (UniformRandomPointProcess (nGC ~ (randomInit (19)) ~ (randomInit (21)) ~ b))) 63 71 64 (output s )72 (output s b) 65 73 ) 66 74 … … 117 125 (component (type layout) (name GolgiCoordinates) 118 126 119 (s = (PointsFromFile ("GoCcoordinates.sorted.dat"))) 127 (b = (Bounds (yExtent 0. 0. xExtent))) 128 129 (s = (UniformRandomPointProcess (nGoC ~ (randomInit (23)) ~ (randomInit (29)) ~ b))) 120 130 121 (output s )131 (output s b) 122 132 ) 123 133 
release/4/npccl/trunk/npcclcore.scm
r30536 r30620 275 275 276 276 ;; floating point precision (single or double; default is double) 277 (define inttype 'int) 277 278 (define fptype (lookupdef 'fpprec alst 'double)) 279 (define boundstype 'bounds) 278 280 (define rngstatetype 'rngstate) 279 281 (define stringtype 'string) … … 298 300 ) 299 301 302 (define builtinboundsops 303 `(Bounds) 304 ) 305 300 306 (define builtinpointsetops 301 `(PointsFromFile )307 `(PointsFromFile UniformRandomPointProcess) 302 308 ) 303 309 304 310 (define builtinops (append builtinprojectionops 311 builtinboundsops 305 312 builtinpathops 306 313 builtinpointsetops … … 311 318 (let ( 312 319 (pointsetprocs 313 (list loadpointsfromfile )320 (list loadpointsfromfile UniformRandomPointProcess) 314 321 ) 315 322 316 323 (pointsetexprs 317 '(loadpointsfromfile )324 '(loadpointsfromfile UniformRandomPointProcess) 318 325 ) 319 326 … … 324 331 (pathexprs 325 332 '(makelinesegment) 333 ) 334 335 (boundsprocs 336 (list Bounds) 337 ) 338 339 (boundsexprs 340 '(Bounds) 326 341 ) 327 342 … … 375 390 (rt ,rt) (formals ,fms))))) 376 391 (hashtableset! env n fb))) 392 builtinboundsops 393 boundsprocs 394 boundsexprs 395 `((,fptype ,fptype ,fptype ,fptype)) 396 `(,boundstype) 397 ) 398 399 (foreach (lambda (n v qb fms rt) 400 (let ((fb (extendprocedure 401 v `((name ,n) (evalbody ,qb) 402 (rt ,rt) (formals ,fms))))) 403 (hashtableset! env n fb))) 377 404 builtinpointsetops 378 405 pointsetprocs 379 406 pointsetexprs 380 `((,stringtype) )381 `(,pointsettype )407 `((,stringtype) (,inttype ,rngstatetype ,rngstatetype ,boundstype)) 408 `(,pointsettype ,pointsettype) 382 409 ) 383 410 
release/4/npccl/trunk/npcclutils.scm
r30536 r30620 109 109 110 110 111 (definerecordtype bounds112 (makebounds top left bottom right)113 bounds?114 (top boundstop )115 (left boundsleft )116 (bottom boundsbottom )117 (right boundsright )118 )119 111 120 112 … … 481 473 482 474 483 (define boundsempty (makebounds inf.0 +inf.0 +inf.0 inf.0))484 485 486 (define (boundstranslate b dx dy)487 (makebounds (+ dy (boundstop b))488 (+ dx (boundsleft b))489 (+ dy (boundsbottom b))490 (+ dx (boundsright b))))491 492 493 (define (boundsadd b p)494 (makebounds (fpmax (coord 1 p) (boundstop b))495 (fpmin (coord 0 p) (boundsleft b))496 (fpmin (coord 1 p) (boundsbottom b))497 (fpmax (coord 0 p) (boundsright b))))498 499 475 500 476 (definedatatype layerboundary layerboundary? 501 (Bounds (b bounds?)) 502 (BoundsXZ (b bounds?) (n integer?) (k integer?) (x f64vector?) (y f64vector?) (d f64vector?) (d2 f64vector?)) 503 (BoundsYZ (b bounds?) (n integer?) (k integer?) (x f64vector?) (y f64vector?) (d f64vector?) (d2 f64vector?)) 504 ) 505 506 507 (define (layerboundarybounds b) 508 (cases layerboundary b 509 (Bounds (b) b) 510 (BoundsXZ (b n k x y d d2) b) 511 (BoundsYZ (b n k x y d d2) b))) 477 (Bounds (top number?) (left number?) (bottom number?) (right number?)) 478 (BoundsXZ (top number?) (left number?) (bottom number?) (right number?) 479 (n integer?) (k integer?) (x f64vector?) (y f64vector?) (d f64vector?) (d2 f64vector?)) 480 (BoundsYZ (top number?) (left number?) (bottom number?) (right number?) 481 (n integer?) (k integer?) (x f64vector?) (y f64vector?) (d f64vector?) (d2 f64vector?)) 482 ) 483 512 484 513 485 514 486 (define (boundaryzextentfunction boundary) 515 487 (cases layerboundary boundary 516 (Bounds ( b)488 (Bounds (top left bottom right) 517 489 (lambda (x y) 0.)) 518 (BoundsXZ ( bn k x y d d2)490 (BoundsXZ (top left bottom right n k x y d d2) 519 491 (lambda (xp yp) 520 492 (letvalues (((y0tab y1tab y2tab res) 521 493 (bvspspline:evaluate n k x y d d2 (f64vector xp) 0))) 522 494 (f64vectorref y0tab 0)))) 523 (BoundsYZ ( bn k x y d d2)495 (BoundsYZ (top left bottom right n k x y d d2) 524 496 (lambda (xp yp) 525 497 (letvalues (((y0tab y1tab y2tab res) … … 529 501 530 502 531 (define (point2drejection boundary) 532 (let ((top (boundstop boundary)) 533 (bottom (boundsbottom boundary)) 534 (left (boundsleft boundary)) 535 (right (boundsright boundary))) 503 (define (point2drejection top left bottom right) 536 504 (lambda (p) 537 505 (let ((x (coord 0 p)) (y (coord 1 p))) 538 506 (and (fp> x left) (fp< x right) (fp> y bottom) (fp< y top) p))) 539 ) )507 ) 540 508 541 509 … … 563 531 564 532 (cases layerboundary boundary 565 (Bounds (b) 533 (Bounds (top left bottom right) 534 566 535 (letvalues (((d d2 constr errc diagn) 567 536 (bvspspline:compute n k xpoints zpoints))) … … 570 539 (error 'generateboundary "error in constructing spline from boundary points" errc)) 571 540 572 (BoundsXZ bn k xpoints zpoints d d2)))541 (BoundsXZ top left bottom right n k xpoints zpoints d d2))) 573 542 574 543 (else (error 'generateboundary "boundary argument to XZAxis is already a pseudo3D boundary"))) … … 578 547 (define (Grid xspacing yspacing zspacing boundary) 579 548 549 (matchlet (((top left bottom right) 550 (cases layerboundary boundary 551 (Bounds (top left bottom right) 552 (list top left bottom right)) 553 (BoundsXZ (top left bottom right n k x y d d2) 554 (list top left bottom right)) 555 (BoundsYZ (top left bottom right n k x y d d2) 556 (list top left bottom right)) 557 ))) 558 580 559 (let* ( 581 (xybounds (cases layerboundary boundary 582 (Bounds (b) b) 583 (BoundsXZ (b n k x y d d2) b) 584 (BoundsYZ (b n k x y d d2) b))) 585 (xextent ( (boundsright xybounds) (boundsleft xybounds))) 586 (yextent ( (boundstop xybounds) (boundsbottom xybounds))) 560 (xextent ( right left)) 561 (yextent ( top bottom)) 587 562 (zextentfunction 588 563 (boundaryzextentfunction boundary)) … … 639 614 ))) 640 615 )) 641 616 ) 642 617 643 618 (define (UniformRandomPointProcess n xseed yseed boundary) 644 619 620 (matchlet (((top left bottom right) 621 (cases layerboundary boundary 622 (Bounds (top left bottom right) 623 (list top left bottom right)) 624 (BoundsXZ (top left bottom right n k x y d d2) 625 (list top left bottom right)) 626 (BoundsYZ (top left bottom right n k x y d d2) 627 (list top left bottom right)) 628 ))) 629 645 630 (let* ( 646 (xybounds (cases layerboundary boundary 647 (Bounds (b) b) 648 (BoundsXZ (b n k x y d d2) b) 649 (BoundsYZ (b n k x y d d2) b))) 650 (xextent ( (boundsright xybounds) (boundsleft xybounds))) 651 (yextent ( (boundstop xybounds) (boundsbottom xybounds))) 631 (xextent ( right left)) 632 (yextent ( top bottom)) 652 633 (zextentfunction (boundaryzextentfunction boundary)) 653 634 ) 654 635 655 (let ((xpoints (randommtzig:f64vectorrandu! n(randommtzig:init xseed)))656 (ypoints (randommtzig:f64vectorrandu! n(randommtzig:init yseed)))657 (zpoints (randommtzig:f64vectorrandu! n(randommtzig:init (currentmilliseconds)))))636 (let ((xpoints (randommtzig:f64vectorrandu! (inexact>exact n) (randommtzig:init xseed))) 637 (ypoints (randommtzig:f64vectorrandu! (inexact>exact n) (randommtzig:init yseed))) 638 (zpoints (randommtzig:f64vectorrandu! (inexact>exact n) (randommtzig:init (currentmilliseconds))))) 658 639 659 (let ((pointrejection1 (point2drejection xybounds)))640 (let ((pointrejection1 (point2drejection top left bottom right))) 660 641 661 642 (let recur ((i 0) (ax '())) … … 675 656 )) 676 657 )) 658 ) 677 659 678 660 679 661 (define (ClusteredRandomPointProcess clusterpts n meandistance xseed yseed boundary) 680 662 663 (matchlet (((top left bottom right) 664 (cases layerboundary boundary 665 (Bounds (top left bottom right) 666 (list top left bottom right)) 667 (BoundsXZ (top left bottom right n k x y d d2) 668 (list top left bottom right)) 669 (BoundsYZ (top left bottom right n k x y d d2) 670 (list top left bottom right)) 671 ))) 672 673 681 674 (let* ( 682 (xybounds (cases layerboundary boundary 683 (Bounds (b) b) 684 (BoundsXZ (b n k x y d d2) b) 685 (BoundsYZ (b n k x y d d2) b))) 686 (xextent ( (boundsright xybounds) (boundsleft xybounds))) 687 (yextent ( (boundstop xybounds) (boundsbottom xybounds))) 675 (xextent ( right left)) 676 (yextent ( top bottom)) 688 677 (zextentfunction (boundaryzextentfunction boundary)) 689 678 ) … … 695 684 (zpoints (randommtzig:f64vectorrandu! n (randommtzig:init (currentmilliseconds))))) 696 685 697 (let ((pointrejection1 (point2drejection xybounds)))686 (let ((pointrejection1 (point2drejection top left bottom right))) 698 687 699 688 (let innerrecur ((j 0) (ax pts)) … … 718 707 )) 719 708 )) 709 ) 720 710 721 711
Note: See TracChangeset
for help on using the changeset viewer.