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

SCM Repository

[diderot] Diff of /branches/ein16/synth/d2/test_createField.py
ViewVC logotype

Diff of /branches/ein16/synth/d2/test_createField.py

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

revision 4242, Thu Jul 21 14:43:40 2016 UTC revision 4243, Thu Jul 21 17:54:34 2016 UTC
# Line 18  Line 18 
18    
19  #call program due to field type  #call program due to field type
20  def progName(itype, outSize):  def progName(itype, outSize):
21        dim = itype.dim
22      #call program due to field type      #call program due to field type
23        if(dim==1):
24      if (fty.isEq_id(itype,ty_scalarF_d1)):      if (fty.isEq_id(itype,ty_scalarF_d1)):
25          #print "kitten-made a 1-d field"          #print "kitten-made a 1-d field"
26          return ("symb_fsd1"," -which 0 "," -s 1 "+str(outSize))          # 1-d scalar field          return ("symb_fsd1"," -which 0 "," -s 1 "+str(outSize))          # 1-d scalar field
27      elif (fty.isEq_id(itype,ty_scalarF_d2)):          #elif(fty.isEq_id(itype,ty_vec2F_d1)):                      # 2-d length 2 vector field
28            #    return ("symb_fv2d1"," -which 0 "," -s 1 "+str(2*outSize))
29        if(dim==2):
30            if (fty.isEq_id(itype,ty_scalarF_d2)):
31          return ("symb_fsd2"," -which 0 "," -s 1 "+str(outSize * outSize))          # 2-d scalar field          return ("symb_fsd2"," -which 0 "," -s 1 "+str(outSize * outSize))          # 2-d scalar field
32      elif(fty.isEq_id(itype,ty_vec2F_d2)):                      # 2-d length 2 vector field      elif(fty.isEq_id(itype,ty_vec2F_d2)):                      # 2-d length 2 vector field
33          return ("symb_fv2d2"," -which 0 "," -s 1 "+str(2*outSize *outSize))         # creates field with coefficients for each axis              return ("symb_fv2d2"," -which 0 "," -s 1 "+str(2*outSize *outSize))
34                # creates field with coefficients for each axis
35            elif(fty.isEq_id(itype,ty_vec3F_d2)):                      # 2-d length 2 vector field
36                return ("symb_fv3d2"," -which 0 "," -s 1 "+str(3*outSize *outSize))
37                # creates field with coefficients for each axis
38      elif(fty.isEq_id(itype, ty_mat2x2F_d2)):                      # 2-d matrx 2x2      elif(fty.isEq_id(itype, ty_mat2x2F_d2)):                      # 2-d matrx 2x2
39          return ("symb_fm2x2d2"," -which 0 "," -s 1 "+str(4*outSize *outSize))          return ("symb_fm2x2d2"," -which 0 "," -s 1 "+str(4*outSize *outSize))
40          # creates field with coefficients for each axis          # creates field with coefficients for each axis
41      elif (fty.isEq_id(itype,ty_scalarF_d3)):      elif(dim==3):
42            if (fty.isEq_id(itype,ty_scalarF_d3)):
43          return ("symb_fsd3"," -which 0 "," -s 1 "+str(outSize * outSize * outSize))          # 3-d scalar field          return ("symb_fsd3"," -which 0 "," -s 1 "+str(outSize * outSize * outSize))          # 3-d scalar field
44            elif(fty.isEq_id(itype, ty_vec2F_d3)):                      # 2-d length 2 vector field
45                size = 2* outSize *outSize*outSize
46                return ("symb_fv2d3"," -which 0 "," -s 1 "+str(size))         # creates field with coefficients for each axis
47      elif(fty.isEq_id(itype,ty_vec3F_d3)):                      # 2-d length 2 vector field      elif(fty.isEq_id(itype,ty_vec3F_d3)):                      # 2-d length 2 vector field
48          size = 3* outSize *outSize*outSize          size = 3* outSize *outSize*outSize
49          return ("symb_fv3d3"," -which 0 "," -s 1 "+str(size))         # creates field with coefficients for each axis          return ("symb_fv3d3"," -which 0 "," -s 1 "+str(size))         # creates field with coefficients for each axis
# Line 99  Line 112 
112      sout=str(outSize)      sout=str(outSize)
113      def get_Params():      def get_Params():
114          if(fty.get_dim(itype)==1):          if(fty.get_dim(itype)==1):
115                if(fty.isEq_id(itype, ty_scalarF_d1)):
116              [a,b,c]=coeff              [a,b,c]=coeff
117              COEFF ="-base "+str(a)+" "+str(b)+" "+str(c)#convert coeff to strings              COEFF ="-base "+str(a)+" "+str(b)+" "+str(c)#convert coeff to strings
118              SIZE=" -sz0 "+ sout +" -width 1"    # giving sample size              SIZE=" -sz0 "+ sout +" -width 1"    # giving sample size
119              return COEFF + SIZE              return COEFF + SIZE
120                elif(fty.isEq_id(itype, ty_vec2F_d1)):
121                    [[a,b,c],[d,e,f]]=coeff
122                    COEFF ="-base1 "+str(a)+" "+str(b)+" "+str(c)#convert coeff to strings
123                    COEFF ="-base2 "+str(d)+" "+str(e)+" "+str(f)#convert coeff to strings
124    
125                    SIZE=" -sz0 "+ sout +" -sz1 "+ sout +" -width 1"    # giving sample size
126                    return COEFF + SIZE
127          elif(fty.get_dim(itype)==2):          elif(fty.get_dim(itype)==2):
128              #2d vector field              if(fty.isEq_id(itype, ty_scalarF_d2)):
129              if(fty.isEq_id(itype,  ty_mat2x2F_d2)):                  # scalar field
130                  [m0,m1]=coeff                  COEFF = coeffToBase(coeff, "")#convert coeff to strings
                 [v1,v3] = m0  
                 [v2,v4] = m1  
                 COEFF = coeffToBase(v1, "1")+coeffToBase(v2, "2")+coeffToBase(v3, "3")+coeffToBase(v4, "4")#convert coeff to strings  
131                  SIZE=" -sz0 "+ sout +" -sz1 "+ sout +" -width 1"    # giving sample size                  SIZE=" -sz0 "+ sout +" -sz1 "+ sout +" -width 1"    # giving sample size
132                  return COEFF + SIZE                  return COEFF + SIZE
133    
134              elif(fty.isEq_id(itype, ty_vec2F_d2)):              elif(fty.isEq_id(itype, ty_vec2F_d2)):
135                  [v0,v1]=coeff                  [v0,v1]=coeff
136                  COEFF = coeffToBase(v0, "1")+coeffToBase(v1, "2")#convert coeff to strings                  COEFF = coeffToBase(v0, "1")+coeffToBase(v1, "2")#convert coeff to strings
137                  SIZE=" -sz0 "+ sout +" -sz1 "+ sout +" -width 1"    # giving sample size                  SIZE=" -sz0 "+ sout +" -sz1 "+ sout +" -width 1"    # giving sample size
138                  return COEFF + SIZE                  return COEFF + SIZE
139              elif(fty.isEq_id(itype, ty_scalarF_d2)):              elif(fty.isEq_id(itype, ty_vec3F_d2)):
140                  # scalar field                  [v0,v1,v2]=coeff
141                  COEFF = coeffToBase(coeff, "")#convert coeff to strings                  COEFF = coeffToBase(v0, "1")+coeffToBase(v1, "2")+coeffToBase(v1, "3")#convert coeff to strings
142                    SIZE=" -sz0 "+ sout +" -sz1 "+ sout +" -width 1"    # giving sample size
143                    return COEFF + SIZE
144                elif(fty.isEq_id(itype,  ty_mat2x2F_d2)):
145                    [m0,m1]=coeff
146                    [v1,v3] = m0
147                    [v2,v4] = m1
148                    COEFF = coeffToBase(v1, "1")+coeffToBase(v2, "2")+coeffToBase(v3, "3")+coeffToBase(v4, "4")#convert coeff to strings
149                  SIZE=" -sz0 "+ sout +" -sz1 "+ sout +" -width 1"    # giving sample size                  SIZE=" -sz0 "+ sout +" -sz1 "+ sout +" -width 1"    # giving sample size
150                  return COEFF + SIZE                  return COEFF + SIZE
151              else:              else:
# Line 130  Line 156 
156                  COEFF=coeffToBase(z0, "_z0")+coeffToBase(z1, "_z1")+coeffToBase(z2, "_z2")                  COEFF=coeffToBase(z0, "_z0")+coeffToBase(z1, "_z1")+coeffToBase(z2, "_z2")
157                  SIZE=" -sz0 "+ sout +" -sz1 "+ sout+" -sz2 "+ sout +" -width 1"    # giving sample size                  SIZE=" -sz0 "+ sout +" -sz1 "+ sout+" -sz2 "+ sout +" -width 1"    # giving sample size
158                  return COEFF + SIZE                  return COEFF + SIZE
159                elif(fty.isEq_id(itype,ty_vec2F_d3)):
160                    [[az0,az1,az2],[bz0,bz1,bz2]]=coeff
161                    COEFF=coeffToBase(az0, "1_z0")+coeffToBase(az1, "1_z1")+coeffToBase(az2, "1_z2")
162                    COEFF+=coeffToBase(bz0, "2_z0")+coeffToBase(bz1, "2_z1")+coeffToBase(bz2, "2_z2")
163                    SIZE=" -sz0 "+ sout +" -sz1 "+ sout+" -sz2 "+ sout +" -width 1"    # giving sample size
164                    return COEFF + SIZE
165              elif(fty.isEq_id(itype,ty_vec3F_d3)):              elif(fty.isEq_id(itype,ty_vec3F_d3)):
166                  [[az0,az1,az2],[bz0,bz1,bz2],[cz0,cz1,cz2]]=coeff                  [[az0,az1,az2],[bz0,bz1,bz2],[cz0,cz1,cz2]]=coeff
167                  COEFF=coeffToBase(az0, "1_z0")+coeffToBase(az1, "1_z1")+coeffToBase(az2, "1_z2")                  COEFF=coeffToBase(az0, "1_z0")+coeffToBase(az1, "1_z1")+coeffToBase(az2, "1_z2")

Legend:
Removed from v.4242  
changed lines
  Added in v.4243

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