Commit 87d17828 authored by frey_m's avatar frey_m
Browse files

remove unused function, add string support

parent 97149d3d
......@@ -751,8 +751,18 @@ std::map<std::string, std::string> OpalData::getVariableData() {
std::map<std::string, std::string> udata;
std::vector<std::string> uvars = this->getVariableNames();
for (auto& uvar : uvars) {
RealVariable &variable = *dynamic_cast<RealVariable *>(OpalData::getInstance()->find(uvar));
udata[uvar] = std::to_string(variable.getReal());
Object *tmpObject = OpalData::getInstance()->find(uvar);
if (dynamic_cast<RealVariable *>(&*tmpObject)) {
RealVariable &variable = *dynamic_cast<RealVariable *>(OpalData::getInstance()->find(uvar));
udata[uvar] = std::to_string(variable.getReal());
} else if (dynamic_cast<StringConstant*>(&*tmpObject)) {
StringConstant &variable = *dynamic_cast<StringConstant *>(OpalData::getInstance()->find(uvar));
udata[uvar] = variable.getString();
} else {
throw OpalException("OpalData::getVariableData()",
"Type of '" + uvar + "' not supported. "
"Only support for REAL and STRING.");
}
}
return udata;
}
......@@ -768,40 +778,13 @@ std::vector<std::string> OpalData::getVariableNames() {
if (!tmpObject || tmpObject->isBuiltin())
continue;
if (tmpObject->getCategory() == "VARIABLE") {
if (dynamic_cast<RealVariable *>(&*tmpObject)) {
result.push_back(tmpName);
}
result.push_back(tmpName);
}
}
}
return result;
}
std::vector<std::string> OpalData::getAllNames() {
std::vector<std::string> result;
for(ObjectDir::const_iterator index = p->mainDirectory.begin();
index != p->mainDirectory.end(); ++index) {
std::string tmpName = (*index).first;
if(!tmpName.empty()) result.push_back(tmpName);
}
// DTA
std::cout << "\nUser-defined variables:\n";
std::vector<std::string> uvars = this->getVariableNames();
for (auto& uvar : uvars) {
std::cout << uvar;
RealVariable &variable = *dynamic_cast<RealVariable *>(OpalData::getInstance()->find(uvar));
std::cout << "\te= " << variable.value().getBase().getImage();
std::cout << "\tr= " << variable.getReal();
std::cout << "\ta= " << variable.itsAttr[0];
std::cout << std::endl;
}
std::cout << std::endl;
return result;
}
void OpalData::addProblemCharacteristicValue(const std::string &name, unsigned int value) {
if (p->problemSize_m.find(name) != p->problemSize_m.end()) {
p->problemSize_m.insert(std::make_pair(name, value));
......
......@@ -153,7 +153,6 @@ public:
std::map<std::string, std::string> getVariableData();
std::vector<std::string> getVariableNames();
std::vector<std::string> getAllNames();
bool isInOPALCyclMode();
bool isInOPALTMode();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment