-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from chrhansk/feature-integration-solver
Add integration solver
- Loading branch information
Showing
21 changed files
with
1,498 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from enum import Enum, auto | ||
|
||
import numpy as np | ||
|
||
|
||
class EventResultType(Enum): | ||
CONVERGED = auto() | ||
UNBOUNDED = auto() | ||
FILTER_CHANGED = auto() | ||
FREE_GRAD_ZERO = auto() | ||
PENALTY = auto() | ||
|
||
|
||
class EventResult: | ||
def __init__(self, t: float, z: np.ndarray): | ||
self.t = t | ||
self.z = z | ||
|
||
|
||
class ConvergedResult(EventResult): | ||
def __init__(self, t: float, z: np.ndarray): | ||
super().__init__(t, z) | ||
self.type = EventResultType.CONVERGED | ||
|
||
|
||
class UnboundedResult(EventResult): | ||
def __init__(self, t: float, z: np.ndarray): | ||
super().__init__(t, z) | ||
self.type = EventResultType.UNBOUNDED | ||
|
||
|
||
class FilterChangedResult(EventResult): | ||
def __init__(self, t: float, z: np.ndarray, filter: np.ndarray, j: int): | ||
super().__init__(t, z) | ||
self.type = EventResultType.FILTER_CHANGED | ||
|
||
next_filter = np.copy(filter) | ||
(size,) = filter.shape | ||
assert 0 <= j < size | ||
next_filter[j] = not (filter[j]) | ||
self.filter = next_filter | ||
|
||
|
||
class PenaltyResult(EventResult): | ||
def __init__(self, t: float, z: np.ndarray): | ||
super().__init__(t, z) | ||
self.type = EventResultType.PENALTY |
Oops, something went wrong.