예제 #1
0
  public void generateMainScript(String exampleFilename)
      throws LEMSException, GenerationException, IOException, ModelFeatureSupportException,
          NeuroMLException {

    Lems lems = AppTest.readLemsFileFromExamples(exampleFilename);

    System.out.println("Loaded: " + exampleFilename);

    CWriter cw = new CWriter(lems);

    String code = cw.getMainScript();

    System.out.println(code);

    File cFile = new File(AppTest.getTempDir(), exampleFilename.replaceAll(".xml", ".c"));
    System.out.println("Writing to: " + cFile.getAbsolutePath());

    FileUtil.writeStringToFile(code, cFile);

    assertTrue(cFile.exists());

    File mFile = new File(AppTest.getTempDir(), "Makefile");
    String makefile = cw.getMakefile();
    FileUtil.writeStringToFile(makefile, mFile);
  }
예제 #2
0
  public void generateMainScript(File localFile)
      throws LEMSException, GenerationException, IOException, ModelFeatureSupportException,
          NeuroMLException {

    Lems lems = Utils.readLemsNeuroMLFile(FileUtil.readStringFromFile(localFile)).getLems();

    System.out.println("Loaded from: " + localFile);

    CWriter cw = new CWriter(lems);

    String code = cw.getMainScript();

    System.out.println(code);

    File cFile = new File(AppTest.getTempDir(), localFile.getName().replaceAll(".xml", ".c"));

    FileUtil.writeStringToFile(code, cFile);

    assertTrue(cFile.exists());

    File mFile = new File(AppTest.getTempDir(), "Makefile");
    String makefile = cw.getMakefile();
    FileUtil.writeStringToFile(makefile, mFile);
  }
  public void generateMainScript(String exampleFilename)
      throws LEMSException, IOException, GenerationException, ModelFeatureSupportException,
          NeuroMLException {

    Lems lems = AppTest.readLemsFileFromExamples(exampleFilename);

    System.out.println("Loaded: " + exampleFilename);

    PyNNWriter mw = new PyNNWriter(lems);

    String mod = mw.generateMainScriptAndCellFiles(AppTest.getTempDir());

    for (File genFile : mw.allGeneratedFiles) {
      assertTrue(genFile.exists());
      System.out.println(
          "------------------"
              + genFile.getAbsolutePath()
              + "------------------------------------");
      System.out.println(FileUtil.readStringFromFile(genFile));
    }
  }