5#ifndef OPENFPM_IO_CSVREADER_HPP
6#define OPENFPM_IO_CSVREADER_HPP
12#include "Vector/map_vector.hpp"
14#include "VCluster/VCluster.hpp"
23T string_to_type(
const std::string & string_to_convert)
26 std::istringstream istream_string_to_convert(string_to_convert);
27 istream_string_to_convert >> x_new_type;
42void read_csv_to_vector(
const std::string & input_file,
openfpm::vector<T> & output_vector,
size_t & m,
size_t & n)
44 size_t total_size = 0;
47 auto & v_cl = create_vcluster();
53 std::cout <<
"Cannot find < " << input_file <<
" >. Please check path specification. Aborting..."
57 std::ifstream file(input_file);
58 std::string line, element;
59 while (getline(file, line))
61 std::stringstream stream_line(line);
62 while (getline(stream_line, element,
','))
64 output_vector.add(string_to_type<T>(element));
70 if(m >= 1) n = total_size / m;
74 MPI_Bcast(&total_size,1,MPI_UNSIGNED,0,MPI_COMM_WORLD);
75 MPI_Bcast(&m,1,MPI_UNSIGNED,0,MPI_COMM_WORLD);
76 MPI_Bcast(&n,1,MPI_UNSIGNED,0,MPI_COMM_WORLD);
80 output_vector.resize(total_size);
83 v_cl.Bcast(output_vector, 0);
Header file containing functions for creating files and folders.
static bool check_if_file_exists(std::string path)
Checks if a file already exists.
Implementation of 1-D std::vector like structure.