|
9 | 9 | #include <AMReX_IntVect.H> |
10 | 10 | #include <AMReX_ParmParse.H> |
11 | 11 |
|
| 12 | +#include <iostream> |
12 | 13 | #include <string> |
13 | 14 | #include <vector> |
14 | 15 |
|
@@ -77,16 +78,29 @@ void init_ParmParse(py::module &m) |
77 | 78 | return ref; |
78 | 79 | }, |
79 | 80 | "parses input values", py::arg("name"), py::arg("ival")=0 |
80 | | - ) |
| 81 | + ) |
81 | 82 |
|
82 | | - .def("query_int", |
83 | | - [](ParmParse &pp, std::string name, int ival) { |
84 | | - int ref; |
85 | | - bool exist = pp.query(name.c_str(), ref, ival); |
86 | | - return std::make_tuple(exist,ref); |
87 | | - }, |
88 | | - "queries input values", py::arg("name"), py::arg("ival")=0 |
89 | | - ) |
| 83 | + .def("query_int", |
| 84 | + [](ParmParse &pp, std::string name, int ival) { |
| 85 | + int ref; |
| 86 | + bool exist = pp.query(name.c_str(), ref, ival); |
| 87 | + return std::make_tuple(exist,ref); |
| 88 | + }, |
| 89 | + "queries input values", py::arg("name"), py::arg("ival")=0 |
| 90 | + ) |
| 91 | + |
| 92 | + .def( |
| 93 | + "pretty_print_table", |
| 94 | + [](ParmParse &pp) { |
| 95 | + py::scoped_ostream_redirect stream( |
| 96 | + std::cout, // std::ostream& |
| 97 | + py::module_::import("sys").attr("stdout") // Python output |
| 98 | + ); |
| 99 | + pp.prettyPrintTable(std::cout); |
| 100 | + }, |
| 101 | + "Write the table in a pretty way to the ostream. If there are " |
| 102 | + "duplicates, only the last one is printed." |
| 103 | + ) |
90 | 104 |
|
91 | 105 | // TODO: dumpTable, hasUnusedInputs, getUnusedInputs, getEntries |
92 | 106 | ; |
|
0 commit comments