NatLabRockies / NatLabRockies/OpenStudio
revamp EpwDataPoint to use double attributes where appropriate
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 646
- Forks
- 237
- Avg merge
- 3d 11h
- Merged PRs (30d)
- 10
Description
There's a lot of back and forth conversions unnecessarily happening because the attributes are std::string but it should be double (or boost::optional<double> rather). We should limit the number of times we do std::stod conversions. Relates #3700 .
eg
hpp
std::string m_extraterrestrialDirectNormalRadiation; //units Wh/m2, missing 9999., minimum 0
cpp
boost::optional<double> EpwDataPoint::extraterrestrialDirectNormalRadiation() const
{
if(m_extraterrestrialDirectNormalRadiation == "9999") {
return boost::none;
}
return boost::optional<double>(std::stod(m_extraterrestrialDirectNormalRadiation));
}
bool EpwDataPoint::setExtraterrestrialDirectNormalRadiation(double value)
{
if(0 > value || value == 9999) {
m_extraterrestrialDirectNormalRadiation = "9999";
return false;
}
m_extraterrestrialDirectNormalRadiation = std::to_string(value);
return true;
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the EpwDataPoint declarations in the hpp file and their definitions in the cpp file. Identify numeric attributes still stored as std::string, then trace their accessors and setters to determine where double or boost::optional storage can remove repeated conversions. Done means the applicable attributes use numeric storage while preserving missing-value and validation behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- data
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100