Skip to content

Commit

Permalink
switch back to ioss for filesystem interaction (#1074)
Browse files Browse the repository at this point in the history
* switch back to ioss for filesystem interaction

* whitespace
  • Loading branch information
rcknaus authored Nov 10, 2022
1 parent f91a782 commit 56d516d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 28 deletions.
4 changes: 0 additions & 4 deletions src/wind_energy/LidarPatterns.C
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
#include "xfer/LocalVolumeSearch.h"
#include "netcdf.h"

#if !defined(KOKKOS_ENABLE_HIP)
#include <filesystem>
#endif

#include <memory>

namespace sierra::nalu {
Expand Down
18 changes: 4 additions & 14 deletions src/wind_energy/SyntheticLidar.C
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
#include "vs/tensor.h"

#include <memory>
#if !defined(KOKKOS_ENABLE_HIP)
#include <filesystem>
#endif

namespace sierra {
namespace nalu {
Expand Down Expand Up @@ -285,17 +282,6 @@ LidarLineOfSite::output(
if (output_type_ == Output::DATAPROBE) {
return;
}
if (internal_output_counter_ == 0) {
auto dir_pos = name_.find_last_of("/");
auto dir_name = name_.substr(0, dir_pos);
#if !defined(KOKKOS_ENABLE_HIP)
std::filesystem::create_directory(dir_name);
#else
throw std::runtime_error(
"LidarLineOfSite::output() filesystem not supported on HIP");
#endif
}

const auto seg = segGen->generate(time());
if (!seg.valid && !always_output_) {
return;
Expand Down Expand Up @@ -400,6 +386,10 @@ LidarLineOfSite::output(
return;
}

if (internal_output_counter_ == 0) {
Ioss::FileInfo::create_path(name_);
}

if (output_type_ == Output::TEXT) {
output_txt(time(), points, velocity);
} else if (output_type_ == Output::NETCDF) {
Expand Down
14 changes: 4 additions & 10 deletions unit_tests/UnitTestLidarLOS.C
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
#include <ostream>
#include <memory>
#include <array>
#if !defined(KOKKOS_ENABLE_HIP)
#include <filesystem>
#endif
#include "Ioss_FileInfo.h"
namespace sierra {
namespace nalu {

Expand Down Expand Up @@ -98,15 +96,11 @@ public:

// lidar will write new files if they exist. Delete them here
// to adding new files ad infinitum`
#if !defined(KOKKOS_ENABLE_HIP)
std::filesystem::remove("lidar/scan.txt");
Ioss::FileInfo("lidar/scan.txt").remove_file();
for (int j = 0; j < 13; ++j) {
std::filesystem::remove("lidar/radar-grid-" + std::to_string(j) + ".txt");
Ioss::FileInfo("lidar/radar-grid-" + std::to_string(j) + ".txt")
.remove_file();
}
#else
throw std::runtime_error(
"LidarLOSFixture() filesystem not supported on HIP");
#endif
}

private:
Expand Down

0 comments on commit 56d516d

Please sign in to comment.