Skip to content

Commit

Permalink
Move time bench to ODE main solve function
Browse files Browse the repository at this point in the history
  • Loading branch information
cpmech committed Sep 25, 2020
1 parent 265c42b commit 071d3ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 3 additions & 0 deletions ode/ode.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package ode

import (
"math"
"time"

"gosl/chk"
"gosl/io"
Expand Down Expand Up @@ -216,7 +217,9 @@ func (o *Solver) Solve(y la.Vector, x, xf float64) {
}

// step update
startTimeStep := time.Now()
o.rkm.Step(x, y)
o.Stat.updateNanosecondsStep(startTimeStep)

// iterations diverging ?
if o.work.diverg {
Expand Down
6 changes: 2 additions & 4 deletions ode/radau5.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,6 @@ func (o *Radau5) DenseOut(yout la.Vector, h, x float64, y la.Vector, xout float6
// Step steps update
func (o *Radau5) Step(x0 float64, y0 la.Vector) {

// benchmark
startTime := time.Now()
defer o.stat.updateNanosecondsStep(startTime)

// auxiliary
h := o.work.h
u := o.work.u
Expand Down Expand Up @@ -273,9 +269,11 @@ func (o *Radau5) Step(x0 float64, y0 la.Vector) {

// initialise linear solver
if !o.ready {
startTimeIniSol := time.Now()
o.lsR.Init(o.kmatR, o.conf.LinSolConfig)
o.lsC.Init(o.kmatC, o.conf.LinSolConfig)
o.ready = true
o.stat.updateNanosecondsIniSol(startTimeIniSol)
}

// perform factorisation
Expand Down

0 comments on commit 071d3ec

Please sign in to comment.