Game Development Reference
In-Depth Information
x
(
)
Txt
(,)
=+ −
T
T
T erf
(12.25)
1
0
1
2
Kt
To solve the heat conduction problem, we will write two classes. The first, called GasTank ,
represents (as you probably guessed) a gas tank. In this simple example, the GasTank class only
declares four fields that contain values of the thickness of the tank wall, thermal diffusivity,
initial temperature, and boundary temperature at the outer wall of the tank.
public class GasTank
{
private double thickness;
private double diffusivity;
private double initialT;
private double boundaryT;
public GasTank(double thickness, double diffusivity,
double initialT, double boundaryT) {
this.thickness = thickness;
this.diffusivity = diffusivity;
this.initialT = initialT;
this.boundaryT = boundaryT;
}
Even though they aren't used in this example, it's good practice to declare a series of get/set
methods to access or change the values of the fields declared in the class.
// These methods return the field values.
public double getThickness() {
return thickness;
}
public double getDiffusivity() {
return diffusivity;
}
public double getInitialT() {
return initialT;
}
public double getBoundaryT() {
return boundaryT;
}
// These methods change the value of the fields.
public void setBoundaryT(double value) {
boundaryT = value;
return;
}
Search WWH ::




Custom Search