mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Changes in trigger.py from PullRequest Inc. review
This commit is contained in:
parent
c4ed966701
commit
cceaa10893
2 changed files with 7 additions and 9 deletions
|
|
@ -7,8 +7,8 @@ import openmc.checkvalue as cv
|
|||
|
||||
|
||||
class EqualityMixin:
|
||||
"""A Class which provides generic __eq__ and __ne__ functionality which
|
||||
can easily be inherited by downstream classes.
|
||||
"""A Class which provides a generic __eq__ method that can be inherited
|
||||
by downstream classes.
|
||||
"""
|
||||
|
||||
def __eq__(self, other):
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@ from xml.etree import ElementTree as ET
|
|||
from collections.abc import Iterable
|
||||
|
||||
import openmc.checkvalue as cv
|
||||
from openmc.mixin import EqualityMixin
|
||||
|
||||
|
||||
class Trigger:
|
||||
class Trigger(EqualityMixin):
|
||||
"""A criterion for when to finish a simulation based on tally uncertainties.
|
||||
|
||||
Parameters
|
||||
|
|
@ -33,14 +34,11 @@ class Trigger:
|
|||
self.threshold = threshold
|
||||
self._scores = []
|
||||
|
||||
def __eq__(self, other):
|
||||
return str(self) == str(other)
|
||||
|
||||
def __repr__(self):
|
||||
string = 'Trigger\n'
|
||||
string += '{0: <16}{1}{2}\n'.format('\tType', '=\t', self._trigger_type)
|
||||
string += '{0: <16}{1}{2}\n'.format('\tThreshold', '=\t', self._threshold)
|
||||
string += '{0: <16}{1}{2}\n'.format('\tScores', '=\t', self._scores)
|
||||
string += '{: <16}=\t{}\n'.format('\tType', self._trigger_type)
|
||||
string += '{: <16}=\t{}\n'.format('\tThreshold', self._threshold)
|
||||
string += '{: <16}=\t{}\n'.format('\tScores', self._scores)
|
||||
return string
|
||||
|
||||
@property
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue