Skip to content

Commit

Permalink
for #4864 guard against undefined particle count with old cached results
Browse files Browse the repository at this point in the history
  • Loading branch information
moellep committed Jan 9, 2024
1 parent 5905bd0 commit 16b3eab
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions sirepo/package_data/static/js/cloudmc.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,12 @@ SIREPO.app.factory('tallyService', function(appState, cloudmcService, $rootScope
};

function normalizer(score, numParticles) {
const n = cloudmcService.canNormalizeScore(score) ?
appState.models.openmcAnimation.sourceNormalization : numParticles;
return x => (n / numParticles) * x;
if (numParticles === undefined || ! cloudmcService.canNormalizeScore(score)) {
return x => x;
}
return x => (appState.models.openmcAnimation.sourceNormalization / numParticles) * x;
}

self.clearMesh = () => {
self.mesh = null;
self.fieldData = null;
Expand Down Expand Up @@ -415,7 +416,7 @@ SIREPO.app.factory('tallyService', function(appState, cloudmcService, $rootScope
? self.minField
: t;
};

self.getOutlines = (volId, dim, index) => {
if (! self.outlines) {
return [];
Expand Down Expand Up @@ -2112,7 +2113,7 @@ SIREPO.viewLogic('tallyView', function(appState, cloudmcService, panelState, val
const ALL_TYPES = SIREPO.APP_SCHEMA.enum.TallyFilter
.map(x => x[SIREPO.ENUM_INDEX_VALUE]);
const inds = cloudmcService.FILTER_INDICES;

const TYPE_NONE = 'None';

function filterField(index) {
Expand All @@ -2138,9 +2139,9 @@ SIREPO.viewLogic('tallyView', function(appState, cloudmcService, panelState, val
inds.forEach(i => {
panelState.showEnum('filter', '_type', type(i), true, i - 1);
});

}

function validateEnergyFilter(filter) {
if (! filter) {
return;
Expand Down Expand Up @@ -2172,7 +2173,7 @@ SIREPO.viewLogic('tallyView', function(appState, cloudmcService, panelState, val
}

$scope.whenSelected = updateEditor;

$scope.watchFields = [
inds.map(i => `${filterField(i)}._type`), updateEditor,
inds.map(i => `${filterField(i)}`), validateFilter,
Expand Down Expand Up @@ -2326,7 +2327,7 @@ SIREPO.app.directive('jRangeSlider', function(appState, panelState) {
let hasSteps = false;
let slider = null;
const watchFields = ['min', 'max', 'step'].map(x => `model[fieldName].${x}`);

function adjustToRange(val, range) {
if (! isValid(range)) {
return val;
Expand Down Expand Up @@ -2562,7 +2563,7 @@ SIREPO.viewLogic('tallySettingsView', function(appState, cloudmcService, panelSt
if (! e || ! cloudmcService.findFilter('meshFilter')) {
return;
}

const s = appState.models.openmcAnimation.energyRangeSum;
s.space = e.space;
s.min = e.start;
Expand All @@ -2574,7 +2575,7 @@ SIREPO.viewLogic('tallySettingsView', function(appState, cloudmcService, panelSt
cloudmcService.validateSelectedTally();
appState.saveChanges('openmcAnimation');
}

cloudmcService.buildRangeDelegate($scope.modelName, 'opacity');

$scope.whenSelected = () => {
Expand All @@ -2595,7 +2596,7 @@ SIREPO.viewLogic('tallySettingsView', function(appState, cloudmcService, panelSt
['openmcAnimation.tally'], validateTally,
['tallyReport.selectedGeometry', 'openmcAnimation.score'], showFields,
];

});

SIREPO.viewLogic('geometry3DReportView', function(cloudmcService, $scope) {
Expand Down

0 comments on commit 16b3eab

Please sign in to comment.