Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/ein16/synth/d2/symb/symb_fv3d3.diderot
ViewVC logotype

Diff of /branches/ein16/synth/d2/symb/symb_fv3d3.diderot

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4455, Wed Aug 24 23:39:30 2016 UTC revision 4456, Thu Aug 25 04:03:27 2016 UTC
# Line 65  Line 65 
65  vec3 orig = -(edge0*(sz0-1) + edge1*(sz1-1) + edge2*(sz2-1))/2 + offws;  vec3 orig = -(edge0*(sz0-1) + edge1*(sz1-1) + edge2*(sz2-1))/2 + offws;
66    
67  //-- field defined by coefficients --  //-- field defined by coefficients --
68  // z=1  input tensor[4] setA1_z0 =[0,0,0,0];
69  input vec2 base1_z0 = [0, 0];    // b*x, c*y  input tensor[4] setB1_z0 =[0,0,0,0];
70  input vec2 xsq1_z0 = [0, 0];     // d*x^2, g*y*x^2  input tensor[4] setC1_z0 =[0,0,0,0];
71  input vec2 ysq1_z0 = [0, 0];     // f*y^2, h*x*y^2  input tensor[4] setD1_z0 =[0,0,0,0];
72  input vec3 diag1_z0 = [0, 0, 0];    // a, e*x*y,  i*y^2*x^2  
73  // z=z  input tensor[4] setA1_z1 =[0,0,0,0];
74  input vec2 base1_z1 = [0, 0];    // b*x, c*y  input tensor[4] setB1_z1 =[0,0,0,0];
75  input vec2 xsq1_z1 = [0, 0];     // d*x^2, g*y*x^2  input tensor[4] setC1_z1 =[0,0,0,0];
76  input vec2 ysq1_z1 = [0, 0];     // f*y^2, h*x*y^2  input tensor[4] setD1_z1 =[0,0,0,0];
77  input vec3 diag1_z1 = [0, 0, 0];    // a, e*x*y,  i*y^2*x^2  
78  // z=z*z  input tensor[4] setA1_z2 =[0,0,0,0];
79  input vec2 base1_z2 = [0, 0];    // b*x, c*y  input tensor[4] setB1_z2 =[0,0,0,0];
80  input vec2 xsq1_z2 = [0, 0];     // d*x^2, g*y*x^2  input tensor[4] setC1_z2 =[0,0,0,0];
81  input vec2 ysq1_z2 = [0, 0];     // f*y^2, h*x*y^2  input tensor[4] setD1_z2 =[0,0,0,0];
82  input vec3 diag1_z2 = [0, 0, 0];    // a, e*x*y,  i*y^2*x^2  
83    
84  //-- field defined by coefficients --  input tensor[4] setA2_z0 =[0,0,0,0];
85  // z=1  input tensor[4] setB2_z0 =[0,0,0,0];
86  input vec2 base2_z0 = [0, 0];    // b*x, c*y  input tensor[4] setC2_z0 =[0,0,0,0];
87  input vec2 xsq2_z0 = [0, 0];     // d*x^2, g*y*x^2  input tensor[4] setD2_z0 =[0,0,0,0];
88  input vec2 ysq2_z0 = [0, 0];     // f*y^2, h*x*y^2  input tensor[4] setA2_z1 =[0,0,0,0];
89  input vec3 diag2_z0 = [0, 0, 0];    // a, e*x*y,  i*y^2*x^2  input tensor[4] setB2_z1 =[0,0,0,0];
90  // z=z  input tensor[4] setC2_z1 =[0,0,0,0];
91  input vec2 base2_z1 = [0, 0];    // b*x, c*y  input tensor[4] setD2_z1 =[0,0,0,0];
92  input vec2 xsq2_z1 = [0, 0];     // d*x^2, g*y*x^2  input tensor[4] setA2_z2 =[0,0,0,0];
93  input vec2 ysq2_z1 = [0, 0];     // f*y^2, h*x*y^2  input tensor[4] setB2_z2 =[0,0,0,0];
94  input vec3 diag2_z1 = [0, 0, 0];    // a, e*x*y,  i*y^2*x^2  input tensor[4] setC2_z2 =[0,0,0,0];
95  // z=z*z  input tensor[4] setD2_z2 =[0,0,0,0];
96  input vec2 base2_z2 = [0, 0];    // b*x, c*y  
97  input vec2 xsq2_z2 = [0, 0];     // d*x^2, g*y*x^2  input tensor[4] setA3_z0 =[0,0,0,0];
98  input vec2 ysq2_z2 = [0, 0];     // f*y^2, h*x*y^2  input tensor[4] setB3_z0 =[0,0,0,0];
99  input vec3 diag2_z2 = [0, 0, 0];    // a, e*x*y,  i*y^2*x^2  input tensor[4] setC3_z0 =[0,0,0,0];
100    input tensor[4] setD3_z0 =[0,0,0,0];
101  //-- field defined by coefficients --  input tensor[4] setA3_z1 =[0,0,0,0];
102  // z=1  input tensor[4] setB3_z1 =[0,0,0,0];
103  input vec2 base3_z0 = [0, 0];    // b*x, c*y  input tensor[4] setC3_z1 =[0,0,0,0];
104  input vec2 xsq3_z0 = [0, 0];     // d*x^2, g*y*x^2  input tensor[4] setD3_z1 =[0,0,0,0];
105  input vec2 ysq3_z0 = [0, 0];     // f*y^2, h*x*y^2  input tensor[4] setA3_z2 =[0,0,0,0];
106  input vec3 diag3_z0 = [0, 0, 0];    // a, e*x*y,  i*y^2*x^2  input tensor[4] setB3_z2 =[0,0,0,0];
107  // z=z  input tensor[4] setC3_z2 =[0,0,0,0];
108  input vec2 base3_z1 = [0, 0];    // b*x, c*y  input tensor[4] setD3_z2 =[0,0,0,0];
109  input vec2 xsq3_z1 = [0, 0];     // d*x^2, g*y*x^2  
110  input vec2 ysq3_z1 = [0, 0];     // f*y^2, h*x*y^2  function real cvt(real x, real y, real z, tensor[4] setA, tensor[4] setB, tensor[4] setC, tensor[4] setD) {
111  input vec3 diag3_z1 = [0, 0, 0];    // a, e*x*y,  i*y^2*x^2      real a = setA[0];
112  // z=z*z      real b = setA[1];
113  input vec2 base3_z2 = [0, 0];    // b*x, c*y      real c = setA[2];
114  input vec2 xsq3_z2 = [0, 0];     // d*x^2, g*y*x^2      real d = setA[3];
115  input vec2 ysq3_z2 = [0, 0];     // f*y^2, h*x*y^2      real e = setB[0];
116  input vec3 diag3_z2 = [0, 0, 0];    // a, e*x*y,  i*y^2*x^2      real f = setB[1];
117        real g = setB[2];
118        real h = setB[3];
119  function real cvt(real x, real y, real z, vec2 base, vec2 xsq, vec2 ysq, vec3 diag){      real i = setC[0];
120      real b = base[0];      real j = setC[1];
121      real c = base[1];      real k = setC[2];
122      real d = xsq[0];      real l = setC[3];
123      real g = xsq[1];      real m = setD[0];
124      real f = ysq[0];      real n = setD[1];
125      real h = ysq[1];      real o = setD[2];
126      real a = diag[0];      real p = setD[3];
127      real e = diag[1];  
128      real i = diag[2];      // as intended to be represented
129      real t0 = b*x + c*y;      real tA = a + b*y + c*x*y+ d*x;
130      real t1 = d*x^2 + g*y*x^2;      real tB = ((e+f*x+g*(x*x))*y*y) + (h*(x*x)*y);
131      real t2 = f*y^2 + h*x*y^2;      real tC = i*(x*x) + (j+k*x+l*(x*x))*y*y*y;
132      real t3 = a + e*x*y + i*(y^2)*(x^2);      real tD = (x*x*x)*((m*y*y*y)+(n*y*y)+(o*y)+p);
133      return z*(t0+t1+t2+t3);      return  z*(tA+tB+tC+tD);
134  }  }
135    
136    
137  function vec3 func(vec3 pos) {  function tensor[3] func(vec3 pos) {
138      real x = pos[0];      real x = pos[0];
139      real y = pos[1];      real y = pos[1];
140      real z = pos[2];      real z = pos[2];
141      real axis1_z0 = cvt(x,y,1,base1_z0,xsq1_z0,ysq1_z0,diag1_z0);  
142      real axis1_z1 = cvt(x,y,z,base1_z1,xsq1_z1,ysq1_z1,diag1_z1);      real axis1_z0 = cvt(x,y,1, setA1_z0, setB1_z0, setC1_z0, setD1_z0);
143      real axis1_z2 = cvt(x,y,z*z,base1_z2,xsq1_z2,ysq1_z2,diag1_z2);      real axis1_z1 = cvt(x,y,z, setA1_z1, setB1_z1, setC1_z1, setD1_z1);
144      real axis1_val = axis1_z0+axis1_z1+axis1_z2;      real axis1_z2 = cvt(x,y,z*z,setA1_z2, setB1_z2, setC1_z2, setD1_z2);
145      real axis2_z0 = cvt(x,y,1,base2_z0,xsq2_z0,ysq2_z0,diag2_z0);      real axis1= axis1_z0+axis1_z1+axis1_z2;
146      real axis2_z1 = cvt(x,y,z,base2_z1,xsq2_z1,ysq2_z1,diag2_z1);  
147      real axis2_z2 = cvt(x,y,z*z,base2_z2,xsq2_z2,ysq2_z2,diag2_z2);      real axis2_z0 = cvt(x,y,1, setA2_z0, setB2_z0, setC2_z0, setD2_z0);
148      real axis2_val = axis2_z0+axis2_z1+axis2_z2;      real axis2_z1 = cvt(x,y,z, setA2_z1, setB2_z1, setC2_z1, setD2_z1);
149      real axis3_z0 = cvt(x,y,1,base3_z0,xsq3_z0,ysq3_z0,diag3_z0);      real axis2_z2 = cvt(x,y,z*z,setA2_z2, setB2_z2, setC2_z2, setD2_z2);
150      real axis3_z1 = cvt(x,y,z,base3_z1,xsq3_z1,ysq3_z1,diag3_z1);      real axis2= axis2_z0+axis2_z1+axis2_z2;
151      real axis3_z2 = cvt(x,y,z*z,base3_z2,xsq3_z2,ysq3_z2,diag3_z2);  
152      real axis3_val = axis3_z0+axis3_z1+axis3_z2;      real axis3_z0 = cvt(x,y,1, setA3_z0, setB3_z0, setC3_z0, setD3_z0);
153      return [axis1_val, axis2_val, axis3_val];      real axis3_z1 = cvt(x,y,z, setA3_z1, setB3_z1, setC3_z1, setD3_z1);
154        real axis3_z2 = cvt(x,y,z*z,setA3_z2, setB3_z2, setC3_z2, setD3_z2);
155        real axis3= axis3_z0+axis3_z1+axis3_z2;
156        return [axis1, axis2, axis3];
157    
158  }  }
159    
160  strand sample(int idx0, int idx1, int idx2) {  strand sample(int idx0, int idx1, int idx2) {
161     output vec3 out = [0,0,0];  
162    
163       output tensor [3] out = [0, 0, 0];
164     update {     update {
165    
166    
167        /* see comment in ../fs2d/fs2d-scl.diderot about the need for these        /* see comment in ../fs2d/fs2d-scl.diderot about the need for these
168           conditionals around the print statements */           conditionals around the print statements */
169        if (0 == idx0 && 0 == idx1 && 0 == idx2) {        if (0 == idx0 && 0 == idx1 && 0 == idx2) {
# Line 169  Line 177 
177           print("dimension: 4\n");           print("dimension: 4\n");
178           print("sizes: 3 ", sz0, " ", sz1, " ", sz2, "\n");           print("sizes: 3 ", sz0, " ", sz1, " ", sz2, "\n");
179           print("kinds: 3-vector space space space\n");           print("kinds: 3-vector space space space\n");
180           print("centers: none cell cell cell\n");          // print("centers: none cell cell cell\n");
181           // NOTE: this assumes machine endianness           // NOTE: this assumes machine endianness
182           print("endian: little\n");           print("endian: little\n");
183           print("encoding: raw\n");           print("encoding: raw\n");

Legend:
Removed from v.4455  
changed lines
  Added in v.4456

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0