Exemplo n.º 1
0
 /** Constructor */
 CUP$GMP2OPTParser$actions(GMP2OPTParser parser) throws IOException {
   this.parser = parser;
   // temp1 = new ParseGSCF2(Settings.defaultDirStr +
   temp1 = new ParseGSCF2(Env.getApplicationDataDir() + Settings.fileSeparator + "Energy_data");
   // temp2 = new ParseGSCF2(Settings.defaultDirStr +
   temp2 = new ParseGSCF2(Env.getApplicationDataDir() + Settings.fileSeparator + "temporary2");
   // temp3 = new ParseGSCF2(Settings.defaultDirStr +
   temp3 = new ParseGSCF2(Env.getApplicationDataDir() + Settings.fileSeparator + "temporary3");
   temp1.putField("TitleText: Energy versus Iteration" + " - " + JobPanel.jobName + "\n");
   temp1.putField("XLabel: Iteration\n YLabel: Energy\n");
   temp1.putField("DataSet: Energy\n");
   temp1.putField("1, ");
   temp2.putField("TitleText: Gradient versus Iteration" + " - " + JobPanel.jobName + "\n");
   temp2.putField("XLabel: Iteration\n YLabel: Maximum Gradient\n");
   temp2.putField("DataSet: Maximum Gradient\n");
   temp3.putField("\n\n");
   temp3.putField("XLabel: Iteration\n YLabel: RMS Gradient\n");
   temp3.putField("DataSet: RMS Gradient\n");
 }
Exemplo n.º 2
0
  /** Method with the actual generated action code. */
  public final java_cup.runtime.Symbol CUP$GMP2OPTParser$do_action(
      int CUP$GMP2OPTParser$act_num,
      java_cup.runtime.lr_parser CUP$GMP2OPTParser$parser,
      java.util.Stack CUP$GMP2OPTParser$stack,
      int CUP$GMP2OPTParser$top)
      throws java.lang.Exception {
    /* Symbol object for return from actions */
    java_cup.runtime.Symbol CUP$GMP2OPTParser$result;

    /* select the action based on the action number */
    switch (CUP$GMP2OPTParser$act_num) {
        /*. . . . . . . . . . . . . . . . . . . .*/
      case 10: // grad2 ::= RmsGrad RGRAD
        {
          Object RESULT = null;
          int rgleft =
              ((java_cup.runtime.Symbol)
                      CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                  .left;
          int rgright =
              ((java_cup.runtime.Symbol)
                      CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                  .right;
          Float rg =
              (Float)
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                      .value;
          // ___________________________________________________________________
          if (DEBUG) System.out.println("CUP:gopt: RMS Force " + rg);
          float rms = rg.floatValue();
          temp3.putField(rms);

          CUP$GMP2OPTParser$result =
              new java_cup.runtime.Symbol(
                  7 /*grad2*/,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 1))
                      .left,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                      .right,
                  RESULT);
        }
        return CUP$GMP2OPTParser$result;

        /*. . . . . . . . . . . . . . . . . . . .*/
      case 9: // grad1 ::= MaxGrad MGRAD
        {
          Object RESULT = null;
          int mgleft =
              ((java_cup.runtime.Symbol)
                      CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                  .left;
          int mgright =
              ((java_cup.runtime.Symbol)
                      CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                  .right;
          Float mg =
              (Float)
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                      .value;
          // ___________________________________________________________________
          if (DEBUG) System.out.println("CUP:gopt: Maximum Force " + mg);
          float maxim = mg.floatValue();
          temp2.putField(maxim);

          CUP$GMP2OPTParser$result =
              new java_cup.runtime.Symbol(
                  6 /*grad1*/,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 1))
                      .left,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                      .right,
                  RESULT);
        }
        return CUP$GMP2OPTParser$result;

        /*. . . . . . . . . . . . . . . . . . . .*/
      case 8: // cycle ::= NSearch ITERATION NT$1 grad1 grad2
        {
          Object RESULT = null;
          // propagate RESULT from NT$1
          if (((java_cup.runtime.Symbol)
                      CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 2))
                  .value
              != null)
            RESULT =
                (Object)
                    ((java_cup.runtime.Symbol)
                            CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 2))
                        .value;
          int cleft =
              ((java_cup.runtime.Symbol)
                      CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 3))
                  .left;
          int cright =
              ((java_cup.runtime.Symbol)
                      CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 3))
                  .right;
          Integer c =
              (Integer)
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 3))
                      .value;

          CUP$GMP2OPTParser$result =
              new java_cup.runtime.Symbol(
                  5 /*cycle*/,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 4))
                      .left,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                      .right,
                  RESULT);
        }
        return CUP$GMP2OPTParser$result;

        /*. . . . . . . . . . . . . . . . . . . .*/
      case 7: // NT$1 ::=
        {
          Object RESULT = null;
          int cleft =
              ((java_cup.runtime.Symbol)
                      CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                  .left;
          int cright =
              ((java_cup.runtime.Symbol)
                      CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                  .right;
          Integer c =
              (Integer)
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                      .value;
          // ___________________________________________________________________
          if (DEBUG) System.out.println("CUP:gopt:  ITERATION " + c);
          int cycl = c.intValue();
          temp1.putField(cycl + 1);
          temp1.putField(", ");
          temp2.putField(cycl);
          temp2.putField(", ");
          temp3.putField(cycl);
          temp3.putField(", ");
          CUP$GMP2OPTParser$result =
              new java_cup.runtime.Symbol(
                  9 /*NT$1*/,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                      .right,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                      .right,
                  RESULT);
        }
        return CUP$GMP2OPTParser$result;

        /*. . . . . . . . . . . . . . . . . . . .*/
      case 6: // scfcycle ::= Energ ENERGY NT$0 cycle
        {
          Object RESULT = null;
          // propagate RESULT from NT$0
          if (((java_cup.runtime.Symbol)
                      CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 1))
                  .value
              != null)
            RESULT =
                (Object)
                    ((java_cup.runtime.Symbol)
                            CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 1))
                        .value;
          int eleft =
              ((java_cup.runtime.Symbol)
                      CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 2))
                  .left;
          int eright =
              ((java_cup.runtime.Symbol)
                      CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 2))
                  .right;
          Float e =
              (Float)
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 2))
                      .value;

          CUP$GMP2OPTParser$result =
              new java_cup.runtime.Symbol(
                  4 /*scfcycle*/,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 3))
                      .left,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                      .right,
                  RESULT);
        }
        return CUP$GMP2OPTParser$result;

        /*. . . . . . . . . . . . . . . . . . . .*/
      case 5: // NT$0 ::=
        {
          Object RESULT = null;
          int eleft =
              ((java_cup.runtime.Symbol)
                      CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                  .left;
          int eright =
              ((java_cup.runtime.Symbol)
                      CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                  .right;
          Float e =
              (Float)
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                      .value;
          // ___________________________________________________________________
          if (DEBUG) System.out.println("CUP:gopt:  ENERGY " + e);
          float energ = e.floatValue();
          energ = 100 * energ;
          temp1.putField(energ);

          CUP$GMP2OPTParser$result =
              new java_cup.runtime.Symbol(
                  8 /*NT$0*/,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                      .right,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                      .right,
                  RESULT);
        }
        return CUP$GMP2OPTParser$result;

        /*. . . . . . . . . . . . . . . . . . . .*/
      case 4: // scfpat ::= scfcycle
        {
          Object RESULT = null;

          CUP$GMP2OPTParser$result =
              new java_cup.runtime.Symbol(
                  3 /*scfpat*/,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                      .left,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                      .right,
                  RESULT);
        }
        return CUP$GMP2OPTParser$result;

        /*. . . . . . . . . . . . . . . . . . . .*/
      case 3: // scfpat ::= scfpat scfcycle
        {
          Object RESULT = null;
          if (DEBUG) System.out.println("CUP:gopt: in scfpat");
          CUP$GMP2OPTParser$result =
              new java_cup.runtime.Symbol(
                  3 /*scfpat*/,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 1))
                      .left,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                      .right,
                  RESULT);
        }
        return CUP$GMP2OPTParser$result;

        /*. . . . . . . . . . . . . . . . . . . .*/
      case 2: // scfintro ::= FOUNDITER
        {
          Object RESULT = null;
          if (DEBUG) System.out.println("CUP:gopt:  found the start of Iteration");
          CUP$GMP2OPTParser$result =
              new java_cup.runtime.Symbol(
                  2 /*scfintro*/,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                      .left,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                      .right,
                  RESULT);
        }
        return CUP$GMP2OPTParser$result;

        /*. . . . . . . . . . . . . . . . . . . .*/
      case 1: // $START ::= startpt EOF
        {
          Object RESULT = null;
          int start_valleft =
              ((java_cup.runtime.Symbol)
                      CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 1))
                  .left;
          int start_valright =
              ((java_cup.runtime.Symbol)
                      CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 1))
                  .right;
          Object start_val =
              (Object)
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 1))
                      .value;
          RESULT = start_val;
          CUP$GMP2OPTParser$result =
              new java_cup.runtime.Symbol(
                  0 /*$START*/,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 1))
                      .left,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                      .right,
                  RESULT);
        }
        /* ACCEPT */
        CUP$GMP2OPTParser$parser.done_parsing();
        return CUP$GMP2OPTParser$result;

        /*. . . . . . . . . . . . . . . . . . . .*/
      case 0: // startpt ::= scfintro scfpat SCFDONE
        {
          Object RESULT = null;
          if (DEBUG) System.out.println("CUP:gopt:  end of parse tree ");
          table = new JTable();

          //       table = parseSCF.getTable();

          CUP$GMP2OPTParser$result =
              new java_cup.runtime.Symbol(
                  1 /*startpt*/,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 2))
                      .left,
                  ((java_cup.runtime.Symbol)
                          CUP$GMP2OPTParser$stack.elementAt(CUP$GMP2OPTParser$top - 0))
                      .right,
                  RESULT);
        }
        return CUP$GMP2OPTParser$result;

        /* . . . . . .*/
      default:
        throw new Exception("Invalid action number found in internal parse table");
    }
  }