still need to modify datareader to use netcdf on only one thread

This commit is contained in:
Robin committed 2024-12-23 20:48:00 +01:00
1 parent a7ad248c38
commit 7b3c87c656
11 files changed
+487 -77

No files matched your search

+40
View File
@@ -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() { }
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.