Skip to content

Commit

Permalink
Removing the last unit conversion. Added an optional thicknessUnit st…
Browse files Browse the repository at this point in the history
…ring to ProductData.
  • Loading branch information
StephenCzarnecki committed Jul 28, 2022
1 parent e4bc022 commit c1848a5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
15 changes: 1 addition & 14 deletions src/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -970,20 +970,7 @@ OpticsParser::ProductData parseIGSDBJson(nlohmann::json const & product_json)
product->manufacturer = matNode.getChildNode("Manufacturer").getText();
auto thickness = parseOptionalDoubleNode(matNode.getChildNode("Thickness"));
auto thicknessUnitStr = matNode.getChildNode("Thickness").getAttribute("unit");
if(toLower(thicknessUnitStr) == "millimeter")
{}
else if(thickness.has_value() && toLower(thicknessUnitStr) == "meter")
{
// Convert to mm here. This is the only case of unit conversion
// and is only here so that the very rare (possibly only theoretical)
// case when BSDF XML files have thickness in meters result in a parsed
// product that has the same thickness as optics files and IGSDB v1 and v2 json
*thickness *= 1000.0;
}
else
{
throw std::runtime_error("XML error: Unsupported thickness unit");
}
product->thicknessUnit = thicknessUnitStr;
product->thickness = thickness;
product->frontEmissivity = parseOptionalDoubleNode(matNode.getChildNode("EmissivityFront"));
product->backEmissivity = parseOptionalDoubleNode(matNode.getChildNode("EmissivityBack"));
Expand Down
1 change: 1 addition & 0 deletions src/ProductData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ namespace OpticsParser
std::optional<DualBandValues> dualBandDiffuse;
std::optional<PrecalculatedResults> precalculatedResults;
std::optional<PVPowerProperties> pvPowerProperties;
std::optional<std::string> thicknessUnit;
};

// Converting to json requires updating and is not currently being
Expand Down

0 comments on commit c1848a5

Please sign in to comment.