14 void searchVar(std::ifstream &stream, std::string search){
19 while (stream >> word) {
24 if ((
int) stream.tellg() == -1){
25 std::cout<<
"Variable not found: \""<< search <<
"\"\n";
35 void checkIfOpen(std::ifstream &stream, std::string fileName){
36 if (!stream.is_open()){
37 std::cout<<
"ERROR: unable to open file "<< fileName << std::endl;
42 void checkIfOpen(std::ofstream &stream, std::string fileName){
43 if (!stream.is_open()){
44 std::cout<<
"ERROR: unable to open file "<< fileName << std::endl;
56 void getRectCoords(std::ifstream &stream,
double *var,
int nRectangles){
59 for (i = 0; i < nRectangles; i++) {
61 stream >> ch >> var[x] >> ch >> var[x+1] >> ch >> var[x+2] >> ch
62 >> ch >> var[x+3] >> ch >> var[x+4] >> ch >> var[x+5] >> ch
63 >> ch >> var[x+6] >> ch >> var[x+7] >> ch >> var[x+8] >> ch
64 >> ch >> var[x+9] >> ch >> var[x+10] >> ch >> var[x+11] >> ch;
77 void getCords(std::ifstream & stream,
double *outAry,
int nPoly,
int nVertices) {
80 int size = nPoly * nVertices;
82 for (
int i = 0; i < size; i++) {
84 stream >> ch >> outAry[x] >> ch >> outAry[x+1] >> ch >> outAry[x+2] >> ch;
97 std::cout << varName <<
": \n";
98 for (i = 0; i<nRectangles; i++) {
100 std::cout <<
"{" << var[x] <<
"," << var[x+1] <<
"," << var[x+2] <<
"} " 101 <<
"{" << var[x+3] <<
"," << var[x+4] <<
"," << var[x+5] <<
"} " 102 <<
"{" << var[x+6] <<
"," << var[x+7] <<
"," << var[x+8] <<
"} " 103 <<
"{" << var[x+9] <<
"," << var[x+10] <<
"," << var[x+11] <<
"}\n";
113 return std::chrono::system_clock::now().time_since_epoch().count();