MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / get_SI_equivalent

Method get_SI_equivalent

src/ifcparse/IfcSIPrefix.cpp:112–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110
111template <typename Schema>
112double IfcParse::get_SI_equivalent(typename Schema::IfcNamedUnit* named_unit) {
113 double scale = 1.;
114 typename Schema::IfcSIUnit* si_unit = 0;
115
116 if (named_unit->declaration().is(Schema::IfcConversionBasedUnit::Class())) {
117 typename Schema::IfcConversionBasedUnit* conv_unit = named_unit->template as<typename Schema::IfcConversionBasedUnit>();
118 typename Schema::IfcMeasureWithUnit* factor = conv_unit->ConversionFactor();
119 typename Schema::IfcUnit* component = factor->UnitComponent();
120 if (component->declaration().is(Schema::IfcSIUnit::Class())) {
121 si_unit = component->template as<typename Schema::IfcSIUnit>();
122 typename Schema::IfcValue* value = factor->ValueComponent();
123 scale = value->template as<IfcUtil::IfcBaseClass>()->get_attribute_value(0);
124 }
125 } else if (named_unit->declaration().is(Schema::IfcSIUnit::Class())) {
126 si_unit = named_unit->template as<typename Schema::IfcSIUnit>();
127 }
128 if (si_unit) {
129 if (si_unit->Prefix()) {
130 scale *= IfcSIPrefixToValue(Schema::IfcSIPrefix::ToString(*si_unit->Prefix()));
131 }
132 } else {
133 scale = 0.;
134 }
135
136 return scale;
137}
138
139#if defined(_MSC_VER) && _MSC_VER < 1900
140

Callers

nothing calls this directly

Calls 2

isMethod · 0.80
get_attribute_valueMethod · 0.80

Tested by

no test coverage detected