Exemple #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)
Exemple #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))
Exemple #3
0
 def _ad_iadd(self, other):
     self.assign(constant_from_values(self, self.values() + other.values()))
Exemple #4
0
 def _ad_imul(self, other):
     self.assign(constant_from_values(self, self.values() * other))
Exemple #5
0
 def _ad_copy(self):
     return constant_from_values(self)
Exemple #6
0
 def _ad_add(self, other):
     return constant_from_values(self, self.values() + other.values())
Exemple #7
0
 def _ad_mul(self, other):
     return constant_from_values(self, self.values() * other)
Exemple #8
0
 def _ad_create_checkpoint(self):
     return constant_from_values(self)
Exemple #9
0
 def __deepcopy__(self, memodict={}):
     return constant_from_values(self)
Exemple #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))