//***********************************************************************************
/** Class to return rhs of differential equations.<br>
* To be subclassed by specific functions, which must provide:
* <UL><LI> a method derivs(double[] x, double t) to return the rhs of the equations
* given x and t
* <LI> an int variable nParameters giving the number of ode parameters
* <LI> the initialization of a[nParamters] and aDefault[nParameters]
* <LI> x[0] giving default initial values of x</UL>
* Optional parameters are:<UL>
* <LI> boolean wrapX true if x-range is to be wrapped
* <LI> double wrapXValue giving value at which x is wrapped if wrapX true
* <LI> boolean wrapY true if y-range is to be wrapped
* <LI> double wrapYValue giving value at which y is wrapped if wrapY true
* <LI> boolean wrapZ true if z-range is to be wrapped
* <LI> double wrapZValue giving value at which z is wrapped if wrapZ true
* <LI> double dt giving the default value of the time step dt
* <LI> double trans giving the default value of the transient trans
* <LI> double ghostTime giving the default value of the time for which the preplot
* is evaluated
* <LI> double poincareSection giving the default value for the Poimcare section
* <LI> String title giving the name of the function to use as a graph title
* </UL>
*/
//***********************************************************************************

public class OdesFunction {


/** number of parameters */
      int nParameters;
/** number of map variables */
      int nVariables;      
/** array giving map paramters */      
      double[] a;
/** array giving default values of map parameters */      
      double[] aDefault; 

      public boolean wrapX=false;
      public double wrapXValue;      

      public boolean wrapY=false;
      public double wrapYValue;      
      
      public boolean wrapZ=false;
      public double wrapZValue;
      
/** the default value of the initial value of x */
      double[] x0;
      
      double dt=0.1;
      double trans=10.;
      double ghostTime=10.;
      double poincareSection=1.;
      
/** the name of the function to use as a graph title */
      String title = "Function";

      OdesFunction(int n) {
            nVariables=n;
      }      
      
//***********************************************************************************
/** Sets the map paramters 
* @param paramters the array of input paramters
*/
//***********************************************************************************      
      public void setParameters(double[] parameters) {
            if(parameters.length < nParameters)
                  System.out.println("Incorrect number of parameters");
            for(int i=0; i<nParameters;i++) a[i]=parameters[i];
      }

//*********************************************************************
/**
* Returns RHS of differential equations
* @param x[] vector of current value of dependent variables
* @param n number of dependent variables in array x[]
* @param t current value of independent variable
* @return n component vector giving derivatives of dependent variables
*/
//*********************************************************************       
      public double[] derivs(double[] x, double t){
           return x;
      }

     
//***********************************************************************************
/** Returnd the number of parameters defining the ode
* @return number of parameters
*/
//***********************************************************************************
     public int getNParameters() {
            return nParameters;
     } 
     
}
