From c955a54e799eff5214775060a95ce08d587fd9e2 Mon Sep 17 00:00:00 2001 From: Ian Bell <ian.bell@nist.gov> Date: Fri, 2 Jun 2023 16:43:33 -0400 Subject: [PATCH] Fix output of dmat --- include/teqp/models/saftvrmie.hpp | 2 +- src/tests/catch_test_SAFTVRMie.cxx | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/teqp/models/saftvrmie.hpp b/include/teqp/models/saftvrmie.hpp index 029b238..f50d7b0 100644 --- a/include/teqp/models/saftvrmie.hpp +++ b/include/teqp/models/saftvrmie.hpp @@ -784,7 +784,7 @@ public: auto fromArrayX = [](const Eigen::ArrayXd &x){std::valarray<double>n(x.size()); for (auto i =0; i < n.size(); ++i){ n[i] = x[i];} return n;}; auto fromArrayXX = [](const Eigen::ArrayXXd &x){ std::size_t N = x.rows(); - std::vector<std::vector<double>> n; n.resize(x.size()); + std::vector<std::vector<double>> n; n.resize(N); for (auto i = 0; i < N; ++i){ n[i].resize(N); for (auto j = 0; j < N; ++j){ diff --git a/src/tests/catch_test_SAFTVRMie.cxx b/src/tests/catch_test_SAFTVRMie.cxx index 65a154f..d03cbc6 100644 --- a/src/tests/catch_test_SAFTVRMie.cxx +++ b/src/tests/catch_test_SAFTVRMie.cxx @@ -326,6 +326,22 @@ TEST_CASE("Check B and its temperature derivatives", "[SAFTVRMie],[B]") CHECK(TdBdT == Approx(TdBdTnondilute)); } +TEST_CASE("Check output of dmat", "[SAFTVRMiedmat]") +{ + auto j = nlohmann::json::parse(R"({ + "kind": "SAFT-VR-Mie", + "model": { + "names": ["Methane", "Ethane"] + } + })"); + CHECK_NOTHROW(teqp::cppinterface::make_model(j)); + auto ptr = teqp::cppinterface::make_model(j); + const auto& model = teqp::cppinterface::adapter::get_model_cref<SAFTVRMie_t>(ptr.get()); + auto z = (Eigen::ArrayXd(2) << 0.300, 0.7).finished(); + auto jj = model.get_core_calcs(300, 0.5, z); + std::cout << jj.dump(2) << std::endl; +} + TEST_CASE("Check ln(phi) and its derivatives", "[SAFTVRMielnphi]") { std::vector<std::string> names = {"Methane", "Ethane"}; -- GitLab