Skip to content

Commit

Permalink
[CORE][NETWORK] Removed saving nodes_data as a network attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
ShravanTata committed Dec 6, 2024
1 parent 960ee3b commit 9bcc7e3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions farms_network/core/network.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ cdef inline void ode(
cdef inline void logger(
int iteration,
NetworkDataCy data,
NodeDataCy[:] nodes_data,
Network* network
) noexcept:
cdef unsigned int nnodes = network.nnodes
Expand All @@ -112,6 +111,7 @@ cdef inline void logger(
cdef NodeDataCy node_data
cdef double[:] node_states
cdef int state_idx, start_idx, end_idx, state_iteration
cdef NodeDataCy[:] nodes_data = data.nodes
for j in range(nnodes):
# Log states
start_idx = state_indices[j]
Expand Down Expand Up @@ -161,7 +161,7 @@ cdef class PyNetwork(ODESystem):

super().__init__()
self.data = <NetworkDataCy>NetworkData.from_options(network_options)
self.nodes_data = self.data.nodes

self.pynodes = []
self.pyedges = []
self.nodes_output_data = []
Expand Down Expand Up @@ -281,12 +281,12 @@ cdef class PyNetwork(ODESystem):

cpdef void step(self):
""" Step the network state """
cdef NetworkDataCy data = self.data
# cdef NetworkDataCy data = self.data
self.iteration += 1
self.ode_integrator.step(
self, (self.iteration%self.buffer_size)*self.timestep, data.states.array
self, (self.iteration%self.buffer_size)*self.timestep, self.data.states.array
)
logger((self.iteration%self.buffer_size), data, self.nodes_data, self.network)
logger((self.iteration%self.buffer_size), self.data, self.network)

cdef void evaluate(self, double time, double[:] states, double[:] derivatives) noexcept:
""" Evaluate the ODE """
Expand Down

0 comments on commit 9bcc7e3

Please sign in to comment.