Skip to content

Commit

Permalink
Merge pull request #29 from LBNL-ETA/dec_2024_test_fix
Browse files Browse the repository at this point in the history
Dec 2024 test fix
  • Loading branch information
vidanovic authored Jan 27, 2025
2 parents 42033be + ba5ce96 commit 3b99960
Show file tree
Hide file tree
Showing 2,483 changed files with 79,601 additions and 28,528 deletions.
65 changes: 62 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,39 @@ env:
BUILD_TYPE: Release

jobs:
build:
windows:
name: ${{ matrix.os }}-${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2019, windows-2022]
arch: [x86, x64]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C RELEASE -V

mac:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2019, windows-2022, macos-12, macos-14, ubuntu-latest]
# arch: [x86, x64]
os: [macos-13, macos-latest]

steps:
- name: Checkout repository
Expand All @@ -29,6 +54,40 @@ jobs:
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C RELEASE -V

linux:
name: ${{ matrix.os }}-${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-24.04]
arch: [x86_64, aarch64]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install QEMU for aarch64 emulation
uses: docker/setup-qemu-action@v2
with:
platforms: all

- name: Upgrade gcc
run: sudo apt-get install -y gcc g++

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C RELEASE -V
2 changes: 1 addition & 1 deletion CMakeLists-OpticalMeasurementParser.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include(ExternalProject)

ExternalProject_Add(OpticalMeasurementParser
GIT_REPOSITORY https://github.com/LBNL-ETA/OpticalMeasurementParser.git
GIT_TAG "v2.3.0"
GIT_TAG "dec_2024_parsing"

UPDATE_COMMAND ""
PATCH_COMMAND ""
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists-THMXParser.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include(ExternalProject)

ExternalProject_Add(THMXParser
GIT_REPOSITORY https://github.com/LBNL-ETA/THMXParser.git
GIT_TAG "v1.1.1"
GIT_TAG "v1.1.2"

UPDATE_COMMAND ""
PATCH_COMMAND ""
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists-Windows-CalcEngine.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include(ExternalProject)

ExternalProject_Add(Windows-CalcEngine
GIT_REPOSITORY https://github.com/LBNL-ETA/Windows-CalcEngine.git
GIT_TAG "Version_1.0.48"
GIT_TAG "Version_1.0.50"

UPDATE_COMMAND ""
PATCH_COMMAND ""
Expand Down
21 changes: 21 additions & 0 deletions doc/WinCalc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
```mermaid
graph TD
%% Package definitions
xmlParser[xmlParser<br/><font color='red'>v1.0.2</font>]
OpticalMeasurementParser[OpticalMeasurementParser<br/><font color='red'>v2.3.2</font>]
nlohmann[nlohmann<br/><font color='red'>v3.11.3</font>]
BSDFXMLParser[BSDFXMLParser<br/><font color='red'>Version_0.0.2</font>]
THMXParser[THMXParser<br/><font color='red'>v1.1.2</font>]
WindowsCalcEngine[WindowsCalcEngine<br/><font color='red'>Version_1.0.50</font>]
Windows-CalcStandards[Windows-CalcStandards<br/><font color='red'>v1.2.1</font>]
WinCalc[WinCalc<br/><font color='red'>dec_2024_test_fix</font>]
%% Package relations
WinCalc --> OpticalMeasurementParser
OpticalMeasurementParser --> nlohmann
OpticalMeasurementParser --> BSDFXMLParser
BSDFXMLParser --> xmlParser
THMXParser --> xmlParser
WinCalc --> THMXParser
WinCalc --> Windows-CalcStandards
WinCalc --> WindowsCalcEngine
5 changes: 4 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Berkeley Lab WINDOW Calc Engine (CalcEngine) Copyright (c) 2016 - 2024, The
Berkeley Lab WINDOW Calc Engine (CalcEngine) Copyright (c) 2016 - 2025, The
Regents of the University of California, through Lawrence Berkeley National
Laboratory (subject to receipt of any required approvals from the U.S.
Dept. of Energy). All rights reserved.
Expand All @@ -14,4 +14,7 @@ its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the
Software to reproduce, distribute copies to the public, prepare derivative
works, and perform publicly and display publicly, and to permit other to do
so.

## Detailed package relation diagram

[Located here](./doc/WinCalc.md)
41 changes: 40 additions & 1 deletion src/convert_optics_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,32 @@ namespace wincalc
return length_conversion;
}

double get_wavelength_unit_conversion_factor(OpticsParser::ProductData const & product)
{
// Seems like most wavelengths are in microns so default to that.
double wavelength_conversion = 1.0;
if(product.wavelengthUnit.has_value())
{
auto wavelength_unit = to_lower(product.wavelengthUnit.value());
if(wavelength_unit == "micron" || wavelength_unit == "microns")
{
// Default case, do nothing
}
else if(wavelength_unit == "nanometer" || wavelength_unit == "nanometers")
{
wavelength_conversion = 1.0 / 1000.0;
}
else
{
std::stringstream msg;
msg << "Unsupported wlvelength unit: " << product.wavelengthUnit.value()
<< " Currently only micron and nanometer are supported.";
throw std::runtime_error(msg.str());
}
}
return wavelength_conversion;
}

std::shared_ptr<Product_Data_Optical> convert_optical(OpticsParser::ProductData const & product)
{
auto length_conversion = get_length_unit_conversion_factor(product);
Expand Down Expand Up @@ -199,10 +225,23 @@ namespace wincalc
coated_side = convert_coated_side(product.coatedSide.value());
}

auto wl_values =
std::get<std::vector<OpticsParser::WLData>>(wavelength_measured_values);

auto wl_unit_conversion_factor = get_wavelength_unit_conversion_factor(product);

if (wl_unit_conversion_factor != 1.0)
{
for (auto& val : wl_values)
{
val.wavelength *= wl_unit_conversion_factor;
}
}

converted.reset(new Product_Data_N_Band_Optical(
material_type,
product.thickness.value() * length_conversion,
std::get<std::vector<OpticsParser::WLData>>(wavelength_measured_values),
wl_values,
coated_side,
product.IRTransmittance,
product.IRTransmittance,
Expand Down
Loading

0 comments on commit 3b99960

Please sign in to comment.