Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

[diderot] Diff of /branches/vis15/src/tests/new-tests/clamp-test.diderot
 [diderot] / branches / vis15 / src / tests / new-tests / clamp-test.diderot

# Diff of /branches/vis15/src/tests/new-tests/clamp-test.diderot

revision 3831, Thu May 5 22:17:06 2016 UTC revision 4490, Sat Sep 3 01:10:16 2016 UTC
# Line 1  Line 1
1  // test various forms of the clamp operation  #version 2.0
2
3    // test clamp function
4    //
5
6  tensor[2,2] t1 = [[-1, 2], [3, 4]];  // FIXME: higher-order clamp
7  tensor[2,2] lo = [[0, 1], [0, 0]];;  //tensor[2,2] M = [[-2, 1], [1.5, 0]];
8  tensor[2,2] hi = [[1, 1.5], [4, 3]];  //tensor[2,2] L = [[-1, -1], [2, 2]];
9    //tensor[2,2] H = [[2, 3], [3, 2.5]];
10    tensor[4] M = [-2, 1, 1.5, 0];
11    tensor[4] L = [-1, -1, 2, 2];
12    tensor[4] H = [2, 3, 3, 2.5];
13
14  tensor[2,2] t = clamp (lo, hi, t1);  initialize {
15      print ("M = ", M, "\n");
16      print ("L = ", L, "\n");
17      print ("H = ", H, "\n");
18    }
19
20    strand S () {
21      output real w = 0;
22
23      update {
24        stabilize;
25      }
26
27    }
28
29    start {
30      print ("clamp(L, H, M) = ", clamp(L, H, M), "\n");
31      print ("clamp(0, 1, M) = ", clamp(0, 1, M), "\n");
32      print ("clamp(-1, 1, M) = ", clamp(-1, 1, M), "\n");
33    }
34
35    collection { S() | i in 1..1 }

Legend:
 Removed from v.3831 changed lines Added in v.4490