mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Added tally arithmetic cross-scores
This commit is contained in:
parent
a430cd7fd0
commit
fe7ba99816
1 changed files with 76 additions and 0 deletions
|
|
@ -145,6 +145,22 @@ class Tally(object):
|
|||
if self.num_realizations == other.num_realizations:
|
||||
new_tally.num_realizations = self.num_realizations
|
||||
|
||||
# Generate "cross" scores
|
||||
# NOTE: This only needs to cross the scores if the
|
||||
if self.scores != other.scores:
|
||||
|
||||
for self_score in self.scores:
|
||||
for other_score in other.scores:
|
||||
new_score = '({0} + {1})'.format(self_score, other_score)
|
||||
new_tally.add_score(new_score)
|
||||
|
||||
else:
|
||||
|
||||
for score in self.scores:
|
||||
new_score = '({0} + {1})'.format(score, score)
|
||||
new_tally.add_score(new_score)
|
||||
|
||||
|
||||
elif is_integer(other) or is_float(other):
|
||||
|
||||
new_tally._mean = self._mean + other
|
||||
|
|
@ -206,6 +222,21 @@ class Tally(object):
|
|||
if self.num_realizations == other.num_realizations:
|
||||
new_tally.num_realizations = self.num_realizations
|
||||
|
||||
# Generate "cross" scores
|
||||
# NOTE: This only needs to cross the scores if the
|
||||
if self.scores != other.scores:
|
||||
|
||||
for self_score in self.scores:
|
||||
for other_score in other.scores:
|
||||
new_score = '({0} - {1})'.format(self_score, other_score)
|
||||
new_tally.add_score(new_score)
|
||||
|
||||
else:
|
||||
|
||||
for score in self.scores:
|
||||
new_score = '({0} - {1})'.format(score, score)
|
||||
new_tally.add_score(new_score)
|
||||
|
||||
elif is_integer(other) or is_float(other):
|
||||
|
||||
new_tally._mean = self._mean - other
|
||||
|
|
@ -270,6 +301,21 @@ class Tally(object):
|
|||
if self.num_realizations == other.num_realizations:
|
||||
new_tally.num_realizations = self.num_realizations
|
||||
|
||||
# Generate "cross" scores
|
||||
# NOTE: This only needs to cross the scores if the
|
||||
if self.scores != other.scores:
|
||||
|
||||
for self_score in self.scores:
|
||||
for other_score in other.scores:
|
||||
new_score = '({0} * {1})'.format(self_score, other_score)
|
||||
new_tally.add_score(new_score)
|
||||
|
||||
else:
|
||||
|
||||
for score in self.scores:
|
||||
new_score = '({0} * {1})'.format(score, score)
|
||||
new_tally.add_score(new_score)
|
||||
|
||||
elif is_integer(other) or is_float(other):
|
||||
|
||||
new_tally._mean = self._mean * other
|
||||
|
|
@ -334,6 +380,21 @@ class Tally(object):
|
|||
if self.num_realizations == other.num_realizations:
|
||||
new_tally.num_realizations = self.num_realizations
|
||||
|
||||
# Generate "cross" scores
|
||||
# NOTE: This only needs to cross the scores if the
|
||||
if self.scores != other.scores:
|
||||
|
||||
for self_score in self.scores:
|
||||
for other_score in other.scores:
|
||||
new_score = '({0} / {1})'.format(self_score, other_score)
|
||||
new_tally.add_score(new_score)
|
||||
|
||||
else:
|
||||
|
||||
for score in self.scores:
|
||||
new_score = '({0} / {1})'.format(score, score)
|
||||
new_tally.add_score(new_score)
|
||||
|
||||
elif is_integer(other) or is_float(other):
|
||||
|
||||
new_tally._mean = self._mean / other
|
||||
|
|
@ -399,6 +460,21 @@ class Tally(object):
|
|||
if self.num_realizations == power.num_realizations:
|
||||
new_tally.num_realizations = self.num_realizations
|
||||
|
||||
# Generate "cross" scores
|
||||
# NOTE: This only needs to cross the scores if the
|
||||
if self.scores != power.scores:
|
||||
|
||||
for self_score in self.scores:
|
||||
for power_score in power.scores:
|
||||
new_score = '({0} ^ {1})'.format(self_score, power_score)
|
||||
new_tally.add_score(new_score)
|
||||
|
||||
else:
|
||||
|
||||
for score in self.scores:
|
||||
new_score = '({0} ^ {1})'.format(score, score)
|
||||
new_tally.add_score(new_score)
|
||||
|
||||
elif is_integer(power) or is_float(power):
|
||||
|
||||
new_tally._mean = self._mean ** power
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue