mirror of
https://github.com/MartinOpat/cuda-based-raytrace.git
synced 2025-06-07 02:13:10 +02:00
still need to modify datareader to use netcdf on only one thread
This commit is contained in:
1 parent
a7ad248c38
commit
7b3c87c656
11 files changed
+487
-77
No files matched your search
@@ -0,0 +1,40 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <filesystem>
|
||||
#include <algorithm>
|
||||
|
||||
#include "filepathmanager.h"
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
FilePathManager::FilePathManager(const std::string& path) {
|
||||
// Check if the directory exists
|
||||
if (!fs::exists(path) || !fs::is_directory(path)) {
|
||||
std::cerr << "Error: Directory does not exist or is not valid." << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Iterate over directory entries
|
||||
for (const auto& entry : fs::directory_iterator(path)) {
|
||||
if (entry.is_regular_file() && entry.path().extension() == ".nc4") {
|
||||
fileNames.push_back(entry.path().string());
|
||||
}
|
||||
}
|
||||
|
||||
// Sort file names lexicographically
|
||||
std::sort(fileNames.begin(), fileNames.end());
|
||||
|
||||
// Print sorted file names
|
||||
std::cout << "Files in directory '" << path << "' sorted lexicographically:\n";
|
||||
for (const auto& fileName : fileNames) {
|
||||
std::cout << fileName << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
const char* FilePathManager::getPath(size_t index) const {
|
||||
return fileNames.at(index).c_str();
|
||||
}
|
||||
|
||||
|
||||
FilePathManager::~FilePathManager() { }
|
||||