Skip to content

Commit

Permalink
Add ignition_cells reading code
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanRenison committed Mar 20, 2023
1 parent 159a2b1 commit 2ca3b02
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/ignition_cells.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "ignition_cells.hpp"

#include <string>
#include <vector>

#include "types.h"

#include "csv.hpp"

IgnitionCells read_ignition_cells(std::string filename) {

std::ifstream file(filename);

CSVIterator loop(file);
loop++; // skip first line

IgnitionCells ignition_cells;

for (; loop != CSVIterator(); ++loop) {
ignition_cells.push_back({ atoi((*loop)[0].data()), atoi((*loop)[1].data()) });
}
}
13 changes: 13 additions & 0 deletions src/ignition_cells.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef _IGNITIONS_CELLS_HPP
#define _IGNITIONS_CELLS_HPP

#include <string>
#include <vector>

#include "types.h"

typedef std::vector<std::pair<uint, uint>> IgnitionCells;

IgnitionCells read_ignition_cells(std::string filename);

#endif

0 comments on commit 2ca3b02

Please sign in to comment.