jabble
Class EquationSetBuilder

java.lang.Object
  extended by jabble.EquationSetBuilder

public class EquationSetBuilder
extends java.lang.Object

A helper class to quickly build EquationSet objects.


Constructor Summary
EquationSetBuilder()
          Creates a new EquationSet builder.
 
Method Summary
 EquationSet createEquationsSet()
          Creates the setEquation according to the instructions given to the builder.
 EquationSetBuilder setBoundaryConditions(java.lang.String fieldName, int dirIndex, BoundaryCondition lowerBoundary, BoundaryCondition upperBoundary)
          Defines the boundary condition for a Field along one direction.
 EquationSetBuilder setConstant(java.lang.String constantName, double value)
          Adds a setConstant to the EquationSet along with its value.
 EquationSetBuilder setCoordinates(java.lang.String... coords)
          Defines the setCoordinates for the setEquation, and initializes the setDifferentials to dcoordinate (for example "x" -> "dx").
 EquationSetBuilder setDifferentials(java.lang.String... differentials)
          Defines the name of the setDifferentials, in case they do not follow the standard convention (that is, it's not "x" -> "dx").
 EquationSetBuilder setEquation(java.lang.String field, java.lang.String equation)
          Adds the setEquation used to evolve the field, and adds the setFields to the list of setFields used (in case is not already added).
 EquationSetBuilder setFields(java.lang.String... fieldNames)
          Adds a new field to the ones defined by the setEquation set.
 EquationSetBuilder setGridSize(int... sizes)
          Specifies the size of the grid in all directions.
 EquationSetBuilder setStationaryFields(java.lang.String... fields)
          Defines a set of stationary setFields, that is setFields that do not change in time.
 EquationSetBuilder setyBoundaryConditions(BoundaryCondition... boundaries)
          Defines the default boundary conditions for all setFields.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EquationSetBuilder

public EquationSetBuilder()
Creates a new EquationSet builder.

Method Detail

setCoordinates

public EquationSetBuilder setCoordinates(java.lang.String... coords)
Defines the setCoordinates for the setEquation, and initializes the setDifferentials to dcoordinate (for example "x" -> "dx").

Parameters:
coords - The setCoordinates (for example "x", "y", "t").
Returns:
The builder.

setDifferentials

public EquationSetBuilder setDifferentials(java.lang.String... differentials)
Defines the name of the setDifferentials, in case they do not follow the standard convention (that is, it's not "x" -> "dx").

Parameters:
differentials - The names of the setDifferentials, which must be the same number of the setCoordinates.
Returns:
The builder.

setEquation

public EquationSetBuilder setEquation(java.lang.String field,
                                      java.lang.String equation)
Adds the setEquation used to evolve the field, and adds the setFields to the list of setFields used (in case is not already added).

Parameters:
field - The name of the field.
equation - The setEquation.
Returns:
The builder.

setFields

public EquationSetBuilder setFields(java.lang.String... fieldNames)
Adds a new field to the ones defined by the setEquation set.

Parameters:
fieldNames - A list of field names.
Returns:
The builder.

setGridSize

public EquationSetBuilder setGridSize(int... sizes)
Specifies the size of the grid in all directions.

Parameters:
sizes - The size of the grid along the setCoordinates.
Returns:
The builder.

createEquationsSet

public EquationSet createEquationsSet()
Creates the setEquation according to the instructions given to the builder.

Returns:
An EquationSet.

setyBoundaryConditions

public EquationSetBuilder setyBoundaryConditions(BoundaryCondition... boundaries)
Defines the default boundary conditions for all setFields.

Parameters:
boundaries - The type of boundary for each direction.
Returns:
The builder.

setBoundaryConditions

public EquationSetBuilder setBoundaryConditions(java.lang.String fieldName,
                                                int dirIndex,
                                                BoundaryCondition lowerBoundary,
                                                BoundaryCondition upperBoundary)
Defines the boundary condition for a Field along one direction.

Parameters:
fieldName - The name of the field.
dirIndex - The direction along which boundary condition are defined.
lowerBoundary - The boundary condition for the lower boundary.
upperBoundary - The boundary condition for the upper boundary.
Returns:
The builder.

setConstant

public EquationSetBuilder setConstant(java.lang.String constantName,
                                      double value)
Adds a setConstant to the EquationSet along with its value.

Parameters:
constantName - The name of the setConstant.
value - The value of the setConstant.
Returns:
The builder.

setStationaryFields

public EquationSetBuilder setStationaryFields(java.lang.String... fields)
Defines a set of stationary setFields, that is setFields that do not change in time. More precisely, setFields that won't change along the last coordinate defined in the setEquation set.

Parameters:
fields - A list of field names.
Returns:
The builder.