NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Probs with FormularManager

Hi List, hi Curtis,

I have some Problems with the FormulaManager. The following simple program, 
posted to the list by Curtis on Tue Apr 18 10:29:26 2000, doesn't work as 
expected on my platform (SUSE linux 7.0, kernel 2.2.16):


// Eval.java

import java.rmi.RemoteException;
import visad.*;
import visad.formula.*;

public class Eval {

   public static void main(String[] argv)
     throws VisADException, RemoteException
   {
     // get arguments from command line
     if (argv.length < 3) {
       System.out.println("Please enter three arguments: " +
         "two numbers and a formula.");
       System.exit(1);
     }
     double d1 = 0;
     double d2 = 0;
     try {
       d1 = Double.parseDouble(argv[0]);
       d2 = Double.parseDouble(argv[1]);
     }
     catch (NumberFormatException exc) {
       System.out.println("First two arguments must be numbers.");
       System.exit(2);
     }
     String formula = argv[2];

     // create two VisAD Data objects that store floating point values
     Real x = new Real(d1);
     Real y = new Real(d2);

     // create formula manager
     FormulaManager fman = FormulaUtil.createStandardManager();

     // register Data objects with formula manager
     fman.setThing("x", x);
     fman.setThing("y", y);

     // assign formula to new variable
     fman.assignFormula("f", formula);

     // wait for formula to finish computing, just to be safe
     fman.waitForFormula("f");

     // get value of function from formula manager
     Real f = (Real) fman.getThing("f");

     // print out results
     System.out.println("x = " + x.getValue() + ", y = " + y.getValue());
     System.out.println("f(x,y) = " + formula + " = " + f.getValue());
   }

}


1. Problem/Error: Eval doesn't return. E.g. 

~/da/test/visad: java Eval 3 4 x+y  
x = 3.0, y = 4.0
f(x,y) = x+y = 7.0

does produce the correct output, but the process isn't exiting.

2. The FormularManager doesn't work if the to be calculated formula doesn't 
contain any variable. E.g. 

Eval 3 4 90+35

doesn't produce any output nor does it return with an exception or something.

Thanks for any help,
Timo

-- 
__.__________
 |lmo |homas


  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: