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

Method load

src/model/Model.cpp:1891–1912  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1889 }
1890
1891 boost::optional<Model> Model::load(const path& osmPath) {
1892
1893 if (!openstudio::filesystem::is_regular_file(osmPath)) {
1894 LOG(Warn, "Path is not a valid file: " << osmPath);
1895 return boost::none;
1896 }
1897 openstudio::osversion::VersionTranslator vt;
1898 boost::optional<openstudio::model::Model> model_ = vt.loadModel(osmPath);
1899 if (!model_) {
1900 LOG(Warn, "Failed to load model at " << osmPath);
1901 return boost::none;
1902 }
1903 // Load the workflow.osw in the model's companion folder
1904 const openstudio::path workflowJSONPath = getCompanionFolder(osmPath) / toPath("workflow.osw");
1905 if (exists(workflowJSONPath)) {
1906 if (boost::optional<WorkflowJSON> workflowJSON_ = WorkflowJSON::load(workflowJSONPath)) {
1907 model_->setWorkflowJSON(*workflowJSON_);
1908 }
1909 }
1910
1911 return model_;
1912 }
1913
1914 boost::optional<Model> Model::load(const path& osmPath, const path& workflowJSONPath) {
1915 OptionalModel result = load(osmPath);

Callers 15

test_pathFunction · 0.45
runMethod · 0.45
runMethod · 0.45
cFunction · 0.45
runiso.rbFile · 0.45
measure.rbFile · 0.45
osm2iso.rbFile · 0.45

Calls 5

getCompanionFolderFunction · 0.85
setWorkflowJSONMethod · 0.80
toPathFunction · 0.50
loadModelMethod · 0.45
resetMethod · 0.45

Tested by 11

test_pathFunction · 0.36
test_fileMethod · 0.36
test_dataMethod · 0.36
test_time_seriesMethod · 0.36
test_WorkspaceMethod · 0.36
TEST_FFunction · 0.36