示例#1
0
 def component_tensor(self, f):
     x, i = f.operands()
     s = f.shape()
     ufl_assert(len(s) == 1, "TODO: Assuming a vector, i.e. scalar operands.")
     n, = s
     d = ListTensor([1]*n) # TODO: Non-scalars
     return (d, None)
示例#2
0
 def list_tensor(self, o, *dops):
     assert o not in self._mapping
     replaced_ufl_operands = list()
     for ufl_operand in dops:
         if ufl_operand in self._mapping:
             replaced_ufl_operands.append(self._mapping[ufl_operand])
         else:
             replaced_ufl_operands.append(
                 map_integrand_dags(self, ufl_operand))
     return ListTensor(*replaced_ufl_operands)
def _remove_mute_indices(node: ListTensor):
    return node._ufl_expr_reconstruct_(
        *[_remove_mute_indices(operand) for operand in node.ufl_operands])
 def list_tensor(self, o, *ops):
     ops, dops = unzip(ops)
     o = self.reuse_if_possible(o, *ops)
     op = ListTensor(*dops)
     return (o, op)