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

Function getSystem

src/utilities/units/UnitFactory.cpp:551–617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

549}
550
551UnitSystem getSystem(const std::string& unitString) {
552
553 OptionalUnit unit;
554
555 // pick up preferred unit system for strings like "C" and "F"
556 unit = createUnit(unitString, UnitSystem::Mixed);
557 if (unit && (unit->system() != UnitSystem::Mixed)) {
558 return unit->system();
559 }
560
561 unit = createUnit(unitString, UnitSystem::SI);
562 if (unit && (unit->system() != UnitSystem::Mixed)) {
563 return unit->system();
564 }
565
566 unit = createUnit(unitString, UnitSystem::IP);
567 if (unit && (unit->system() != UnitSystem::Mixed)) {
568 return unit->system();
569 }
570
571 unit = createUnit(unitString, UnitSystem::BTU);
572 if (unit && (unit->system() != UnitSystem::Mixed)) {
573 return unit->system();
574 }
575
576 unit = createUnit(unitString, UnitSystem::CFM);
577 if (unit && (unit->system() != UnitSystem::Mixed)) {
578 return unit->system();
579 }
580
581 unit = createUnit(unitString, UnitSystem::GPD);
582 if (unit && (unit->system() != UnitSystem::Mixed)) {
583 return unit->system();
584 }
585
586 unit = createUnit(unitString, UnitSystem::MPH);
587 if (unit && (unit->system() != UnitSystem::Mixed)) {
588 return unit->system();
589 }
590
591 unit = createUnit(unitString, UnitSystem::Wh);
592 if (unit && (unit->system() != UnitSystem::Mixed)) {
593 return unit->system();
594 }
595
596 unit = createUnit(unitString, UnitSystem::Therm);
597 if (unit && (unit->system() != UnitSystem::Mixed)) {
598 return unit->system();
599 }
600
601 unit = createUnit(unitString, UnitSystem::Misc1);
602 if (unit && (unit->system() != UnitSystem::Mixed)) {
603 return unit->system();
604 }
605
606 unit = createUnit(unitString, UnitSystem::Celsius);
607 if (unit && (unit->system() != UnitSystem::Mixed)) {
608 return unit->system();

Callers 3

createQuantityMethod · 0.85
TEST_FFunction · 0.85

Calls 2

createUnitFunction · 0.85
systemMethod · 0.45

Tested by 1

TEST_FFunction · 0.68