Commit 66b06f8d authored by Henderson, Shane's avatar Henderson, Shane
Browse files

First pass verbose json keys

parent a3e40350
Loading
Loading
Loading
Loading
+16 −9
Original line number Diff line number Diff line
@@ -12,23 +12,25 @@ stages:

build_macos:
  stage: build
  rules:
    - when: manual
  variables:
    GIT_SUBMODULE_STRATEGY: normal
  tags:
    - macOS
  script:
    - source $HOME/spack/share/spack/setup-env.sh
    - spack env activate saline
    - pip install delocate
    - ls "$CI_PROJECT_DIR/.."
    - cat "$CI_PROJECT_DIR/../saline_venv/bin/activate"
    - source "$CI_PROJECT_DIR/../saline_venv/bin/activate"
    - cmake -S $CI_PROJECT_DIR -B "$CI_PROJECT_DIR/build" -DCMAKE_BUILD_TYPE=RELEASE
      -Dsaline_ENABLE_Fortran=ON -DCMAKE_Fortran_FLAGS:STRING="-ffree-line-length-none"
      -Dsaline_ENABLE_Python=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -Dsaline_ENABLE_hdf5=ON
      -DPython_EXECUTABLE=`which python`
      -Dsaline_ENABLE_Python=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0
      -DPython_EXECUTABLE="/opt/homebrew/bin/python3.9" -DCMAKE_POLICY_VERSION_MINIMUM=3.5
    - cmake --build "$CI_PROJECT_DIR/build"
    - cmake --build "$CI_PROJECT_DIR/build" --target SalinePy_wheel
    - ctest --test-dir "$CI_PROJECT_DIR/build"
    - cmake --install build --prefix install
    - delocate-wheel -w ${CI_PROJECT_DIR}/install/wheelhouse ${CI_PROJECT_DIR}/build/src/python/dist/salinepy*.whl
    - /Users/gitlab-runner/Library/Python/3.9/bin/delocate-wheel -w ${CI_PROJECT_DIR}/install/wheelhouse ${CI_PROJECT_DIR}/build/src/python/dist/salinepy*.whl
    - tar -czf darwin_arm.tar.gz install
  artifacts:
    name: darwin
@@ -73,9 +75,14 @@ build_linux:
  tags:
    - docker
  script:
    - cmake -S $CI_PROJECT_DIR -B build -DCMAKE_BUILD_TYPE=RELEASE
      -Dsaline_ENABLE_Fortran=ON -DCMAKE_Fortran_FLAGS:STRING="-ffree-line-length-none"
      -Dsaline_ENABLE_Python=ON -Dsaline_ENABLE_hdf5=ON
    - cmake
      -S $CI_PROJECT_DIR
      -B build
      -D CMAKE_BUILD_TYPE=RELEASE
      -D saline_ENABLE_Fortran=ON
      -D CMAKE_Fortran_FLAGS:STRING="-ffree-line-length-none"
      -D saline_ENABLE_Python=ON
      -D saline_ENABLE_hdf5=ON
    - cmake --build "$CI_PROJECT_DIR/build"
    - cmake --build "$CI_PROJECT_DIR/build" --target SalinePy_wheel
    - ctest --test-dir build --output-on-failure
+1 −1
Original line number Diff line number Diff line
[submodule "thirdparty/nlohmann_json"]
	path = thirdparty/nlohmann_json
	url = https://github.com/nlohmann/json.git
	url = https://code.ornl.gov/oxh/nlohmann_json.git
+19 −11
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
#include <string>
#include <vector>

#include <nlohmann/json.hpp>
#ifdef SALINE_USE_HDF5
#include <hdf5.h>
#endif
@@ -154,12 +153,9 @@ public:
  std::size_t constituent_count(Id id) const;

  void load(const std::string &fPath);
  [[deprecated("Use from_json(std::istream& inFile) instead.")]]
  void from_json(std::istream &inFile);
  [[deprecated("Use load(std::string &fPath) instead with a file path instead.")]]
  void load(std::istream &inFile);
  void from_json(nlohmann::json);
#ifdef SALINE_USE_HDF5
  void from_h5(hid_t file);
#endif

  View setView(const Vec_Name &names, const Vec_Mole &mole_percents);

@@ -180,7 +176,7 @@ public:
  // The list accessible salt names
  Vec_Name getSaltKeys() const;
  std::vector<std::vector<double>> getSaltComps(Vec_Name names) const;
  void to_json(nlohmann::json &j) const;
  std::string to_json() const;

private:
  class Data {
@@ -205,7 +201,9 @@ private:

    // surface tension
    double surfaceTension(double t) const { return m_st_a - (m_st_b * t); }
    double surfaceTension_h(double h) const { return surfaceTension(h_to_t(h)); }
    double surfaceTension_h(double h) const {
      return surfaceTension(h_to_t(h));
    }
    bool valid_surfaceTension() const { return st_a() != 0.0; }
    double surfaceTension_unc() const { return m_st_unc; }
    std::string surfaceTension_ref() const { return m_st_ref; }
@@ -294,6 +292,7 @@ private:
    double m_melt_unc = 0.0;
    DataQualifier m_melt_unc_qualifier;
    std::string m_melt_ref;
    std::string m_melt_doi;

    // Molecular Weight
    double m_mole_weight;
@@ -304,6 +303,7 @@ private:
    double m_boil_unc = 0.0;
    DataQualifier m_boil_unc_qualifier;
    std::string m_boil_ref;
    std::string m_boil_doi;

    // density
    double m_rho_a = 0.0;
@@ -312,6 +312,7 @@ private:
    DataQualifier m_rho_unc_qualifier;
    std::pair<double, double> m_rho_rng;
    std::string m_rho_ref;
    std::string m_rho_doi;

    // viscosity
    double m_mu_a = 0.0;
@@ -321,6 +322,7 @@ private:
    DataQualifier m_mu_unc_qualifier;
    std::pair<double, double> m_mu_rng;
    std::string m_mu_ref;
    std::string m_mu_doi;

    // conductivity
    double m_k_a = 0.0;
@@ -329,6 +331,7 @@ private:
    DataQualifier m_k_unc_qualifier;
    std::pair<double, double> m_k_rng;
    std::string m_k_ref;
    std::string m_k_doi;

    // specific heat
    double m_cp_a = 0.0;
@@ -339,6 +342,7 @@ private:
    DataQualifier m_cp_unc_qualifier;
    std::pair<double, double> m_cp_rng;
    std::string m_cp_ref;
    std::string m_cp_doi;

    // surface tension
    double m_st_a = 0.0;
@@ -347,6 +351,7 @@ private:
    DataQualifier m_st_unc_qualifier;
    std::pair<double, double> m_st_rng;
    std::string m_st_ref;
    std::string m_st_doi;

    // enthalpy to temperature table
    std::vector<double> m_h;
@@ -358,7 +363,7 @@ private:
    double m_e;
  };

  void to_json(nlohmann::json &j, Data &d) const;
  std::string to_json(Data &d) const;
  using Vec_Data = std::vector<Data>;
  struct Compound {
    Vec_Name names;
@@ -375,6 +380,9 @@ private:
  std::vector<Compound> compounds;

  // >>> ACCESSORS
#ifdef SALINE_USE_HDF5
  void from_h5(hid_t file);
#endif

  // calculate the enthalpy interpolation tables as a function of temperature
  void setup_enthalpy_tables();
+6 −7
Original line number Diff line number Diff line
@@ -36,12 +36,9 @@ public:

  // >>> CONSTRUCTORS
  R_Kister_Data_Store();
  void from_json(std::istream &inFile);
  void load(const std::string &fPath);

  void from_json(nlohmann::json json_in);
#ifdef SALINE_USE_HDF5
  void from_h5(hid_t file);
#endif
  [[deprecated("Use load(const std::string& fPath) to load a json instead.")]]
  void load(const std::string &rkDens, const std::string &rkVisc,
            const std::string &dfPath);
@@ -149,7 +146,7 @@ public:
  Vec_Name getSaltKeys() const;
  std::vector<std::vector<double>> getSaltComps(Vec_Name names) const;

  void to_json(nlohmann::json &j) const;
  std::string to_json() const;

private:
  // Data_Store providing the base information
@@ -182,10 +179,12 @@ private:
  rk_model m_mu;
  rk_model m_cp;
  rk_model m_k;
  nlohmann::json rk_to_json(rk_model m) const;
  void parse_poly_node(RK_Polynomial &poly, nlohmann::json j);

  std::string rk_to_json(rk_model m) const;
  // >>> ACCESSORS
#ifdef SALINE_USE_HDF5
  void from_h5(hid_t file);
#endif

  // calculate the enthalpy interpolation tables as a function of temperature
  void setup_enthalpy_tables();
+182 −147

File changed.

Preview size limit exceeded, changes collapsed.

Loading