Java.generateFortran
Class GenerateFortran

java.lang.Object
  extended by Java.generateFortran.GenerateFortran

public class GenerateFortran
extends java.lang.Object

Generates the Fortan program

Since:
1.0

Constructor Summary
GenerateFortran(java.lang.String dir, Problem p)
          Generates the Fortan program in directory for a certain problem
 
Method Summary
static java.lang.String adaptEquationToParaest(java.lang.String ein, ReactionType r)
          Adapt an equation to the Fortran parameter estimation routine
static java.lang.String adaptEquationToSim(java.lang.String ein, ReactionType r)
          Adapt an equation to the Fortran simulation routine
static java.lang.String adaptEquationToSimSingle(java.lang.String ein, ReactionType r, int ivar)
          Adapt an equation to the Fortran routine for simulation of a single variable
static java.lang.String fixExponent(double d)
          Java double to Fortran double, replace E by d, or add d0 at end
 void generate(Problem p, java.lang.String fromDirectory, java.lang.String toDirectory)
          Generate Fortran files that are based on code skeletons in files
static void prettyPrint(java.io.BufferedWriter out, java.lang.String s, int indent)
          Pretty printout in Fortran program, no line number in column 1-6
static void prettyPrint(java.io.BufferedWriter out, java.lang.String s, int indent, int linenumber)
          Pretty printout in Fortran program
static void printExperimentDefinition(java.io.BufferedWriter out, boolean include_edata2, boolean include_spline, boolean include_useip)
          Print definition for the experiments in Fortran program
static void printMaxDefinition(java.io.BufferedWriter out, Problem p)
          Print max sizes of arrays in Fortran program
static void printModelDefinition(java.io.BufferedWriter out, boolean include_modkinit)
          Print model definition in Fortran program
static void printTempModelDefinition(java.io.BufferedWriter out, boolean include_modkinit)
          Print definition for temporary model variables in Fortran program
static void printTempModelDefinition2(java.io.BufferedWriter out, boolean include_modkinit)
          Print definition for second temporary model variables in Fortran program
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenerateFortran

public GenerateFortran(java.lang.String dir,
                       Problem p)
Generates the Fortan program in directory for a certain problem

Parameters:
dir - the directory
p - the problem
Method Detail

printMaxDefinition

public static void printMaxDefinition(java.io.BufferedWriter out,
                                      Problem p)
                               throws java.io.IOException
Print max sizes of arrays in Fortran program

Parameters:
out - bufferedWriter to write in
p - the problem
Throws:
java.io.IOException

printModelDefinition

public static void printModelDefinition(java.io.BufferedWriter out,
                                        boolean include_modkinit)
                                 throws java.io.IOException
Print model definition in Fortran program

Parameters:
out - bufferedWriter to write in
include_modkinit - true if initial values are parameters, otherwise false
Throws:
java.io.IOException

printTempModelDefinition

public static void printTempModelDefinition(java.io.BufferedWriter out,
                                            boolean include_modkinit)
                                     throws java.io.IOException
Print definition for temporary model variables in Fortran program

Parameters:
out - bufferedWriter to write in
include_modkinit - true if initial values are parameters, otherwise false
Throws:
java.io.IOException

printTempModelDefinition2

public static void printTempModelDefinition2(java.io.BufferedWriter out,
                                             boolean include_modkinit)
                                      throws java.io.IOException
Print definition for second temporary model variables in Fortran program

Parameters:
out - bufferedWriter to write in
include_modkinit - true if initial values are parameters, otherwise false
Throws:
java.io.IOException

printExperimentDefinition

public static void printExperimentDefinition(java.io.BufferedWriter out,
                                             boolean include_edata2,
                                             boolean include_spline,
                                             boolean include_useip)
                                      throws java.io.IOException
Print definition for the experiments in Fortran program

Parameters:
out - bufferedWriter to write in
include_edata2 - true if the variable edata2 is included, otherwise false
include_spline - true if the variable spline is included, otherwise false
include_useip - true if the variable useip is included, otherwise false
Throws:
java.io.IOException

prettyPrint

public static void prettyPrint(java.io.BufferedWriter out,
                               java.lang.String s,
                               int indent)
                        throws java.io.IOException
Pretty printout in Fortran program, no line number in column 1-6

Parameters:
out - bufferedWriter to write in
s - the String to write
indent - number of indented columns
Throws:
java.io.IOException

prettyPrint

public static void prettyPrint(java.io.BufferedWriter out,
                               java.lang.String s,
                               int indent,
                               int linenumber)
                        throws java.io.IOException
Pretty printout in Fortran program

Parameters:
out - bufferedWriter to write in
s - the String to write
indent - number of indented columns
linenumber - line number in column 1-6
Throws:
java.io.IOException

fixExponent

public static java.lang.String fixExponent(double d)
Java double to Fortran double, replace E by d, or add d0 at end

Parameters:
d - the input real number of Java type double
Returns:
a String representing the modfied number

adaptEquationToParaest

public static java.lang.String adaptEquationToParaest(java.lang.String ein,
                                                      ReactionType r)
Adapt an equation to the Fortran parameter estimation routine

Parameters:
ein - a String representing the equation of a certain reaction type
r - the current Reaction type
Returns:
a String representing the modfied equation

adaptEquationToSim

public static java.lang.String adaptEquationToSim(java.lang.String ein,
                                                  ReactionType r)
Adapt an equation to the Fortran simulation routine

Parameters:
ein - a String representing the equation of a certain reaction type
r - the current Reaction type
Returns:
a String representing the modfied equation

adaptEquationToSimSingle

public static java.lang.String adaptEquationToSimSingle(java.lang.String ein,
                                                        ReactionType r,
                                                        int ivar)
Adapt an equation to the Fortran routine for simulation of a single variable

Parameters:
ein - a String representing the equation of a certain reaction type
r - the current Reaction type
Returns:
a String representing the modfied equation

generate

public void generate(Problem p,
                     java.lang.String fromDirectory,
                     java.lang.String toDirectory)
Generate Fortran files that are based on code skeletons in files

Parameters:
p - the problem
fromDirectory - directory of code skeletons
toDirectory - directory of generated code