| 189 | } |
| 190 | |
| 191 | shared_ptr<Solution> newSolution(const string &infile, |
| 192 | const string &name, |
| 193 | const string &transport, |
| 194 | const vector<shared_ptr<Solution>> &adjacent) |
| 195 | { |
| 196 | // get file extension |
| 197 | size_t dot = infile.find_last_of("."); |
| 198 | string extension; |
| 199 | if (dot != npos) { |
| 200 | extension = toLowerCopy(infile.substr(dot+1)); |
| 201 | } |
| 202 | |
| 203 | if (extension == "cti" || extension == "xml") { |
| 204 | throw CanteraError("newSolution", |
| 205 | "The CTI and XML formats are no longer supported."); |
| 206 | } |
| 207 | |
| 208 | // load YAML file |
| 209 | auto rootNode = AnyMap::fromYamlFile(infile); |
| 210 | const AnyMap& phaseNode = rootNode.at("phases").getMapWhere("name", name); |
| 211 | auto sol = newSolution(phaseNode, rootNode, transport, adjacent); |
| 212 | sol->setSource(infile); |
| 213 | return sol; |
| 214 | } |
| 215 | |
| 216 | shared_ptr<Solution> newSolution(const string& infile, const string& name, |
| 217 | const string& transport, const vector<string>& adjacent) |