Skip to content

Commit

Permalink
smaller interface
Browse files Browse the repository at this point in the history
  • Loading branch information
K20shores committed Mar 8, 2024
1 parent ab62da1 commit 379a84f
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 51 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Mac

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

jobs:
macos_lateset:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: macos-latest
strategy:
matrix:
compiler:
- { cpp: g++-11, c: gcc-11}
- { cpp: g++-12, c: gcc-12}
- { cpp: clang++, c: clang}
build_type: [Debug, Release]
env:
CC: ${{ matrix.compiler.c }}
CXX: ${{ matrix.compiler.cpp }}

steps:
- uses: actions/checkout@v3

- name: Run Cmake
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.build_type }}

- name: Build
run: cmake --build build --parallel 10

- name: Run tests
run: |
cd build
ctest -C ${{ matrix.build_type }} --rerun-failed --output-on-failure . --verbose -j 10
32 changes: 32 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Ubuntu

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

jobs:
gcc:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
strategy:
matrix:
build_type: [Debug, Release]
env:
CC: gcc
CXX: g++
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Run Cmake
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.build_type }}

- name: Build
run: cmake --build build --parallel 10

- name: Run tests
run: |
cd build
ctest -C ${{ matrix.build_type }} --rerun-failed --output-on-failure . --verbose -j 10
13 changes: 13 additions & 0 deletions include/musica/micm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@
#include <string>
#include <vector>

#ifdef __cplusplus
extern "C" {
#endif

void create_micm(void** micm);
void delete_micm(void** micm);
int micm_create_solver(void** micm, const char* config_path);
void micm_solve(void** micm, double time_step, double temperature, double pressure, int num_concentrations,
double* concentrations);

#ifdef __cplusplus
}
#endif

class MICM
{
Expand Down
13 changes: 0 additions & 13 deletions include/musica/micm_c.h

This file was deleted.

42 changes: 32 additions & 10 deletions src/micm/micm.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,35 @@
#include <musica/micm.hpp>
#include <cstddef>
#include <filesystem>
#include <iostream>

#include <micm/configure/solver_config.hpp>
#include <micm/solver/rosenbrock_solver_parameters.hpp>
#include <musica/micm.hpp>
#include <musica/micm.hpp>

#include <filesystem>
#include <cstddef>
void create_micm(void **micm)
{
*micm = new MICM();
}

void delete_micm(void **micm)
{
if (*micm)
{
delete static_cast<MICM *>(*micm);
*micm = nullptr;
}
}

int micm_create_solver(void **micm, const char *config_path)
{
return static_cast<MICM *>(*micm)->create_solver(std::string(config_path));
}

void micm_solve(void **micm, double time_step, double temperature, double pressure, int num_concentrations, double *concentrations)
{
static_cast<MICM *>(*micm)->solve(time_step, temperature, pressure, num_concentrations, concentrations);
}

MICM::MICM() : solver_(nullptr) {}

Expand All @@ -24,13 +49,10 @@ int MICM::create_solver(const std::string &config_path)
{
micm::SolverParameters solver_params = solver_config.GetSolverParams();
auto params = micm::RosenbrockSolverParameters::three_stage_rosenbrock_parameters(NUM_GRID_CELLS);
// solver_ = std::make_unique<micm::RosenbrockSolver<>>(solver_params.system_,
// solver_params.processes_,
// params);
// Create the RosenbrockSolver object using a raw pointer first
solver_ = new micm::RosenbrockSolver<>(solver_params.system_,
solver_params.processes_,
params);
solver_ = std::make_unique<micm::RosenbrockSolver<>>(solver_params.system_,
solver_params.processes_,
params);
Create the RosenbrockSolver object using a raw pointer first
}
else
{
Expand Down
28 changes: 0 additions & 28 deletions src/micm/micm_c_api.cpp

This file was deleted.

0 comments on commit 379a84f

Please sign in to comment.