Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

[diderot] Diff of /branches/ein16/synth/d2/obj_ty.py
 [diderot] / branches / ein16 / synth / d2 / obj_ty.py

# Diff of /branches/ein16/synth/d2/obj_ty.py

revision 3945, Thu Jun 9 20:00:15 2016 UTC revision 3946, Sat Jun 11 00:39:19 2016 UTC
# Line 130  Line 130
130  ty_mat2x2F_d3 = fty(19,"mat2x2field_d3", 3, [2,2], ty_mat2x2T,k_init)  ty_mat2x2F_d3 = fty(19,"mat2x2field_d3", 3, [2,2], ty_mat2x2T,k_init)
131  ty_ten2x2x2F_d3 = fty(20,"ten2x2x2field_d3", 3, [2,2,2], ty_ten2x2x2T,k_init)  ty_ten2x2x2F_d3 = fty(20,"ten2x2x2field_d3", 3, [2,2,2], ty_ten2x2x2T,k_init)
132

133  # check equal dim  # check equal dim
134  def check_dim(fld,b):  def check_dim(fld,b):
135      if(fty.is_Field(b)):      if(fty.is_Field(b)):
# Line 186  Line 183
183      dim1=ty1.dim      dim1=ty1.dim
184      dim2=ty2.dim      dim2=ty2.dim
185      if (dim1==0): # tensors      if (dim1==0): # tensors
186          return ty2          return (True , ty2)
187      elif(dim2==0):# tensors      elif(dim2==0):# tensors
188          return ty1          return  (True , ty1)
189      elif(dim1==dim2):      elif(dim1==dim2):
190          return ty1          return  (True , ty1)
191      else :      else :
192          raise "neither are fields"          return (False, None)
193
194  #shape to type  #shape to type
195  def shapeToTy(shapeout, dim):  def shapeToTy(shapeout, dim):
# Line 212  Line 209
209          elif(shapeout==[3,3, 3]):          elif(shapeout==[3,3, 3]):
210              return ty_ten3x3x3F_d2              return ty_ten3x3x3F_d2
211          else:          else:
212              print "shapeout",shapeout,"dim", dim              #print "shapeout",shapeout,"dim", dim
213              raise "unsupported shapeout"              raise Exception ("unsupported shapeout", str(shapeout))
214      elif (dim==3):      elif (dim==3):
215          if (shapeout==[]):          if (shapeout==[]):
216              return ty_scalarF_d3              return ty_scalarF_d3
# Line 221  Line 218
218              return ty_vec3F_d3              return ty_vec3F_d3
219          elif(shapeout==[3,3]):          elif(shapeout==[3,3]):
220              return ty_mat3x3F_d3              return ty_mat3x3F_d3
221
222          elif(shapeout==[3,3, 3]):          elif(shapeout==[3,3, 3]):
223              return ty_ten3x3x3F_d3              return ty_ten3x3x3F_d3
224          elif(shapeout==[2]):          elif(shapeout==[2]):

Legend:
 Removed from v.3945 changed lines Added in v.3946