Skip to content

Commit

Permalink
Add unique read_csv in utility
Browse files Browse the repository at this point in the history
  • Loading branch information
sbaldu committed Feb 7, 2025
1 parent 816f15c commit 615f2ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 55 deletions.
46 changes: 0 additions & 46 deletions benchmark/profiling/read_csv.hpp

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@

#ifndef read_csv_hpp
#define read_csv_hpp
#pragma once

#include <fstream>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#include "CLUEstering/DataFormats/alpaka/AlpakaVecArray.hpp"

using clue::VecArray;

template <typename T, size_t NDim>
std::vector<T> read_csv(const std::string& file_path) {
std::fstream file(file_path);
Expand All @@ -20,9 +14,9 @@ std::vector<T> read_csv(const std::string& file_path) {
}
auto n_points = std::count(
std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>(), '\n');

std::vector<float> coords((NDim + 1) * n_points);

file = std::fstream(file_path);
// discard the header
std::string buffer;
getline(file, buffer);
Expand All @@ -43,4 +37,3 @@ std::vector<T> read_csv(const std::string& file_path) {
return coords;
}

#endif

0 comments on commit 615f2ef

Please sign in to comment.