Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
061a9fe
chore(deps): update to eigen 5.0 and kokkos 5.0 (mc::domain construct…
Benncs Nov 26, 2025
ff6c3fa
refractor(common): clean up
Benncs Nov 27, 2025
a7c51c6
chore: minor changes
Benncs Nov 27, 2025
ff13c73
feat(kernels): use binary search to find compartment
Benncs Nov 27, 2025
9ed2bb8
fix(prng): fix UB in sample_random_variables to accept only generator…
Benncs Dec 1, 2025
e6ac92c
feat: opti move/leave kernel with pregenerated random buffer
Benncs Nov 28, 2025
e4eb0a7
feat: update model selector
Benncs Dec 1, 2025
523b9cc
perf(kernels): split move_kernel with precomputed randon numbers
Benncs Dec 1, 2025
b3d6432
feat(api): add set_mtr method
Benncs Dec 1, 2025
a79df72
doc: improve doc
Benncs Dec 1, 2025
b05248f
feat(api): update python helper
Benncs Dec 3, 2025
bbbb519
fix: remove print probe overflow
Benncs Dec 3, 2025
5f11b6e
feat: set same output position for scalar and particle leaving
Benncs Dec 3, 2025
cb1fdf6
fix(#26): apply changes
Benncs Dec 3, 2025
0419e5b
fix(#26): update serde to new scalarfactory changes
Benncs Dec 5, 2025
3c99076
fix(udf): fallback to default model if .so not found
Benncs Dec 5, 2025
02f7d05
chore: minor changes
Benncs Dec 5, 2025
2ca8ba7
refractor(all): use MC alias for random pool instead of MC::KPRNG
Benncs Dec 5, 2025
4389a84
fix(test): update test
Benncs Dec 5, 2025
98992c2
chore: minor changes
Benncs Dec 5, 2025
4527a9e
chore: minor changes
Benncs Dec 5, 2025
470d0dd
refractor: minor changes, use rangepolcy for move kernel
Benncs Dec 8, 2025
e51e5f7
feat(logger): flush console output
Benncs Dec 10, 2025
8005d6b
fix(api): use correct attribute name in python param structure
Benncs Dec 10, 2025
dfb4980
fix(mc): set flag to force resize for shrink when needed
Benncs Dec 15, 2025
143dce5
feat(libs): clean alias and merge move_info and MC domain
Benncs Dec 15, 2025
b98c2f1
feat(mc): bad condition in MC::get_contribution
Benncs Dec 15, 2025
adeb889
fix(api): error handling for cma/serde and python set up
Benncs Dec 16, 2025
e677150
feat(kernel): use split and team policy for contributions
Benncs Dec 16, 2025
ef33695
fix(test): add includes
Benncs Dec 16, 2025
4b86155
refractor(mc): domain contructor
Benncs Dec 16, 2025
743facb
chore: clean code, remove useless, rename MoveInfo into DomainState
Benncs Dec 17, 2025
d7c9768
chore: clang-format
Benncs Dec 17, 2025
893ee5b
chore: clean code
Benncs Dec 17, 2025
773652c
feat(sort): wip sort_soa
Benncs Dec 17, 2025
fe2ae45
wip: test magic_enum
Benncs Jan 12, 2026
673cc07
Revert "feat(sort): wip sort_soa"
Benncs Jan 12, 2026
51b884b
refractor: fix compiler warnings
Benncs Jan 12, 2026
905fb60
fix(test): update tests
Benncs Jan 12, 2026
0690fd8
chore: remove magic_enum
Benncs Jan 12, 2026
5be7f68
chore: clean code
Benncs Jan 14, 2026
3ef2681
feat(api): get list of available models (wip for C api)
Benncs Jan 14, 2026
ecb0df5
fix(api): call to mpi/kokkos finalis in API finalise and also atexit …
Benncs Jan 21, 2026
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
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BasedOnStyle: llvm
BasedOnStyle: gnu
BraceWrapping:
AfterFunction: true
AllowShortFunctionsOnASingleLine: None
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div align="left">

[![License: Apache-2.0](https://img.shields.io/badge/License-Apache-blue.svg)](LICENSE)
[![Version: 0.9.7](https://img.shields.io/badge/Version-0.9.7-red.svg)](LICENSE)
[![Version: 1.0.0](https://img.shields.io/badge/Version-0.9.7-red.svg)](LICENSE)
</div>


Expand Down
34 changes: 24 additions & 10 deletions apps/api/public/api/api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
*/
namespace Api
{
std::array<int, 3> get_version();
constexpr std::array<int, 3>
get_version()
{
return { _BIOMC_VERSION_MAJOR, _BIOMC_VERSION_MINOR, _BIOMC_VERSION_DEV };
}

void finalise();

Expand Down Expand Up @@ -76,6 +80,8 @@ namespace Api
char** argv,
std::optional<std::size_t> run_id = std::nullopt) noexcept;

static std::vector<std::string> get_model_list() noexcept;

/**
* @brief Default constructor.
*/
Expand Down Expand Up @@ -136,7 +142,7 @@ namespace Api
* @param recursive Flag indicating if recursive registration is required.
* @return True if the path was successfully registered; false otherwise.
*/
bool register_cma_path(std::string_view path);
ApiResult register_cma_path(std::string_view path);

/**
* @brief Register a serialization/deserialization (serde) path.
Expand Down Expand Up @@ -171,6 +177,10 @@ namespace Api
std::size_t output_position,
bool gas = false);

ApiResult set_mtr(Simulation::MassTransfer::Type::MtrTypeVariant&& variant);

void set_auto_mtr();

// /**
// * @brief Configure feed constants for the simulation.
// *
Expand Down Expand Up @@ -222,13 +232,15 @@ namespace Api
*/
ApiResult exec() noexcept;

void set_logger(std::shared_ptr<IO::Logger> _logger)
void
set_logger(std::shared_ptr<IO::Logger> _logger)
{

logger = std::move(_logger);
}

[[nodiscard]] auto& get_logger() const
[[nodiscard]] auto&
get_logger() const
{
return logger;
}
Expand All @@ -250,17 +262,19 @@ namespace Api

std::shared_ptr<IO::Logger> logger;

std::optional<Core::ScalarFactory::ScalarVariant>
scalar_initializer_variant = std::nullopt;
std::optional<Core::ScalarFactory::ScalarVariant> scalar_initializer_variant
= std::nullopt;
Core::CaseData _data; ///< Case data for the simulation.
Core::UserControlParameters params; ///< User-defined control parameters.
bool loaded = false; ///< Flag indicating if the instance is loaded.
bool applied = false; ///< Flag indicating if the configuration is applied.
bool registered = false; ///< Flag indicating if resources are registered.
std::optional<Simulation::Feed::SimulationFeed> feed =
std::nullopt; ///< Optional feed configuration.
std::optional<Simulation::MassTransfer::Type::MtrTypeVariant> mtr_type =
std::nullopt;
std::optional<Simulation::Feed::SimulationFeed> feed
= std::nullopt; ///< Optional feed configuration.
std::optional<Simulation::MassTransfer::Type::MtrTypeVariant> mtr_type
= std::nullopt;

bool auto_mtr;
};

} // namespace Api
Expand Down
3 changes: 3 additions & 0 deletions apps/api/public/api/api_raw.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ typedef struct Opaque* Handle; // NOLINT //In C we only need ptr type so Opaque
*/
void delete_handle(Handle* handle);

// TODO
void get_model_list(char** names, const int* n_model);
void free_model_list(char** names, int n_model);
// void finalize(); //Do not use it

int exec(Handle handle);
Expand Down
3 changes: 2 additions & 1 deletion apps/api/public/api/results.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ struct ApiResult : Result<Success, std::string>
}

explicit constexpr ApiResult() noexcept = default;
constexpr int to_c_ret_code()
constexpr int
to_c_ret_code()
{
return (valid()) ? 0 : -1;
}
Expand Down
26 changes: 15 additions & 11 deletions apps/api/python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
if hasattr(handle_module, "__all__"):
__all__ = handle_module.__all__

__all__.extend(
["pyinit_handle", "init_simulation", "set_initial_concentrations", "fast_run"]
)


def pyinit_handle(sim_id: int):
"""
Expand Down Expand Up @@ -85,25 +89,30 @@ def fast_run(
is_serde: bool = False,
f_init=None,
serde_path=None,
uniform=None,
):
"""Run the simulation with optional recursion or serde handling."""

# Prepare parameters
params = handle_module.make_params(**params)
handle = handle_module.init_simulation(
outfolder, name, cma_path, params
)

if uniform is not None:
params.uniform_particle_init = True

handle = init_simulation(outfolder, name, cma_path, params)

# Liquid feed configuration
if liquid_flow_rate != 0:
handle_module.set_liquid_feed_constant(handle, liquid_flow_rate, s_feed, 0, 0)

handle_module.register_model_name(
handle, model_name
) # Needed to set it even if serde with UDF
# Model setup
if not is_serde:
if f_init is None:
raise ValueError("f_init must be provided when is_serde is False")
handle_module.set_initial_concentrations(handle, *f_init(n_compartment))
handle_module.register_model_name(handle, model_name)
set_initial_concentrations(handle, *f_init(n_compartment))
else:
if not serde_path:
raise ValueError("serde_path must be provided when is_serde is True")
Expand All @@ -116,9 +125,4 @@ def fast_run(
return -1

handle_module.exec(handle)
return 0


__all__.extend(
["pyinit_handle", "init_simulation", "set_initial_concentrations", "fast_run"]
)
return handle_module.i_rank(handle)
Loading
Loading