Examples of AspectSubTreeNode


Examples of org.geppetto.core.model.runtime.AspectSubTreeNode

  protected void advanceRecordings(AspectNode aspect) throws GeppettoExecutionException
  {
    if(_recordings != null && isWatching())
    {
      AspectSubTreeNode watchTree = (AspectSubTreeNode) aspect.getSubTree(AspectTreeType.WATCH_TREE);

      if(watchTree.getChildren().isEmpty() || watchListModified())
      {
        for(RecordingModel recording : _recordings)
        {
          watchListModified(false);
          NetcdfFile file = recording.getHDF5();
          for(ucar.nc2.Variable hdfVariable : file.getVariables())
          {

            // for every state found in the recordings check if we are watching that variable
            String fullPath = watchTree.getInstancePath() + "." + hdfVariable.getFullName().replace("/", ".");
            if(getWatchList().contains(fullPath))
            {
              fullPath = fullPath.replace(watchTree.getInstancePath() + ".", "");

              StringTokenizer tokenizer = new StringTokenizer(fullPath, ".");
              ACompositeNode node = watchTree;
              while(tokenizer.hasMoreElements())
              {
                String current = tokenizer.nextToken();
                boolean found = false;
                for(ANode child : node.getChildren())
                {
                  if(child.getId().equals(current))
                  {
                    if(child instanceof ACompositeNode)
                    {
                      node = (ACompositeNode) child;
                    }
                    found = true;
                    break;
                  }
                }
                if(found)
                {
                  continue;
                }
                else
                {
                  if(tokenizer.hasMoreElements())
                  {
                    // not a leaf, create a composite state node
                    ACompositeNode newNode = new CompositeNode(current);
                    node.addChild(newNode);
                    node = newNode;
                  }
                  else
                  {
                    // it's a leaf node
                    VariableNode newNode = new VariableNode(current);
                    int[] start = { _currentRecordingIndex };
                    int[] lenght = { 1 };
                    Array value;
                    try
                    {
                      value = hdfVariable.read(start, lenght);
                      Type type = Type.fromValue(hdfVariable.getDataType().toString());

                      PhysicalQuantity quantity = new PhysicalQuantity();
                      AValue readValue = null;
                      switch(type)
                      {
                        case DOUBLE:
                          readValue = ValuesFactory.getDoubleValue(value.getDouble(0));
                          break;
                        case FLOAT:
                          readValue = ValuesFactory.getFloatValue(value.getFloat(0));
                          break;
                        case INTEGER:
                          readValue = ValuesFactory.getIntValue(value.getInt(0));
                          break;
                        default:
                          break;
                      }
                      quantity.setValue(readValue);
                      newNode.addPhysicalQuantity(quantity);
                      node.addChild(newNode);
                    }
                    catch(IOException | InvalidRangeException e)
                    {
                      throw new GeppettoExecutionException(e);
                    }
                  }
                }
              }
            }
          }
          _currentRecordingIndex++;
        }
      }
      else
      {
        for(RecordingModel recording : _recordings)
        {
          UpdateRecordingStateTreeVisitor updateStateTreeVisitor = new UpdateRecordingStateTreeVisitor(recording, watchTree.getInstancePath(), _currentRecordingIndex++);
          watchTree.apply(updateStateTreeVisitor);
          if(updateStateTreeVisitor.getError() != null)
          {
            throw new GeppettoExecutionException(updateStateTreeVisitor.getError());
          }
        }
View Full Code Here

Examples of org.geppetto.core.model.runtime.AspectSubTreeNode

    EntityNode purkinje = new EntityNode("purkinje");

    AspectNode electrical = new AspectNode("electrical");
    AspectNode electrical2 = new AspectNode("electrical");

    AspectSubTreeNode visualization = electrical.getSubTree(AspectTreeType.VISUALIZATION_TREE);
    SphereNode sphere = new SphereNode("purkinje");
    visualization.addChild(sphere);

    runtime.addChild(hhcell);
    runtime.addChild(purkinje);
    hhcell.getAspects().add(electrical);
    purkinje.getAspects().add(electrical2);
    electrical.setParent(hhcell);
    electrical2.setParent(purkinje);
   
    VisualGroupNode group = new VisualGroupNode("group");
    group.setName("Group 1");
    group.setHighSpectrumColor("red");
    group.setLowSpectrumColor("yellow");
    group.setType("group");
   
    VisualGroupElementNode soma = new VisualGroupElementNode("soma");
    soma.setDefaultColor("orange");
    PhysicalQuantity quantity = new PhysicalQuantity();
    quantity.setScalingFactor("ms");
    quantity.setValue(new DoubleValue(12));
    soma.setParameter(quantity);
   
    VisualGroupElementNode synapse = new VisualGroupElementNode("synapse");
    synapse.setDefaultColor("orange");
    PhysicalQuantity quantity2 = new PhysicalQuantity();
    quantity2.setScalingFactor("ms");
    quantity2.setValue(new DoubleValue(12));
    synapse.setParameter(quantity2);
   
    group.getVisualGroupElements().add(soma);
    group.getVisualGroupElements().add(synapse);
   
    visualization.addChild(group);
   
    SerializeTreeVisitor visitor = new SerializeTreeVisitor();
    runtime.apply(visitor);
    String serialized = visitor.getSerializedTree();
    System.out.println(serialized);
View Full Code Here

Examples of org.geppetto.core.model.runtime.AspectSubTreeNode

    EntityNode purkinje = new EntityNode("purkinje");

    AspectNode electrical = new AspectNode("electrical");
    AspectNode electrical2 = new AspectNode("electrical");

    AspectSubTreeNode visualization = new AspectSubTreeNode(
        AspectTreeType.VISUALIZATION_TREE);

    SphereNode sphere = new SphereNode("purkinje");
    visualization.addChild(sphere);

    runtime.addChild(hhcell);
    runtime.addChild(purkinje);
    hhcell.getAspects().add(electrical);
    purkinje.getAspects().add(electrical2);
View Full Code Here

Examples of org.geppetto.core.model.runtime.AspectSubTreeNode

    AspectNode aspectC = new AspectNode("Aspect3");
    aspectB.setId("123");
    aspectB.setSimulator(sim);
    aspectB.setModelInterpreter(modelInt);

    AspectSubTreeNode model = new AspectSubTreeNode(
        AspectTreeType.MODEL_TREE);
    model.setModified(true);

    DynamicsSpecificationNode dynamics = new DynamicsSpecificationNode(
        "Dynamics");

    PhysicalQuantity value = new PhysicalQuantity();
    value.setScalingFactor("10");
    value.setUnit("ms");
    value.setValue(new DoubleValue(10));
    dynamics.setInitialConditions(value);

    FunctionNode function = new FunctionNode("Function");
    function.setExpression("y=x+2");
    List<String> argumentsF = new ArrayList<String>();
    argumentsF.add("1");
    argumentsF.add("2");
    function.setArgument(argumentsF);

    dynamics.setDynamics(function);

    ParameterSpecificationNode parameter = new ParameterSpecificationNode(
        "Parameter");

    PhysicalQuantity value1 = new PhysicalQuantity();
    value1.setScalingFactor("10");
    value1.setUnit("ms");
    value1.setValue(new DoubleValue(10));

    parameter.setValue(value1);

    FunctionNode functionNode = new FunctionNode("FunctionNode");
    functionNode.setExpression("y=x^2");
    List<String> arguments = new ArrayList<String>();
    arguments.add("1");
    functionNode.setArgument(arguments);

    AspectSubTreeNode visualization = new AspectSubTreeNode(
        AspectTreeType.VISUALIZATION_TREE);
    visualization.setModified(true);

    SphereNode sphere = new SphereNode("sphere");
    Point p = new Point();
    p.setX(new Double(3.3));
    p.setY(new Double(4));
    p.setZ(new Double(-1.444));
    sphere.setPosition(p);
    sphere.setRadius(new Double(33));

    CylinderNode cylinder = new CylinderNode("cylinder");
    Point p2 = new Point();
    p2.setX(new Double(6.3));
    p2.setY(new Double(8));
    p2.setZ(new Double(-3.999));
    cylinder.setPosition(p2);
    Point p3 = new Point();
    p3.setX(new Double(6.3));
    p3.setY(new Double(8));
    p3.setZ(new Double(-3.999));
    cylinder.setDistal(p3);
    cylinder.setRadiusBottom(new Double(34.55));
    cylinder.setRadiusTop(new Double(34.55));

    CylinderNode cylinder2 = new CylinderNode("cylinder");
    cylinder2.setPosition(p2);
    cylinder2.setDistal(p3);
    cylinder2.setRadiusBottom(new Double(34.55));
    cylinder2.setRadiusTop(new Double(34.55));

    CylinderNode cylinder3 = new CylinderNode("cylinder");
    cylinder3.setPosition(p2);
    cylinder3.setDistal(p3);
    cylinder3.setRadiusBottom(new Double(34.55));
    cylinder3.setRadiusTop(new Double(34.55));

    CylinderNode cylinder4 = new CylinderNode("cylinder");
    cylinder4.setPosition(p2);
    cylinder4.setDistal(p3);
    cylinder4.setRadiusBottom(new Double(34.55));
    cylinder4.setRadiusTop(new Double(34.55));

    CylinderNode cylinder5 = new CylinderNode("cylinder");
    cylinder5.setPosition(p2);
    cylinder5.setDistal(p3);
    cylinder5.setRadiusBottom(new Double(34.55));
    cylinder5.setRadiusTop(new Double(34.55));

    CompositeNode vg = new CompositeNode("vg");
    vg.addChild(sphere);
    vg.addChild(cylinder);
    vg.addChild(cylinder2);
    vg.addChild(cylinder3);
    vg.addChild(cylinder4);
    vg.addChild(cylinder5);

    CompositeNode vg2 = new CompositeNode("vg2");
    vg2.addChild(cylinder);
    vg2.addChild(cylinder2);
    vg2.addChild(cylinder3);
    vg2.addChild(cylinder4);
    vg2.addChild(cylinder5);
    vg2.addChild(sphere);

    AspectSubTreeNode simulation = new AspectSubTreeNode(
        AspectTreeType.WATCH_TREE);
    simulation.setModified(true);

    CompositeNode hhpop = new CompositeNode("hhpop[0]");

    VariableNode v = new VariableNode("v");
    PhysicalQuantity quantity = new PhysicalQuantity();
    quantity.setValue(ValuesFactory.getDoubleValue(20d));

    PhysicalQuantity quantity2 = new PhysicalQuantity();
    quantity2.setValue(ValuesFactory.getDoubleValue(100d));

    v.addPhysicalQuantity(quantity);
    v.addPhysicalQuantity(quantity2);

    ParameterNode a1 = new ParameterNode("a");

    runtimeTree.addChild(entity1);
    runtimeTree.addChild(entity2);
    entity1.addChild(entity2);
    entity2.addChild(entity3);
    entity2.getAspects().add(aspectB);
    entity1.getAspects().add(aspectA);
    entity3.getAspects().add(aspectC);
    aspectC.setParent(entity3);
    aspectB.setParent(entity2);
    aspectA.setParent(entity1);
    aspectA.addChild(model);
    model.addChild(parameter);
    model.addChild(dynamics);
    model.addChild(functionNode);
    model.setModified(false);
    AspectNode parentAspect = ((AspectNode) model.getParent());
    parentAspect.setModified(false);

    aspectA.addChild(visualization);
    visualization.addChild(vg);
    visualization.addChild(vg2);
    visualization.setModified(false);
    parentAspect = ((AspectNode) visualization.getParent());
    parentAspect.setModified(false);

    aspectA.addChild(simulation);
    simulation.addChild(hhpop);
    simulation.setModified(false);
    parentAspect = ((AspectNode) simulation.getParent());
    parentAspect.setModified(false);
    hhpop.addChild(v);
    hhpop.addChild(a1);

    SerializeTreeVisitor visitor = new SerializeTreeVisitor();
View Full Code Here

Examples of org.geppetto.core.model.runtime.AspectSubTreeNode

    AspectNode aspectC = new AspectNode("Aspect3");
    aspectB.setId("123");
    aspectB.setSimulator(sim);
    aspectB.setModelInterpreter(modelInt);

    AspectSubTreeNode model = new AspectSubTreeNode(
        AspectTreeType.MODEL_TREE);
    model.setModified(true);

    DynamicsSpecificationNode dynamics = new DynamicsSpecificationNode(
        "Dynamics");

    PhysicalQuantity value = new PhysicalQuantity();
    value.setScalingFactor("10");
    value.setUnit("ms");
    value.setValue(new DoubleValue(10));
    dynamics.setInitialConditions(value);

    FunctionNode function = new FunctionNode("Function");
    function.setExpression("y=x+2");
    List<String> argumentsF = new ArrayList<String>();
    argumentsF.add("1");
    argumentsF.add("2");
    function.setArgument(argumentsF);

    dynamics.setDynamics(function);

    ParameterSpecificationNode parameter = new ParameterSpecificationNode(
        "Parameter");

    PhysicalQuantity value1 = new PhysicalQuantity();
    value1.setScalingFactor("10");
    value1.setUnit("ms");
    value1.setValue(new DoubleValue(10));

    parameter.setValue(value1);

    FunctionNode functionNode = new FunctionNode("FunctionNode");
    functionNode.setExpression("y=x^2");
    List<String> arguments = new ArrayList<String>();
    arguments.add("1");
    functionNode.setArgument(arguments);

    AspectSubTreeNode visualization = new AspectSubTreeNode(
        AspectTreeType.VISUALIZATION_TREE);
    visualization.setModified(true);

    SphereNode sphere = new SphereNode("sphere");
    Point p = new Point();
    p.setX(new Double(3.3));
    p.setY(new Double(4));
    p.setZ(new Double(-1.444));
    sphere.setPosition(p);
    sphere.setRadius(new Double(33));

    CylinderNode cylinder = new CylinderNode("cylinder");
    Point p2 = new Point();
    p2.setX(new Double(6.3));
    p2.setY(new Double(8));
    p2.setZ(new Double(-3.999));
    cylinder.setPosition(p2);
    Point p3 = new Point();
    p3.setX(new Double(6.3));
    p3.setY(new Double(8));
    p3.setZ(new Double(-3.999));
    cylinder.setDistal(p3);
    cylinder.setRadiusBottom(new Double(34.55));
    cylinder.setRadiusTop(new Double(34.55));

    CylinderNode cylinder2 = new CylinderNode("cylinder");
    cylinder2.setPosition(p2);
    cylinder2.setDistal(p3);
    cylinder2.setRadiusBottom(new Double(34.55));
    cylinder2.setRadiusTop(new Double(34.55));

    CylinderNode cylinder3 = new CylinderNode("cylinder");
    cylinder3.setPosition(p2);
    cylinder3.setDistal(p3);
    cylinder3.setRadiusBottom(new Double(34.55));
    cylinder3.setRadiusTop(new Double(34.55));

    CylinderNode cylinder4 = new CylinderNode("cylinder");
    cylinder4.setPosition(p2);
    cylinder4.setDistal(p3);
    cylinder4.setRadiusBottom(new Double(34.55));
    cylinder4.setRadiusTop(new Double(34.55));

    CylinderNode cylinder5 = new CylinderNode("cylinder");
    cylinder5.setPosition(p2);
    cylinder5.setDistal(p3);
    cylinder5.setRadiusBottom(new Double(34.55));
    cylinder5.setRadiusTop(new Double(34.55));

    CompositeNode vg = new CompositeNode("vg");
    vg.addChild(sphere);
    vg.addChild(cylinder);
    vg.addChild(cylinder2);
    vg.addChild(cylinder3);
    vg.addChild(cylinder4);
    vg.addChild(cylinder5);

    CompositeNode vg2 = new CompositeNode("vg2");
    vg2.addChild(cylinder);
    vg2.addChild(cylinder2);
    vg2.addChild(cylinder3);
    vg2.addChild(cylinder4);
    vg2.addChild(cylinder5);
    vg2.addChild(sphere);

    AspectSubTreeNode simulation = new AspectSubTreeNode(
        AspectTreeType.WATCH_TREE);
    simulation.setModified(true);

    CompositeNode hhpop = new CompositeNode("hhpop[0]");

    VariableNode v = new VariableNode("v");
    PhysicalQuantity quantity = new PhysicalQuantity();
    quantity.setValue(ValuesFactory.getDoubleValue(20d));

    PhysicalQuantity quantity2 = new PhysicalQuantity();
    quantity2.setValue(ValuesFactory.getDoubleValue(100d));

    v.addPhysicalQuantity(quantity);
    v.addPhysicalQuantity(quantity2);

    ParameterNode a1 = new ParameterNode("a");

    runtimeTree.addChild(entity1);
    runtimeTree.addChild(entity4);
    entity1.addChild(entity2);
    entity2.addChild(entity3);
    entity4.addChild(entity5);
    entity2.getAspects().add(aspectB);
    entity1.getAspects().add(aspectA);
    entity3.getAspects().add(aspectC);
    aspectC.setParent(entity3);
    aspectB.setParent(entity2);
    aspectA.setParent(entity1);
    aspectA.addChild(model);
    model.addChild(parameter);
    model.addChild(dynamics);
    model.addChild(functionNode);

    aspectA.addChild(visualization);
    visualization.addChild(vg);
    visualization.addChild(vg2);
    entity5.updateParentEntitiesFlags(true);

    aspectA.addChild(simulation);
    simulation.addChild(hhpop);
    hhpop.addChild(v);
    hhpop.addChild(a1);

    SerializeTreeVisitor visitor = new SerializeTreeVisitor();
    runtimeTree.apply(visitor);
View Full Code Here

Examples of org.geppetto.core.model.runtime.AspectSubTreeNode

    AspectNode aspectC = new AspectNode("Aspect3");
    aspectB.setId("123");
    aspectB.setSimulator(sim);
    aspectB.setModelInterpreter(modelInt);

    AspectSubTreeNode model = new AspectSubTreeNode(
        AspectTreeType.MODEL_TREE);
    model.setModified(true);

    DynamicsSpecificationNode dynamics = new DynamicsSpecificationNode(
        "Dynamics");

    PhysicalQuantity value = new PhysicalQuantity();
    value.setScalingFactor("10");
    value.setUnit("ms");
    value.setValue(new DoubleValue(10));
    dynamics.setInitialConditions(value);

    FunctionNode function = new FunctionNode("Function");
    function.setExpression("y=x+2");
    List<String> argumentsF = new ArrayList<String>();
    argumentsF.add("1");
    argumentsF.add("2");
    function.setArgument(argumentsF);

    dynamics.setDynamics(function);

    ParameterSpecificationNode parameter = new ParameterSpecificationNode(
        "Parameter");

    PhysicalQuantity value1 = new PhysicalQuantity();
    value1.setScalingFactor("10");
    value1.setUnit("ms");
    value1.setValue(new DoubleValue(10));

    parameter.setValue(value1);

    FunctionNode functionNode = new FunctionNode("FunctionNode");
    functionNode.setExpression("y=x^2");
    List<String> arguments = new ArrayList<String>();
    arguments.add("1");
    functionNode.setArgument(arguments);

    AspectSubTreeNode visualization = new AspectSubTreeNode(
        AspectTreeType.VISUALIZATION_TREE);
    visualization.setModified(true);

    SphereNode sphere = new SphereNode("sphere");
    Point p = new Point();
    p.setX(new Double(3.3));
    p.setY(new Double(4));
    p.setZ(new Double(-1.444));
    sphere.setPosition(p);
    sphere.setRadius(new Double(33));

    CylinderNode cylinder = new CylinderNode("cylinder");
    Point p2 = new Point();
    p2.setX(new Double(6.3));
    p2.setY(new Double(8));
    p2.setZ(new Double(-3.999));
    cylinder.setPosition(p2);
    Point p3 = new Point();
    p3.setX(new Double(6.3));
    p3.setY(new Double(8));
    p3.setZ(new Double(-3.999));
    cylinder.setDistal(p3);
    cylinder.setRadiusBottom(new Double(34.55));
    cylinder.setRadiusTop(new Double(34.55));

    CylinderNode cylinder2 = new CylinderNode("cylinder");
    cylinder2.setPosition(p2);
    cylinder2.setDistal(p3);
    cylinder2.setRadiusBottom(new Double(34.55));
    cylinder2.setRadiusTop(new Double(34.55));

    CylinderNode cylinder3 = new CylinderNode("cylinder");
    cylinder3.setPosition(p2);
    cylinder3.setDistal(p3);
    cylinder3.setRadiusBottom(new Double(34.55));
    cylinder3.setRadiusTop(new Double(34.55));

    CylinderNode cylinder4 = new CylinderNode("cylinder");
    cylinder4.setPosition(p2);
    cylinder4.setDistal(p3);
    cylinder4.setRadiusBottom(new Double(34.55));
    cylinder4.setRadiusTop(new Double(34.55));

    CylinderNode cylinder5 = new CylinderNode("cylinder");
    cylinder5.setPosition(p2);
    cylinder5.setDistal(p3);
    cylinder5.setRadiusBottom(new Double(34.55));
    cylinder5.setRadiusTop(new Double(34.55));

    CompositeNode vg = new CompositeNode("vg");
    vg.addChild(sphere);
    vg.addChild(cylinder);
    vg.addChild(cylinder2);
    vg.addChild(cylinder3);
    vg.addChild(cylinder4);
    vg.addChild(cylinder5);

    CompositeNode vg2 = new CompositeNode("vg2");
    vg2.addChild(cylinder);
    vg2.addChild(cylinder2);
    vg2.addChild(cylinder3);
    vg2.addChild(cylinder4);
    vg2.addChild(cylinder5);
    vg2.addChild(sphere);

    AspectSubTreeNode simulation = new AspectSubTreeNode(
        AspectTreeType.WATCH_TREE);
    simulation.setModified(true);

    CompositeNode hhpop = new CompositeNode("hhpop[0]");

    VariableNode v = new VariableNode("v");
    PhysicalQuantity quantity = new PhysicalQuantity();
    quantity.setValue(ValuesFactory.getDoubleValue(20d));

    PhysicalQuantity quantity2 = new PhysicalQuantity();
    quantity2.setValue(ValuesFactory.getDoubleValue(100d));

    v.addPhysicalQuantity(quantity);
    v.addPhysicalQuantity(quantity2);

    ParameterNode a1 = new ParameterNode("a");

    runtimeTree.addChild(entity1);
    runtimeTree.addChild(entity4);
    entity1.addChild(entity2);
    entity2.addChild(entity3);
    entity4.addChild(entity5);
    entity2.getAspects().add(aspectB);
    entity1.getAspects().add(aspectA);
    entity3.getAspects().add(aspectC);
    aspectC.setParent(entity3);
    aspectB.setParent(entity2);
    aspectA.setParent(entity1);
    aspectA.addChild(model);
    model.addChild(parameter);
    model.addChild(dynamics);
    model.addChild(functionNode);

    aspectA.addChild(visualization);
    visualization.addChild(vg);
    visualization.addChild(vg2);

    aspectA.setModified(true);
    aspectB.setModified(true);
    entity2.updateParentEntitiesFlags(true);
    entity5.updateParentEntitiesFlags(true);

    aspectA.addChild(simulation);
    simulation.addChild(hhpop);
    hhpop.addChild(v);
    hhpop.addChild(a1);

    SerializeTreeVisitor visitor = new SerializeTreeVisitor();
    runtimeTree.apply(visitor);
View Full Code Here

Examples of org.geppetto.core.model.runtime.AspectSubTreeNode

    EntityNode entity_A = new EntityNode("Entity_A");

    AspectNode aspect_A = new AspectNode("Aspect_A");

    AspectSubTreeNode simulation = new AspectSubTreeNode(
        AspectTreeType.WATCH_TREE);

    VariableNode dummyNode = new VariableNode("dummyFloat");
    PhysicalQuantity quantity = new PhysicalQuantity();
    quantity.setValue(ValuesFactory.getDoubleValue(50d));
    dummyNode.addPhysicalQuantity(quantity);

    PhysicalQuantity quantity2 = new PhysicalQuantity();
    quantity2.setValue(ValuesFactory.getDoubleValue(100d));
    dummyNode.addPhysicalQuantity(quantity2);

    VariableNode anotherDummyNode = new VariableNode("dummyDouble");

    PhysicalQuantity quantity3 = new PhysicalQuantity();
    quantity3.setValue(ValuesFactory.getDoubleValue(20d));
    anotherDummyNode.addPhysicalQuantity(quantity3);

    PhysicalQuantity quantity4 = new PhysicalQuantity();
    quantity4.setValue(ValuesFactory.getDoubleValue(100d));
    anotherDummyNode.addPhysicalQuantity(quantity4);

    runtime.addChild(entity_A);
    entity_A.getAspects().add(aspect_A);
    aspect_A.setParent(entity_A);
    aspect_A.addChild(simulation);
    simulation.addChild(dummyNode);
    simulation.addChild(anotherDummyNode);

    simulation.setModified(true);
    aspect_A.setModified(true);
    entity_A.setModified(true);

    SerializeTreeVisitor visitor = new SerializeTreeVisitor();
    runtime.apply(visitor);
View Full Code Here

Examples of org.geppetto.core.model.runtime.AspectSubTreeNode

    EntityNode entity_A = new EntityNode("Entity_A");

    AspectNode aspect_A = new AspectNode("Aspect_A");

    AspectSubTreeNode simulation = new AspectSubTreeNode(
        AspectTreeType.WATCH_TREE);

    AValue val = ValuesFactory.getDoubleValue(50d);
    AValue val2 = ValuesFactory.getDoubleValue(100d);

    PhysicalQuantity quantity = new PhysicalQuantity();
    quantity.setValue(val);
    quantity.setUnit("V");
    quantity.setScalingFactor("1.E3");

    PhysicalQuantity quantity2 = new PhysicalQuantity();
    quantity2.setValue(val2);
    quantity2.setScalingFactor("1.E3");
    quantity2.setUnit("V");

    VariableNode dummyNode = new VariableNode("dummyFloat");
    dummyNode.addPhysicalQuantity(quantity);
    dummyNode.addPhysicalQuantity(quantity2);

    VariableNode anotherDummyNode = new VariableNode("dummyDouble");

    AValue val3 = ValuesFactory.getDoubleValue(50d);
    AValue val4 = ValuesFactory.getDoubleValue(100d);

    PhysicalQuantity quantity3 = new PhysicalQuantity();
    quantity3.setValue(val3);
    quantity3.setUnit("mV");
    quantity3.setScalingFactor("1.E3");

    PhysicalQuantity quantity4 = new PhysicalQuantity();
    quantity4.setValue(val4);
    quantity4.setScalingFactor("1.E3");
    quantity4.setUnit("mV");

    anotherDummyNode.addPhysicalQuantity(quantity3);
    anotherDummyNode.addPhysicalQuantity(quantity4);

    runtime.addChild(entity_A);
    entity_A.getAspects().add(aspect_A);
    aspect_A.setParent(entity_A);
    aspect_A.addChild(simulation);
    simulation.addChild(dummyNode);
    simulation.addChild(anotherDummyNode);

    simulation.setModified(true);
    aspect_A.setModified(true);
    entity_A.setModified(true);

    SerializeTreeVisitor visitor = new SerializeTreeVisitor();
    runtime.apply(visitor);
View Full Code Here

Examples of org.geppetto.core.model.runtime.AspectSubTreeNode

    EntityNode hhcell = new EntityNode("hhcell");

    AspectNode electrical = new AspectNode("electrical");

    AspectSubTreeNode visualization = new AspectSubTreeNode(
        AspectTreeType.VISUALIZATION_TREE);

    SphereNode sphere = new SphereNode("hhcell");
    visualization.addChild(sphere);

    AspectSubTreeNode simulation = new AspectSubTreeNode(
        AspectTreeType.WATCH_TREE);

    CompositeNode hhpop = new CompositeNode("hhpop[0]");
    CompositeNode bio = new CompositeNode("bioPhys1");
    CompositeNode membrane = new CompositeNode("membraneProperties");
    CompositeNode naChans = new CompositeNode("naChans");
    CompositeNode na = new CompositeNode("na");
    CompositeNode m = new CompositeNode("m");

    VariableNode v = new VariableNode("v");
    PhysicalQuantity quantity = new PhysicalQuantity();
    quantity.setValue(ValuesFactory.getDoubleValue(20d));

    PhysicalQuantity quantity2 = new PhysicalQuantity();
    quantity2.setValue(ValuesFactory.getDoubleValue(100d));

    VariableNode spiking = new VariableNode("spiking");

    VariableNode q = new VariableNode("q");

    v.addPhysicalQuantity(quantity);
    v.addPhysicalQuantity(quantity2);

    spiking.addPhysicalQuantity(quantity);
    q.addPhysicalQuantity(quantity);

    simulation.addChild(hhpop);
    hhpop.addChild(v);
    hhpop.addChild(spiking);
    hhpop.addChild(bio);
    bio.addChild(membrane);
    membrane.addChild(naChans);
    naChans.addChild(na);
    na.addChild(m);
    m.addChild(q);

    runtime.addChild(hhcell);
    hhcell.getAspects().add(electrical);
    electrical.setParent(hhcell);
    electrical.addChild(simulation);

    simulation.setModified(true);
    electrical.setModified(true);
    electrical.setModified(true);

    SerializeTreeVisitor visitor = new SerializeTreeVisitor();
    runtime.apply(visitor);
View Full Code Here

Examples of org.geppetto.core.model.runtime.AspectSubTreeNode

    EntityNode small = new EntityNode("small");

    AspectNode fluid = new AspectNode("fluid");

    AspectSubTreeNode visualization = new AspectSubTreeNode(
        AspectTreeType.VISUALIZATION_TREE);

    CompositeNode elastic = new CompositeNode("Elastic");
    CompositeNode liquid = new CompositeNode("Liquid");
    CompositeNode boundary = new CompositeNode("Boundary");

    ParticleNode p0 = new ParticleNode("p[0]");
    ParticleNode p1 = new ParticleNode("p[1]");
    ParticleNode p2 = new ParticleNode("p[2]");

    visualization.addChild(elastic);
    visualization.addChild(liquid);
    visualization.addChild(boundary);

    fluid.addChild(visualization);
    visualization.setModified(true);

    liquid.addChild(p0);
    liquid.addChild(p1);
    liquid.addChild(p2);

    AspectSubTreeNode simulation = new AspectSubTreeNode(
        AspectTreeType.WATCH_TREE);

    // CompositeNode dummyNode0 = new CompositeNode("particle[0]");
    CompositeNode particle = new CompositeNode("particle[1]");
    CompositeNode position = new CompositeNode("position");

    VariableNode anotherDummyNode0 = new VariableNode("v");
    PhysicalQuantity quantity = new PhysicalQuantity();
    quantity.setValue(ValuesFactory.getDoubleValue(20d));

    PhysicalQuantity quantity2 = new PhysicalQuantity();
    quantity2.setValue(ValuesFactory.getDoubleValue(100d));

    anotherDummyNode0.addPhysicalQuantity(quantity);
    anotherDummyNode0.addPhysicalQuantity(quantity2);

    VariableNode anotherDummyNode1 = new VariableNode("v");
    PhysicalQuantity quantity3 = new PhysicalQuantity();
    quantity3.setValue(ValuesFactory.getDoubleValue(55d));

    PhysicalQuantity quantity4 = new PhysicalQuantity();
    quantity4.setValue(ValuesFactory.getDoubleValue(65d));

    anotherDummyNode1.addPhysicalQuantity(quantity3);
    anotherDummyNode1.addPhysicalQuantity(quantity4);

    simulation.addChild(particle);
    particle.addChild(position);
    position.addChild(anotherDummyNode1);

    runtime.addChild(small);
    small.getAspects().add(fluid);
    fluid.setParent(small);
    fluid.addChild(simulation);

    simulation.setModified(true);
    fluid.setModified(true);
    small.updateParentEntitiesFlags(true);

    SerializeTreeVisitor visitor = new SerializeTreeVisitor();
    runtime.apply(visitor);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.