Commit 44002393 authored by LEFEBVREJP email's avatar LEFEBVREJP email
Browse files

radixio python bindings

gitlab coverage and test report integration
build status and coverage report badge in README.md
parent 5a25768f
...@@ -8,80 +8,120 @@ stages: ...@@ -8,80 +8,120 @@ stages:
mac_gcc_testing: mac_gcc_testing:
tags: tags:
- mac - mac
artifacts:
reports:
junit: build/ctest-results.xml
script: script:
- which git - which git
- git --version - git --version
- module load cmake gcc/4.8.5 qt/5.9.1 vtk/8.1.0 - module load cmake/3.21.0 gcc/4.8.5 qt/5.9.1 vtk/8.1.0
- which cmake - which cmake
- mkdir build - mkdir build
- cd build - cd build
- cmake -DTasmanian_DIR=/opt/tasmanian/6.0 ^ - cmake -DTasmanian_DIR=/opt/tasmanian/6.0
-DBUILDNAME=$(uname -s)-GCC-4.8.5-Debug-${CI_BUILD_REF_NAME} ^ -DBUILDNAME=$(uname -s)-GCC-4.8.5-Debug-${CI_BUILD_REF_NAME}
-DCMAKE_BUILD_TYPE=DEBUG ^ -DCMAKE_BUILD_TYPE=DEBUG
-Dradix_ENABLE_TESTS=ON ^ -Dradix_ENABLE_TESTS=ON
-Dradix_ENABLE_SECONDARY_TESTED_CODE=ON ^ -Dradix_ENABLE_SECONDARY_TESTED_CODE=ON
-Dradix_ENABLE_TESTS=ON ^ -Dradix_ENABLE_TESTS=ON
-DTPL_ENABLE_VTK=ON ^ -DTPL_ENABLE_VTK=ON
-Dradix_ENABLE_radixplot=OFF ^ -Dradix_ENABLE_radixplot=OFF
-Dradix_ENABLE_radixwidgets=OFF .. -Dradix_ENABLE_radixwidgets=OFF ..
- ctest --verbose --output-on-failure ^ - ctest --output-on-failure
-D ExperimentalStart ^ -D ExperimentalStart
-D ExperimentalBuild ^ -D ExperimentalBuild
-D ExperimentalTest -D ExperimentalTest
--output-junit ctest-results.xml
mac_llvm_testing: mac_llvm_testing:
tags: tags:
- mac - mac
artifacts:
reports:
junit: build/ctest-results.xml
script: script:
- which git - which git
- git --version - git --version
- module load cmake qt/5.9.1 vtk/8.1.0 - module load cmake/3.21.0 qt/5.9.1 vtk/8.1.0
- mkdir build - mkdir build
- cd build - cd build
- which cmake - which cmake
- export radix_ENABLE_Fortran=OFF - export radix_ENABLE_Fortran=OFF
- cmake -DTasmanian_DIR=/opt/tasmanian/6.0 ^ - cmake -DTasmanian_DIR=/opt/tasmanian/6.0
-DBUILDNAME=$(uname -s)-LLVM-Debug-${CI_BUILD_REF_NAME} ^ -DBUILDNAME=$(uname -s)-LLVM-Debug-${CI_BUILD_REF_NAME}
-DCMAKE_BUILD_TYPE=DEBUG ^ -DCMAKE_BUILD_TYPE=DEBUG
-Dradix_ENABLE_TESTS=ON ^ -Dradix_ENABLE_TESTS=ON
-Dradix_ENABLE_SECONDARY_TESTED_CODE=ON ^ -Dradix_ENABLE_SECONDARY_TESTED_CODE=ON
-Dradix_ENABLE_TESTS=ON ^ -Dradix_ENABLE_TESTS=ON
-DTPL_ENABLE_VTK=ON ^ -DTPL_ENABLE_VTK=ON
-Dradix_ENABLE_radixplot=OFF ^ -Dradix_ENABLE_radixplot=OFF
-Dradix_ENABLE_radixwidgets=OFF .. -Dradix_ENABLE_radixwidgets=OFF ..
- ctest --verbose --output-on-failure ^ - ctest --output-on-failure
-D ExperimentalStart ^ -D ExperimentalStart
-D ExperimentalBuild ^ -D ExperimentalBuild
-D ExperimentalTest -D ExperimentalTest
--output-junit ctest-results.xml
linux_python_bindings:
tags:
- linux
artifacts:
name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}-python-bindings
paths:
- lib/
- python/
script:
- which git
- git --version
- mkdir build
- cd build
- module load swig/4.0.2 cmake
- which cmake
- cmake
-DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}
-DBUILD_SHARED_LIBS=ON
-DCMAKE_BUILD_TYPE=Release
-Dradix_ENABLE_TESTS=ON
-DENABLE_PYTHON_WRAPPERS=ON
-Dradix_ENABLE_radixmath=ON
-Dradix_ENABLE_radixio=ON
-Dradix_ENABLE_TESTS=OFF ..
- cmake --build . --target install
linux_gcc_testing: linux_gcc_testing:
tags: tags:
- linux - linux
artifacts:
reports:
junit: build/ctest-results.xml
script: script:
- which git - which git
- git --version - git --version
- mkdir build - mkdir build
- cd build - cd build
- module load cmake qt/5.9.0 vtk/8.1.0 - module load swig/4.0.2 cmake/3.21.0 qt/5.9.0 vtk/8.1.0
- which cmake - which cmake
- cmake -DTasmanian_DIR=/opt/vendors/tasmanian/6.0 ^ - cmake -DTasmanian_DIR=/opt/vendors/tasmanian/6.0
-DBUILDNAME=$(uname -s)-GCC-4.8.5-Release-${CI_BUILD_REF_NAME} ^ -DBUILDNAME=$(uname -s)-GCC-4.8.5-Release-${CI_BUILD_REF_NAME}
-DCMAKE_BUILD_TYPE=Release ^ -DBUILD_SHARED_LIBS=ON
-Dradix_ENABLE_TESTS=ON ^ -DCMAKE_BUILD_TYPE=Release
-DENABLE_PYTHON_WRAPPERS=ON ^ -Dradix_ENABLE_TESTS=ON
-Dradix_ENABLE_SECONDARY_TESTED_CODE=ON ^ -DENABLE_PYTHON_WRAPPERS=ON
-Dradix_ENABLE_TESTS=ON -DTPL_ENABLE_VTK=ON ^ -Dradix_ENABLE_SECONDARY_TESTED_CODE=ON
-Dradix_ENABLE_radixplot=OFF ^ -Dradix_ENABLE_TESTS=ON -DTPL_ENABLE_VTK=ON
-Dradix_ENABLE_radixplot=OFF
-Dradix_ENABLE_radixwidgets=OFF .. -Dradix_ENABLE_radixwidgets=OFF ..
- ctest --verbose --output-on-failure ^ - cmake --build .
-D ExperimentalStart ^ - ctest --output-junit ctest-results.xml
-D ExperimentalBuild ^
-D ExperimentalTest
linux_analysis: linux_analysis:
stage: analysis stage: analysis
tags: tags:
- linux - linux
artifacts:
name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}-analysis
reports:
cobertura: build/coverage.xml
script: script:
- which git - which git
- git --version - git --version
...@@ -89,23 +129,28 @@ linux_analysis: ...@@ -89,23 +129,28 @@ linux_analysis:
- cd build - cd build
- module load cmake valgrind - module load cmake valgrind
- which cmake - which cmake
- cmake -DTasmanian_DIR=/opt/vendors/tasmanian/6.0/ ^ - cmake -DTasmanian_DIR=/opt/vendors/tasmanian/6.0/
-DCOVERAGE_EXTRA_FLAGS="-s ${CI_PROJECT_DIR}/googletest -d" ^ -DCOVERAGE_EXTRA_FLAGS="-s ${CI_PROJECT_DIR}/googletest -d"
-DMEMCHECK_COMMAND=$(which valgrind) ^ -DMEMCHECK_COMMAND=$(which valgrind)
-DBUILDNAME=$(uname -s)-GCC-4.8.5-Debug-${CI_BUILD_REF_NAME} ^ -DBUILDNAME=$(uname -s)-GCC-4.8.5-Debug-${CI_BUILD_REF_NAME}
-DCMAKE_BUILD_TYPE=DEBUG ^ -DCMAKE_BUILD_TYPE=DEBUG
-Dradix_ENABLE_COVERAGE_TESTING=ON ^ -Dradix_ENABLE_COVERAGE_TESTING=ON
-Dradix_ENABLE_TESTS=ON ^ -Dradix_ENABLE_TESTS=ON
-Dradix_ENABLE_SECONDARY_TESTED_CODE=ON ^ -Dradix_ENABLE_SECONDARY_TESTED_CODE=ON
-Dradix_ENABLE_TESTS=ON ^ -Dradix_ENABLE_TESTS=ON
-Dradix_ENABLE_radixplot=OFF ^ -Dradix_ENABLE_radixplot=OFF
-Dradix_ENABLE_radixwidgets=OFF .. -Dradix_ENABLE_radixwidgets=OFF ..
- ctest --verbose --output-on-failure^ - ctest --output-on-failure
-D ExperimentalStart ^ -D ExperimentalStart
-D ExperimentalBuild ^ -D ExperimentalBuild
-D ExperimentalTest ^ -D ExperimentalTest
-D ExperimentalMemCheck ^ -D ExperimentalMemCheck
-D ExperimentalCoverage - gcovr --filter=".*/radix.*"
--xml-pretty
--print-summary
-o coverage.xml
-r $CI_PROJECT_DIR
coverage: /^\s*lines:\s*\d+.\d+\%/
allow_failure: true allow_failure: true
linux_openmpi_testing: linux_openmpi_testing:
...@@ -127,7 +172,7 @@ linux_openmpi_testing: ...@@ -127,7 +172,7 @@ linux_openmpi_testing:
-Dradix_ENABLE_googletest=ON ^ -Dradix_ENABLE_googletest=ON ^
-Dradix_ENABLE_radixdl=ON ^ -Dradix_ENABLE_radixdl=ON ^
-Dradix_ENABLE_radixcore=ON .. -Dradix_ENABLE_radixcore=ON ..
- ctest --verbose --output-on-failure ^ - ctest --output-on-failure ^
-D ExperimentalStart ^ -D ExperimentalStart ^
-D ExperimentalBuild ^ -D ExperimentalBuild ^
-D ExperimentalTest -D ExperimentalTest
......
...@@ -14,6 +14,9 @@ IF (NOT TRIBITS_PROCESSING_PACKAGE) ...@@ -14,6 +14,9 @@ IF (NOT TRIBITS_PROCESSING_PACKAGE)
SET(radix_ENABLE_CXX11 ON CACHE BOOL "Compile using the C++11 standard" FORCE) SET(radix_ENABLE_CXX11 ON CACHE BOOL "Compile using the C++11 standard" FORCE)
#SET(USE_QT5 TRUE) #SET(USE_QT5 TRUE)
# Disable SONAME VERSION
SET(CMAKE_PLATFORM_NO_VERSIONED_SONAME 1)
# disable generating HTML dependencies webpage and xml files # disable generating HTML dependencies webpage and xml files
SET(${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE OFF CACHE BOOL "") SET(${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE OFF CACHE BOOL "")
# disable TriBITS export system to save time configuring # disable TriBITS export system to save time configuring
...@@ -32,6 +35,9 @@ IF (NOT TRIBITS_PROCESSING_PACKAGE) ...@@ -32,6 +35,9 @@ IF (NOT TRIBITS_PROCESSING_PACKAGE)
IF(RADIX_DBC) IF(RADIX_DBC)
ADD_DEFINITIONS("-DRADIX_DBC=${RADIX_DBC}") ADD_DEFINITIONS("-DRADIX_DBC=${RADIX_DBC}")
ENDIF() ENDIF()
IF(ENABLE_PYTHON_WRAPPERS AND NOT BUILD_SHARED_LIBS)
MESSAGE(FATAL_ERROR "ENABLE_PYTHON_WRAPPERS=ON requires BUILD_SHARED_LIBS=ON")
ENDIF()
# #
# For windows with BUILD_SHARED_LIBS we must use CMAKE_RUNTIME_OUTPUT_DIRECTORY # For windows with BUILD_SHARED_LIBS we must use CMAKE_RUNTIME_OUTPUT_DIRECTORY
# to place all *dll and *exe in the same directory so unit tests will work # to place all *dll and *exe in the same directory so unit tests will work
......
[![pipeline status](https://code.ornl.gov/jap/radix/badges/master/pipeline.svg)](https://code.ornl.gov/jap/radix/-/commits/master)
[![coverage report](https://code.ornl.gov/jap/radix/badges/master/coverage.svg)](https://code.ornl.gov/jap/radix/-/commits/master)
# Requirements # Requirements
* C compiler. gcc 4.8 tested * C compiler. gcc 4.8 tested
* Git * Git
* CMake. 2.8.12.2 tested. * CMake. 3.8.0 tested.
# Getting Started # Getting Started
* You will need to save your ssh-key in [code.ornl.gov](https://code.ornl.gov/profile/keys). * You will need to save your ssh-key in [code.ornl.gov](https://code.ornl.gov/profile/keys).
...@@ -43,3 +46,22 @@ cmake ^ ...@@ -43,3 +46,22 @@ cmake ^
`../configure.sh or ..\configure.bat` `../configure.sh or ..\configure.bat`
* I place the configure script in the build directory as opposed to the build/radix directory because it allows me to delete the build/radix * I place the configure script in the build directory as opposed to the build/radix directory because it allows me to delete the build/radix
directory without removing my script. directory without removing my script.
# Enable Python Bindings
Example configuration enabling python bindings
```
#!/bin/bash
# Linux bash file example
rm -rf CMake*
cmake \
-D CMAKE_INSTALL_PREFIX=`pwd`/install \
-D CMAKE_BUILD_TYPE:STRING=RELEASE \
-D radix_ENABLE_radixio:BOOL=ON \
-D radix_ENABLE_radixmath:BOOL=ON \
-D radix_ENABLE_TESTS:BOOL=OFF \
-G "Unix Makefiles" \
~/radix
```
After configuration, compilation, and installation, you need to add the python directory to PYTHONPATH.
`export PYTHONPATH=~/build/radix/install/python/`
...@@ -9,6 +9,9 @@ FIND_PACKAGE(PythonLibsFromExe REQUIRED) ...@@ -9,6 +9,9 @@ FIND_PACKAGE(PythonLibsFromExe REQUIRED)
# Find the SWIG package for language bindings # Find the SWIG package for language bindings
FIND_PACKAGE(SWIG REQUIRED) FIND_PACKAGE(SWIG REQUIRED)
IF(CMAKE_VERSION VERSION_GREATER "3.8.0")
include(UseSWIG)
ENDIF()
# #
# Ensure that PYTHON wrappers are enabled # Ensure that PYTHON wrappers are enabled
IF (ENABLE_PYTHON_WRAPPERS) IF (ENABLE_PYTHON_WRAPPERS)
...@@ -45,8 +48,10 @@ IF (ENABLE_PYTHON_WRAPPERS) ...@@ -45,8 +48,10 @@ IF (ENABLE_PYTHON_WRAPPERS)
SET(SWIG_CXX_FLAGS "${SWIG_CXX_FLAGS} -diag-disable 955") SET(SWIG_CXX_FLAGS "${SWIG_CXX_FLAGS} -diag-disable 955")
ENDIF() ENDIF()
# Tell SWIG to use modern Python code IF(CMAKE_VERSION VERSION_LESS "3.8.0")
LIST(APPEND CMAKE_SWIG_FLAGS "-modern" "-noproxydel") # Tell SWIG to use modern Python code
LIST(APPEND CMAKE_SWIG_FLAGS "-modern" "-noproxydel")
ENDIF()
# If python version is high enough, add -py3 flag # If python version is high enough, add -py3 flag
IF(PYTHON_VERSION_STRING VERSION_GREATER 3.0) IF(PYTHON_VERSION_STRING VERSION_GREATER 3.0)
...@@ -122,9 +127,7 @@ IF(ENABLE_PYTHON_WRAPPERS) ...@@ -122,9 +127,7 @@ IF(ENABLE_PYTHON_WRAPPERS)
# Bug fix: version of CMake older than 2.8.8 don't support the # Bug fix: version of CMake older than 2.8.8 don't support the
# INCLUDE_DIRECTORIES property # INCLUDE_DIRECTORIES property
IF(CMAKE_MAJOR_VERSION LESS 3 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
AND CMAKE_MINOR_VERSION LESS 9
AND CMAKE_PATCH_VERSION LESS 9)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR})
ENDIF() ENDIF()
ELSE() ELSE()
...@@ -173,10 +176,11 @@ FUNCTION(_RADIX_ADD_SWIG) ...@@ -173,10 +176,11 @@ FUNCTION(_RADIX_ADD_SWIG)
SET(SWIG_MODULE_${MODULE_NAME}_EXTRA_DEPS ${DEPENDENCIES} ) SET(SWIG_MODULE_${MODULE_NAME}_EXTRA_DEPS ${DEPENDENCIES} )
# Add the new python target # Add the new python target
IF("${CMAKE_VERSION}" VERSION_LESS "3.8.0") IF(CMAKE_VERSION VERSION_LESS "3.8.0")
SWIG_ADD_MODULE(${MODULE_NAME} python SWIG_ADD_MODULE(${MODULE_NAME} python
${SRC_FILE} ${MKSWIG_EXTRASRC}) ${SRC_FILE} ${MKSWIG_EXTRASRC})
ELSE() ELSE()
SET_PROPERTY(SOURCE ${SRC_FILE} PROPERTY CPLUSPLUS ON)
SWIG_ADD_LIBRARY(${MODULE_NAME} SWIG_ADD_LIBRARY(${MODULE_NAME}
LANGUAGE python LANGUAGE python
TYPE MODULE TYPE MODULE
......
...@@ -49,5 +49,10 @@ TRIBITS_ADD_TEST_DIRECTORIES(tests) ...@@ -49,5 +49,10 @@ TRIBITS_ADD_TEST_DIRECTORIES(tests)
# Add example directory # Add example directory
TRIBITS_ADD_EXAMPLE_DIRECTORIES(examples) TRIBITS_ADD_EXAMPLE_DIRECTORIES(examples)
IF(ENABLE_PYTHON_WRAPPERS)
ADD_SUBDIRECTORY(python)
ENDIF()
INSTALL(FILES ${HEADERS} DESTINATION "include/radixio/") INSTALL(FILES ${HEADERS} DESTINATION "include/radixio/")
TRIBITS_SUBPACKAGE_POSTPROCESS() TRIBITS_SUBPACKAGE_POSTPROCESS()
...@@ -13517,7 +13517,7 @@ const std::unordered_map<int, DecayDBEntry>& DecayDb::activations() const ...@@ -13517,7 +13517,7 @@ const std::unordered_map<int, DecayDBEntry>& DecayDb::activations() const
{ {
return mActivation; return mActivation;
} }
const DecayDBEntry& DecayDb::light_element(const int zaid) const const DecayDBEntry& DecayDb::light_element(int zaid) const
{ {
const auto& it = mActivation.find(zaid); const auto& it = mActivation.find(zaid);
return it->second; return it->second;
...@@ -13530,7 +13530,7 @@ const std::unordered_map<int, DecayDBEntry>& DecayDb::actinides() const ...@@ -13530,7 +13530,7 @@ const std::unordered_map<int, DecayDBEntry>& DecayDb::actinides() const
{ {
return mActinide; return mActinide;
} }
const DecayDBEntry& DecayDb::actinide(const int zaid) const const DecayDBEntry& DecayDb::actinide(int zaid) const
{ {
const auto& it = mActinide.find(zaid); const auto& it = mActinide.find(zaid);
return it->second; return it->second;
...@@ -13543,14 +13543,14 @@ const std::unordered_map<int, DecayDBEntry>& DecayDb::fission_products() const ...@@ -13543,14 +13543,14 @@ const std::unordered_map<int, DecayDBEntry>& DecayDb::fission_products() const
{ {
return mFissionProduct; return mFissionProduct;
} }
const DecayDBEntry& DecayDb::fission_product(const int zaid) const const DecayDBEntry& DecayDb::fission_product(int zaid) const
{ {
const auto& it = mFissionProduct.find(zaid); const auto& it = mFissionProduct.find(zaid);
return it->second; return it->second;
} }
const std::unordered_map<int, DecayDBEntry>::iterator DecayDb::find_decayer( std::unordered_map<int, DecayDBEntry>::const_iterator DecayDb::find_decayer(
const int zaid) int zaid)
{ {
std::unordered_map<int, DecayDBEntry>::iterator decayer; std::unordered_map<int, DecayDBEntry>::iterator decayer;
const auto& fpI = mFissionProduct.find(zaid); const auto& fpI = mFissionProduct.find(zaid);
...@@ -13575,7 +13575,7 @@ const std::unordered_map<int, DecayDBEntry>::iterator DecayDb::find_decayer( ...@@ -13575,7 +13575,7 @@ const std::unordered_map<int, DecayDBEntry>::iterator DecayDb::find_decayer(
return decayer; return decayer;
} }
const DecayDBEntry& DecayDb::find_entry(const int zaid) const const DecayDBEntry& DecayDb::find_entry(int zaid) const
{ {
if (mFissionProduct.find(zaid) != mFissionProduct.end()) if (mFissionProduct.find(zaid) != mFissionProduct.end())
{ {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
namespace radix namespace radix
{ {
struct DecayDBEntry struct RADIX_PUBLIC DecayDBEntry
{ {
/** /**
* symbol * symbol
...@@ -140,16 +140,15 @@ class RADIX_PUBLIC DecayDb ...@@ -140,16 +140,15 @@ class RADIX_PUBLIC DecayDb
void set_fission_product_title(const std::string& title); void set_fission_product_title(const std::string& title);
std::unordered_map<int, DecayDBEntry>& activations(); std::unordered_map<int, DecayDBEntry>& activations();
const std::unordered_map<int, DecayDBEntry>& activations() const; const std::unordered_map<int, DecayDBEntry>& activations() const;
const DecayDBEntry& light_element(const int zaid) const; const DecayDBEntry& light_element(int zaid) const;
std::unordered_map<int, DecayDBEntry>& actinides(); std::unordered_map<int, DecayDBEntry>& actinides();
const std::unordered_map<int, DecayDBEntry>& actinides() const; const std::unordered_map<int, DecayDBEntry>& actinides() const;
const DecayDBEntry& actinide(const int zaid) const; const DecayDBEntry& actinide(int zaid) const;
std::unordered_map<int, DecayDBEntry>& fission_products(); std::unordered_map<int, DecayDBEntry>& fission_products();
const std::unordered_map<int, DecayDBEntry>& fission_products() const; const std::unordered_map<int, DecayDBEntry>& fission_products() const;
const DecayDBEntry& fission_product(const int zaid) const; const DecayDBEntry& fission_product(int zaid) const;
const std::unordered_map<int, DecayDBEntry>::iterator find_decayer( std::unordered_map<int, DecayDBEntry>::const_iterator find_decayer(int zaid);
const int zaid); const DecayDBEntry& find_entry(int zaid) const;
const DecayDBEntry& find_entry(const int zaid) const;
}; // class }; // class
} // namespace radix } // namespace radix
......
...@@ -139,7 +139,8 @@ bool system_is_big_endian() ...@@ -139,7 +139,8 @@ bool system_is_big_endian()
#ifdef _WIN32 #ifdef _WIN32
typedef unsigned __int32 uint32_t; typedef unsigned __int32 uint32_t;
#endif #endif
union { union
{
uint32_t i; uint32_t i;
char c[4]; char c[4];
} bint = {0x01020304}; } bint = {0x01020304};
......
...@@ -9,25 +9,28 @@ void HysplitCDump::setId(const std::string &id) { mId = id; } ...@@ -9,25 +9,28 @@ void HysplitCDump::setId(const std::string &id) { mId = id; }
void HysplitCDump::dateTime(int &year, int &month, int &day, int &hour) const void HysplitCDump::dateTime(int &year, int &month, int &day, int &hour) const
{ {
year = mYear; year = mTime.year;
month = mMonth; month = mTime.month;
day = mDay; day = mTime.day;
hour = mHour; hour = mTime.hour;
} }
const HysplitTime &HysplitCDump::dateTime() const { return mTime; }
void HysplitCDump::setDateTime(int year, int month, int day, int hour) void HysplitCDump::setDateTime(int year, int month, int day, int hour)
{ {
mYear = year; mTime.year = year;
mMonth = month; mTime.month = month;
mDay = day; mTime.day = day;
mHour = hour; mTime.hour = hour;
mTime.forecast = 0;
} }
int HysplitCDump::forecastHour() const { return mForecastHour; } int HysplitCDump::forecastHour() const { return mTime.forecast; }
void HysplitCDump::setForecastHour(int forecastHour) void HysplitCDump::setForecastHour(int forecastHour)
{ {
mForecastHour = forecastHour; mTime.forecast = forecastHour;
} }
int HysplitCDump::numLocations() const { return int(mStartLocations.size()); } int HysplitCDump::numLocations() const { return int(mStartLocations.size()); }
...@@ -38,22 +41,30 @@ void HysplitCDump::location(int i, int &year, int &month, int &day, int &hour, ...@@ -38,22 +41,30 @@ void HysplitCDump::location(int i, int &year, int &month, int &day, int &hour,
{ {
radix_check(i < mStartLocations.size()); radix_check(i < mStartLocations.size());
radix_check(i >= 0); radix_check(i >= 0);
size_t i_ = size_t(i); size_t i_ = size_t(i);
Location loc = mStartLocations[i_]; const HysplitLocation &loc = mStartLocations[i_];
year = loc.year; year = loc.year;
month = loc.month; month = loc.month;
day = loc.day; day = loc.day;
hour = loc.hour; hour = loc.hour;
minutes = loc.minutes; minutes = loc.minutes;
lat = loc.lat; lat = loc.lat;
lon = loc.lon; lon = loc.lon;
z = loc.z; z = loc.z;
}
const HysplitLocation &HysplitCDump::location(int i) const
{
radix_check(i < mStartLocations.size());
radix_check(i >= 0);
size_t i_ = size_t(i);
return mStartLocations[i_];
} }
void HysplitCDump::addLocation(int year, int month, int day, int hour, void HysplitCDump::addLocation(int year, int month, int day, int hour,
float lat, float lon, float z, int minutes) float lat, float lon, float z, int minutes)
{ {
Location loc; HysplitLocation loc;
loc.year = year; loc.year = year;
loc.month = month; loc.month = month;
loc.day = day; loc.day = day;
...@@ -119,7 +130,7 @@ int HysplitCDump::numStartTimes() const { return int(mStartTimes.size()); } ...@@ -119,7 +130,7 @@ int HysplitCDump::numStartTimes() const { return int(mStartTimes.size()); }
void HysplitCDump::addStartTime(int year, int month, int day, int hour, void HysplitCDump::addStartTime(int year, int month, int day, int hour,
int minute, int forecast) int minute, int forecast)
{ {
Time t; HysplitTime t;
t.year = year; t.year = year;