37 #ifndef CSVGNUPLOTOUTPUT_H_
38 #define CSVGNUPLOTOUTPUT_H_
58 template<
typename Vector_type,
typename postype>
59 void WriteVectorCSV(
const char *filename,
const Vector_type &b, postype *positions,
int dimensions)
61 std::fstream file(filename, std::ios::out);
62 size_t rows = b.size();
65 file <<
"# dim=" << dimensions<<
", rows="<< rows <<std::endl;
68 for(
size_t i=0; i < rows; i++)
69 file << positions[i][0] <<
", " << b[i] <<std::endl;
71 else if(dimensions == 2)
72 for(
size_t i=0; i < rows; i++)
73 file << positions[i][0] <<
", " << positions[i][1] <<
", " << b[i]<< std::endl;
75 for(
size_t i=0; i < rows; i++)
76 file << positions[i][0] <<
", " << positions[i][1] <<
", " << positions[i][2] <<
", " << b[i] << std::endl;
void WriteVectorCSV(const char *filename, const Vector_type &b, postype *positions, int dimensions)
writes to a file in somewhat SparseMatrix-market format (for connection viewer)
Definition: csv_gnuplot_output.h:59