-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from LBNL-ETA/BSDFXML
Bsdfxml
- Loading branch information
Showing
26 changed files
with
2,515 additions
and
204 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,104 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
|
||
project( OpticalMeasurementParser VERSION 2.1.0 LANGUAGES CXX ) | ||
project(OpticalMeasurementParser VERSION 2.1.0 LANGUAGES CXX) | ||
set(LIB_NAME ${PROJECT_NAME}) | ||
|
||
if (MSVC) | ||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") | ||
endif() | ||
|
||
if(NOT "${CMAKE_CXX_STANDARD}") | ||
set(CMAKE_CXX_STANDARD 14) | ||
set(CMAKE_CXX_STANDARD 14) | ||
endif() | ||
|
||
if(NOT "${CMAKE_CXX_EXTENSIONS}") | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
endif() | ||
|
||
include(GNUInstallDirs) | ||
if(NOT "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}") | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) | ||
endif() | ||
|
||
if(NOT "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) | ||
endif() | ||
|
||
if(NOT "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) | ||
endif() | ||
|
||
# Check to see if this project is included in another via add_subdirectoru | ||
# If it is, do not download GTest since it will create errors in the client | ||
# if the client also uses GTest | ||
# Check to see if this project is included in another via add_subdirectory | ||
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) | ||
set(DOWNLOAD_GTEST ON) | ||
else() | ||
set(DOWNLOAD_GTEST OFF) | ||
endif() | ||
|
||
set( JSON_BuildTests OFF CACHE BOOL "") | ||
set(JSON_BuildTests OFF CACHE BOOL "") | ||
|
||
include(FetchContent) | ||
|
||
if(NOT TARGET nlohmann_json) | ||
FetchContent_Declare( | ||
nlohmann_json | ||
GIT_REPOSITORY https://github.com/nlohmann/json.git | ||
GIT_TAG "db53bda" | ||
) | ||
|
||
FetchContent_MakeAvailable(nlohmann_json) | ||
endif() | ||
|
||
if(NOT TARGET xmlParser) | ||
FetchContent_Declare( | ||
xmlParser | ||
GIT_REPOSITORY https://github.com/LBNL-ETA/XMLParser.git | ||
GIT_TAG "v1.0.1" | ||
) | ||
|
||
include(CMakeLists-nlohmann_json.txt) | ||
include(CMakeLists-xmlParser.txt) | ||
FetchContent_MakeAvailable(xmlParser) | ||
endif() | ||
|
||
add_subdirectory( src ) | ||
if(NOT TARGET FileParse) | ||
set(BUILD_FileParse_tests OFF CACHE BOOL "Build FileParse tests" FORCE) | ||
|
||
FetchContent_Declare( | ||
FileParse | ||
GIT_REPOSITORY https://github.com/LBNL-ETA/FileParse.git | ||
GIT_TAG Version_1.0 | ||
) | ||
|
||
FetchContent_MakeAvailable(FileParse) | ||
endif() | ||
|
||
# Set include directories for FileParse | ||
set(FileParse_INCLUDE_DIRS "${fileparse_SOURCE_DIR}/include") | ||
include_directories(${FileParse_INCLUDE_DIRS}) | ||
|
||
# Add your target | ||
add_subdirectory(src) | ||
|
||
# Add nlohmann_json include directory to your target | ||
target_include_directories(${LIB_NAME} | ||
PUBLIC | ||
$<INSTALL_INTERFACE:include> | ||
PUBLIC | ||
$<INSTALL_INTERFACE:include> | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
${nlohmann_json_SOURCE_DIR}/include | ||
PRIVATE | ||
${CMAKE_CURRENT_SOURCE_DIR}/src | ||
) | ||
|
||
Option(BUILD_Optical_Measurement_Parser_Tests "Build tests for optical measurement parsing." ON) | ||
|
||
if(BUILD_Optical_Measurement_Parser_Tests) | ||
enable_testing() | ||
add_subdirectory( test ) | ||
endif() | ||
enable_testing() | ||
add_subdirectory(test) | ||
|
||
# Set the path to the test directory | ||
set(TEST_DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/test") | ||
target_compile_definitions(OpticalMeasurementParser-test PRIVATE TEST_DATA_DIR="${TEST_DATA_DIR}") | ||
|
||
# Add the test with the specified arguments | ||
add_test(NAME OpticalMeasurementParser-test | ||
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/OpticalMeasurementParser-test --gtest_catch_exceptions=0) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
#include <optional> | ||
#include <variant> | ||
#include <vector> | ||
|
||
#include "Enumerators.hpp" | ||
|
||
namespace BSDFXML | ||
{ | ||
struct Thickness | ||
{ | ||
double value; | ||
LengthUnit unit; | ||
}; | ||
|
||
struct Wavelength | ||
{ | ||
std::string value; | ||
WavelengthUnit unit; | ||
std::optional<std::string> type; | ||
}; | ||
|
||
struct OpticalProperties | ||
{ | ||
std::optional<double> transmittance; | ||
std::optional<double> reflectanceFront; | ||
std::optional<double> reflectanceBack; | ||
std::optional<std::string> comments; | ||
}; | ||
|
||
struct Material | ||
{ | ||
std::string name; | ||
std::optional<std::string> productName; | ||
std::optional<std::string> manufacturer; | ||
std::optional<Thickness> thickness; | ||
std::optional<DeviceType> deviceType; | ||
std::optional<double> thermalConductivity; | ||
std::optional<double> airPermeability; | ||
std::optional<double> emissivityFront; | ||
std::optional<double> emissivityBack; | ||
std::optional<double> TIR; | ||
std::optional<double> effectiveOpennessFraction; | ||
std::optional<double> permeabilityFactor; | ||
std::optional<OpticalProperties> opticalProperties; | ||
std::optional<std::string> color; | ||
std::optional<std::string> AERCAcceptance; | ||
std::optional<std::string> comments; | ||
std::optional<double> width; | ||
std::optional<double> height; | ||
std::optional<double> openness; | ||
}; | ||
|
||
/// Schema is actually using many different types that look like this. I will not repeat them | ||
/// all here but will use single one. In case schema gets updated and one of the parameters is | ||
/// updated, then additional parameter can be added here. | ||
struct Length | ||
{ | ||
double value; | ||
LengthUnit unit; | ||
}; | ||
|
||
struct LengthWithCavity | ||
{ | ||
double value; | ||
std::optional<int> cavity; | ||
LengthUnit unit; | ||
}; | ||
|
||
struct Geometry | ||
{ | ||
std::optional<std::string> format; | ||
std::optional<LengthUnit> unit; | ||
std::optional<Length> blindSlatThickness; | ||
std::optional<Length> blindCurvature; | ||
std::optional<Length> blindWidth; | ||
std::optional<Length> blindSpacing; | ||
std::optional<double> blindAngle; | ||
std::optional<double> diffusingGlassCoverageFraction; | ||
std::optional<double> wovenShadeOpennessFraction; | ||
std::optional<Length> wovenShadeThreadDiameter; | ||
std::optional<Length> wovenShadeThreadSpacing; | ||
std::optional<Length> wovenShadeThickness; | ||
std::optional<Length> cellularShadeCellHeight; | ||
std::optional<Length> cellularShadeInnerWallLength; | ||
std::optional<LengthWithCavity> cellularShadeSideWallLength; | ||
std::optional<LengthWithCavity> pleatedShadeCellHeight; | ||
std::optional<LengthWithCavity> pleatedShadeCellSideWallLength; | ||
std::optional<Length> mgfBlock; | ||
}; | ||
|
||
struct ThetaBounds | ||
{ | ||
std::optional<double> lowerTheta; | ||
std::optional<double> upperTheta; | ||
std::optional<std::string> comments; | ||
}; | ||
|
||
struct AngleBasisBlock | ||
{ | ||
double theta; | ||
std::optional<double> phi; | ||
std::optional<double> nPhis; | ||
std::optional<std::variant<double, ThetaBounds>> bounds; | ||
std::optional<std::string> comments; | ||
}; | ||
|
||
struct AngleBasis | ||
{ | ||
std::optional<std::string> name; | ||
std::vector<AngleBasisBlock> blocks; | ||
}; | ||
|
||
struct DataDefinition | ||
{ | ||
std::optional<IncidentDataStructure> incidentDataStructure; | ||
AngleBasis angleBasis; | ||
std::optional<std::string> comments; | ||
}; | ||
|
||
using ScatteringData = std::vector<std::vector<double>>; | ||
|
||
struct WavelengthDataBlock | ||
{ | ||
std::optional<WavelengthDataDirection> wavelengthDataDirection; | ||
std::optional<std::string> columnAngleBasis; | ||
std::optional<std::string> rowAngleBasis; | ||
std::optional<ScatteringDataType> scatteringDataType; | ||
ScatteringData scatteringData; | ||
}; | ||
|
||
struct WavelengthData | ||
{ | ||
std::optional<std::string> layerNumber; | ||
std::optional<std::string> angle; | ||
std::optional<Wavelength> wavelength; | ||
std::optional<std::string> sourceSpectrum; | ||
std::optional<std::string> detectorSpectrum; | ||
WavelengthDataBlock block; | ||
std::optional<std::string> comments; | ||
}; | ||
|
||
struct Layer | ||
{ | ||
std::optional<Material> material; | ||
std::optional<Geometry> geometry; | ||
std::optional<DataDefinition> dataDefinition; | ||
std::vector<WavelengthData> wavelengthData; | ||
}; | ||
|
||
struct Optical | ||
{ | ||
Layer layer; | ||
}; | ||
|
||
struct WindowElement | ||
{ | ||
WindowElementType windowElementType{WindowElementType::Unknown}; | ||
std::optional<FileType> fileType; | ||
std::optional<std::string> Checksum; | ||
Optical optical; | ||
}; | ||
} // namespace BSDFXML |
Oops, something went wrong.