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
11 changes: 7 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ jobs:
install_uninstall_and_package: ON
use_install_prefix: ON
- name: 'JavaScript bindings'
os: macos-15
os: ubuntu-22.04
build_type: Release
code_analysis: OFF
code_coverage: OFF
Expand Down Expand Up @@ -251,7 +251,7 @@ jobs:
context: PATH=$GITHUB_WORKSPACE:$PATH
target: check_code_formatting
- name: 'JavaScript code formatting'
os: macos-15
os: ubuntu-22.04
build_type: Release
code_analysis: OFF
code_coverage: OFF
Expand Down Expand Up @@ -376,10 +376,13 @@ jobs:
sudo mv clang-tidy /usr/local/bin
- name: Install Emscripten
if: ${{ matrix.javascript_support == 'ON' }}
run: brew install --overwrite emscripten
uses: mymindstorm/setup-emsdk@v14
- name: Install Biome
if: ${{ matrix.target == 'javascript_check_code_formatting' }}
run: brew install --overwrite biome
run: |
curl -L https://github.com/biomejs/biome/releases/latest/download/biome-linux-x64 -o biome
chmod +x biome
mv biome /usr/local/bin
- name: Install uv
if: ${{ matrix.documentation == 'ON' || matrix.python_support == 'ON' || matrix.target == 'python_check_code_formatting' }}
uses: astral-sh/setup-uv@v6
Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.20251027.0
0.20251030.0
6 changes: 3 additions & 3 deletions cmake/base64encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ int main(int pArgC, char *pArgV[])
return 1;
}

std::uintmax_t fileSize = std::filesystem::file_size(pArgV[1]);
char *buffer = new char[fileSize];
std::uintmax_t fileSize {std::filesystem::file_size(pArgV[1])};
char *buffer {new char[fileSize]};
std::ifstream file(pArgV[1], std::ios::binary);

file.read(buffer, fileSize);
Expand All @@ -44,7 +44,7 @@ int main(int pArgC, char *pArgV[])

file.close();

char *base64 = new char[modp_b64_encode_len(fileSize)];
char *base64 {new char[modp_b64_encode_len(fileSize)]};

modp_b64_encode(base64, buffer, fileSize);

Expand Down
12 changes: 6 additions & 6 deletions extern/nanobind/src/implicit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ NAMESPACE_BEGIN(detail)

void implicitly_convertible(const std::type_info *src,
const std::type_info *dst) noexcept {
nb_internals *internals_ = internals;
type_data *t = nb_type_c2p(internals_, dst);
nb_internals *internals_ {internals};
type_data *t {nb_type_c2p(internals_, dst)};
check(t, "nanobind::detail::implicitly_convertible(src=%s, dst=%s): "
"destination type unknown!", type_name(src), type_name(dst));

lock_internals guard(internals_);
size_t size = 0;
size_t size {0};

if (t->flags & (uint32_t) type_flags::has_implicit_conversions) {
while (t->implicit.cpp && t->implicit.cpp[size])
Expand All @@ -45,13 +45,13 @@ void implicitly_convertible(const std::type_info *src,
void implicitly_convertible(bool (*predicate)(PyTypeObject *, PyObject *,
cleanup_list *),
const std::type_info *dst) noexcept {
nb_internals *internals_ = internals;
type_data *t = nb_type_c2p(internals_, dst);
nb_internals *internals_ {internals};
type_data *t {nb_type_c2p(internals_, dst)};
check(t, "nanobind::detail::implicitly_convertible(src=<predicate>, dst=%s): "
"destination type unknown!", type_name(dst));

lock_internals guard(internals_);
size_t size = 0;
size_t size {0};

if (t->flags & (uint32_t) type_flags::has_implicit_conversions) {
while (t->implicit.py && t->implicit.py[size])
Expand Down
4 changes: 2 additions & 2 deletions src/api/libopencor/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ class LIBOPENCOR_EXPORT File: public Logger
* Factory method to create a @ref File object:
*
* ```
* auto localFile = libOpenCOR::File::create("/some/path/file.txt");
* auto remoteFile = libOpenCOR::File::create("https://some.domain.com/file.txt");
* auto localFile {libOpenCOR::File::create("/some/path/file.txt")};
* auto remoteFile {libOpenCOR::File::create("https://some.domain.com/file.txt")};
* ```
*
* Note: if there is already a @ref File object for the given file name or URL then we return it after having reset
Expand Down
4 changes: 2 additions & 2 deletions src/api/libopencor/sedanalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class LIBOPENCOR_EXPORT SedAnalysis: public SedSimulation
* Factory method to create a @ref SedAnalysis object:
*
* ```
* auto document = libOpenCOR::SedDocument::create();
* auto simulation = libOpenCOR::SedAnalysis::create(document);
* auto document {libOpenCOR::SedDocument::create()};
* auto simulation {libOpenCOR::SedAnalysis::create(document)};
* ```
*
* @param pDocument The @ref SedDocument object to which the @ref SedAnalysis object is to belong.
Expand Down
2 changes: 1 addition & 1 deletion src/api/libopencor/sedchangeattribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class LIBOPENCOR_EXPORT SedChangeAttribute: public SedChange
* Factory method to create a @ref SedChangeAttribute object:
*
* ```
* auto simulation = libOpenCOR::SedChangeAttribute::create(component, variable, newValue);
* auto simulation {libOpenCOR::SedChangeAttribute::create(component, variable, newValue)};
* ```
*
* @param pComponentName The name of the component, as a @c std::string, where the target is located.
Expand Down
2 changes: 1 addition & 1 deletion src/api/libopencor/seddocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class LIBOPENCOR_EXPORT SedDocument: public Logger
* Factory method to create a @ref SedDocument object:
*
* ```
* auto document = libOpenCOR::SedDocument::create();
* auto document {libOpenCOR::SedDocument::create()};
* ```
*
* @param pFile The @ref File, if any, used to initialise this @ref SedDocument object.
Expand Down
6 changes: 3 additions & 3 deletions src/api/libopencor/sedmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ class LIBOPENCOR_EXPORT SedModel: public SedBase
* Factory method to create a @ref SedModel object:
*
* ```
* auto document = libOpenCOR::SedDocument::create();
* auto file = libOpenCOR::File::create("/some/path/file.txt");
* auto model = libOpenCOR::SedModel::create(document, file);
* auto document {libOpenCOR::SedDocument::create()};
* auto file {libOpenCOR::File::create("/some/path/file.txt")};
* auto model {libOpenCOR::SedModel::create(document, file)};
* ```
*
* @param pDocument The @ref SedDocument object to which the @ref SedModel object is to belong.
Expand Down
4 changes: 2 additions & 2 deletions src/api/libopencor/sedonestep.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class LIBOPENCOR_EXPORT SedOneStep: public SedSimulation
* Factory method to create a @ref SedOneStep object:
*
* ```
* auto document = libOpenCOR::SedDocument::create();
* auto simulation = libOpenCOR::SedOneStep::create(document);
* auto document {libOpenCOR::SedDocument::create()};
* auto simulation {libOpenCOR::SedOneStep::create(document)};
* ```
*
* @param pDocument The @ref SedDocument object to which the @ref SedOneStep object is to belong.
Expand Down
4 changes: 2 additions & 2 deletions src/api/libopencor/sedrepeatedtask.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class LIBOPENCOR_EXPORT SedRepeatedTask: public SedAbstractTask
* Factory method to create a @ref SedRepeatedTask object:
*
* ```
* auto document = libOpenCOR::SedDocument::create();
* auto task = libOpenCOR::SedRepeatedTask::create(document);
* auto document {libOpenCOR::SedDocument::create()};
* auto task {libOpenCOR::SedRepeatedTask::create(document)};
* ```
*
* @param pDocument The @ref SedDocument object to which the @ref SedRepeatedTask object is to belong.
Expand Down
4 changes: 2 additions & 2 deletions src/api/libopencor/sedsteadystate.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class LIBOPENCOR_EXPORT SedSteadyState: public SedSimulation
* Factory method to create a @ref SedSteadyState object:
*
* ```
* auto document = libOpenCOR::SedDocument::create();
* auto simulation = libOpenCOR::SedSteadyState::create(document);
* auto document {libOpenCOR::SedDocument::create()};
* auto simulation {libOpenCOR::SedSteadyState::create(document)};
* ```
*
* @param pDocument The @ref SedDocument object to which the @ref SedSteadyState object is to belong.
Expand Down
4 changes: 2 additions & 2 deletions src/api/libopencor/sedtask.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class LIBOPENCOR_EXPORT SedTask: public SedAbstractTask
* Factory method to create a @ref SedTask object:
*
* ```
* auto document = libOpenCOR::SedDocument::create();
* auto task = libOpenCOR::SedTask::create(document);
* auto document {libOpenCOR::SedDocument::create()};
* auto task {libOpenCOR::SedTask::create(document)};
* ```
*
* @param pDocument The @ref SedDocument object to which the @ref SedTask object is to belong.
Expand Down
4 changes: 2 additions & 2 deletions src/api/libopencor/seduniformtimecourse.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class LIBOPENCOR_EXPORT SedUniformTimeCourse: public SedSimulation
* Factory method to create a @ref SedUniformTimeCourse object:
*
* ```
* auto document = libOpenCOR::SedDocument::create();
* auto simulation = libOpenCOR::SedUniformTimeCourse::create(document);
* auto document {libOpenCOR::SedDocument::create()};
* auto simulation {libOpenCOR::SedUniformTimeCourse::create(document)};
* ```
*
* @param pDocument The @ref SedDocument object to which the @ref SedUniformTimeCourse object is to
Expand Down
2 changes: 1 addition & 1 deletion src/api/libopencor/solvercvode.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class LIBOPENCOR_EXPORT SolverCvode: public SolverOde
* Factory method to create a @ref SolverCvode object:
*
* ```
* auto solver = libOpenCOR::SolverCvode::create();
* auto solver {libOpenCOR::SolverCvode::create()};
* ```
*
* @return A smart pointer to a @ref SolverCvode object.
Expand Down
2 changes: 1 addition & 1 deletion src/api/libopencor/solverforwardeuler.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class LIBOPENCOR_EXPORT SolverForwardEuler: public SolverOdeFixedStep
* Factory method to create a @ref SolverForwardEuler object:
*
* ```
* auto solver = libOpenCOR::SolverForwardEuler::create();
* auto solver {libOpenCOR::SolverForwardEuler::create()};
* ```
*
* @return A smart pointer to a @ref SolverForwardEuler object.
Expand Down
2 changes: 1 addition & 1 deletion src/api/libopencor/solverfourthorderrungekutta.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class LIBOPENCOR_EXPORT SolverFourthOrderRungeKutta: public SolverOdeFixedStep
* Factory method to create a @ref SolverFourthOrderRungeKutta object:
*
* ```
* auto solver = libOpenCOR::SolverFourthOrderRungeKutta::create();
* auto solver {libOpenCOR::SolverFourthOrderRungeKutta::create()};
* ```
*
* @return A smart pointer to a @ref SolverFourthOrderRungeKutta object.
Expand Down
2 changes: 1 addition & 1 deletion src/api/libopencor/solverheun.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class LIBOPENCOR_EXPORT SolverHeun: public SolverOdeFixedStep
* Factory method to create a @ref SolverHeun object:
*
* ```
* auto solver = libOpenCOR::SolverHeun::create();
* auto solver {libOpenCOR::SolverHeun::create()};
* ```
*
* @return A smart pointer to a @ref SolverHeun object.
Expand Down
2 changes: 1 addition & 1 deletion src/api/libopencor/solverkinsol.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class LIBOPENCOR_EXPORT SolverKinsol: public SolverNla
* Factory method to create a @ref SolverKinsol object:
*
* ```
* auto solver = libOpenCOR::SolverKinsol::create();
* auto solver {libOpenCOR::SolverKinsol::create()};
* ```
*
* @return A smart pointer to a @ref SolverKinsol object.
Expand Down
2 changes: 1 addition & 1 deletion src/api/libopencor/solversecondorderrungekutta.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class LIBOPENCOR_EXPORT SolverSecondOrderRungeKutta: public SolverOdeFixedStep
* Factory method to create a @ref SolverSecondOrderRungeKutta object:
*
* ```
* auto solver = libOpenCOR::SolverSecondOrderRungeKutta::create();
* auto solver {libOpenCOR::SolverSecondOrderRungeKutta::create()};
* ```
*
* @return A smart pointer to a @ref SolverSecondOrderRungeKutta object.
Expand Down
12 changes: 6 additions & 6 deletions src/bindings/javascript/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ void fileApi()
.property("fileName", &libOpenCOR::File::fileName)
.property("url", &libOpenCOR::File::url)
.property("path", &libOpenCOR::File::path)
.function("contents", emscripten::optional_override([](libOpenCOR::FilePtr &pThis) {
auto contents = pThis->contents();
auto view = emscripten::typed_memory_view(contents.size(), contents.data());
auto res = emscripten::val::global("Uint8Array").new_(contents.size());
.function("contents", emscripten::optional_override([](const libOpenCOR::FilePtr &pThis) {
auto contents {pThis->contents()};
auto view {emscripten::typed_memory_view(contents.size(), contents.data())};
auto res {emscripten::val::global("Uint8Array").new_(contents.size())};

res.call<void>("set", view);

return res;
}))
.function("setContents", emscripten::optional_override([](libOpenCOR::FilePtr &pThis, uintptr_t pContents, size_t pSize) {
auto contents = reinterpret_cast<unsigned char *>(pContents);
.function("setContents", emscripten::optional_override([](const libOpenCOR::FilePtr &pThis, uintptr_t pContents, size_t pSize) {
auto contents {reinterpret_cast<unsigned char *>(pContents)};

pThis->setContents(libOpenCOR::UnsignedChars(contents, contents + pSize));
}))
Expand Down
14 changes: 7 additions & 7 deletions src/file/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ File::Impl::Impl(const std::string &pFileNameOrUrl, bool pRetrieveContents)
{
// Check whether we are dealing with a local file or a URL.

auto [isLocalFile, fileNameOrUrl] = retrieveFileInfo(decodeUrl(pFileNameOrUrl));
auto [isLocalFile, fileNameOrUrl] {retrieveFileInfo(decodeUrl(pFileNameOrUrl))};

if (isLocalFile) {
mFilePath = stringToPath(fileNameOrUrl);
Expand All @@ -40,7 +40,7 @@ File::Impl::Impl(const std::string &pFileNameOrUrl, bool pRetrieveContents)

if (mFilePath.empty()) {
if (pRetrieveContents) {
auto [res, filePath] = downloadFile(mUrl);
auto [res, filePath] {downloadFile(mUrl)};

if (res) {
mFilePath = filePath;
Expand Down Expand Up @@ -258,21 +258,21 @@ FilePtr File::create(const std::string &pFileNameOrUrl, bool pRetrieveContents)
// Check whether the given file name or URL is already managed and if so then return it otherwise create, manage,
// and return a new file object.

auto fileManager = FileManager::instance();
auto fileManager {FileManager::instance()};
#ifdef __EMSCRIPTEN__
auto file = fileManager.fileFromFileNameOrUrl(pFileNameOrUrl);
auto file {fileManager.fileFromFileNameOrUrl(pFileNameOrUrl)};
#else
auto file = fileManager.file(pFileNameOrUrl);
auto file {fileManager.file(pFileNameOrUrl)};
#endif

if (file != nullptr) {
return file;
}

#ifdef __EMSCRIPTEN__
auto res = FilePtr {new File {pFileNameOrUrl, false}};
auto res {FilePtr {new File {pFileNameOrUrl, false}}};
#else
auto res = FilePtr {new File {pFileNameOrUrl, pRetrieveContents}};
auto res {FilePtr {new File {pFileNameOrUrl, pRetrieveContents}}};
#endif

res->pimpl()->checkType(res);
Expand Down
8 changes: 4 additions & 4 deletions src/file/file_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ namespace libOpenCOR {
class File::Impl: public Logger::Impl
{
public:
Type mType = Type::UNKNOWN_FILE;
Type mType {Type::UNKNOWN_FILE};

std::filesystem::path mFilePath;
std::string mUrl;

bool mTypeChecked = false;
bool mTypeChecked {false};

bool mRetrieveContents = true;
bool mContentsRetrieved = false;
bool mRetrieveContents {true};
bool mContentsRetrieved {false};
UnsignedChars mContents;

CellmlFilePtr mCellmlFile;
Expand Down
16 changes: 8 additions & 8 deletions src/file/filemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void FileManager::Impl::unmanage(File *pFile)
while (!files.empty()) {
// Retrieve the file at the top of the stack.

File *file = files.top();
auto *file {files.top()};

files.pop();

Expand All @@ -59,7 +59,7 @@ void FileManager::Impl::unmanage(File *pFile)

// Unmanage the current file.

auto iter = std::ranges::find(mFiles, file);
auto iter {std::ranges::find(mFiles, file)};

if (iter != mFiles.cend()) {
mFiles.erase(iter);
Expand Down Expand Up @@ -109,17 +109,17 @@ FilePtr FileManager::Impl::file(const std::string &pFileNameOrUrl) const
#endif
{
#if __clang_major__ < 16
auto [tIsLocalFile, tFileNameOrUrl] = retrieveFileInfo(pFileNameOrUrl);
auto isLocalFile = tIsLocalFile;
auto fileNameOrUrl = tFileNameOrUrl;
auto [tIsLocalFile, tFileNameOrUrl] {retrieveFileInfo(pFileNameOrUrl)};
auto isLocalFile {tIsLocalFile};
auto fileNameOrUrl {tFileNameOrUrl};
#else
auto [isLocalFile, fileNameOrUrl] = retrieveFileInfo(pFileNameOrUrl);
auto [isLocalFile, fileNameOrUrl] {retrieveFileInfo(pFileNameOrUrl)};
#endif
auto res = std::ranges::find_if(mFiles, [&](const auto &file) {
auto res {std::ranges::find_if(mFiles, [&](const auto &file) {
return isLocalFile ?
file->fileName() == fileNameOrUrl :
file->url() == fileNameOrUrl;
});
})};

if (res != mFiles.end()) {
return (*res)->shared_from_this();
Expand Down
Loading
Loading