Added export function to function container.
This commit is contained in:
@@ -58,7 +58,7 @@ void Func_Container::readFromCSV(std::string loadFilePath) {
|
||||
|
||||
if (!fileStream.good()) {
|
||||
stringstream ss;
|
||||
ss<<"Func_Container::readFromCSV: Could not open file: "<<loadFilePath<<endl;
|
||||
ss<<"Func_Container::readFromCSV: Could not open file. \n loadFilePath= "<<loadFilePath<<endl;
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
|
||||
@@ -97,6 +97,24 @@ void Func_Container::printAnkerpoints() {
|
||||
}
|
||||
}
|
||||
|
||||
void Func_Container::exportToFile(std::string exportFilePath) {
|
||||
ofstream outFile;
|
||||
outFile.open(exportFilePath);
|
||||
if (!outFile.good()) {
|
||||
stringstream ss;
|
||||
ss<<"Func_Container::exportToFile: Could not open file. \n exportFilePath= "<<exportFilePath<<endl;
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
outFile<<"# Automatically generated Data of Function_Container class by exportToFile().\n";
|
||||
outFile<<"# Generated on "<<getTimeString()<<".\n";
|
||||
outFile<<"#key (usually Energy)\tparameter (usually TCS)\n";
|
||||
dim1Map::iterator AnkerItr;
|
||||
for (AnkerItr = Map.begin();AnkerItr!=Map.end();AnkerItr++) {
|
||||
outFile<<AnkerItr->first<<"\t"<<AnkerItr->second<<"\n";
|
||||
}
|
||||
outFile.close();
|
||||
}
|
||||
|
||||
// Func2D_Container
|
||||
Func2D_Container::Func2D_Container(std::string loadFilePath) {
|
||||
readFromCSV(loadFilePath);
|
||||
|
||||
Reference in New Issue
Block a user