Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions include/amici/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include "amici/sundials_matrix_wrapper.h"

#include <map>
#include <span>
#include <string_view>
#include <vector>

namespace amici {
Expand Down Expand Up @@ -618,7 +620,7 @@ class Model : public AbstractModel, public ModelDimensions {
*
* @return The parameter names
*/
virtual std::vector<std::string> get_free_parameter_names() const;
virtual std::span<std::string_view const> get_free_parameter_names() const;

/**
* @brief Report whether the model has state names set.
Expand All @@ -633,14 +635,14 @@ class Model : public AbstractModel, public ModelDimensions {
*
* @return State names
*/
virtual std::vector<std::string> get_state_names() const;
virtual std::span<std::string_view const> get_state_names() const;

/**
* @brief Get names of the solver states.
*
* @return State names
*/
virtual std::vector<std::string> get_state_names_solver() const;
virtual std::span<std::string_view const> get_state_names_solver() const;

/**
* @brief Report whether the model has fixed parameter names set.
Expand All @@ -655,7 +657,7 @@ class Model : public AbstractModel, public ModelDimensions {
*
* @return Fixed parameter names
*/
virtual std::vector<std::string> get_fixed_parameter_names() const;
virtual std::span<std::string_view const> get_fixed_parameter_names() const;

/**
* @brief Report whether the model has observable names set.
Expand All @@ -670,7 +672,7 @@ class Model : public AbstractModel, public ModelDimensions {
*
* @return Observable names
*/
virtual std::vector<std::string> get_observable_names() const;
virtual std::span<std::string_view const> get_observable_names() const;

/**
* @brief Report whether the model has expression names set.
Expand All @@ -685,7 +687,7 @@ class Model : public AbstractModel, public ModelDimensions {
*
* @return Expression names
*/
virtual std::vector<std::string> get_expression_names() const;
virtual std::span<std::string_view const> get_expression_names() const;

/**
* @brief Report whether the model has parameter IDs set.
Expand All @@ -700,7 +702,7 @@ class Model : public AbstractModel, public ModelDimensions {
*
* @return Parameter IDs
*/
virtual std::vector<std::string> get_free_parameter_ids() const;
virtual std::span<std::string_view const> get_free_parameter_ids() const;

/**
* @brief Report whether the model has state IDs set.
Expand All @@ -715,14 +717,14 @@ class Model : public AbstractModel, public ModelDimensions {
*
* @return State IDs
*/
virtual std::vector<std::string> get_state_ids() const;
virtual std::span<std::string_view const> get_state_ids() const;

/**
* @brief Get IDs of the solver states.
*
* @return State IDs
*/
virtual std::vector<std::string> get_state_ids_solver() const;
virtual std::span<std::string_view const> get_state_ids_solver() const;

/**
* @brief Report whether the model has fixed parameter IDs set.
Expand All @@ -737,7 +739,7 @@ class Model : public AbstractModel, public ModelDimensions {
*
* @return Fixed parameter IDs
*/
virtual std::vector<std::string> get_fixed_parameter_ids() const;
virtual std::span<std::string_view const> get_fixed_parameter_ids() const;

/**
* @brief Report whether the model has observable IDs set.
Expand All @@ -752,7 +754,7 @@ class Model : public AbstractModel, public ModelDimensions {
*
* @return Observable IDs
*/
virtual std::vector<std::string> get_observable_ids() const;
virtual std::span<std::string_view const> get_observable_ids() const;

/**
* @brief Report whether the model has expression IDs set.
Expand All @@ -767,7 +769,7 @@ class Model : public AbstractModel, public ModelDimensions {
*
* @return Expression IDs
*/
virtual std::vector<std::string> get_expression_ids() const;
virtual std::span<std::string_view const> get_expression_ids() const;

/**
* @brief Checks whether the defined noise model is Gaussian, i.e., the nllh
Expand Down
5 changes: 5 additions & 0 deletions models/model_calvetti_py/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
cmake_minimum_required(VERSION 3.22)
cmake_policy(VERSION 3.22...3.31)

# We aren't using C++20 modules, so disable scanning for them to avoid
# clang-scan-deps-notfound errors.
# See also https://discourse.cmake.org/t/cmake-3-28-cmake-cxx-compiler-clang-scan-deps-notfound-not-found/9244/3
set(CMAKE_CXX_SCAN_FOR_MODULES OFF)

project(model_calvetti_py)

message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
Expand Down
39 changes: 29 additions & 10 deletions models/model_calvetti_py/model_calvetti_py.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#include <amici/defines.h>
#include <array>
#include <string_view>

namespace amici::model_model_calvetti_py {

// clang-format off

std::array<const char*, 0> free_parameter_names = {
extern const std::array<std::string_view const, 0> free_parameter_names = {

};

std::array<const char*, 6> fixed_parameter_names = {
extern const std::array<std::string_view const, 6> fixed_parameter_names = {
"V1ss", // k[0]
"R1ss", // k[1]
"V2ss", // k[2]
Expand All @@ -18,7 +19,7 @@ std::array<const char*, 6> fixed_parameter_names = {
"R3ss", // k[5]
};

std::array<const char*, 6> state_names = {
extern const std::array<std::string_view const, 6> state_names = {
"V1", // x_rdata[0]
"V2", // x_rdata[1]
"V3", // x_rdata[2]
Expand All @@ -27,7 +28,16 @@ std::array<const char*, 6> state_names = {
"f3", // x_rdata[5]
};

std::array<const char*, 6> observable_names = {
extern const std::array<std::string_view const, 6> state_names_solver = {
"V1", // x_solver[0]
"V2", // x_solver[1]
"V3", // x_solver[2]
"f1", // x_solver[3]
"f2", // x_solver[4]
"f3", // x_solver[5]
};

extern const std::array<std::string_view const, 6> observable_names = {
"y0", // y[0]
"y1", // y[1]
"y2", // y[2]
Expand All @@ -45,7 +55,7 @@ ObservableScaling::lin, // y[4]
ObservableScaling::lin, // y[5]
};

std::array<const char*, 16> expression_names = {
extern const std::array<std::string_view const, 16> expression_names = {
"C1ss", // w[0]
"C2ss", // w[1]
"C3ss", // w[2]
Expand All @@ -64,11 +74,11 @@ std::array<const char*, 16> expression_names = {
"rate_of_V3", // w[15]
};

std::array<const char*, 0> free_parameter_ids = {
extern const std::array<std::string_view const, 0> free_parameter_ids = {

};

std::array<const char*, 6> fixed_parameter_ids = {
extern const std::array<std::string_view const, 6> fixed_parameter_ids = {
"V1ss", // k[0]
"R1ss", // k[1]
"V2ss", // k[2]
Expand All @@ -77,7 +87,7 @@ std::array<const char*, 6> fixed_parameter_ids = {
"R3ss", // k[5]
};

std::array<const char*, 6> state_ids = {
extern const std::array<std::string_view const, 6> state_ids = {
"V1", // x_rdata[0]
"V2", // x_rdata[1]
"V3", // x_rdata[2]
Expand All @@ -86,7 +96,16 @@ std::array<const char*, 6> state_ids = {
"f3", // x_rdata[5]
};

std::array<const char*, 6> observable_ids = {
extern const std::array<std::string_view const, 6> state_ids_solver = {
"V1", // x_solver[0]
"V2", // x_solver[1]
"V3", // x_solver[2]
"f1", // x_solver[3]
"f2", // x_solver[4]
"f3", // x_solver[5]
};

extern const std::array<std::string_view const, 6> observable_ids = {
"obs_V1", // y[0]
"obs_V2", // y[1]
"obs_V3", // y[2]
Expand All @@ -95,7 +114,7 @@ std::array<const char*, 6> observable_ids = {
"obs_f2", // y[5]
};

std::array<const char*, 16> expression_ids = {
extern const std::array<std::string_view const, 16> expression_ids = {
"C1ss", // w[0]
"C2ss", // w[1]
"C3ss", // w[2]
Expand Down
Loading
Loading