Examples of Simulation


Examples of org.openpixi.pixi.physics.Simulation

    defaultSettings.setParticleSolver(new LeapFrog());
                defaultSettings.setInterpolator(new ChargeConservingCIC());
                defaultSettings.setOCLParticleSolver("leap frog");
                defaultSettings.setOCLGridInterpolator("charge conserving CIC");
               
    Simulation sequentialSimulation = new Simulation(defaultSettings);

    Settings openCLSettings = ClassCopier.copy(defaultSettings);
    Simulation openCLSimulation = new Simulation(openCLSettings);

    sequentialSimulation.run();
    openCLSimulation.run();

    ParticleComparator comparator = new ParticleComparator();
    comparator.compare(sequentialSimulation.particles, openCLSimulation.particles);
  }
View Full Code Here

Examples of org.openpixi.pixi.physics.Simulation

  private static void compareResult(Settings stt, Node n, String testName) {
    if (n.isMaster()) {
      System.out.println("Comparing result of " + testName + " test");

      Simulation localSimulation = new Simulation(stt);
      localSimulation.run();

      Master master = n.getMaster();
      ResultsComparator comparator = new ResultsComparator();
      comparator.compare(
          localSimulation.particles, master.getFinalParticles(),
View Full Code Here

Examples of org.openpixi.pixi.physics.Simulation

    stt.setGridCellsX(100);
    stt.setGridCellsY(100);
    stt.setGridSolver(new SimpleSolver());
    stt.setInterpolator(new ChargeConservingCIC());

    this.s = new Simulation(stt);
    this.g = s.grid;
    g.resetCurrent();
   
    this.poisolver = new PoissonSolverFFTPeriodic();
  }
View Full Code Here

Examples of org.openpixi.pixi.physics.Simulation

    stt.setGridCellsX(100);
    stt.setGridCellsY(100);
    stt.setGridSolver(new SimpleSolver());
    stt.setInterpolator(new ChargeConservingCIC());

    Simulation s = new Simulation(stt);
    PoissonSolverCalculations.output(s.grid);
  }
View Full Code Here

Examples of org.openpixi.pixi.physics.Simulation

    p.setVy((y2 - y1) / stt.getTimeStep());
    p.setMass(1);
    p.setCharge(charge);
    stt.addParticle(p);

    Simulation s = new Simulation(stt);
    s.prepareAllParticles();

    // Advance particle
    s.particlePush();

    // The simulation always creates its own copy of particles
    // (in fact the setting class does so)
    // and we would like to obtain the reference to our initial particle p.
    p = s.particles.get(0);

    //Remember old values after boundary check
    double sx = p.getPrevX();
    double sy = p.getPrevY();

    // Calculate current
    s.getInterpolation().interpolateToGrid(s.particles, s.grid, s.tstep);

    double jx = GridTestCommon.getJxSum(s.grid);
    double jy = GridTestCommon.getJySum(s.grid);

    if (VERBOSE) System.out.println("Total current " + text + ": jx = " + jx + ", jy = " + jy
View Full Code Here

Examples of presage.Simulation

    events();

    Logger.getLogger("presage.Simulation").setLevel(Level.SEVERE);
    Logger.getLogger("gameoflife.AbstractAgent").setLevel(Level.SEVERE);

    Simulation simulation = new Simulation
        (presageConfig, agents, environment, pluginManager, scriptManager);
    synchronized(simulation)
    {
      simulation.play();
      simulation.wait();
    }
  }
View Full Code Here

Examples of se.sics.cooja.Simulation

   *
   * @param arguments Command arguments
   * @return Reply to client (XML format)
   */
  private String createSimulation(Collection<Element> arguments) {
    Simulation simulation = new Simulation(myGUI);
    simulation.setTitle("[chakana - no title]");
    simulation.setDelayTime(0);
    simulation.setSimulationTime(0);
    simulation.setTickTime(1);

    try {
      RadioMedium radioMedium = RadioMedium.generateRadioMedium(UDGM.class,
          simulation);
      simulation.setRadioMedium(radioMedium);
    } catch (Exception e) {
      return createErrorMessage("Create simulation: Could not create radio medium: " + e.getMessage());
    }

    // Let simulation parse command arguments
    myGUI.setSimulation(simulation);
    try {
      boolean success = simulation.setConfigXML(arguments, false);
    } catch (Exception e) {
      logger.fatal("Error when configuring simulation: " + e);
      if (DEBUG_OUTPUT) {
        if (e instanceof MoteTypeCreationException) {
          MessageList compilationOutput = ((MoteTypeCreationException) e).getCompilationOutput();
View Full Code Here

Examples of se.sics.cooja.Simulation

   *
   * @param arguments Command arguments
   * @return Reply to client (XML format)
   */
  private String configureSimulation(Collection<Element> arguments) {
    Simulation simulation = myGUI.getSimulation();

    // Let simulation parse command arguments
    try {
      simulation.setConfigXML(arguments, false);
    } catch (Exception e) {
      logger.fatal("Error when configuring simulation: " + e);
      e.printStackTrace();
      return createErrorMessage("Could not configure simulation: " + e.getMessage());
    }
View Full Code Here

Examples of se.sics.cooja.Simulation

   *
   * @param arguments Command arguments
   * @return Reply to client (XML format)
   */
  private String configurePlugins(Collection<Element> arguments) {
    Simulation simulation = myGUI.getSimulation();

    // Let GUI parse command arguments
    try {
      myGUI.setPluginsConfigXML(arguments, simulation, false);
    } catch (Exception e) {
View Full Code Here

Examples of se.sics.cooja.Simulation

   *
   * @param arguments Command arguments
   * @return Reply to client (XML format)
   */
  private String readMemory(Collection<Element> arguments) {
    Simulation simulation = myGUI.getSimulation();

    String type = null;
    String mote = null;
    String variable = null;
    String size = null;
    String address = null;

    for (Element element : arguments) {
      if (element.getName().equals(XML_TYPE_NAME)) {
        type = element.getText();
      } else if (element.getName().equals(XML_MOTE_NAME)) {
        mote = element.getText();
      } else if (element.getName().equals(XML_VARIABLE_NAME)) {
        variable = element.getText();
      } else if (element.getName().equals(XML_SIZE_NAME)) {
        size = element.getText();
      } else if (element.getName().equals(XML_ADDRESS_NAME)) {
        address = element.getText();
      } else {
        return createErrorMessage("Unknown read memory parameter: " + element.getName());
      }
    }

    if (type == null)
      return createErrorMessage("No read memory type specified");
    if (mote == null)
      return createErrorMessage("No mote specified");
    if (mote == null)
      return createErrorMessage("No mote ID specified");
    int moteNr = Integer.parseInt(mote);
    if (moteNr < 0 || simulation.getMotesCount() <= moteNr) {
      return createErrorMessage("Bad mote ID specified: " + moteNr);
    }
    MoteMemory memory = simulation.getMote(moteNr).getMemory();
   
    // Read integer variable
    if (type.equals("int")) {
      if (variable == null)
        return createErrorMessage("No variable name specified");
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.