#include "../include/BendData.h" #include "../include/DataLoad.h" #include #include #include #include #include namespace DataLoad { void loadDataFromCSV(const std::string& fileName, BendData& bendData) { std::ifstream file(fileName); if (!file.is_open()) { std::cerr << "Failed to open the file: " << fileName << std::endl; return; } std::string line; while (std::getline(file, line)) { std::stringstream ss(line); std::string item; std::vector data; while (std::getline(ss, item, ',')) { data.push_back(std::stod(item)); } // Assuming the order of data in the CSV matches the fields in BendData if (data.size() == 4) { bendData.bendAngleDegrees = data[0]; bendData.insideRadius = data[1]; bendData.materialThickness = data[2]; bendData.kFactor = data[3]; } else { std::cerr << "Unexpected number of items in line: " << line << std::endl; } } file.close(); } }