Skip to content

Commit 4c4ee46

Browse files
committed
Add version of Read that takes MultiFab as argument
1 parent d071ae4 commit 4c4ee46

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Base/VisMF.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,15 @@ void init_VisMF(py::module &m)
3232
py::return_value_policy::move,
3333
py::arg("name"),
3434
"Reads a MultiFab from the specified file")
35+
.def_static("Read",
36+
[](const std::string &name, amrex::MultiFab &mf) {
37+
if (amrex::VisMF::Exist(name)) {
38+
amrex::VisMF::Read(mf, name);
39+
} else {
40+
throw std::runtime_error("MultiFab file " + name + " couldn't be found!");
41+
}
42+
},
43+
py::arg("name"), py::arg("mf"),
44+
"Reads a MultiFab from the specified file into the given MultiFab. The BoxArray on the disk must match the BoxArray * in mf")
3545
;
3646
}

0 commit comments

Comments
 (0)