Skip to content

Commit b7ba234

Browse files
committed
Fix minor issues:
(1) address FIXME's in cactusthorn.py (2) fix typo in cactusthorn that prevents loops from compiling (3) Remove gf_centering from grid.py
1 parent c669cd3 commit b7ba234

File tree

2 files changed

+4
-24
lines changed

2 files changed

+4
-24
lines changed

cactusthorn.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ def __iter__(self):
5858
li = sorted(li)
5959
return li.__iter__()
6060

61-
# FIXME: "name" is an unused argument:
62-
def check_eqns(name, eqns):
61+
def check_eqns(eqns):
6362
forgotten = sortedset()
6463
scalar_reads = sortedset()
6564
scalar_writes = sortedset()
@@ -166,7 +165,7 @@ def _add_src(self, src):
166165

167166
def add_func(self, name, body, schedule_bin, doc, where='interior', centering=None, sync=None):
168167
body = flatten(body)
169-
check_eqns(name, body)
168+
check_eqns(body)
170169
self.sync[name] = sync
171170
check_centering(centering)
172171
if gri.ET_driver == "Carpet":
@@ -255,11 +254,6 @@ def add_func(self, name, body, schedule_bin, doc, where='interior', centering=No
255254
centerings_needed = sortedset()
256255
centerings_needed.add(centering)
257256
layout_decls = ""
258-
# FIXME: dead code
259-
# for c in centerings_needed:
260-
# if c not in centerings_used:
261-
# nums = ",".join(["1" if n in ["c","C"] else "0" for n in c])
262-
# #layout_decls += f(" CCTK_CENTERING_LAYOUT({c},({{ {nums} }})); ")
263257
tmp_centerings = {}
264258
for gf in tmps:
265259
c = gri.find_centering(gf)
@@ -401,8 +395,8 @@ def do_body(self, body, where, centering):
401395
body = f("""
402396
{decl}
403397
{checkbounds}
404-
gri.loop_{wtag}_device<{centering}_centered[0], {centering}_centered[1], {centering}_centered[2], CCTK_VECSIZE>(
405-
gri.nghostzones, [=] CCTK_DEVICE (
398+
grid.loop_{wtag}_device<{centering}_centered[0], {centering}_centered[1], {centering}_centered[2], CCTK_VECSIZE>(
399+
grid.nghostzones, [=] CCTK_DEVICE (
406400
const PointDesc &p) CCTK_ATTRIBUTE_ALWAYS_INLINE {{
407401
const GF3D5index CCTK_ATTRIBUTE_UNUSED {centering}_index({centering}_layout, p.I);
408402
const GF3D5index CCTK_ATTRIBUTE_UNUSED {centering}_tmp_index({centering}_tmp_layout, p.I);
@@ -679,12 +673,6 @@ def generate(self,dirname=None,cactus_config="sim",cactus_thornlist=None,schedul
679673
if writegf in gri.find_gfnames():
680674
full_name = self.get_full_name(writegf)
681675
print(f(u" WRITES: {full_name}({src.where})"),file=fd)
682-
# FIXME: dead code
683-
# if src.where == "interior":
684-
# for writegf in func.writegfs:
685-
# if writegf in gri.find_gfnames():
686-
# full_name = self.get_full_group_name(writegf)
687-
# pass #print(f(u" SYNC: {full_name}"),file=fd)
688676
sync = self.sync.get(func.name, None)
689677
if sync is not None:
690678
print(f(u" SYNC: {sync}"), file=fd)

grid.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ def glb_gridfcs_map():
3131
return m
3232

3333

34-
# Grids may have centerings. These will be C=cell-centered or V=vertex centered, with either one C or V per dimension
35-
gf_centering = {}
36-
3734
# griddata_struct contains data needed by each grid
3835
glb_griddata = namedtuple('griddata', 'module string')
3936
glb_griddata_struct_list = []
@@ -259,8 +256,6 @@ def find_centering(gf_name):
259256

260257
def register_gridfunctions(gf_type, gf_names, rank=0, is_indexed=False, DIM=3, f_infinity=None, wavespeed=None,
261258
centering=None, external_module=None):
262-
global gf_centering
263-
264259
# Step 0: Sanity check
265260
if (rank > 0 and not is_indexed) or (rank == 0 and is_indexed):
266261
print(
@@ -280,9 +275,6 @@ def register_gridfunctions(gf_type, gf_names, rank=0, is_indexed=False, DIM=3, f
280275
gf_namestmp = [gf_names]
281276
gf_names = gf_namestmp
282277

283-
for gf_name in gf_names:
284-
gf_centering[gf_name] = centering
285-
286278
f_inf = []
287279
if f_infinity is None:
288280
f_infinity = 0.0 # set to default

0 commit comments

Comments
 (0)