mesh-adaptation / goalie

Goal-oriented error estimation and mesh adaptation for finite element problems solved using Firedrake
Other
1 stars 1 forks source link

Introduce indexing and slicing of `TimePartition` #111

Closed jwallwork23 closed 4 months ago

jwallwork23 commented 4 months ago

Closes #99.

Currently, indexing a TimePartition returns various pieces of information associated with that subinterval. The changes introduced in this PR are more logical, i.e., indexing gives a sub-TimePartition. Similarly for slicing.

jwallwork23 commented 4 months ago

Thanks @acse-ej321, good spot. In this snippet of code, we want to get the number of timesteps for a given subinterval.

This could be done by taking the sub-timepartition and evaluating num_timesteps, which sums num_timesteps_per_subinterval over all subintervals (in this case there is only one), which is what would be done with the snippet you quote.

An equivalent but perhaps clearer way is to just take the appropriate index of num_timesteps_per_subinterval, so that's what I've done in the latest commit https://github.com/pyroteus/goalie/pull/111/commits/06da0adb9ecb9a3f53172182b20c8ade4b7fe658.

(The pre-commit hook also seems to have put an unrelated formatting change in there, too.)