System Preprocessors
Typedefs | Functions
sysprolinear.h File Reference
#include "petscmat.h"
#include "petscksp.h"
#include "syspro.h"
#include "nmd.h"

Go to the source code of this file.

Typedefs

typedef struct LinearSystem_LinearSystem
typedef struct LinearSolution_LinearSolution
typedef struct Diagnostics_ * Diagnostics

Functions

PetscErrorCode CreateLinearSystem (MPI_Comm, LinearSystem *)
PetscErrorCode LinearSystemDelete (LinearSystem)
PetscErrorCode LinearDeleteNumericalProblem (NumericalProblem)
PetscErrorCode LinearSystemSetParts (LinearSystem, Mat, Mat, Vec, Vec, Vec)
PetscErrorCode LinearSystemInheritParts (LinearSystem, Mat, Mat, Vec, Vec, Vec)
PetscErrorCode LinearSystemGetParts (LinearSystem, Mat *, Mat *, Vec *, Vec *, Vec *)
PetscErrorCode LinearSystemGetTmpVector (LinearSystem, Vec *)
PetscErrorCode LinearSystemSetContext (LinearSystem, void *ctx)
PetscErrorCode LinearSystemGetContext (LinearSystem, void **ctx)
PetscErrorCode LinearSystemSetKnownSolution (LinearSystem, PetscBool)
PetscErrorCode LinearSystemGetKnownSolution (LinearSystem, PetscBool *)
PetscErrorCode LinearSystemSetMetadata (LinearSystem, NMD_metadata)
PetscErrorCode LinearSystemGetMetadata (LinearSystem, NMD_metadata *)
PetscErrorCode LinearSystemDuplicatePointers (LinearSystem, LinearSystem *)
PetscErrorCode LinearSystemDuplicate (LinearSystem, LinearSystem *)
PetscErrorCode LinearSystemCopy (LinearSystem, LinearSystem)
PetscErrorCode CreateLinearSolution (LinearSolution *)
PetscErrorCode LinearCreateNumericalSolution (NumericalProblem, NumericalSolution *)
PetscErrorCode LinearSolutionDelete (LinearSolution)
PetscErrorCode LinearSolutionCopy (LinearSolution, LinearSolution)
PetscErrorCode LinearSolutionCopyStats (LinearSolution, LinearSolution)
PetscErrorCode LinearCopyNumericalSolution (NumericalSolution, NumericalSolution)
PetscErrorCode LinearDeleteNumericalSolution (NumericalSolution)
PetscErrorCode LinearDeleteNumericalSolutionContext (NumericalSolution)
PetscErrorCode CreateDefaultLinearSolution (NumericalProblem, NumericalSolution *)
PetscErrorCode LinearSolutionSetVector (LinearSolution, Vec)
PetscErrorCode LinearSolutionGetVector (LinearSolution, Vec *)
PetscErrorCode LinearSolutionGetStatistics (LinearSolution, NMD_metadata *)
PetscErrorCode LinearSolutionSetTimes (LinearSolution, PetscLogDouble, PetscLogDouble, PetscLogDouble)
PetscErrorCode LinearSolutionAddToPreprocessTime (LinearSolution, PetscLogDouble)
PetscErrorCode LinearSolutionGetTimes (LinearSolution, PetscLogDouble *, PetscLogDouble *, PetscLogDouble *)
PetscErrorCode LinearSolutionSetContext (LinearSolution, void *ctx)
PetscErrorCode LinearSolutionGetContext (LinearSolution, void **ctx)
PetscErrorCode LinearSystemTrueDistance (LinearSystem, LinearSolution, PetscReal *)
PetscErrorCode LinearSystemTrueDistancePrint (NumericalProblem, NumericalSolution, char *)
PetscErrorCode LinearSolutionCreateStatistics (LinearSolution sol)
PetscErrorCode PreprocessedLinearSystemSolution (LinearSystem, LinearSolution *)
PetscErrorCode delete_diagnostics (Diagnostics)
PetscErrorCode make_diagnostics (char *, char *, Diagnostics *)
PetscErrorCode DeclareSingletonPreprocessor (void)
PetscErrorCode DeclareFlipsignPreprocessor (void)
PetscErrorCode DeclareApproximationPreprocessor (void)
PetscErrorCode DeclareDummyRowPreprocessor (void)
PetscErrorCode DeclareDistributionPreprocessor (void)
PetscErrorCode DeclareScalingPreprocessor (void)
PetscErrorCode DeclarePCPreprocessor (void)
PetscErrorCode DeclareKSPPreprocessor (void)

Typedef Documentation

typedef struct Diagnostics_* Diagnostics

Definition at line 11 of file sysprolinear.h.

Definition at line 10 of file sysprolinear.h.

typedef struct LinearSystem_* LinearSystem

Definition at line 9 of file sysprolinear.h.


Function Documentation

PetscErrorCode CreateLinearSolution ( LinearSolution )
PetscErrorCode CreateLinearSystem ( MPI_Comm  comm,
LinearSystem system 
)

Allocate the structure for a linear system

Definition at line 74 of file linear.c.

References CHKERRQ(), LinearSystem_::cookie, ierr, LINSYSCOOKIE, and LinearSystem_::partsoriginal.

Referenced by LinearSystemDuplicate(), LinearSystemDuplicatePointers(), and main().

PetscErrorCode DeclareApproximationPreprocessor ( void  )
PetscErrorCode DeclareDistributionPreprocessor ( void  )
PetscErrorCode DeclareDummyRowPreprocessor ( void  )
PetscErrorCode DeclareFlipsignPreprocessor ( void  )
PetscErrorCode DeclareKSPPreprocessor ( void  )
PetscErrorCode DeclarePCPreprocessor ( void  )
PetscErrorCode DeclareScalingPreprocessor ( void  )
PetscErrorCode DeclareSingletonPreprocessor ( void  )
PetscErrorCode delete_diagnostics ( Diagnostics  )

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 515 of file linear.c.

References CHKERRQ(), ierr, and LinearSolutionCopy().

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 432 of file linear.c.

References CHKERRQ(), CreateLinearSolution(), ierr, LinearSolutionSetVector(), and LinearSystemGetParts().

Referenced by main(), and solvelinear().

This is like LinearSystemDelete(), except that the argument has been cast so that this routine can be used as the problemdelete argument of SysProDeclareFunctions().

Definition at line 122 of file linear.c.

References CHKERRQ(), ierr, and LinearSystemDelete().

Referenced by main().

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 477 of file linear.c.

References CHKERRQ(), ierr, and LinearSolutionDelete().

Referenced by main().

Definition at line 650 of file linear.c.

References LinearSolution_::ctx, and SYSPROCHECKVALIDLINSOL.

PetscErrorCode LinearSolutionAddToPreprocessTime ( LinearSolution  ,
PetscLogDouble   
)
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 496 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().

Definition at line 573 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 459 of file linear.c.

References CHKERRQ(), ierr, LinearSolution_::Out, LinearSolution_::statistics, and SYSPROCHECKVALIDLINSOL.

Referenced by LinearDeleteNumericalSolution().

PetscErrorCode LinearSolutionGetContext ( LinearSolution  ,
void **  ctx 
)

Definition at line 640 of file linear.c.

References LinearSolution_::ctx, and SYSPROCHECKVALIDLINSOL.

PetscErrorCode LinearSolutionGetStatistics ( LinearSolution  ,
NMD_metadata *   
)

Definition at line 601 of file linear.c.

References LinearSolution_::statistics, and SYSPROCHECKVALIDLINSOL.

PetscErrorCode LinearSolutionGetTimes ( LinearSolution  ,
PetscLogDouble *  ,
PetscLogDouble *  ,
PetscLogDouble *   
)
PetscErrorCode LinearSolutionGetVector ( LinearSolution  ,
Vec *   
)
PetscErrorCode LinearSolutionSetContext ( LinearSolution  ,
void *  ctx 
)

Definition at line 630 of file linear.c.

References LinearSolution_::ctx, and SYSPROCHECKVALIDLINSOL.

PetscErrorCode LinearSolutionSetTimes ( LinearSolution  ,
PetscLogDouble  ,
PetscLogDouble  ,
PetscLogDouble   
)
PetscErrorCode LinearSolutionSetVector ( LinearSolution  ,
Vec   
)
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 368 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 LinearSystemDelete ( LinearSystem  )
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 323 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 
)
PetscErrorCode LinearSystemGetContext ( LinearSystem  ,
void **  ctx 
)

Definition at line 227 of file linear.c.

References LinearSystem_::ctx, and SYSPROCHECKVALIDLINSYS.

Referenced by eliminate_singletons().

PetscErrorCode LinearSystemGetKnownSolution ( LinearSystem  ,
PetscBool *   
)

Definition at line 247 of file linear.c.

References LinearSystem_::known_solution, and SYSPROCHECKVALIDLINSYS.

Referenced by LinearSystemTrueDistancePrint().

PetscErrorCode LinearSystemGetMetadata ( LinearSystem  ,
NMD_metadata *   
)
PetscErrorCode LinearSystemGetParts ( LinearSystem  system,
Mat *  A,
Mat *  B,
Vec *  Rhs,
Vec *  Sol,
Vec *  Init 
)
PetscErrorCode LinearSystemGetTmpVector ( LinearSystem  ,
Vec *   
)
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 175 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  ,
void *  ctx 
)

Definition at line 217 of file linear.c.

References LinearSystem_::ctx, and SYSPROCHECKVALIDLINSYS.

Referenced by eliminate_singletons().

PetscErrorCode LinearSystemSetKnownSolution ( LinearSystem  ,
PetscBool   
)

Definition at line 237 of file linear.c.

References LinearSystem_::known_solution, and SYSPROCHECKVALIDLINSYS.

PetscErrorCode LinearSystemSetMetadata ( LinearSystem  ,
NMD_metadata   
)

Definition at line 257 of file linear.c.

References LinearSystem_::metadata, and SYSPROCHECKVALIDLINSYS.

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 matrix
  • B : operator to construct the preconditioner from; if NULL, (or identical to A), A will be used
  • rhs : right hand side
  • sol : storage for the computed solution
  • init : (optional) nontrivial starting vector for iterative solution

Definition at line 145 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  ,
LinearSolution  ,
PetscReal *   
)
PetscErrorCode LinearSystemTrueDistancePrint ( NumericalProblem  ,
NumericalSolution  ,
char *   
)
PetscErrorCode make_diagnostics ( char *  ,
char *  ,
Diagnostics  
)