|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjabble.Field
public abstract class Field
Represents a scalar field defined on all of the point of the Grid.
In Jabble, objects from the Field classes are usually created by the framwork. A user will typically write an Evolver to write code that solves a new equation, in which case Field objects are automatically initialized (see the Evolver documentation). A user that simply need to specify initial condition for an equation for which an Evolver is already written, might not even need Field objects at all.
In case that one needs to create a field, he can do so with the static methods Field.createField(...). This might happen if one is writing a new completely method to solve equations, but it's not the norm.
In general, we try to have the framework to manage the full life-cycle of Field object so it can manage memory management efficiently, and take care of things such as storing the data to file. Plus, the Field being an abstract class, and the framework deciding which implementation class to use, allows us to experiment with different data structure implementation without affecting the physics code. We also envision that Jabble could choose a different implementation at runtime, depending on the problem at hand. Notice that there is no penalty associated with Field being an abstract class, as the Jabble code is carefully constructed so that the implementation code can still be inlined at runtime.
| Constructor Summary | |
|---|---|
Field()
|
|
| Method Summary | |
|---|---|
abstract double |
at(Point p)
Returns the value of the field at the given point. |
abstract void |
copyData(Field sourceField)
Changes all values of the field to match the given one. |
static Field |
createField(Field field)
Creates a new field that is the copy of the given Field. |
static Field |
createField(java.lang.String name,
double[] data,
Grid grid)
Creates a new field with the given name, data and Grid. |
static Field |
createField(java.lang.String name,
Grid grid)
Creates a new field with a value of zero at each point of the Grid. |
abstract Grid |
getGrid()
Returns the Grid on which the Field is defined. |
abstract java.lang.String |
getName()
The name of the field. |
abstract void |
load(java.nio.DoubleBuffer buffer)
Loads the field values from the buffer. |
abstract void |
setAt(Point p,
double value)
Changes the value of the field at the given point. |
abstract void |
store(java.nio.DoubleBuffer buffer)
Saves the field values to the buffer. |
java.lang.String |
toString()
Returns the name of the Field, the Grid on which is defined and the values around the origin. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Field()
| Method Detail |
|---|
public static Field createField(java.lang.String name,
Grid grid)
name - The name of the field (will be used to identify it in the Slice object)grid - The Grid on which the field is defined.public static Field createField(Field field)
field - The template field from which to create the new one
public static Field createField(java.lang.String name,
double[] data,
Grid grid)
name - the name to give to the fielddata - array containing all the values of the field across the gridgrid - the grid on which the field is definedpublic abstract double at(Point p)
p - A point on the grid
public abstract void setAt(Point p,
double value)
p - A point on the gridvalue - The new value for the fieldpublic abstract java.lang.String getName()
public abstract void copyData(Field sourceField)
sourceField - the field from which to copypublic abstract Grid getGrid()
public abstract void load(java.nio.DoubleBuffer buffer)
buffer - the buffer to load frompublic abstract void store(java.nio.DoubleBuffer buffer)
buffer - the buffer to save topublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||