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 14, 2023
1 parent d1598ba commit 7900f00
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 ParallelDescriptor.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 ParallelDescriptor.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 ParallelDescriptor.IOProcessor():
print(*args, **kwargs)

0 comments on commit 7900f00

Please sign in to comment.