java.lang.Object
simpa.core.api.Solver
Class for calculating the strength of sources.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSolver
(List<SurfacePoint> spoints, FieldType type) Constructor for direct solverSolver
(List<SurfacePoint> spoints, FieldType type, SolverOptions opts) Solver
(FieldType type, List<List<SurfacePoint>> slices, SolverOptions opts) Special constructor for the slice preconditioner. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Returns the relative error between the reproduced field by the sources and the given field by the user.void
solve
(double relativeError) Calculates the strength of the sources and saves it to a file.
-
Field Details
-
logger
public static final org.apache.logging.log4j.Logger logger
-
-
Constructor Details
-
Solver
Constructor for direct solver- Parameters:
spoints
- List of surface points.
-
Solver
- Parameters:
spoints
- List of surface points.type
- The field type: static magnetic, static electric.opts
- Options specifying the preconditioner type and its parameters.
-
Solver
Special constructor for the slice preconditioner. This is useful for accelerator elements or anything which can be partitioned to slices.- Parameters:
type
- The field type: static magnetic, static electric, or RF (not yet implemented).slices
- List of not overlapping slices of the surface foints.opts
- Options specifying the preconditioner type and its parameters. Since this constructor is specially made for the slice preconditioner, the preconditioner type inside the options should be always Preconditioner.SLICE and the solver is SolverType.GMRES
-
-
Method Details
-
solve
public void solve(double relativeError) Calculates the strength of the sources and saves it to a file.- Parameters:
relativeError
- Allowed relative error.
-
getResidual
public double getResidual()Returns the relative error between the reproduced field by the sources and the given field by the user. After solving A.x=b, the relative norm error is: |b-A.x|/|b]- Returns:
- The residual error.
-