#include <stdlib.h>
#include "syspro.h"
#include "syspro_impl.h"
#include "sysprolinear.h"
#include "linear_impl.h"
#include "petscmat.h"
#include "nmd.h"
#include "anamod.h"
Go to the source code of this file.
Definition in file linear.c.
PetscErrorCode CreateDefaultLinearSolution | ( | NumericalProblem | problem, | |
NumericalSolution * | rsol | |||
) |
Definition at line 516 of file linear.c.
References CHKERRQ(), CreateLinearSolution(), ierr, LinearSolutionSetVector(), LinearSystemGetParts(), and SYSPROCHECKVALIDLINSYS.
PetscErrorCode CreateLinearSolution | ( | LinearSolution * | sol | ) |
Definition at line 399 of file linear.c.
References CHKERRQ(), LinearSolution_::cookie, ierr, LINSOLCOOKIE, and LinearSolution_::statistics.
Referenced by CreateDefaultLinearSolution(), and LinearCreateNumericalSolution().
PetscErrorCode CreateLinearSystem | ( | MPI_Comm | comm, | |
LinearSystem * | system | |||
) |
Allocate the structure for a linear system
Definition at line 75 of file linear.c.
References CHKERRQ(), LinearSystem_::cookie, ierr, LINSYSCOOKIE, and LinearSystem_::partsoriginal.
Referenced by LinearSystemDuplicate(), LinearSystemDuplicatePointers(), and main().
PetscErrorCode DeleteLinearSystem | ( | LinearSystem | system | ) |
Definition at line 90 of file linear.c.
References LinearSystem_::A, LinearSystem_::B, CHKERRQ(), ierr, LinearSystem_::Init, LinearSystem_::partsoriginal, LinearSystem_::Rhs, LinearSystem_::Sol, SYSPROCHECKVALIDLINSYS, and LinearSystem_::Tmp.
Referenced by back_flipsign(), back_singleton(), unapproximate_system(), undistribute_system(), unscale_system(), unset_ksp(), and unset_pc().
PetscErrorCode LinearCopyNumericalSolution | ( | NumericalSolution | old, | |
NumericalSolution | nnew | |||
) |
This routine is essentially LinearSolutionCopy(), except that it does casts of the arguments so that it can be used as the solutioncopy
member of SysProDeclareFunctions()
Definition at line 503 of file linear.c.
References CHKERRQ(), ierr, and LinearSolutionCopy().
PetscErrorCode LinearCreateNumericalSolution | ( | NumericalProblem | prob, | |
NumericalSolution * | sol | |||
) |
Shell routine around CreateLinearSolution() to save you some type casting.
If the first argument is not NULL, its matrix is extracted and used to create the vector of the solution object.
Definition at line 420 of file linear.c.
References CHKERRQ(), CreateLinearSolution(), ierr, LinearSolutionSetVector(), and LinearSystemGetParts().
Referenced by main(), and solvelinear().
PetscErrorCode LinearDeleteNumericalSolution | ( | NumericalSolution | sol | ) |
This is like LinearSolutionDelete(), except that the argument has been cast so that this routine can be used as the solutiondelete
argument of SysProDeclareFunctions().
Definition at line 465 of file linear.c.
References CHKERRQ(), ierr, and LinearSolutionDelete().
Referenced by main().
PetscErrorCode LinearDeleteNumericalSolutionContext | ( | NumericalSolution | sol | ) |
Definition at line 638 of file linear.c.
References LinearSolution_::ctx, and SYSPROCHECKVALIDLINSOL.
PetscErrorCode LinearSolutionCopy | ( | LinearSolution | old, | |
LinearSolution | lnew | |||
) |
Copy one linear solution object into another. This clearly only works if their vectors are similarly layed out.
The context pointer is blindly copied. We may have to think about this a bit more.
See also LinearCopyNumericalSolution().
Definition at line 484 of file linear.c.
References CHKERRQ(), LinearSolution_::ctx, ierr, LinearSolution_::Out, LinearSolution_::statistics, and SYSPROCHECKVALIDLINSOLa.
Referenced by back_flipsign(), LinearCopyNumericalSolution(), unapproximate_system(), unset_ksp(), and unset_pc().
PetscErrorCode LinearSolutionCopyStats | ( | LinearSolution | in, | |
LinearSolution | out | |||
) |
Definition at line 599 of file linear.c.
References CHKERRQ(), ierr, LinearSolution_::statistics, and SYSPROCHECKVALIDLINSOLa.
Referenced by back_singleton(), undistribute_system(), and unscale_system().
PetscErrorCode LinearSolutionCreateStatistics | ( | LinearSolution | sol | ) |
Definition at line 561 of file linear.c.
References CHKERRQ(), ierr, LinearSolution_::statistics, and SYSPROCHECKVALIDLINSOL.
PetscErrorCode LinearSolutionDelete | ( | LinearSolution | sol | ) |
Delete a linear solution.
This does not affect the context stored in the solution. That needs a special purpose routine.
See also LinearDeleteNumericalSolution().
Definition at line 447 of file linear.c.
References CHKERRQ(), ierr, LinearSolution_::Out, LinearSolution_::statistics, and SYSPROCHECKVALIDLINSOL.
Referenced by LinearDeleteNumericalSolution().
PetscErrorCode LinearSolutionGetContext | ( | LinearSolution | sol, | |
void ** | ctx | |||
) |
Definition at line 628 of file linear.c.
References LinearSolution_::ctx, and SYSPROCHECKVALIDLINSOL.
PetscErrorCode LinearSolutionGetStatistics | ( | LinearSolution | sol, | |
NMD_metadata * | s | |||
) |
Definition at line 589 of file linear.c.
References LinearSolution_::statistics, and SYSPROCHECKVALIDLINSOL.
PetscErrorCode LinearSolutionGetVector | ( | LinearSolution | sol, | |
Vec * | out | |||
) |
Definition at line 545 of file linear.c.
References LinearSolution_::Out, and SYSPROCHECKVALIDLINSOL.
Referenced by back_singleton(), LinearSystemTrueDistance(), LinearSystemTrueDistancePrint(), main(), undistribute_system(), and unscale_system().
PetscErrorCode LinearSolutionSetContext | ( | LinearSolution | sol, | |
void * | ctx | |||
) |
Definition at line 618 of file linear.c.
References LinearSolution_::ctx, and SYSPROCHECKVALIDLINSOL.
PetscErrorCode LinearSolutionSetVector | ( | LinearSolution | sol, | |
Vec | out | |||
) |
Definition at line 535 of file linear.c.
References LinearSolution_::Out, and SYSPROCHECKVALIDLINSOL.
Referenced by back_singleton(), CreateDefaultLinearSolution(), LinearCreateNumericalSolution(), and solvelinear().
PetscErrorCode LinearSystemCopy | ( | LinearSystem | old, | |
LinearSystem | lnew | |||
) |
Copy the values of the components of an old linear system into a new. The new system has to have been created with LinearSystemDuplicate() because this routine assumes that the data structures are already in place.
Definition at line 356 of file linear.c.
References LinearSystem_::A, ALLPARTSNEW, LinearSystem_::B, CHKERRQ(), ierr, LinearSystem_::Init, LinearSystem_::known_solution, LinearSystem_::metadata, LinearSystem_::partsoriginal, LinearSystem_::Rhs, LinearSystem_::Sol, and SYSPROCHECKVALIDLINSYSa.
Referenced by scale_system().
PetscErrorCode LinearSystemDuplicate | ( | LinearSystem | problem, | |
LinearSystem * | newproblem | |||
) |
Allocate a new linear system, and create copies in it of the data structure, but not the values, of the components of the old system.
See also LinearSystemCopy().
Definition at line 311 of file linear.c.
References LinearSystem_::A, ALLPARTSNEW, LinearSystem_::B, CHKERRQ(), CreateLinearSystem(), NumericalProblem_::ctx, LinearSystem_::ctx, ierr, LinearSystem_::Init, LinearSystem_::known_solution, LinearSystem_::partsoriginal, LinearSystem_::Rhs, LinearSystem_::Sol, and SYSPROCHECKVALIDLINSYS.
Referenced by scale_system().
PetscErrorCode LinearSystemDuplicatePointers | ( | LinearSystem | problem, | |
LinearSystem * | newproblem | |||
) |
Allocate a new linear system and give it the components of the old by pointer duplication.
Definition at line 282 of file linear.c.
References LinearSystem_::A, LinearSystem_::B, CHKERRQ(), CreateLinearSystem(), NumericalProblem_::ctx, LinearSystem_::ctx, ierr, LinearSystem_::Init, LinearSystem_::known_solution, LinearSystem_::metadata, LinearSystem_::partsoriginal, LinearSystem_::Rhs, LinearSystem_::Sol, and SYSPROCHECKVALIDLINSYS.
Referenced by approximate_system(), distribute_system(), eliminate_singletons(), flipsign(), setup_ksp(), and setup_pc().
PetscErrorCode LinearSystemGetContext | ( | LinearSystem | system, | |
void ** | ctx | |||
) |
Definition at line 215 of file linear.c.
References LinearSystem_::ctx, and SYSPROCHECKVALIDLINSYS.
Referenced by eliminate_singletons().
PetscErrorCode LinearSystemGetKnownSolution | ( | LinearSystem | sys, | |
PetscTruth * | sol | |||
) |
Definition at line 235 of file linear.c.
References LinearSystem_::known_solution, and SYSPROCHECKVALIDLINSYS.
Referenced by LinearSystemTrueDistancePrint().
PetscErrorCode LinearSystemGetMetadata | ( | LinearSystem | system, | |
NMD_metadata * | nmd | |||
) |
Definition at line 255 of file linear.c.
References LinearSystem_::metadata, and SYSPROCHECKVALIDLINSYS.
Referenced by main(), SysProComputeQuantity(), SysProFreeQuantities(), and SysProRemoveQuantity().
PetscErrorCode LinearSystemGetParts | ( | LinearSystem | system, | |
Mat * | A, | |||
Mat * | B, | |||
Vec * | Rhs, | |||
Vec * | Sol, | |||
Vec * | Init | |||
) |
Get the matrices and vectors of the system
Definition at line 190 of file linear.c.
References LinearSystem_::A, LinearSystem_::B, LinearSystem_::Init, LinearSystem_::Rhs, LinearSystem_::Sol, and SYSPROCHECKVALIDLINSYS.
Referenced by approximate_system(), back_singleton(), CreateDefaultLinearSolution(), distribute_system(), eliminate_singletons(), flipsign(), LinearCreateNumericalSolution(), LinearSystemTrueDistance(), LinearSystemTrueDistancePrint(), MatGustafssonMod(), MatSymmetricPart(), sans_partition(), scale_system(), setup_pc(), solvelinear(), specific_approximation_choices(), SysProComputeQuantity(), SysProRetrieveQuantity(), and unset_pc().
PetscErrorCode LinearSystemGetTmpVector | ( | LinearSystem | sys, | |
Vec * | tmp | |||
) |
Definition at line 265 of file linear.c.
References CHKERRQ(), ierr, LinearSystem_::Rhs, SYSPROCHECKVALIDLINSYS, and LinearSystem_::Tmp.
Referenced by LinearSystemTrueDistance(), and LinearSystemTrueDistancePrint().
PetscErrorCode LinearSystemInheritParts | ( | LinearSystem | system, | |
Mat | A, | |||
Mat | B, | |||
Vec | Rhs, | |||
Vec | Sol, | |||
Vec | Init | |||
) |
Declare the matrices and vectors for a linear system. Unlike in LinearSystemSetParts(), here the parts are marked as not original, so they will not be deleted in DeleteLinearSystem().
Definition at line 162 of file linear.c.
References LinearSystem_::A, ALLPARTSNEW, LinearSystem_::B, CHKERRQ(), ierr, LinearSystem_::Init, LinearSystem_::partsoriginal, LinearSystem_::Rhs, LinearSystem_::Sol, and SYSPROCHECKVALIDLINSYS.
PetscErrorCode LinearSystemSetContext | ( | LinearSystem | system, | |
void * | ctx | |||
) |
Definition at line 205 of file linear.c.
References LinearSystem_::ctx, and SYSPROCHECKVALIDLINSYS.
Referenced by eliminate_singletons().
PetscErrorCode LinearSystemSetKnownSolution | ( | LinearSystem | sys, | |
PetscTruth | sol | |||
) |
Definition at line 225 of file linear.c.
References LinearSystem_::known_solution, and SYSPROCHECKVALIDLINSYS.
PetscErrorCode LinearSystemSetMetadata | ( | LinearSystem | system, | |
NMD_metadata | nmd | |||
) |
Definition at line 245 of file linear.c.
References LinearSystem_::metadata, and SYSPROCHECKVALIDLINSYS.
Referenced by main().
PetscErrorCode LinearSystemSetParts | ( | LinearSystem | system, | |
Mat | A, | |||
Mat | B, | |||
Vec | Rhs, | |||
Vec | Sol, | |||
Vec | Init | |||
) |
Declare the matrices and vectors for a linear system.
Arguments:
system
A
: the matrixB
: operator to construct the preconditioner from; if NULL, (or identical to A), A will be usedDefinition at line 131 of file linear.c.
References LinearSystem_::A, LinearSystem_::B, CHKERRQ(), ierr, LinearSystem_::Init, LinearSystem_::partsoriginal, LinearSystem_::Rhs, LinearSystem_::Sol, and SYSPROCHECKVALIDLINSYS.
Referenced by distribute_system(), eliminate_singletons(), flipsign(), main(), MatGustafssonMod(), MatSymmetricPart(), and setup_pc().
PetscErrorCode LinearSystemTrueDistance | ( | LinearSystem | system, | |
LinearSolution | linsol, | |||
PetscReal * | rnrm | |||
) |
Definition at line 652 of file linear.c.
References CHKERRQ(), ierr, LinearSolutionGetVector(), LinearSystemGetParts(), and LinearSystemGetTmpVector().
Referenced by LinearSystemTrueDistancePrint().
PetscErrorCode LinearSystemTrueDistancePrint | ( | NumericalProblem | problem, | |
NumericalSolution | solution, | |||
char * | caption | |||
) |
Definition at line 672 of file linear.c.
References CHKERRQ(), ierr, LinearSolutionGetVector(), LinearSystemGetKnownSolution(), LinearSystemGetParts(), LinearSystemGetTmpVector(), LinearSystemTrueDistance(), SYSPROCHECKVALIDLINSOL, and SYSPROCHECKVALIDLINSYS.
PetscErrorCode PreprocessedLinearSystemSolution | ( | LinearSystem | sys, | |
LinearSolution * | sol | |||
) |
Definition at line 705 of file linear.c.
References CHKERRQ(), ierr, PreprocessedProblemSolving(), RegisterPreprocessorContext(), and SYSPROCHECKVALIDLINSYS.