From 5a2397345e1c03240a9c3d43efce2818fd9f3003 Mon Sep 17 00:00:00 2001 From: "Martin D. Weinberg" Date: Sun, 2 Feb 2025 18:51:55 -0500 Subject: [PATCH 1/4] Make FieldGenerator::file_lines,file_slices,file_volumes throw a standard exception rather than terminate if provided directory does not exist --- expui/FieldGenerator.cc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/expui/FieldGenerator.cc b/expui/FieldGenerator.cc index b12df7592..c79c180b9 100644 --- a/expui/FieldGenerator.cc +++ b/expui/FieldGenerator.cc @@ -1,3 +1,4 @@ +#include #include #include #include @@ -259,6 +260,14 @@ namespace Field const std::string prefix, const std::string outdir) { + if (myid==0) { + // Verify existence of directory + bool filepathExists = std::filesystem::is_directory(outdir); + if (not filepathExists) + throw std::runtime_error("FieldGenerator::file_lines: directory <" + + outdir + "> does not exist"); + } + auto db = lines(basis, coefs, beg, end, num); if (myid==0) { @@ -505,6 +514,14 @@ namespace Field const std::string prefix, const std::string outdir) { + if (myid==0) { + // Verify existence of directory + bool filepathExists = std::filesystem::is_directory(outdir); + if (not filepathExists) + throw std::runtime_error("FieldGenerator::file_slices: directory <" + + outdir + "> does not exist"); + } + auto db = slices(basis, coefs); if (myid==0) { @@ -710,6 +727,14 @@ namespace Field const std::string prefix, const std::string outdir) { + if (myid==0) { + // Verify existence of directory + bool filepathExists = std::filesystem::is_directory(outdir); + if (not filepathExists) + throw std::runtime_error("FieldGenerator::file_volumes: directory <" + + outdir + "> does not exist"); + } + auto db = volumes(basis, coefs); int bunch = db.size()/numprocs; From 575d8635d9728bccaa1551eadb14e7675b1c7cc8 Mon Sep 17 00:00:00 2001 From: "Martin D. Weinberg" Date: Tue, 4 Feb 2025 15:54:40 -0500 Subject: [PATCH 2/4] Remove some senseless documentation cruft --- pyEXP/FieldWrappers.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyEXP/FieldWrappers.cc b/pyEXP/FieldWrappers.cc index 9cfca7e9d..0b68fb9b2 100644 --- a/pyEXP/FieldWrappers.cc +++ b/pyEXP/FieldWrappers.cc @@ -399,10 +399,7 @@ void FieldGeneratorClasses(py::module &m) { See also -------- -<<<<<<< HEAD -======= points : generate fields at an array of mesh points ->>>>>>> pointMesh slices : generate fields in a surface slice given by the initializtion grid volumes : generate fields in volume given by the initializtion grid From 33179b73c056560872ba66c6c158033a60696402 Mon Sep 17 00:00:00 2001 From: "Martin D. Weinberg" Date: Tue, 4 Feb 2025 15:54:56 -0500 Subject: [PATCH 3/4] Fix the VtkGrid writing order --- exputil/VtkGrid.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exputil/VtkGrid.cc b/exputil/VtkGrid.cc index 395e56317..1c8f181f3 100644 --- a/exputil/VtkGrid.cc +++ b/exputil/VtkGrid.cc @@ -182,9 +182,9 @@ void VtkGrid::Add(const std::vector& data, const std::string& name) // int I = 0; - for (int i=0; i(data[(k*ny + j)*nx + i]); } } From 6e6b51a4ee493556bc2f990c1ad5c06ec7cb8da7 Mon Sep 17 00:00:00 2001 From: "Martin D. Weinberg" Date: Fri, 7 Feb 2025 09:53:49 -0500 Subject: [PATCH 4/4] Additional comments only --- src/FlatDisk.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/FlatDisk.cc b/src/FlatDisk.cc index 706bd95ba..ea3694182 100644 --- a/src/FlatDisk.cc +++ b/src/FlatDisk.cc @@ -109,7 +109,7 @@ void FlatDisk::initialize() if (dump_basis) ortho->dump_basis(runtag); // Set background model - if (conf["background"]) setBackground(); + if (M0_back) setBackground(); } FlatDisk::~FlatDisk(void) @@ -121,8 +121,17 @@ FlatDisk::~FlatDisk(void) void FlatDisk::setBackground() { try { - - YAML::Node Params = conf["background"]; + YAML::Node Params; + + if (conf["background"]) Params = conf["background"]; + else { + Params = conf["diskconf"]; + if (myid==0) // Log file message + std::cout << "---- FlatDisk::setBackground: " + << "M0_BACK set without a 'background' profile" << std::endl + << "---- FlatDisk::setBackground: " + << "using 'diskconf' for 'background' profile" << std::endl; + } std::string name = Params["name"].as(); auto params = Params["parameters"];