Object-oriented refactoring of active stress#578
Conversation
…forwarded to ionic model and active stress
|
I think this PR is now ready for review and merging. |
kko27
left a comment
There was a problem hiding this comment.
@michelebucelli, thanks so much for working on this! Documentation was excellent and the code was very easy to follow.
I had a general comment about coding style. I noticed that in Exception.h and Parameters.cpp, many of the changes are due to indentation, whitespaces, and the position of the * and & operators. I have two questions about this. 1) Should we think about enforcing coding standards (as discussed in #96)? 2) And (more practically for me) is there a way I can review the code without looking over these minor changes?
|
@kko27 There used to an implementation document describing implementation details and a It is standard procedure in software engineering to follow the coding style used in a project; especially that used in a file. However, most developers here don't follow this practice so new code ends up looking different from one function to the next (Parameters.cpp) or the coding in an entire file does not look like that used in any other file in the project (Core/Exception.h). I suppose we will again enable automatically enforced coding standards. Note that this may mess up the formatting of some complex mathematical statements like those used in material models. |
|
@kko27 @ktbolt Sorry, I have automatic formatting enabled in VS Code. It normally only touches lines of code that I've modified, but sometimes it misfires and touches the whole file without me noticing. A nice (terminal-only) tool to filter out whitespace changes in diffs is difftastic. Having said that, I am very much in favor of automated formatting. I've used |
|
@michelebucelli We used clang-format before so we will enable that. Thanks for your feedback ! |
javijv4
left a comment
There was a problem hiding this comment.
Thanks for working on this @michelebucelli. Looks great. I just left a few comments and questions.
|
@michelebucelli Are there any unit tests for |
|
@michelebucelli And we name class files using the class name, like Sorry, I missed this until now. |
No (or at least not yet). There are integration tests (one new electromechanics test using
Sorry, I forgot to update this. If it's all right with you, I'll sneak this into the PR for #592. I'll also do the same for |
Partially addresses #519.
Current situation
Release Notes
Many of the implementation choices here are modeled after the implementation of
IonicModelin #540. Here, I took some further steps towards encapsulation which might be ported toIonicModelas well, although maybe in a separate PR. I'll add some comments to the code about this.ActiveStressorActiveStressODE.--- config: class: hideEmptyMembersBox: true --- classDiagram ActiveStress <|-- ActiveStressODE ActiveStressODE <|-- NashPanfilov ActiveStress <|-- UniformSteadyActiveStress ActiveStress <|-- UniformUnsteadyActiveStress dmnType *-- ActiveStress ActiveStressFactory .. ActiveStress : instantiates Factory~BaseClass~ <|.. ActiveStressFactory : BaseClass=ActiveStressA new abstract
Factoryclass is introduced, by templating theIonicModelFactory; aliases are provided for bothFactory<IonicModel>andFactory<ActiveStress>.The
ActiveStressclass and derived classes manage their own XML parameters through the abstract classActiveStressParametersand the methodsget_parameters,read_parameters,distribute_parameters, so that the addition of model parameters can be localized to the source files where the model is defined.A (shared) pointer to
ActiveStressis stored indmnType, to allow different active stress models in different domains.Time stepping of
ActiveStressinstances is managed byIntegrator::predictor. After advancing one time step, the active tension along the three principal directions is stored in the vectorCepMod::cem.Ya_{f,s,n}, whose entries are then passed on to the constitutive law routines.The XML section for a
structdomain now can optionally contain the following tag:If present, the tag enables active stress through the
ActiveStressclass. If the active stress model is calcium-based, and no electrophysiology equation is present, the calcium will be kept to zero.Documentation
New additions are documented via Doxygen comments. Documentation for
ActiveStressandActiveStressODEalso includes a brief list of steps needed to implement a new model.Testing
Existing automatic tests pass with the new implementation, although they do not cover the newly added features.
I have tested this on a basic electromechanics example based on

cases/cep/slab_domains. I attach below a preview of the simulation.I plan to turn this into an integration test (running one timestep is reasonably fast).
TODO before marking as ready
Code of Conduct & Contributing Guidelines