opale.ode
Class SEquation

java.lang.Object
  |
  +--opale.tools.OpaleObject
        |
        +--opale.ode.ObjectODE
              |
              +--opale.ode.SEquation
All Implemented Interfaces:
java.lang.Cloneable, Equation

public class SEquation
extends ObjectODE
implements Equation

Permet de construire dynamiquement une équation en définissant les valeurs de son second membre grace à des chaines de caractères. Ces chaines seront interprétées par un parser. Avec cette classe, il faut se limiter à des problèmes de dimension comprise entre 1 et 3 c'est à dire que la fonction vectorielle f est définie sur I x R ou I x R² ou I x R³ ; de plus les variables dans cette fonction seront nommées par t, x, y, z dans leur ordre d'apparition.

Since:
Opale-ODE 0.1

Constructor Summary
SEquation()
           
 
Method Summary
 DVect derivs(double t, DVect x)
          Defines the function of the equation.
 int dim()
          Get the space dimension of the unknown.
 java.lang.String getFunc(int i)
          Returns the string representation of the composante i of the function.
static void main(java.lang.String[] arg)
           
 int readKeyWord(java.lang.String word, java.io.StreamTokenizer f, OpaleSet ode)
          Abstract method to read a key word in a file '*.ode'.
 boolean setFunc(java.lang.String[] f)
          Prend en argument un tableau de chaines de carcatères correspondant aux composantes de la fonction second memebre de l'équation.
 java.lang.String toString()
           
 void write(java.io.PrintWriter f, OpaleSet ode)
          Abstrcat method to write the current object in a stream.
 
Methods inherited from class opale.tools.OpaleObject
clone, getId, read, setId
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SEquation

public SEquation()
Method Detail

setFunc

public boolean setFunc(java.lang.String[] f)
Prend en argument un tableau de chaines de carcatères correspondant aux composantes de la fonction second memebre de l'équation. Ce tableau ne doit pas comporter plus de 3 éléments sinon il est rejeté et la fonction non interprété. Si ce tableau compirte 1 élément alors la chaine de caractères ne doit comporter que les variables t et x ; si il en comporte 2 alors les deux chaines doivent comporter les variables t, x, et y ; si enfin il en comporte 3 alors on peut trouver t, x, y , z comme variables dans la chaine. Dans tous les cas si un problème se produit (mauvaise dimension ou mauvaises variables) la méthode renvoie false.
Parameters:
String[], - le tableau de chaine de caractères définissant les composantes de la fonction second membre.
Returns:
boolean, true si la fonction a pu etre parsé sans problème, false sinon.

getFunc

public java.lang.String getFunc(int i)
Returns the string representation of the composante i of the function.
Parameters:
int - i
Returns:
String

dim

public int dim()
Get the space dimension of the unknown.
Specified by:
dim in interface Equation
Returns:
int, the dimension.

derivs

public DVect derivs(double t,
                    DVect x)
Defines the function of the equation.
Specified by:
derivs in interface Equation
Parameters:
double - t, time parameter (=derivation parameter).
DVect - x, unknown parameters.
Returns:
DVect, the value of the function at the point (t,x).

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

readKeyWord

public int readKeyWord(java.lang.String word,
                       java.io.StreamTokenizer f,
                       OpaleSet ode)
                throws java.io.IOException,
                       InvalidFormatException
Description copied from class: OpaleObject
Abstract method to read a key word in a file '*.ode'.
Overrides:
readKeyWord in class OpaleObject
Following copied from class: opale.tools.OpaleObject
Parameters:
String - s, key word to read.
StreamTokenizer - f, stream to read.
OpaleSet - session, the group of 'Opale' object
Returns:
int, 0 if the key word is correct, -1 otherwise.

write

public void write(java.io.PrintWriter f,
                  OpaleSet ode)
Description copied from class: OpaleObject
Abstrcat method to write the current object in a stream.
Overrides:
write in class OpaleObject
Following copied from class: opale.tools.OpaleObject
Parameters:
printWriter - f, a stream.
OpaleSet - session, the set of 'Opale' object.

main

public static void main(java.lang.String[] arg)