Skip to content

Commit 761f653

Browse files
committed
..
1 parent d45fa9e commit 761f653

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/model.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2875,19 +2875,21 @@ void Model::fdwdp(realtype const t, realtype const* x, bool include_static) {
28752875
}
28762876

28772877
void Model::fdwdx(realtype const t, realtype const* x, bool include_static) {
2878+
// NOTE: (at least) Model_{ODE,DAE}::fJSparse rely on `fw` and `fdwdw`
2879+
// being called from here. They need to be executed even if nx_solver==0.
28782880
if (!nw)
28792881
return;
28802882

28812883
fw(t, x, include_static);
28822884

28832885
derived_state_.dwdx_.zero();
28842886
if (pythonGenerated) {
2885-
auto dwdx_hierarchical_0 = derived_state_.dwdx_hierarchical_.at(0);
2887+
fdwdw(t, x, include_static);
2888+
2889+
auto&& dwdx_hierarchical_0 = derived_state_.dwdx_hierarchical_.at(0);
28862890
if (!dwdx_hierarchical_0.data() || !dwdx_hierarchical_0.capacity())
28872891
return;
28882892

2889-
fdwdw(t, x, include_static);
2890-
28912893
if (include_static) {
28922894
dwdx_hierarchical_0.zero();
28932895
fdwdx_colptrs(dwdx_hierarchical_0);

0 commit comments

Comments
 (0)