MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / loadModel

Method loadModel

src/osversion/VersionTranslator.cpp:194–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192 }
193
194 boost::optional<model::Model> VersionTranslator::loadModel(const openstudio::path& pathToOldOsm, ProgressBar* progressBar) {
195 LOG(Trace, "Loading model from " << toString(pathToOldOsm) << ".");
196 if (getFileExtension(pathToOldOsm) != modelFileExtension()) {
197 LOG(Error, "Cannot loadModel for path'" << toString(pathToOldOsm) << "'. Extension must be '" << modelFileExtension() << "'. For '"
198 << componentFileExtension() << "'s use loadComponent.");
199 return boost::none;
200 }
201
202 path wp = completePathToFile(pathToOldOsm, path(), modelFileExtension(), false);
203 openstudio::filesystem::ifstream inFile(wp);
204 if (inFile) {
205 return loadModel(inFile, progressBar);
206 }
207 return boost::none;
208 }
209
210 boost::optional<model::Model> VersionTranslator::loadModel(std::istream& is, ProgressBar* progressBar) {
211 return updateVersion(is, false, progressBar);

Callers 5

setup_testMethod · 0.95
BM_VTFunction · 0.45
testExampleModelFunction · 0.45
TEST_FFunction · 0.45

Calls 5

getFileExtensionFunction · 0.85
modelFileExtensionFunction · 0.85
componentFileExtensionFunction · 0.85
completePathToFileFunction · 0.85
toStringFunction · 0.50

Tested by 4

setup_testMethod · 0.76
testExampleModelFunction · 0.36
TEST_FFunction · 0.36