RubyContinuousVariable RubyContinuousVariable_Impl::fromVariant(const QVariant& variant, const VersionString& version) { QVariantMap map = variant.toMap(); // dummy measure. need to do something better sometime (like make sure overload version of // this method is always called) RubyMeasure dummyMeasure(toPath("*.rb"), FileReferenceType::Unknown, FileReferenceType::Unknown); return RubyContinuousVariable( toUUID(map["uuid"].toString().toStdString()), toUUID(map["version_uuid"].toString().toStdString()), map.contains("name") ? map["name"].toString().toStdString() : std::string(), map.contains("display_name") ? map["display_name"].toString().toStdString() : std::string(), map.contains("description") ? map["description"].toString().toStdString() : std::string(), map.contains("uncertainty_description") ? analysis::detail::toUncertaintyDescription(map["uncertainty_description"],version) : OptionalUncertaintyDescription(), map.contains("minimum") ? map["minimum"].toDouble() : OptionalDouble(), map.contains("maximum") ? map["maximum"].toDouble() : OptionalDouble(), map.contains("increment") ? map["increment"].toDouble() : OptionalDouble(), map.contains("n_steps") ? map["n_steps"].toInt() : OptionalInt(), ruleset::detail::toOSArgument(map["argument"],version), dummyMeasure); }
OptionalInt getProjectRadianceJobIndex(const openstudio::analysisdriver::SimpleProject &t_project) { openstudio::analysis::Problem problem = t_project.analysis().problem(); OptionalInt index = problem.getWorkflowStepIndexByJobType(runmanager::JobType::ModelToIdf); LOG_FREE(Trace, "WorkflowTools", "ModelToIdf job found " << (index?"true":"false")); if (index) { LOG_FREE(Trace, "WorkflowTools", "ModelToIdf job found at " << *index); } else { return OptionalInt(); } int i = *index - 1; std::vector<openstudio::analysis::WorkflowStep> workflow = problem.workflow(); if (i > 0 && workflow[i].isWorkItem() && workflow[i].workItem().jobkeyname == "pat-radiance-job") { return i; } else { return OptionalInt(); } }
RubyContinuousVariable RubyContinuousVariable_Impl::fromVariant(const QVariant& variant, const Measure& measure, const VersionString& version) { QVariantMap map = variant.toMap(); OS_ASSERT(measure.optionalCast<RubyMeasure>()); return RubyContinuousVariable( toUUID(map["uuid"].toString().toStdString()), toUUID(map["version_uuid"].toString().toStdString()), map.contains("name") ? map["name"].toString().toStdString() : std::string(), map.contains("display_name") ? map["display_name"].toString().toStdString() : std::string(), map.contains("description") ? map["description"].toString().toStdString() : std::string(), map.contains("uncertainty_description") ? analysis::detail::toUncertaintyDescription(map["uncertainty_description"],version) : OptionalUncertaintyDescription(), map.contains("minimum") ? map["minimum"].toDouble() : OptionalDouble(), map.contains("maximum") ? map["maximum"].toDouble() : OptionalDouble(), map.contains("increment") ? map["increment"].toDouble() : OptionalDouble(), map.contains("n_steps") ? map["n_steps"].toInt() : OptionalInt(), ruleset::detail::toOSArgument(map["argument"],version), measure.cast<RubyMeasure>()); }