mathcomp.assemble
Class Assembler

java.lang.Object
  extended by mathcomp.monitor.DefaultReportable
      extended by mathcomp.monitor.DefaultAlgorithm
          extended by mathcomp.assemble.Assembler
All Implemented Interfaces:
java.lang.Runnable, Algorithm, Reportable
Direct Known Subclasses:
AssemblerPair, DGAssembler, LagrangeCubicAssembler, LagrangeLinearAssembler, LagrangeSquareAssembler, MiniAssembler, mathcomp.assemble.stokes.StokesAssembler

public abstract class Assembler
extends DefaultAlgorithm
implements java.lang.Runnable

An Assembler assembles the Matrix for a given Problem.

Author:
pht

Field Summary
 java.util.Map dirichletBoundaryValues
          Maps to every node on a Dirichlet boundary segment its value..
 double solScale
          A constant double to scale the calculated solution
 
Constructor Summary
Assembler()
           
 
Method Summary
 Vector addDirichletNodes(Vector sol)
          Completes the solution vector by adding the values at the dirichlet nodes
 void assembleGlobal()
          The main assemble method generally called from outside.
 java.util.Map calcDirichletBoundary(java.util.Map boundaryNodes)
          Pre-calculation of the values at the Dirichlet boundary stored in a HashMap that maps to every Dirichlet boundary point its corresponding value by considering the boundary indetifier info for this boundary segment.
abstract  void createDof(Grid grid, java.util.Set dof)
          All global Objects, that represent a degreeOfFreedom are added to dof.
 Surface[] createSurfaces(Vector x)
          Generates and returns an array of Surface Objects.
 Surface[] createSurfaces(Vector x, Vector fineSolution)
           
 double[] evalApproxGradient(Node n, Triangle t, Vector x)
          For H1 error calculations we need to know the gradient of the approximated solution in a node n.
abstract  double evalApproxSolution(Node n, Triangle t, Vector x)
          Evaluates the FEM solution in a Node.
 double[] evalExactGradient(Node n)
          For H1 error calculations we need to know the exact gradient of a problem.
 double evalExactSolution(Node n)
          For error calculations we need to know the exact solution of a problem.
abstract  double evalF(Node n)
          Evaluates the right hand side function f on the Node n
 java.util.Set getDof()
           
 Matrix getElementMatrix(Triangle t)
          Return the Element Matrix of this Assembler
 double getEpsilon()
           
 ErrorCalculator getErrorCalculator()
           
 double getExactPartialX(Node n)
          Direct access to partialX
 double getExactPartialY(Node n)
          Direct access to partialY
 Grid getGrid()
           
 java.lang.String getInfoUrl()
          Here you can specify the URL to the HTML-Description of your model problem
 Matrix getM()
           
 java.lang.String getPreferredGridFileName()
          Every Assembler has a preferred grid.
 double getSolScale()
           
 Vector getY()
           
 void report()
          This is the one method, where reporting is handled for GridRefiner.
 void run()
           
 void setEpsilon(double e)
           
 void setGrid(Grid grid)
           
 void setM(Matrix matrix)
           
 void setTauIndex(int i)
           
 void setY(Vector vector)
           
abstract  java.lang.String toString()
          Set the name of your assembler by overwriting this method in your assembler class.
 
Methods inherited from class mathcomp.monitor.DefaultAlgorithm
algoAbortIfNeeded, algoCancel, algoClear, algoCount, algoIncrement, algoMax, isAlgoCancel, setAlgoCount, setAlgoMax
 
Methods inherited from class mathcomp.monitor.DefaultReportable
getReport, setReport
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface mathcomp.monitor.Reportable
getReport, setReport
 

Field Detail

solScale

public double solScale
A constant double to scale the calculated solution


dirichletBoundaryValues

public java.util.Map dirichletBoundaryValues
Maps to every node on a Dirichlet boundary segment its value..

Constructor Detail

Assembler

public Assembler()
Method Detail

addDirichletNodes

public Vector addDirichletNodes(Vector sol)
Completes the solution vector by adding the values at the dirichlet nodes

Parameters:
sol - the calculated solution vector
Returns:
the completed solution vector

createDof

public abstract void createDof(Grid grid,
                               java.util.Set dof)
All global Objects, that represent a degreeOfFreedom are added to dof.

Parameters:
grid - the current grid
dof - the Set where the DOFs have to be put in

getPreferredGridFileName

public java.lang.String getPreferredGridFileName()
Every Assembler has a preferred grid. If this method is not implemented in the specific assembler class, "square.grid" is default.

Returns:
the file name of the preferred grid as a String object.

evalApproxSolution

public abstract double evalApproxSolution(Node n,
                                          Triangle t,
                                          Vector x)
Evaluates the FEM solution in a Node. To do that we do need the triangle. We need this method for an easy l2 and l\infty error calculation.

Parameters:
n - Node where the solution has to be evaluated
t - the triangle that contains the Node n
x - the solution vector
Returns:
the value of the solution in n

evalApproxGradient

public double[] evalApproxGradient(Node n,
                                   Triangle t,
                                   Vector x)
For H1 error calculations we need to know the gradient of the approximated solution in a node n. If we don't know that, return [0.0,0.0] for every node n. TODO this should become abstract.

Parameters:
n - node where the approximated gradient should be evaluated

evalExactSolution

public double evalExactSolution(Node n)
For error calculations we need to know the exact solution of a problem. If we don't know that, return 0.0 for every node n.

Parameters:
n - node where the exact solution should be evaluated

evalExactGradient

public double[] evalExactGradient(Node n)
For H1 error calculations we need to know the exact gradient of a problem. If we don't know that, return [0.0,0.0] for every node n. TODO this should become abstract.

Parameters:
n - node where the exact gradient should be evaluated

getExactPartialX

public double getExactPartialX(Node n)
Direct access to partialX


getExactPartialY

public double getExactPartialY(Node n)
Direct access to partialY


evalF

public abstract double evalF(Node n)
Evaluates the right hand side function f on the Node n

Parameters:
n - the Node where f is evaluated
Returns:
the evaluation value

createSurfaces

public Surface[] createSurfaces(Vector x)
Generates and returns an array of Surface Objects. This contains the data for the java3D plots. For every basis type, this draws only triangles by evaluating the solution in the corner nodes of the triangle. By convention th order of the four objects is [approx, error, exact, empty]

Parameters:
x - the FE-solution vector
errorPlot - true returns the errorSurface, false returns the FE-approxSurface
Returns:
the generated Suface object

createSurfaces

public Surface[] createSurfaces(Vector x,
                                Vector fineSolution)

assembleGlobal

public void assembleGlobal()
The main assemble method generally called from outside. It once calculates the boundary, the global DOFs and the Dirichlet values. Then Matrix m and right side Vector y are created. Finally an iteration over all elements calls assemble(Grid g, Triangle t, Matrix m) for each element.


getElementMatrix

public Matrix getElementMatrix(Triangle t)
Return the Element Matrix of this Assembler

Parameters:
t - the current element the element metrix is generated of
Returns:
the element matrix for the element t

calcDirichletBoundary

public java.util.Map calcDirichletBoundary(java.util.Map boundaryNodes)
Pre-calculation of the values at the Dirichlet boundary stored in a HashMap that maps to every Dirichlet boundary point its corresponding value by considering the boundary indetifier info for this boundary segment.


getGrid

public Grid getGrid()

getM

public Matrix getM()

setGrid

public void setGrid(Grid grid)

setM

public void setM(Matrix matrix)

getY

public Vector getY()

setY

public void setY(Vector vector)

getDof

public java.util.Set getDof()

run

public void run()
Specified by:
run in interface java.lang.Runnable

toString

public abstract java.lang.String toString()
Set the name of your assembler by overwriting this method in your assembler class.

Overrides:
toString in class java.lang.Object
Returns:
the name of the assembler

getInfoUrl

public java.lang.String getInfoUrl()
Here you can specify the URL to the HTML-Description of your model problem

Returns:
the url of the HTML info

report

public void report()
This is the one method, where reporting is handled for GridRefiner.

Specified by:
report in interface Reportable
Overrides:
report in class DefaultReportable

getErrorCalculator

public ErrorCalculator getErrorCalculator()

getSolScale

public double getSolScale()

getEpsilon

public double getEpsilon()

setEpsilon

public void setEpsilon(double e)

setTauIndex

public void setTauIndex(int i)