caffeinterface
Class CaffeToScalarFunction

java.lang.Object
  extended by function.BasicScalarFunction
      extended by caffeinterface.CaffeToScalarFunction
All Implemented Interfaces:
Computable, ScalarFunction
Direct Known Subclasses:
WaveDragAxisymmetric.CART3D

public abstract class CaffeToScalarFunction
extends BasicScalarFunction

Simplifies the use of CaffeClass for computation. In JAMPOT, the basic compute functionality is provided by the Computable interface, its sub-interfaces, and derived classes. While the CAFFE framework provides a compute method, it typically returns nothing. In addition, CAFFE facilitates interfacing of legacy code, XML-based input, and data sharing. This class attempts to bring that functionality, and the resulting PASS-compatibility, into JAMPOT.

Author:
dgorur

Field Summary
protected  caffe.SharedData db
           
 
Fields inherited from class function.BasicScalarFunction
DEFAULT_BOUNDS, DEFAULT_DIM, VALUE_OUTSIDE_BOUNDS
 
Constructor Summary
CaffeToScalarFunction()
           
 
Method Summary
 java.lang.String getComputeVarName()
          Returns the name of the variable that holds the computed result in the CAFFE database.
 caffe.CaffeClass getMainClass()
          Returns the main compute class in the CAFFE application.
 java.lang.String getXmlFileName()
          Returns the name of the XML file to be used for data input.
 void init()
          Initialization method.
protected abstract  void populateDatabase(double[] x)
          Populates the CAFFE database with variable values based on the given vector x.
 double quickCompute(double[] x)
          Populates the database, runs the compute routine on the main class, and then returns the value of the variable in the database corresponding to the compute-variable name.
 void setComputeVarName(java.lang.String computeVarName)
          Sets the name of the compute-result variable
 void setXmlFileName(java.lang.String xmlFileName)
          Sets the name of the XML file to be used for data input
 
Methods inherited from class function.BasicScalarFunction
checkDimensions, compute, compute, compute, compute, compute, compute, getBounds, getInputDimension, getOutputDimension, isWithinBounds, makeBounds, quickCompute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

db

protected caffe.SharedData db
Constructor Detail

CaffeToScalarFunction

public CaffeToScalarFunction()
Method Detail

getMainClass

public caffe.CaffeClass getMainClass()
Returns the main compute class in the CAFFE application.

Returns:
the main compute class in the CAFFE application.

getXmlFileName

public java.lang.String getXmlFileName()
Returns the name of the XML file to be used for data input.

Returns:
the name of the XML file for data input.

setXmlFileName

public void setXmlFileName(java.lang.String xmlFileName)
Sets the name of the XML file to be used for data input

Parameters:
xmlFileName - the name of the XML file for data input.

getComputeVarName

public java.lang.String getComputeVarName()
Returns the name of the variable that holds the computed result in the CAFFE database.

Returns:
the name of the variable that holds the result in the CAFFE database.

setComputeVarName

public void setComputeVarName(java.lang.String computeVarName)
Sets the name of the compute-result variable

Parameters:
computeVarName - the desired name of the compute-result variable.

init

public void init()
Description copied from class: BasicScalarFunction
Initialization method.

Specified by:
init in interface ScalarFunction
Overrides:
init in class BasicScalarFunction

quickCompute

public double quickCompute(double[] x)
Populates the database, runs the compute routine on the main class, and then returns the value of the variable in the database corresponding to the compute-variable name.

Specified by:
quickCompute in interface ScalarFunction
Specified by:
quickCompute in class BasicScalarFunction
Parameters:
x - the given input.
Returns:
the output corresponding to the given input.
See Also:
BasicScalarFunction.quickCompute(double[])

populateDatabase

protected abstract void populateDatabase(double[] x)
Populates the CAFFE database with variable values based on the given vector x. This is the core of the adapter, since this maps the variables in this Computable to the variables in the CAFFE database.

Parameters:
x - the given set of design values.