Cell2Fire
A large-scale forest fire simulator.
Loading...
Searching...
No Matches
WriteCSV.h
1#ifndef WRITECSV
2#define WRITECSV
3
4#include <algorithm>
5#include <boost/algorithm/string.hpp>
6#include <cmath>
7#include <fstream>
8#include <iostream>
9#include <iterator>
10#include <set>
11#include <string>
12#include <unordered_map>
13#include <unordered_set>
14#include <vector>
15
16/*
17 * A class to read data from a csv file.
18 */
20{
21 public:
22 // inmutable
23 std::string fileName;
24 std::string delimeter;
25
26 // mutable
27 int linesCount;
28
29 // Constructor
30 CSVWriter(std::string filename, std::string delm = ",");
31
32 // Function to write data (row) to a CSV File
33 template <typename T>
34 void addDatainRow(T first, T last);
35
36 // Function to write the entire file
37 void printCSV(int rows, int cols, std::vector<int> statusCells);
38 void printCSVDouble(int rows, int cols, std::vector<double> network);
39 void printCSVDouble_V2(int rows, int cols, std::vector<double> network);
40 void
41 printASCII(int rows, int cols, double xllcorner, double yllcorner, int cellside, std::vector<float> statusCells);
42 void
43 printASCIIInt(int rows, int cols, double xllcorner, double yllcorner, int cellside, std::vector<int> statusCells);
44 void asciiHeader(int rows, int cols, double xllcorner, double yllcorner, int cellside);
45 void printWeather(std::vector<std::string> weatherHistory);
46 void printIgnitions(std::unordered_map<int, int> ignitionsHistory);
47 void printCSV_V2(int rows, int cols, std::vector<int> statusCells);
48 // Function to create a directory
49 void MakeDir(std::string pathPlot);
50};
51
52#endif
Definition WriteCSV.h:20
void addDatainRow(T first, T last)
Writes a row of data to a file Takes a range of values and appends them as a single row to the output...
Definition WriteCSV.cpp:48
void printWeather(std::vector< std::string > weatherHistory)
writes the weather file history onto an output file
Definition WriteCSV.cpp:320
void printIgnitions(std::unordered_map< int, int > ignitionsHistory)
writes the ignition point history onto an output file
Definition WriteCSV.cpp:340
void printASCIIInt(int rows, int cols, double xllcorner, double yllcorner, int cellside, std::vector< int > statusCells)
Writes a raster layer with int data in ASCII format onto a file.
Definition WriteCSV.cpp:285
void printASCII(int rows, int cols, double xllcorner, double yllcorner, int cellside, std::vector< float > statusCells)
Writes a raster layer with float data in ASCII format onto a file.
Definition WriteCSV.cpp:243
void printCSV(int rows, int cols, std::vector< int > statusCells)
Writes a 2D grid of cell statuses to a CSV file.
Definition WriteCSV.cpp:134
void MakeDir(std::string pathPlot)
Creates the directory for a given path.
Definition WriteCSV.cpp:394
void asciiHeader(int rows, int cols, double xllcorner, double yllcorner, int cellside)
Writes the ascii header onto a raster file.
Definition WriteCSV.cpp:81