Search in sources :

Example 1 with ParameterDomain

use of gov.sandia.n2a.parms.ParameterDomain in project n2a by frothga.

the class EquationSet method getOutputParameters.

/**
 *        Assembles list of all variables that can be used in an output expression.
 *        Depends on results of: resolveLHS() (optional, enables us to remove "reference" variables)
 */
public ParameterDomain getOutputParameters() {
    ImageIcon icon;
    if (connectionBindings == null) {
        icon = ImageUtil.getImage("layer.gif");
    } else {
        icon = ImageUtil.getImage("bridge.gif");
    }
    // TODO: should we return the empty string, or replace it with something?
    ParameterDomain result = new ParameterDomain(name, icon);
    for (Variable v : variables) {
        if (v.hasAttribute("reference"))
            continue;
        String defaultValue = "";
        if (v.equations.size() > 0)
            defaultValue = v.equations.first().expression.render();
        result.addParameter(new Parameter(v.nameString(), defaultValue));
    }
    for (EquationSet s : parts) {
        result.addSubdomain(s.getOutputParameters());
    }
    return result;
}
Also used : ImageIcon(javax.swing.ImageIcon) AccessVariable(gov.sandia.n2a.language.AccessVariable) ParameterDomain(gov.sandia.n2a.parms.ParameterDomain) Parameter(gov.sandia.n2a.parms.Parameter)

Example 2 with ParameterDomain

use of gov.sandia.n2a.parms.ParameterDomain in project n2a by frothga.

the class FixedParameterSpacePanel method populate.

// AMap wrap operation
private void populate(TNode nParent, ParameterDomain domain) {
    for (ParameterDomain subdomain : domain.getSubdomains()) {
        TNode nSubdomain = new TNode(new NodeSubdomain(subdomain));
        populate(nSubdomain, subdomain);
        nParent.add(nSubdomain);
    }
    for (Parameter param : domain.getParameters()) {
        TNode nParam = new TNode(new NodeParameter(param));
        nParent.add(nParam);
    }
}
Also used : NodeSubdomain(gov.sandia.umf.platform.ui.ensemble.tree.NodeSubdomain) TNode(replete.gui.controls.simpletree.TNode) NodeParameter(gov.sandia.umf.platform.ui.ensemble.tree.NodeParameter) ParameterDomain(gov.sandia.n2a.parms.ParameterDomain) NodeParameter(gov.sandia.umf.platform.ui.ensemble.tree.NodeParameter) Parameter(gov.sandia.n2a.parms.Parameter)

Example 3 with ParameterDomain

use of gov.sandia.n2a.parms.ParameterDomain in project n2a by frothga.

the class FixedParameterSpacePanel method setSimulationInputParameters.

public void setSimulationInputParameters(ParameterDomain sDomain) {
    if (sDomain == null) {
        sDomain = new ParameterDomain();
    }
    simDomain = sDomain;
    simDomain.setName("Simulator");
    simDomain.setIcon(ImageUtil.getImage("job.gif"));
    constructDVGroup();
    buildDomainTab(simDomain);
    updateFromGroups();
// TODO remove from groups any old sim params
}
Also used : ParameterDomain(gov.sandia.n2a.parms.ParameterDomain)

Example 4 with ParameterDomain

use of gov.sandia.n2a.parms.ParameterDomain in project n2a by frothga.

the class ParameterSpecGroupPanel method initPanel.

private void initPanel(ParameterSpecGroup group) {
    for (Object key : group.keySet()) {
        ParameterSpecification spec = group.get(key);
        String keyStr = key.toString();
        String[] path = keyStr.split("\\.");
        List<ParameterDomain> d = new ArrayList<ParameterDomain>();
        for (int i = 0; i < path.length - 1; i++) {
            String seg = path[i];
            d.add(new ParameterDomain(seg));
        }
        // , dv, desc,icon);
        Parameter param = new Parameter(path[path.length - 1]);
        ParameterBundle bundle = new ParameterBundle(d, param);
        addParam(bundle, spec);
    }
}
Also used : ConstantParameterSpecification(gov.sandia.umf.platform.ensemble.params.specs.ConstantParameterSpecification) ParameterSpecification(gov.sandia.n2a.parms.ParameterSpecification) UniformParameterSpecification(gov.sandia.umf.platform.ensemble.params.specs.UniformParameterSpecification) EvenSpacingParameterSpecification(gov.sandia.umf.platform.ensemble.params.specs.EvenSpacingParameterSpecification) ParameterDomain(gov.sandia.n2a.parms.ParameterDomain) ArrayList(java.util.ArrayList) Parameter(gov.sandia.n2a.parms.Parameter) ParameterBundle(gov.sandia.n2a.parms.ParameterBundle)

Example 5 with ParameterDomain

use of gov.sandia.n2a.parms.ParameterDomain in project n2a by frothga.

the class OutputParameterPanel method dragGestureRecognized.

public void dragGestureRecognized(DragGestureEvent event) {
    Cursor cursor = null;
    SimpleTree list = (SimpleTree) event.getComponent();
    TreePath[] paths = list.getSelectionPaths();
    if (paths == null) {
        return;
    }
    List<ParameterBundle> bundles = new ArrayList<ParameterBundle>();
    for (TreePath path : paths) {
        List<ParameterDomain> domains = new ArrayList<ParameterDomain>();
        for (int p = 0; p < path.getPathCount(); p++) {
            Object u = ((TNode) path.getPathComponent(p)).getObject();
            if (u instanceof NodeSubdomain) {
                domains.add(((NodeSubdomain) u).getSubdomain());
            }
        }
        NodeBase uLeaf = ((TNode) path.getLastPathComponent()).getObject();
        if (uLeaf instanceof NodeParameter) {
            NodeParameter p = (NodeParameter) uLeaf;
            bundles.add(new ParameterBundle(domains, p.getParameter()));
        } else {
            // TODO: add all children?
            return;
        }
    }
    if (event.getDragAction() == DnDConstants.ACTION_LINK) {
        cursor = DragCursors.getGrabhandcursor();
    }
    event.startDrag(cursor, new TransferableParameterBundles(bundles));
}
Also used : ArrayList(java.util.ArrayList) TransferableParameterBundles(gov.sandia.umf.platform.ui.ensemble.TransferableParameterBundles) ParameterBundle(gov.sandia.n2a.parms.ParameterBundle) Cursor(java.awt.Cursor) SimpleTree(replete.gui.controls.simpletree.SimpleTree) NodeSubdomain(gov.sandia.umf.platform.ui.ensemble.tree.NodeSubdomain) NodeBase(replete.gui.controls.simpletree.NodeBase) TNode(replete.gui.controls.simpletree.TNode) TreePath(javax.swing.tree.TreePath) NodeParameter(gov.sandia.umf.platform.ui.ensemble.tree.NodeParameter) ParameterDomain(gov.sandia.n2a.parms.ParameterDomain)

Aggregations

ParameterDomain (gov.sandia.n2a.parms.ParameterDomain)13 Parameter (gov.sandia.n2a.parms.Parameter)7 NodeParameter (gov.sandia.umf.platform.ui.ensemble.tree.NodeParameter)4 NodeSubdomain (gov.sandia.umf.platform.ui.ensemble.tree.NodeSubdomain)4 TNode (replete.gui.controls.simpletree.TNode)4 ParameterBundle (gov.sandia.n2a.parms.ParameterBundle)3 ArrayList (java.util.ArrayList)3 ParameterKeyPath (gov.sandia.n2a.parms.ParameterKeyPath)2 ParameterSpecification (gov.sandia.n2a.parms.ParameterSpecification)2 ConstantParameterSpecification (gov.sandia.umf.platform.ensemble.params.specs.ConstantParameterSpecification)2 EvenSpacingParameterSpecification (gov.sandia.umf.platform.ensemble.params.specs.EvenSpacingParameterSpecification)2 UniformParameterSpecification (gov.sandia.umf.platform.ensemble.params.specs.UniformParameterSpecification)2 TreePath (javax.swing.tree.TreePath)2 NodeBase (replete.gui.controls.simpletree.NodeBase)2 AccessVariable (gov.sandia.n2a.language.AccessVariable)1 ConstantParameterSpecGroup (gov.sandia.umf.platform.ensemble.params.groups.ConstantParameterSpecGroup)1 ParameterSpecGroup (gov.sandia.umf.platform.ensemble.params.groups.ParameterSpecGroup)1 TransferableParameterBundles (gov.sandia.umf.platform.ui.ensemble.TransferableParameterBundles)1 Cursor (java.awt.Cursor)1 ImageIcon (javax.swing.ImageIcon)1