| 1401 | } |
| 1402 | |
| 1403 | AnyMap SolutionArray::restore(const string& fname, |
| 1404 | const string& name, const string& sub) |
| 1405 | { |
| 1406 | size_t dot = fname.find_last_of("."); |
| 1407 | string extension = (dot != npos) ? toLowerCopy(fname.substr(dot + 1)) : ""; |
| 1408 | AnyMap header; |
| 1409 | if (extension == "csv") { |
| 1410 | throw NotImplementedError("SolutionArray::restore", |
| 1411 | "CSV import not implemented; if using Python, data can be imported via " |
| 1412 | "'read_csv' instead."); |
| 1413 | } |
| 1414 | if (extension == "h5" || extension == "hdf" || extension == "hdf5") { |
| 1415 | readEntry(fname, name, sub); |
| 1416 | header = readHeader(fname, name); |
| 1417 | } else if (extension == "yaml" || extension == "yml") { |
| 1418 | const AnyMap& root = AnyMap::fromYamlFile(fname); |
| 1419 | readEntry(root, name, sub); |
| 1420 | header = readHeader(root, name); |
| 1421 | } else { |
| 1422 | throw CanteraError("SolutionArray::restore", |
| 1423 | "Unknown file extension '{}'; supported extensions include " |
| 1424 | "'h5'/'hdf'/'hdf5' and 'yml'/'yaml'.", extension); |
| 1425 | } |
| 1426 | return header; |
| 1427 | } |
| 1428 | |
| 1429 | void SolutionArray::_initExtra(const string& name, const AnyValue& value) |
| 1430 | { |