From fdd9c8cc8f9092ddbd5f29275393cf1329d7ac14 Mon Sep 17 00:00:00 2001 From: David Grote Date: Fri, 11 Oct 2024 19:15:00 -0700 Subject: [PATCH 01/12] Print IntVect values in repr (#380) This does what the title says. Note that the RealVect already does this. --- src/Base/IntVect.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Base/IntVect.cpp b/src/Base/IntVect.cpp index 50b29b04..0ec68921 100644 --- a/src/Base/IntVect.cpp +++ b/src/Base/IntVect.cpp @@ -28,8 +28,10 @@ namespace py::class_< iv_type > py_iv(m, iv_name.c_str()); py_iv .def("__repr__", - [iv_name](const iv_type&) { - return ""; + [iv_name](const iv_type& iv) { + std::stringstream s; + s << iv; + return ""; } ) .def("__str", From d96b4948cc5812be82dbff1df5d62927c866ae07 Mon Sep 17 00:00:00 2001 From: David Grote Date: Thu, 17 Oct 2024 12:30:20 -0700 Subject: [PATCH 02/12] Fix comments in tests/test_multifab.py (#384) This fixes some comments from PR #370 --- tests/test_multifab.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_multifab.py b/tests/test_multifab.py index becd777a..2abbee53 100644 --- a/tests/test_multifab.py +++ b/tests/test_multifab.py @@ -77,7 +77,7 @@ def test_mfab_numpy(mfab): # Config = sim.extension.Config # Using global indexing - # Set all valid cells + # Set all valid cells (and internal ghost cells) mfab[...] = 42.0 # Set a range of cells. Indices are in Fortran order. @@ -91,8 +91,8 @@ def test_mfab_numpy(mfab): # Get a range of cells # Get the data along the valid cells in the first dimension (gathering data across blocks - # and processors), at the first upper guard cell in the second dimensionn, and cell 16 of - # the third (with 16 being relative to 0 which is the lower end of the full domain). + # and processors), at the first upper guard cell in the second dimensionn, and cell 2 of + # the third (with 2 being relative to 0 which is the lower end of the valid cells of the full domain). # Note that in an MPI context, this is a global operation, so caution is required when # scaling to large numbers of processors. if mfab.n_grow_vect.max > 0: From 47f57581a8fc952c2b14da6484ba2defe980af09 Mon Sep 17 00:00:00 2001 From: David Grote Date: Wed, 23 Oct 2024 13:43:28 -0700 Subject: [PATCH 03/12] Fix getitem for cases with incomplete domains (#385) This is a fix for the global indexing mechanism in `MultiFab` that is needed in cases where the box array does not fully cover the domain. In those cases, the `__getitem__` is done twice, once to get all of the data including places where the ghost cells internal to the domain cover places that are not covered by valid cells, and a second time to ensure that in places where the ghost cells do overlap valid cells, that the data used is from the valid cells. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- src/Base/BoxArray.cpp | 10 +++++--- src/amrex/extensions/MultiFab.py | 42 ++++++++++++++++++++++++++------ 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/src/Base/BoxArray.cpp b/src/Base/BoxArray.cpp index f79e1b3a..a6b57d87 100644 --- a/src/Base/BoxArray.cpp +++ b/src/Base/BoxArray.cpp @@ -129,13 +129,15 @@ void init_BoxArray(py::module &m) { //! \brief Apply surroundingNodes(Box,int) to each Box in //! BoxArray. See the documentation of Box for details. BoxArray& surroundingNodes (int dir); +*/ //! Apply Box::enclosedCells() to each Box in the BoxArray. - BoxArray& enclosedCells (); - - //! Apply Box::enclosedCells(int) to each Box in the BoxArray. - BoxArray& enclosedCells (int dir); + .def("enclosed_cells", + py::overload_cast<>(&BoxArray::enclosedCells)) + .def("enclosed_cells", + py::overload_cast(&BoxArray::enclosedCells)) +/* //! Apply Box::convert(IndexType) to each Box in the BoxArray. BoxArray& convert (IndexType typ); diff --git a/src/amrex/extensions/MultiFab.py b/src/amrex/extensions/MultiFab.py index e91f9b02..3f6b4144 100644 --- a/src/amrex/extensions/MultiFab.py +++ b/src/amrex/extensions/MultiFab.py @@ -463,7 +463,7 @@ def _get_intersect_slice(self, mfi, index, with_internal_ghosts): return None, None -def __getitem__(self, index): +def __getitem__(self, index, with_internal_ghosts=False): """Returns slice of the MultiFab using global indexing, as a numpy array. This uses numpy array indexing, with the indexing relative to the global array. The slice ranges can cross multiple blocks and the result will be gathered into a single @@ -484,13 +484,18 @@ def __getitem__(self, index): ---------- index : the index using numpy style indexing Index of the slice to return. + with_internal_ghosts : bool, optional + Whether to include internal ghost cells. When true, data from ghost cells may be used that + overlaps valid cells. """ - index = _process_index(self, index) + index4 = _process_index(self, index) # Gather the data to be included in a list to be sent to other processes datalist = [] for mfi in self: - block_slices, global_slices = _get_intersect_slice(self, mfi, index, False) + block_slices, global_slices = _get_intersect_slice( + self, mfi, index4, with_internal_ghosts + ) if global_slices is not None: # Note that the array will always have 4 dimensions. device_arr = _get_field(self, mfi) @@ -522,11 +527,29 @@ def __getitem__(self, index): raise Exception("MultiFab.__getitem__ requires mpi4py") all_datalist = comm_world.allgather(datalist) - # Create the array to be returned - result_shape = tuple([max(0, ii.stop - ii.start) for ii in index]) + # The shape of the array to be returned + result_shape = tuple([max(0, ii.stop - ii.start) for ii in index4]) + + # If the boxes do not fill the domain, then include the internal ghost + # cells since they may cover internal regions not otherwise covered by valid cells. + # If the domain is not completely covered, __getitem__ is done twice, the first time + # including internal ghost cells, and the second time without. The second time is needed + # to ensure that in places where ghost cells overlap with valid cells, that the data + # from the valid cells is used. + # The domain is complete if the number of cells in the box array is the same as + # the number of cells in the minimal box. + cell_centered_box_array = self.box_array().enclosed_cells() + domain_complete = ( + cell_centered_box_array.numPts == cell_centered_box_array.minimal_box().numPts() + ) + + if domain_complete or with_internal_ghosts: + result_global = None + else: + # First get the data including the internal ghost cells + result_global = self.__getitem__(index, with_internal_ghosts=True) # Now, copy the data into the result array - result_global = None for datalist in all_datalist: for global_slices, f_arr in datalist: if result_global is None: @@ -540,7 +563,12 @@ def __getitem__(self, index): # Remove dimensions of length 1, and if all dimensions # are removed, return a scalar (that's what the [()] does) - return result_global.squeeze()[()] + if with_internal_ghosts: + # Return the data without the squeeze so that the result can be used in the loop + # above again. + return result_global + else: + return result_global.squeeze()[()] def __setitem__(self, index, value): From 62f23ae10fc6db7730e47d8296fc8f5284ddf58f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 13:43:42 -0700 Subject: [PATCH 04/12] [pre-commit.ci] pre-commit autoupdate (#383) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.9 → v0.7.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.9...v0.7.0) - [github.com/mgedmin/check-manifest: 0.49 → 0.50](https://github.com/mgedmin/check-manifest/compare/0.49...0.50) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b63974a1..8a9d29c8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -74,7 +74,7 @@ repos: # Python: Ruff linter & formatter # https://docs.astral.sh/ruff/ - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.9 + rev: v0.7.0 hooks: # Run the linter - id: ruff @@ -94,7 +94,7 @@ repos: # Checks the manifest for missing files (native support) - repo: https://github.com/mgedmin/check-manifest - rev: "0.49" + rev: "0.50" hooks: - id: check-manifest # This is a slow hook, so only run this if --hook-stage manual is passed From 1aa1db34a0d1bdc084bd6069a4fd97b26266af5c Mon Sep 17 00:00:00 2001 From: WeiqunZhang Date: Wed, 23 Oct 2024 20:47:58 +0000 Subject: [PATCH 05/12] Update Stub Files --- src/amrex/space1d/amrex_1d_pybind/__init__.pyi | 9 ++++++++- src/amrex/space2d/amrex_2d_pybind/__init__.pyi | 9 ++++++++- src/amrex/space3d/amrex_3d_pybind/__init__.pyi | 9 ++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/amrex/space1d/amrex_1d_pybind/__init__.pyi b/src/amrex/space1d/amrex_1d_pybind/__init__.pyi index 862bf833..7399eedf 100644 --- a/src/amrex/space1d/amrex_1d_pybind/__init__.pyi +++ b/src/amrex/space1d/amrex_1d_pybind/__init__.pyi @@ -4935,6 +4935,10 @@ class BoxArray: @typing.overload def coarsenable(self, arg0: IntVect1D, arg1: IntVect1D) -> bool: ... def define(self, arg0: Box) -> None: ... + @typing.overload + def enclosed_cells(self) -> BoxArray: ... + @typing.overload + def enclosed_cells(self, arg0: int) -> BoxArray: ... def get(self, arg0: int) -> Box: ... def ix_type(self) -> IndexType: ... @typing.overload @@ -6276,7 +6280,7 @@ class MultiFab(FabArray_FArrayBox): """ dst = src + a*dst """ - def __getitem__(self, index): + def __getitem__(self, index, with_internal_ghosts=False): """ Returns slice of the MultiFab using global indexing, as a numpy array. This uses numpy array indexing, with the indexing relative to the global array. @@ -6298,6 +6302,9 @@ class MultiFab(FabArray_FArrayBox): ---------- index : the index using numpy style indexing Index of the slice to return. + with_internal_ghosts : bool, optional + Whether to include internal ghost cells. When true, data from ghost cells may be used that + overlaps valid cells. """ @typing.overload diff --git a/src/amrex/space2d/amrex_2d_pybind/__init__.pyi b/src/amrex/space2d/amrex_2d_pybind/__init__.pyi index 6b26c72f..fb1a8678 100644 --- a/src/amrex/space2d/amrex_2d_pybind/__init__.pyi +++ b/src/amrex/space2d/amrex_2d_pybind/__init__.pyi @@ -4959,6 +4959,10 @@ class BoxArray: @typing.overload def coarsenable(self, arg0: IntVect2D, arg1: IntVect2D) -> bool: ... def define(self, arg0: Box) -> None: ... + @typing.overload + def enclosed_cells(self) -> BoxArray: ... + @typing.overload + def enclosed_cells(self, arg0: int) -> BoxArray: ... def get(self, arg0: int) -> Box: ... def ix_type(self) -> IndexType: ... @typing.overload @@ -6304,7 +6308,7 @@ class MultiFab(FabArray_FArrayBox): """ dst = src + a*dst """ - def __getitem__(self, index): + def __getitem__(self, index, with_internal_ghosts=False): """ Returns slice of the MultiFab using global indexing, as a numpy array. This uses numpy array indexing, with the indexing relative to the global array. @@ -6326,6 +6330,9 @@ class MultiFab(FabArray_FArrayBox): ---------- index : the index using numpy style indexing Index of the slice to return. + with_internal_ghosts : bool, optional + Whether to include internal ghost cells. When true, data from ghost cells may be used that + overlaps valid cells. """ @typing.overload diff --git a/src/amrex/space3d/amrex_3d_pybind/__init__.pyi b/src/amrex/space3d/amrex_3d_pybind/__init__.pyi index 6241e711..cfb75911 100644 --- a/src/amrex/space3d/amrex_3d_pybind/__init__.pyi +++ b/src/amrex/space3d/amrex_3d_pybind/__init__.pyi @@ -4935,6 +4935,10 @@ class BoxArray: @typing.overload def coarsenable(self, arg0: IntVect3D, arg1: IntVect3D) -> bool: ... def define(self, arg0: Box) -> None: ... + @typing.overload + def enclosed_cells(self) -> BoxArray: ... + @typing.overload + def enclosed_cells(self, arg0: int) -> BoxArray: ... def get(self, arg0: int) -> Box: ... def ix_type(self) -> IndexType: ... @typing.overload @@ -6283,7 +6287,7 @@ class MultiFab(FabArray_FArrayBox): """ dst = src + a*dst """ - def __getitem__(self, index): + def __getitem__(self, index, with_internal_ghosts=False): """ Returns slice of the MultiFab using global indexing, as a numpy array. This uses numpy array indexing, with the indexing relative to the global array. @@ -6305,6 +6309,9 @@ class MultiFab(FabArray_FArrayBox): ---------- index : the index using numpy style indexing Index of the slice to return. + with_internal_ghosts : bool, optional + Whether to include internal ghost cells. When true, data from ghost cells may be used that + overlaps valid cells. """ @typing.overload From 917f32678b515cc0835389785c5d8d6092a73f1b Mon Sep 17 00:00:00 2001 From: David Grote Date: Thu, 31 Oct 2024 17:03:17 -0700 Subject: [PATCH 06/12] Fix case when only empty tuple is passed in (#387) One more fix for the global indexing of MultiFabs. I hadn't taken care of the case when only the empty tuple is passed in (for example for 1D). This PR fixes this case. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- src/amrex/extensions/MultiFab.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/amrex/extensions/MultiFab.py b/src/amrex/extensions/MultiFab.py index 3f6b4144..11ce9de1 100644 --- a/src/amrex/extensions/MultiFab.py +++ b/src/amrex/extensions/MultiFab.py @@ -314,13 +314,19 @@ def _process_index(self, index): # If only one slice or integer passed in, it was not wrapped in a tuple index = [index] elif isinstance(index, tuple): - index = list(index) - for i in range(len(index)): - if index[i] == Ellipsis: - index = ( - index[:i] + (dims + 2 - len(index)) * [slice(None)] + index[i + 1 :] - ) - break + if len(index) == 0: + # The empty tuple specifies all valid and ghost cells + index = [index] + else: + index = list(index) + for i in range(len(index)): + if index[i] == Ellipsis: + index = ( + index[:i] + + (dims + 2 - len(index)) * [slice(None)] + + index[i + 1 :] + ) + break else: raise Exception("MultiFab.__getitem__: unexpected index type") From 2ed3ba24642e321fc377b65b9a1903f53b789ab5 Mon Sep 17 00:00:00 2001 From: Weiqun Zhang Date: Fri, 1 Nov 2024 09:03:35 -0700 Subject: [PATCH 07/12] Update CXXFLAGS in SYCL CIs (#389) Disable some warnings for oneAPI 2025.0. Remove some `-Wno`'s that are no longer needed. --- .github/workflows/intel.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/intel.yml b/.github/workflows/intel.yml index e1bb7907..242ebc69 100644 --- a/.github/workflows/intel.yml +++ b/.github/workflows/intel.yml @@ -26,7 +26,7 @@ jobs: - name: Build & Install # mkl/rng/device/detail/mrg32k3a_impl.hpp has a number of sign-compare error # mkl/rng/device/detail/mrg32k3a_impl.hpp has missing braces in array-array initalization - env: {CXXFLAGS: "-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual -Wextra-semi -Wunreachable-code -Wnon-virtual-dtor -Wno-sign-compare -Wno-missing-braces"} + env: {CXXFLAGS: "-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual -Wextra-semi -Wunreachable-code -Wnon-virtual-dtor -Wno-unused-variable -Wno-shadow"} run: | set +e source /opt/intel/oneapi/setvars.sh @@ -73,10 +73,8 @@ jobs: restore-keys: | ccache-${{ github.workflow }}-${{ github.job }}-git- - name: Build & Install - # mkl/rng/device/detail/mrg32k3a_impl.hpp has a number of sign-compare error - # mkl/rng/device/detail/mrg32k3a_impl.hpp has missing braces in array-array initalization # /usr/include/c++/12/bits/stl_tempbuf.h has deprecated-declarations in 'get_temporary_buffer>' - env: {CXXFLAGS: "-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual -Wextra-semi -Wunreachable-code -Wnon-virtual-dtor -Wno-sign-compare -Wno-missing-braces -Wno-error=pass-failed -Wno-tautological-constant-compare -Wno-deprecated-declarations"} + env: {CXXFLAGS: "-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual -Wextra-semi -Wunreachable-code -Wnon-virtual-dtor -Wno-deprecated-declarations"} run: | set +e source /opt/intel/oneapi/setvars.sh From 6c2dc4f698c9cbc30bfd302778f7fcb9f7beba8b Mon Sep 17 00:00:00 2001 From: David Grote Date: Fri, 1 Nov 2024 12:21:08 -0700 Subject: [PATCH 08/12] Add wrapper for VisMF (#388) I need to read in a MultiFab so added this. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- src/Base/CMakeLists.txt | 1 + src/Base/VisMF.cpp | 46 +++++++++++++++++++++++++++++++++++++++++ src/pyAMReX.cpp | 3 +++ 3 files changed, 50 insertions(+) create mode 100644 src/Base/VisMF.cpp diff --git a/src/Base/CMakeLists.txt b/src/Base/CMakeLists.txt index 5a8169eb..b80c820b 100644 --- a/src/Base/CMakeLists.txt +++ b/src/Base/CMakeLists.txt @@ -33,6 +33,7 @@ foreach(D IN LISTS AMReX_SPACEDIM) Utility.cpp Vector.cpp Version.cpp + VisMF.cpp ) if (AMReX_MPI) diff --git a/src/Base/VisMF.cpp b/src/Base/VisMF.cpp new file mode 100644 index 00000000..8c2dab63 --- /dev/null +++ b/src/Base/VisMF.cpp @@ -0,0 +1,46 @@ +/* Copyright 2024 The AMReX Community + * + * Authors: David Grote + * License: BSD-3-Clause-LBNL + */ +#include "pyAMReX.H" + +#include +#include + +void init_VisMF(py::module &m) +{ + py::class_< amrex::VisMF > py_VisMF(m, "VisMF"); + + py_VisMF + .def_static("Write", + [](const amrex::FabArray &mf, const std::string& name) { + return amrex::VisMF::Write(mf, name); + }, + py::arg("mf"), py::arg("name"), + "Writes a Multifab to the specified file") + .def_static("Read", + [](const std::string &name) { + amrex::MultiFab mf; + if (amrex::VisMF::Exist(name)) { + amrex::VisMF::Read(mf, name); + } else { + throw std::runtime_error("MultiFab file " + name + " couldn't be found!"); + } + return mf; + }, + py::return_value_policy::move, + py::arg("name"), + "Reads a MultiFab from the specified file") + .def_static("Read", + [](const std::string &name, amrex::MultiFab &mf) { + if (amrex::VisMF::Exist(name)) { + amrex::VisMF::Read(mf, name); + } else { + throw std::runtime_error("MultiFab file " + name + " couldn't be found!"); + } + }, + py::arg("name"), py::arg("mf"), + "Reads a MultiFab from the specified file into the given MultiFab. The BoxArray on the disk must match the BoxArray * in mf") + ; +} diff --git a/src/pyAMReX.cpp b/src/pyAMReX.cpp index e952e64b..aebe7403 100644 --- a/src/pyAMReX.cpp +++ b/src/pyAMReX.cpp @@ -38,6 +38,7 @@ void init_PODVector(py::module &); void init_Utility(py::module &); void init_Vector(py::module &); void init_Version(py::module &); +void init_VisMF(py::module &); #ifdef AMREX_USE_MPI void init_MPMD(py::module &); #endif @@ -82,6 +83,7 @@ PYBIND11_MODULE(amrex_3d_pybind, m) { StructOfArrays Utility Vector + VisMF )pbdoc"; // note: order from parent to child classes and argument usage @@ -117,6 +119,7 @@ PYBIND11_MODULE(amrex_3d_pybind, m) { init_PlotFileUtil(m); init_Utility(m); init_Version(m); + init_VisMF(m); // authors m.attr("__author__") = From e830c1ee454c078b12668e36aec98084a71bbba2 Mon Sep 17 00:00:00 2001 From: WeiqunZhang Date: Fri, 1 Nov 2024 19:25:08 +0000 Subject: [PATCH 09/12] Update Stub Files --- src/amrex/space1d/__init__.pyi | 3 +++ .../space1d/amrex_1d_pybind/__init__.pyi | 21 +++++++++++++++++++ src/amrex/space2d/__init__.pyi | 3 +++ .../space2d/amrex_2d_pybind/__init__.pyi | 21 +++++++++++++++++++ src/amrex/space3d/__init__.pyi | 3 +++ .../space3d/amrex_3d_pybind/__init__.pyi | 21 +++++++++++++++++++ 6 files changed, 72 insertions(+) diff --git a/src/amrex/space1d/__init__.pyi b/src/amrex/space1d/__init__.pyi index c23dea05..07e4335a 100644 --- a/src/amrex/space1d/__init__.pyi +++ b/src/amrex/space1d/__init__.pyi @@ -30,6 +30,7 @@ amrex StructOfArrays Utility Vector + VisMF """ @@ -261,6 +262,7 @@ from amrex.space1d.amrex_1d_pybind import ( Vector_Long, Vector_Real, Vector_string, + VisMF, XDim3, begin, coarsen, @@ -508,6 +510,7 @@ __all__ = [ "Vector_Real", "Vector_int", "Vector_string", + "VisMF", "XDim3", "amrex_1d_pybind", "begin", diff --git a/src/amrex/space1d/amrex_1d_pybind/__init__.pyi b/src/amrex/space1d/amrex_1d_pybind/__init__.pyi index 7399eedf..fd417d1a 100644 --- a/src/amrex/space1d/amrex_1d_pybind/__init__.pyi +++ b/src/amrex/space1d/amrex_1d_pybind/__init__.pyi @@ -30,6 +30,7 @@ amrex StructOfArrays Utility Vector + VisMF """ @@ -261,6 +262,7 @@ __all__ = [ "Vector_Real", "Vector_int", "Vector_string", + "VisMF", "XDim3", "begin", "coarsen", @@ -18050,6 +18052,25 @@ class Vector_string: """ def size(self) -> int: ... +class VisMF: + @staticmethod + @typing.overload + def Read(name: str) -> MultiFab: + """ + Reads a MultiFab from the specified file + """ + @staticmethod + @typing.overload + def Read(name: str, mf: MultiFab) -> None: + """ + Reads a MultiFab from the specified file into the given MultiFab. The BoxArray on the disk must match the BoxArray * in mf + """ + @staticmethod + def Write(mf: FabArray_FArrayBox, name: str) -> int: + """ + Writes a Multifab to the specified file + """ + class XDim3: x: float y: float diff --git a/src/amrex/space2d/__init__.pyi b/src/amrex/space2d/__init__.pyi index ace0a07b..b52fe86e 100644 --- a/src/amrex/space2d/__init__.pyi +++ b/src/amrex/space2d/__init__.pyi @@ -30,6 +30,7 @@ amrex StructOfArrays Utility Vector + VisMF """ @@ -285,6 +286,7 @@ from amrex.space2d.amrex_2d_pybind import ( Vector_Long, Vector_Real, Vector_string, + VisMF, XDim3, begin, coarsen, @@ -556,6 +558,7 @@ __all__ = [ "Vector_Real", "Vector_int", "Vector_string", + "VisMF", "XDim3", "amrex_2d_pybind", "begin", diff --git a/src/amrex/space2d/amrex_2d_pybind/__init__.pyi b/src/amrex/space2d/amrex_2d_pybind/__init__.pyi index fb1a8678..7a287693 100644 --- a/src/amrex/space2d/amrex_2d_pybind/__init__.pyi +++ b/src/amrex/space2d/amrex_2d_pybind/__init__.pyi @@ -30,6 +30,7 @@ amrex StructOfArrays Utility Vector + VisMF """ @@ -285,6 +286,7 @@ __all__ = [ "Vector_Real", "Vector_int", "Vector_string", + "VisMF", "XDim3", "begin", "coarsen", @@ -19868,6 +19870,25 @@ class Vector_string: """ def size(self) -> int: ... +class VisMF: + @staticmethod + @typing.overload + def Read(name: str) -> MultiFab: + """ + Reads a MultiFab from the specified file + """ + @staticmethod + @typing.overload + def Read(name: str, mf: MultiFab) -> None: + """ + Reads a MultiFab from the specified file into the given MultiFab. The BoxArray on the disk must match the BoxArray * in mf + """ + @staticmethod + def Write(mf: FabArray_FArrayBox, name: str) -> int: + """ + Writes a Multifab to the specified file + """ + class XDim3: x: float y: float diff --git a/src/amrex/space3d/__init__.pyi b/src/amrex/space3d/__init__.pyi index c7ad0434..af10c59f 100644 --- a/src/amrex/space3d/__init__.pyi +++ b/src/amrex/space3d/__init__.pyi @@ -30,6 +30,7 @@ amrex StructOfArrays Utility Vector + VisMF """ @@ -261,6 +262,7 @@ from amrex.space3d.amrex_3d_pybind import ( Vector_Long, Vector_Real, Vector_string, + VisMF, XDim3, begin, coarsen, @@ -508,6 +510,7 @@ __all__ = [ "Vector_Real", "Vector_int", "Vector_string", + "VisMF", "XDim3", "amrex_3d_pybind", "begin", diff --git a/src/amrex/space3d/amrex_3d_pybind/__init__.pyi b/src/amrex/space3d/amrex_3d_pybind/__init__.pyi index cfb75911..ad1247e4 100644 --- a/src/amrex/space3d/amrex_3d_pybind/__init__.pyi +++ b/src/amrex/space3d/amrex_3d_pybind/__init__.pyi @@ -30,6 +30,7 @@ amrex StructOfArrays Utility Vector + VisMF """ @@ -261,6 +262,7 @@ __all__ = [ "Vector_Real", "Vector_int", "Vector_string", + "VisMF", "XDim3", "begin", "coarsen", @@ -18083,6 +18085,25 @@ class Vector_string: """ def size(self) -> int: ... +class VisMF: + @staticmethod + @typing.overload + def Read(name: str) -> MultiFab: + """ + Reads a MultiFab from the specified file + """ + @staticmethod + @typing.overload + def Read(name: str, mf: MultiFab) -> None: + """ + Reads a MultiFab from the specified file into the given MultiFab. The BoxArray on the disk must match the BoxArray * in mf + """ + @staticmethod + def Write(mf: FabArray_FArrayBox, name: str) -> int: + """ + Writes a Multifab to the specified file + """ + class XDim3: x: float y: float From 0e113276be6cd7ad9d9d88dcb6d83099f10977ee Mon Sep 17 00:00:00 2001 From: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> Date: Mon, 4 Nov 2024 12:22:00 -0800 Subject: [PATCH 10/12] Release: 24.11 (#391) November release. Followed example in #373 and [documentation](https://pyamrex.readthedocs.io/en/latest/maintenance/release.html). --- CMakeLists.txt | 2 +- cmake/dependencies/AMReX.cmake | 4 ++-- docs/source/conf.py | 4 ++-- setup.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ecdad02..6ac9e3a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # Preamble #################################################################### # cmake_minimum_required(VERSION 3.24.0) -project(pyAMReX VERSION 24.10) +project(pyAMReX VERSION 24.11) include(${pyAMReX_SOURCE_DIR}/cmake/pyAMReXFunctions.cmake) diff --git a/cmake/dependencies/AMReX.cmake b/cmake/dependencies/AMReX.cmake index 68d6bf98..dce8a507 100644 --- a/cmake/dependencies/AMReX.cmake +++ b/cmake/dependencies/AMReX.cmake @@ -67,7 +67,7 @@ macro(find_amrex) message(STATUS "Searching for pre-installed AMReX ...") # https://amrex-codes.github.io/amrex/docs_html/BuildingAMReX.html#importing-amrex-into-your-cmake-project # not strictly required yet to compile pyAMReX: EB - find_package(AMReX 24.10 CONFIG REQUIRED COMPONENTS PARTICLES PIC) + find_package(AMReX 24.11 CONFIG REQUIRED COMPONENTS PARTICLES PIC) message(STATUS "AMReX: Found version '${AMReX_VERSION}'") if(AMReX_GPU_BACKEND STREQUAL CUDA) @@ -86,7 +86,7 @@ option(pyAMReX_amrex_internal "Download & build AMReX" ON) set(pyAMReX_amrex_repo "https://github.com/AMReX-Codes/amrex.git" CACHE STRING "Repository URI to pull and build AMReX from if(pyAMReX_amrex_internal)") -set(pyAMReX_amrex_branch "8df11b69a1169a1b7791a7a5e723feecd121b467" +set(pyAMReX_amrex_branch "24.11" CACHE STRING "Repository branch for pyAMReX_amrex_repo if(pyAMReX_amrex_internal)") diff --git a/docs/source/conf.py b/docs/source/conf.py index 73474e49..9e1e11bd 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -72,9 +72,9 @@ # built documents. # # The short X.Y version. -version = "24.10" +version = "24.11" # The full version, including alpha/beta/rc tags. -release = "24.10" +release = "24.11" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.py b/setup.py index 12797e52..0bcf5503 100644 --- a/setup.py +++ b/setup.py @@ -217,7 +217,7 @@ def build_extension(self, ext): setup( name="amrex", # note PEP-440 syntax: x.y.zaN but x.y.z.devN - version="24.10", + version="24.11", packages=["amrex"], # Python sources: package_dir={"": "src"}, From b4484da10bea6bd90f504507389c94a8fb52c2b3 Mon Sep 17 00:00:00 2001 From: WeiqunZhang Date: Mon, 4 Nov 2024 20:44:30 +0000 Subject: [PATCH 11/12] Update Stub Files --- src/amrex/space1d/__init__.pyi | 2 +- src/amrex/space1d/amrex_1d_pybind/__init__.pyi | 4 ++-- src/amrex/space2d/__init__.pyi | 2 +- src/amrex/space2d/amrex_2d_pybind/__init__.pyi | 4 ++-- src/amrex/space3d/__init__.pyi | 2 +- src/amrex/space3d/amrex_3d_pybind/__init__.pyi | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/amrex/space1d/__init__.pyi b/src/amrex/space1d/__init__.pyi index 07e4335a..025d74d6 100644 --- a/src/amrex/space1d/__init__.pyi +++ b/src/amrex/space1d/__init__.pyi @@ -556,4 +556,4 @@ def d_decl(x, y, z): __author__: str = "Axel Huebl, Ryan T. Sandberg, Shreyas Ananthan, David P. Grote, Revathi Jambunathan, Edoardo Zoni, Remi Lehe, Andrew Myers, Weiqun Zhang" __license__: str = "BSD-3-Clause-LBNL" -__version__: str = "24.10-8-g8df11b69a116" +__version__: str = "24.11" diff --git a/src/amrex/space1d/amrex_1d_pybind/__init__.pyi b/src/amrex/space1d/amrex_1d_pybind/__init__.pyi index fd417d1a..3bb52a2a 100644 --- a/src/amrex/space1d/amrex_1d_pybind/__init__.pyi +++ b/src/amrex/space1d/amrex_1d_pybind/__init__.pyi @@ -4965,7 +4965,7 @@ class BoxArray: def size(self) -> int: ... class Config: - amrex_version: typing.ClassVar[str] = "24.10-8-g8df11b69a116" + amrex_version: typing.ClassVar[str] = "24.11" gpu_backend = None have_eb: typing.ClassVar[bool] = False have_gpu: typing.ClassVar[bool] = False @@ -18379,5 +18379,5 @@ def write_single_level_plotfile( __author__: str = "Axel Huebl, Ryan T. Sandberg, Shreyas Ananthan, David P. Grote, Revathi Jambunathan, Edoardo Zoni, Remi Lehe, Andrew Myers, Weiqun Zhang" __license__: str = "BSD-3-Clause-LBNL" -__version__: str = "24.10-8-g8df11b69a116" +__version__: str = "24.11" IntVect = IntVect1D diff --git a/src/amrex/space2d/__init__.pyi b/src/amrex/space2d/__init__.pyi index b52fe86e..439b14b7 100644 --- a/src/amrex/space2d/__init__.pyi +++ b/src/amrex/space2d/__init__.pyi @@ -604,4 +604,4 @@ def d_decl(x, y, z): __author__: str = "Axel Huebl, Ryan T. Sandberg, Shreyas Ananthan, David P. Grote, Revathi Jambunathan, Edoardo Zoni, Remi Lehe, Andrew Myers, Weiqun Zhang" __license__: str = "BSD-3-Clause-LBNL" -__version__: str = "24.10-8-g8df11b69a116" +__version__: str = "24.11" diff --git a/src/amrex/space2d/amrex_2d_pybind/__init__.pyi b/src/amrex/space2d/amrex_2d_pybind/__init__.pyi index 7a287693..d0e05d4a 100644 --- a/src/amrex/space2d/amrex_2d_pybind/__init__.pyi +++ b/src/amrex/space2d/amrex_2d_pybind/__init__.pyi @@ -4989,7 +4989,7 @@ class BoxArray: def size(self) -> int: ... class Config: - amrex_version: typing.ClassVar[str] = "24.10-8-g8df11b69a116" + amrex_version: typing.ClassVar[str] = "24.11" gpu_backend = None have_eb: typing.ClassVar[bool] = True have_gpu: typing.ClassVar[bool] = False @@ -20197,5 +20197,5 @@ def write_single_level_plotfile( __author__: str = "Axel Huebl, Ryan T. Sandberg, Shreyas Ananthan, David P. Grote, Revathi Jambunathan, Edoardo Zoni, Remi Lehe, Andrew Myers, Weiqun Zhang" __license__: str = "BSD-3-Clause-LBNL" -__version__: str = "24.10-8-g8df11b69a116" +__version__: str = "24.11" IntVect = IntVect2D diff --git a/src/amrex/space3d/__init__.pyi b/src/amrex/space3d/__init__.pyi index af10c59f..78134abe 100644 --- a/src/amrex/space3d/__init__.pyi +++ b/src/amrex/space3d/__init__.pyi @@ -556,4 +556,4 @@ def d_decl(x, y, z): __author__: str = "Axel Huebl, Ryan T. Sandberg, Shreyas Ananthan, David P. Grote, Revathi Jambunathan, Edoardo Zoni, Remi Lehe, Andrew Myers, Weiqun Zhang" __license__: str = "BSD-3-Clause-LBNL" -__version__: str = "24.10-8-g8df11b69a116" +__version__: str = "24.11" diff --git a/src/amrex/space3d/amrex_3d_pybind/__init__.pyi b/src/amrex/space3d/amrex_3d_pybind/__init__.pyi index ad1247e4..390fe14b 100644 --- a/src/amrex/space3d/amrex_3d_pybind/__init__.pyi +++ b/src/amrex/space3d/amrex_3d_pybind/__init__.pyi @@ -4965,7 +4965,7 @@ class BoxArray: def size(self) -> int: ... class Config: - amrex_version: typing.ClassVar[str] = "24.10-8-g8df11b69a116" + amrex_version: typing.ClassVar[str] = "24.11" gpu_backend = None have_eb: typing.ClassVar[bool] = True have_gpu: typing.ClassVar[bool] = False @@ -18412,5 +18412,5 @@ def write_single_level_plotfile( __author__: str = "Axel Huebl, Ryan T. Sandberg, Shreyas Ananthan, David P. Grote, Revathi Jambunathan, Edoardo Zoni, Remi Lehe, Andrew Myers, Weiqun Zhang" __license__: str = "BSD-3-Clause-LBNL" -__version__: str = "24.10-8-g8df11b69a116" +__version__: str = "24.11" IntVect = IntVect3D From 66fc71fecf77eee903e9c60100f1243f9e157744 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 00:29:10 +0000 Subject: [PATCH 12/12] [pre-commit.ci] pre-commit autoupdate (#386) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.7.0 → v0.7.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.7.0...v0.7.3) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8a9d29c8..d7447c12 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -74,7 +74,7 @@ repos: # Python: Ruff linter & formatter # https://docs.astral.sh/ruff/ - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.0 + rev: v0.7.3 hooks: # Run the linter - id: ruff