diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e0468eed..8476c5acf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -252,7 +252,7 @@ add_subdirectory("distribution") # Enforce and check code format # ----------------------------------------------------------------------------- # set paths of files to format -set(SDIR ${PROJECT_SOURCE_DIR}/src/**/) +set(SDIR ${PROJECT_SOURCE_DIR}/src) # format the code add_custom_target(codeformat diff --git a/package.json b/package.json index 01e9f537a..a23ff14d5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "devDependencies": { - "prettier": "^3.6.2" + "prettier": "^3.8.4" }, "scripts": { "format": "prettier --write \"**/*.json\"", diff --git a/src/model/Block.h b/src/model/Block.h index 849aeb956..752a5c0c0 100644 --- a/src/model/Block.h +++ b/src/model/Block.h @@ -25,7 +25,7 @@ * to the global system. */ struct TripletsContributions { - TripletsContributions() {}; + TripletsContributions(){}; /** * @brief Set the number of triplets that the element contributes * to the global system. @@ -33,7 +33,7 @@ struct TripletsContributions { * @param E Contributions to E matrix * @param D Contributions to dC/dy matrix */ - TripletsContributions(int F, int E, int D) : F(F), E(E), D(D) {}; + TripletsContributions(int F, int E, int D) : F(F), E(E), D(D){}; /** * @brief Set the number of triplets that the element contributes * to the global system. diff --git a/src/model/ChamberSphere.cpp b/src/model/ChamberSphere.cpp index 6971e7713..645a7089d 100644 --- a/src/model/ChamberSphere.cpp +++ b/src/model/ChamberSphere.cpp @@ -119,8 +119,15 @@ void ChamberSphere::get_elastance_values(std::vector& parameters) { const auto T_cardiac = model->cardiac_cycle_period; const auto t_in_cycle = fmod(model->time, T_cardiac); - const double S_plus = 0.5 * (1.0 + tanh((t_in_cycle - tsys) / steepness)); - const double S_minus = 0.5 * (1.0 - tanh((t_in_cycle - tdias) / steepness)); + auto warp_signed = [T_cardiac](double dt) { + return fmod(dt + 1.5 * T_cardiac, T_cardiac) - 0.5 * T_cardiac; + }; + + const double phase_tsys = warp_signed(t_in_cycle - tsys); + const double phase_tdias = warp_signed(t_in_cycle - tdias); + + const double S_plus = 0.5 * (1.0 + tanh(phase_tsys / steepness)); + const double S_minus = 0.5 * (1.0 - tanh(phase_tdias / steepness)); // indicator function const double f = S_plus * S_minus;