use of gov.sandia.n2a.parms.ParameterSpecification in project n2a by frothga.
the class ParameterSpecGroupPanel method getParameterSpecGroup.
public ParameterSpecGroup getParameterSpecGroup() {
ParameterSpecGroup group = new ParameterSpecGroup(validCardinality);
for (ParameterSpecPanel pnlSpec : specPanels.keySet()) {
// TODO: hierarchical?
Object paramKey = pnlSpec.getParamBundle().getParameter().getKey();
List<ParameterDomain> domains = pnlSpec.getParamBundle().getDomains();
ParameterKeyPath keyPath = new ParameterKeyPath();
for (ParameterDomain domain : domains) {
keyPath.add(domain.getName());
}
keyPath.add(paramKey);
ParameterSpecification spec = pnlSpec.getSpecification();
group.add(keyPath, spec);
}
return group;
}
use of gov.sandia.n2a.parms.ParameterSpecification in project n2a by frothga.
the class UIController method divideEnsembleParams.
// Any group in origSet for which the Simulator can handle parameterization
// is removed from origSet and added to the returned set
private ParameterSpecGroupSet divideEnsembleParams(MNode model, ParameterSpecGroupSet origSet, Backend sim) {
// Three cases:
// 1) framework handles all in group
// 2) simulator handles all in group
// 3) (changed) sim can only handle some of group; so have framework handle group instead
ParameterSpecGroupSet result = new ParameterSpecGroupSet();
for (ParameterSpecGroup group : origSet) {
if (group == origSet.getDefaultValueGroup()) {
// don't want to transfer default value group to simulator groups
continue;
}
int numHandled = 0;
ParameterSpecification spec = null;
Object errorKey = null;
for (Object key : group.keySet()) {
spec = group.get(key);
if (sim.canHandleRunEnsembleParameter(model, key, spec)) {
numHandled++;
} else if (numHandled != 0) {
errorKey = key;
break;
}
}
if (numHandled != group.size() && numHandled != 0) {
System.out.println("this simulator cannot handle '" + errorKey + "' with specification '" + spec.getShortName());
} else if (numHandled != 0) {
result.add(group);
}
}
for (ParameterSpecGroup group : result) {
origSet.remove(group);
}
return result;
}
Aggregations