All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class AT.Ac.univie.imp.loeffler.pde.threeD.fd.CachingPDE

java.lang.Object
   |
   +----AT.Ac.univie.imp.loeffler.pde.threeD.fd.CachingPDE

public abstract class CachingPDE
extends Object
implements PDE
An abstract class that has the same public interface as class PDE but adds caching for improved performance of classes that dervie from it.

Caching is supported for the right hand side (source term) f and for a representation of the matrix A which is allmost always needed by the methods evaluateLHS() and evaluate().

Author:
Gerald Loeffler (Gerald.Loeffler@univie.ac.at)

Constructor Index

 o CachingPDE()

Method Index

 o actuallySampleMatrix(int)
sample the matrix A in a way that it can later be used by methods evaluate() and evaluateLHS() on a grid of the given size.
 o actuallySampleRHS(int)
sample the right hand side f on a cubic grid of the given size.
 o evaluate(ConstBoundaryGrid, ConstNoBoundaryGrid, int, int, int)
evaluate the solution u of the PDE for a given interior grid element on a grid of a specific size.
 o evaluateLHS(ConstBoundaryGrid, int, int, int)
evaluate the left hand side of the discretized PDE for a given interior grid element on a grid of a specific size.
 o getGridSpacing(int)
return the grid spacing for a grid of the given size.
 o sampleMatrix(int)
a caching frontend to calculating a representation of the matrix A of the PDE for a specific grid size.
 o sampleRHS(int)
implements method from PDE.

Constructors

 o CachingPDE
 public CachingPDE()

Methods

 o sampleRHS
 public NoBoundaryGrid sampleRHS(int size)
implements method from PDE.

Sampling the right hand side f of a PDE for a given grid size (as this method does) is usually a time-consuming task. This implementation improves performance for those cases where sampleRHS() is called more than once for a specific grid size because it caches the right hand side (source term) f for every grid size. This may lead to space inefficiencies in general but not in the context of the (Full) Multigrid algorithm, where the right hand side is needed at all grid levels over and over again.

The actual calculation of the right hand side f is re-routed to method actuallySampleRHS().

See Also:
actuallySampleRHS, sampleRHS
 o actuallySampleRHS
 protected abstract NoBoundaryGrid actuallySampleRHS(int size)
sample the right hand side f on a cubic grid of the given size.

It is not necessary to know the value of f at the boundary of the grid, so the return type of this method is of type NoBoundaryGrid. But note that the size of the grid passed to this method includes (as always) the boundary. E.g., a 65x65x65 grid would be described by a size of 65 and its interior values (the one to be set by this method) would comprise the grid elements (1,1,1) to (63,63,63). The boundary elements (where at least one index is either 0 or 64) are non-existent in a NoBoundaryGrid.

Parameters:
size - the number of elements of the grid in each direction ( > 0)
Returns:
the right hand side (source term) f sampled on a cubic grid of the given size
 o sampleMatrix
 protected Object sampleMatrix(int size)
a caching frontend to calculating a representation of the matrix A of the PDE for a specific grid size.

Methods evaluateLHS() and evaluate() are supposed to call this method if they need a representation of the matrix A for doing their job for a grid of a certain size.

The actual calculation of the representation of the matrix A is re-routed to method actuallySampleMatrix().

Parameters:
size - the number of elements of the grid in each direction ( > 0)
Returns:
a representation of matrix A sampled on a grid of the given size
See Also:
actuallySampleMatrix
 o actuallySampleMatrix
 protected abstract Object actuallySampleMatrix(int size)
sample the matrix A in a way that it can later be used by methods evaluate() and evaluateLHS() on a grid of the given size.

The implementer of this method is entirely free in choosing any suitable representation for the matrix A as long as the methods evaluate() and evaluateLHS() are able to fulfill their job when passed the output of this method later in the course of the execution of the FMG algorithm.

Parameters:
size - the number of elements of the grid in each direction ( > 0)
Returns:
a representation of matrix A sampled on a grid of the given size

All Packages  Class Hierarchy  This Package  Previous  Next  Index