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 12, 2023
1 parent 7b8055f commit 57aca82
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/amrex/space1d/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@
#
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)
6 changes: 6 additions & 0 deletions src/amrex/space2d/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@
#
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)
6 changes: 6 additions & 0 deletions src/amrex/space3d/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@
#
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 57aca82

Please sign in to comment.