def symbolic_shape(self): """ The symbolic shape of the object. This includes the domain, halo, and padding regions. While halo and padding are known quantities (integers), the domain size is given as a symbol. """ halo = [Add(*i) for i in self._size_halo] padding = [Add(*i) for i in self._size_padding] domain = [i.symbolic_size for i in self.indices] ret = tuple(Add(i, j, k) for i, j, k in zip(domain, halo, padding)) return EnrichedTuple(*ret, getters=self.dimensions)
def create_ops_arg(p, accessible_origin, name_to_ops_dat, par_to_ops_stencil): elements_per_point = 1 dtype = Literal('"%s"' % dtype_to_cstr(p.dtype)) if p.is_Constant: ops_type = namespace['ops_arg_gbl'] ops_name = Byref(Constant(name=p.name[1:])) rw_flag = namespace['ops_read'] else: ops_type = namespace['ops_arg_dat'] accessible_info = accessible_origin[p.name] ops_name = name_to_ops_dat[p.name] \ if accessible_info.time is None \ else name_to_ops_dat[accessible_info.origin_name].\ indexify([Add(accessible_info.time, accessible_info.shift)]) rw_flag = namespace['ops_read'] if p.read_only else namespace[ 'ops_write'] ops_arg = OpsArgDecl(ops_type=ops_type, ops_name=ops_name, elements_per_point=elements_per_point, dtype=dtype, rw_flag=rw_flag) return ops_arg
def symbolic_shape(self): """ The symbolic shape of the object. This includes: * the domain, halo, and padding regions. While halo and padding are known quantities (integers), the domain size is represented by a symbol. * the shifting induced by the ``staggered`` mask. """ symbolic_shape = super(DiscreteFunction, self).symbolic_shape ret = tuple(Add(i, -j) for i, j in zip(symbolic_shape, self.staggered)) return EnrichedTuple(*ret, getters=self.dimensions)
def create_ops_fetch(f, name_to_ops_dat, time_upper_bound): if f.is_TimeFunction: ops_fetch = [ namespace['ops_dat_fetch_data']( name_to_ops_dat[f.name].indexify( [Mod(Add(time_upper_bound, -i), f._time_size)]), Byref( f.indexify([Mod(Add(time_upper_bound, -i), f._time_size)]))) for i in range(f._time_size) ] else: # The second parameter is the beginning of the array. But I didn't manage # to generate a C code like: `v`. Instead, I am generating `&(v[0])`. ops_fetch = [ namespace['ops_dat_fetch_data'](name_to_ops_dat[f.name], Byref(f.indexify([0]))) ] return ops_fetch