Package by.andd3dfx.math.pde.solver
Record Class Solution<E extends Equation>
java.lang.Object
java.lang.Record
by.andd3dfx.math.pde.solver.Solution<E>
- Type Parameters:
E
- the type of equation that was solved- Record Components:
equation
- the partial differential equation that was solvedarea
- the space-time domain where the solution was foundsolution
- the numerical solution stored as a 2D matrix
public record Solution<E extends Equation>(E extends Equation equation, Area area, Matrix2D solution)
extends Record
Record class representing a numerical solution of a partial differential equation
on a defined space-time domain. The solution is stored as a 2D matrix where rows
represent time layers and columns represent spatial points.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionarea()
Returns the value of thearea
record component.final boolean
Indicates whether some other object is "equal to" this one.equation()
Returns the value of theequation
record component.gUt
(double t) Retrieves a spatial slice of the solution at a specified time moment.gUt
(int it) Retrieves a spatial slice of the solution at a specified time layer index.gUx
(double x) Retrieves a temporal slice of the solution at a specified spatial coordinate.gUx
(int ix) Retrieves a temporal slice of the solution at a specified spatial column index.final int
hashCode()
Returns a hash code value for this object.solution()
Returns the value of thesolution
record component.void
Saves solution data U(x) for a single time moment to a file.void
Saves solution data U(x,t) for specified time moments to a file.void
Saves solution data U(t) for a single spatial coordinate to a file.void
Saves solution data U(x,t) for specified spatial coordinates to a file.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
sUt
Saves solution data U(x,t) for specified time moments to a file. Creates a set of spatial slices of the solution at different time points. Each line in the output file contains spatial coordinates followed by solution values at different time moments.- Parameters:
fileName
- name of the file to save the datat
- array of time moments to save- Throws:
IllegalArgumentException
- if any time moment is outside the solution domain
-
sUt
Saves solution data U(x) for a single time moment to a file. Creates a spatial slice of the solution at the specified time.- Parameters:
fileName
- name of the file to save the datat
- time moment to save- Throws:
IllegalArgumentException
- if the time moment is outside the solution domain
-
sUx
Saves solution data U(x,t) for specified spatial coordinates to a file. Creates a set of temporal slices of the solution at different spatial points. Each line in the output file contains time coordinates followed by solution values at different spatial points.- Parameters:
fileName
- name of the file to save the datax
- array of spatial coordinates to save- Throws:
IllegalArgumentException
- if any spatial coordinate is outside the solution domain
-
sUx
Saves solution data U(t) for a single spatial coordinate to a file. Creates a temporal slice of the solution at the specified spatial point.- Parameters:
fileName
- name of the file to save the datax
- spatial coordinate to save- Throws:
IllegalArgumentException
- if the spatial coordinate is outside the solution domain
-
gUt
Retrieves a spatial slice of the solution at a specified time moment. Returns a matrix containing spatial coordinates and corresponding solution values.- Parameters:
t
- time moment to get the slice for- Returns:
- MatrixXY containing the spatial slice of the solution
- Throws:
IllegalArgumentException
- if the time moment is outside the solution domain
-
gUt
Retrieves a spatial slice of the solution at a specified time layer index. Returns a matrix containing spatial coordinates and corresponding solution values.- Parameters:
it
- index of the time layer in the solution matrix (0 <= it < M)- Returns:
- MatrixXY containing the spatial slice of the solution
- Throws:
IllegalArgumentException
- if the time layer index is out of bounds
-
gUx
Retrieves a temporal slice of the solution at a specified spatial coordinate. Returns a matrix containing time coordinates and corresponding solution values.- Parameters:
x
- spatial coordinate to get the slice for- Returns:
- MatrixXY containing the temporal slice of the solution
- Throws:
IllegalArgumentException
- if the spatial coordinate is outside the solution domain
-
gUx
Retrieves a temporal slice of the solution at a specified spatial column index. Returns a matrix containing time coordinates and corresponding solution values.- Parameters:
ix
- index of the spatial column in the solution matrix (0 <= ix < N)- Returns:
- MatrixXY containing the temporal slice of the solution
- Throws:
IllegalArgumentException
- if the spatial column index is out of bounds
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
equation
Returns the value of theequation
record component.- Returns:
- the value of the
equation
record component
-
area
Returns the value of thearea
record component.- Returns:
- the value of the
area
record component
-
solution
Returns the value of thesolution
record component.- Returns:
- the value of the
solution
record component
-