Package jmt.analytical

Examples of jmt.analytical.SolverDispatcher$SolverListener


  private ProgressWindow progress;
 
  private JSimLogger logger = JSimLogger.getLogger(SolverClient.class);

  public SolverClient(Frame owner) {
    solver = new SolverDispatcher();
    xmlUtils = new XMLUtils();
    this.owner = owner;
  }
View Full Code Here


    // Checks for exceptions
    if (solverThread.getOutOfMemoryError() != null) {
      solver = null;
      System.gc();
      solver = new SolverDispatcher();
      throw solverThread.getOutOfMemoryError();
    }
    if (solverThread.getInputException() != null) {
      progress.kill();
      throw solverThread.getInputException();
View Full Code Here

      if (!model.isFile()) {
        System.err.print("Invalid model file: " + model.getAbsolutePath());
        System.exit(1);
      }

      SolverDispatcher dispatcher = new SolverDispatcher();
     
      // Starts the solution
      dispatcher.solve(model);
      copyFile(model, result);     

    } else if(args[0].equals("sim")){
      Map<String,String> options = parseParameters(args, 2);
     
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      DocumentBuilder db = dbf.newDocumentBuilder();
     
      File model = new File(args[1]);
      if (!model.isFile()) {
        System.err.print("Model file not found: " + model.getAbsolutePath());
        System.exit(1);
      }
      System.out.println(model.getName());
     
      File temp = File.createTempFile("tempfileSim",".jsim");
      temp.deleteOnExit();
     
     
      Document doc = db.parse(model);
      Element sim = XMLArchiver.getSimFromArchiveDocument(doc);
     
      Document doc2 = db.newDocument();
      Node dup = doc2.importNode(sim, true);
      NamedNodeMap attributes = dup.getAttributes();
      attributes.removeNamedItem("xsi:noNamespaceSchemaLocation");
      doc2.appendChild(dup);
     
      /*
       * save to a temp file
       */
      TransformerFactory tranFactory = TransformerFactory.newInstance()
      Transformer aTransformer = tranFactory.newTransformer()
      Source src = new DOMSource(doc2)
      Result dest = new StreamResult(temp)
      aTransformer.transform(src, dest)
     
      Dispatcher_jSIMschema dispatcher = new Dispatcher_jSIMschema(temp);
      // Sets simulation seed if required
      if (options.containsKey(OPTION_SEED)) {
        try {
          dispatcher.setSimulationSeed(Long.parseLong(options.get(OPTION_SEED)));
        } catch (NumberFormatException ex) {
          System.err.println("Invalid simulation seed. Should be a number.");
          System.exit(1);
        }
      }
     
      if (options.containsKey(OPTION_MAXTIME)) {
        try {
          dispatcher.setSimulationMaxDuration(Long.parseLong(options.get(OPTION_MAXTIME)) * 1000);
        } catch (NumberFormatException ex) {
          System.err.println("Invalid maximum simulation time. Should be a number.");
          System.exit(1);
       
      }
     
      // Starts the simulation
      dispatcher.solveModel();
     
      File output = dispatcher.getOutputFile();
     
      File result = new File(args[1]+"-result.jsim");
     
      copyFile(output, result);
      output.delete();
View Full Code Here

    if (!model.isFile()) {
      System.err.print("Invalid model file: " + model.getAbsolutePath());
      System.exit(1);
    }

    SolverDispatcher dispatcher = new SolverDispatcher();
   
    // Starts the solution
    dispatcher.solve(model);
   
    System.out.println("Solution results stored in input file: " + model.getAbsolutePath());
  }
View Full Code Here

*/
public class TestExact {

  public static void Test1() {

    SolverDispatcher sd = new SolverDispatcher();
    String path = "D://provaLD.xml";
    File fileXML = new File(path);
    try {
      sd.solve(fileXML);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return;

View Full Code Here

TOP

Related Classes of jmt.analytical.SolverDispatcher$SolverListener

Copyright © 2018 www.massapicom. 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.