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

Function attachWorkflow

src/model/FileOperations.cpp:222–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220 }
221
222 bool attachWorkflow(openstudio::model::Model& model, const openstudio::path& modelTempDir) {
223 boost::optional<WorkflowJSON> workflowJSON;
224 bool result = false;
225
226 openstudio::path oswPath = modelTempDir / openstudio::toPath("resources/workflow.osw");
227 if (boost::filesystem::exists(oswPath)) {
228 workflowJSON = WorkflowJSON::load(oswPath);
229 if (workflowJSON) {
230 result = true;
231 LOG_FREE(Debug, "attachWorkflow", "Opened existing workflow.osw file");
232 } else {
233 LOG_FREE(Error, "attachWorkflow", "Could not open existing workflow.osw file");
234 }
235 }
236
237 if (!workflowJSON) {
238 workflowJSON = WorkflowJSON();
239 workflowJSON->setOswPath(oswPath);
240 workflowJSON->save();
241 }
242 OS_ASSERT(workflowJSON);
243 model.setWorkflowJSON(*workflowJSON);
244
245 return result;
246 }
247
248 openstudio::path initializeModel(openstudio::model::Model model) {
249 return initializeModel(model, openstudio::path());

Callers 1

initializeModelFunction · 0.85

Calls 5

WorkflowJSONClass · 0.85
setOswPathMethod · 0.80
setWorkflowJSONMethod · 0.80
toPathFunction · 0.50
saveMethod · 0.45

Tested by

no test coverage detected