コード例 #1
0
 def _ad_convert_type(self, value, options={}):
     if value is None:
         # TODO: Should the default be 0 constant here or return just None?
         return Constant(numpy.zeros(self.ufl_shape))
     value = gather(value)
     value = compat.constant_function_firedrake_compat(value)
     return constant_from_values(self, value)
コード例 #2
0
 def _applyBinary(self, f, y):
     npdata = self.values()
     npdatacopy = self.values().copy()
     npdatay = y.values()
     for i in range(len(npdata)):
         npdatacopy[i] = f(npdata[i], npdatay[i])
     self.assign(constant_from_values(self, npdatacopy))
コード例 #3
0
 def _ad_iadd(self, other):
     self.assign(constant_from_values(self, self.values() + other.values()))
コード例 #4
0
 def _ad_imul(self, other):
     self.assign(constant_from_values(self, self.values() * other))
コード例 #5
0
 def _ad_copy(self):
     return constant_from_values(self)
コード例 #6
0
 def _ad_add(self, other):
     return constant_from_values(self, self.values() + other.values())
コード例 #7
0
 def _ad_mul(self, other):
     return constant_from_values(self, self.values() * other)
コード例 #8
0
 def _ad_create_checkpoint(self):
     return constant_from_values(self)
コード例 #9
0
 def __deepcopy__(self, memodict={}):
     return constant_from_values(self)
コード例 #10
0
 def _applyUnary(self, f):
     npdata = self.values()
     npdatacopy = npdata.copy()
     for i in range(len(npdata)):
         npdatacopy[i] = f(npdata[i])
     self.assign(constant_from_values(self, npdatacopy))