Skip to content

Commit

Permalink
Add amrex::Print() Like Function
Browse files Browse the repository at this point in the history
Add `amr.Print(...)` that behaves like Python's `print()`,
but only prints on the AMReX IOProcessor.
  • Loading branch information
ax3l committed Aug 11, 2023
1 parent 7b8055f commit e83530b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/amrex/space1d/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@
#
def d_decl(x, y, z):
return (x,)

def Print(*args, **kwargs):
"""Wrap amrex::Print() - only the IO processor writes"""
if IOProcessor():
print(*args, **kwargs)
5 changes: 5 additions & 0 deletions src/amrex/space2d/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@
#
def d_decl(x, y, z):
return (x, y)

def Print(*args, **kwargs):
"""Wrap amrex::Print() - only the IO processor writes"""
if IOProcessor():
print(*args, **kwargs)
5 changes: 5 additions & 0 deletions src/amrex/space3d/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@
#
def d_decl(x, y, z):
return (x, y, z)

def Print(*args, **kwargs):
"""Wrap amrex::Print() - only the IO processor writes"""
if IOProcessor():
print(*args, **kwargs)

0 comments on commit e83530b

Please sign in to comment.