linear.c File Reference

#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.

Functions

PetscErrorCode LinearPackageSetUp ()
PetscErrorCode CreateLinearSystem (MPI_Comm comm, LinearSystem *system)
PetscErrorCode DeleteLinearSystem (LinearSystem system)
PetscErrorCode LinearSystemSetParts (LinearSystem system, Mat A, Mat B, Vec Rhs, Vec Sol, Vec Init)
PetscErrorCode LinearSystemInheritParts (LinearSystem system, Mat A, Mat B, Vec Rhs, Vec Sol, Vec Init)
PetscErrorCode LinearSystemGetParts (LinearSystem system, Mat *A, Mat *B, Vec *Rhs, Vec *Sol, Vec *Init)
PetscErrorCode LinearSystemSetContext (LinearSystem system, void *ctx)
PetscErrorCode LinearSystemGetContext (LinearSystem system, void **ctx)
PetscErrorCode LinearSystemSetKnownSolution (LinearSystem sys, PetscTruth sol)
PetscErrorCode LinearSystemGetKnownSolution (LinearSystem sys, PetscTruth *sol)
PetscErrorCode LinearSystemSetMetadata (LinearSystem system, NMD_metadata nmd)
PetscErrorCode LinearSystemGetMetadata (LinearSystem system, NMD_metadata *nmd)
PetscErrorCode LinearSystemGetTmpVector (LinearSystem sys, Vec *tmp)
PetscErrorCode LinearSystemDuplicatePointers (LinearSystem problem, LinearSystem *newproblem)
PetscErrorCode LinearSystemDuplicate (LinearSystem problem, LinearSystem *newproblem)
PetscErrorCode LinearSystemCopy (LinearSystem old, LinearSystem lnew)
PetscErrorCode CreateLinearSolution (LinearSolution *sol)
PetscErrorCode LinearCreateNumericalSolution (NumericalProblem prob, NumericalSolution *sol)
PetscErrorCode LinearSolutionDelete (LinearSolution sol)
PetscErrorCode LinearDeleteNumericalSolution (NumericalSolution sol)
PetscErrorCode LinearSolutionCopy (LinearSolution old, LinearSolution lnew)
PetscErrorCode LinearCopyNumericalSolution (NumericalSolution old, NumericalSolution nnew)
PetscErrorCode CreateDefaultLinearSolution (NumericalProblem problem, NumericalSolution *rsol)
PetscErrorCode LinearSolutionSetVector (LinearSolution sol, Vec out)
PetscErrorCode LinearSolutionGetVector (LinearSolution sol, Vec *out)
PetscErrorCode LinearSolutionCreateStatistics (LinearSolution sol)
PetscErrorCode LinearSolutionGetStatistics (LinearSolution sol, NMD_metadata *s)
PetscErrorCode LinearSolutionCopyStats (LinearSolution in, LinearSolution out)
PetscErrorCode LinearSolutionSetContext (LinearSolution sol, void *ctx)
PetscErrorCode LinearSolutionGetContext (LinearSolution sol, void **ctx)
PetscErrorCode LinearDeleteNumericalSolutionContext (NumericalSolution sol)
PetscErrorCode LinearSystemTrueDistance (LinearSystem system, LinearSolution linsol, PetscReal *rnrm)
PetscErrorCode LinearSystemTrueDistancePrint (NumericalProblem problem, NumericalSolution solution, char *caption)
PetscErrorCode PreprocessedLinearSystemSolution (LinearSystem sys, LinearSolution *sol)


Detailed Description

Definition in file linear.c.


Function Documentation

PetscErrorCode CreateDefaultLinearSolution ( NumericalProblem  problem,
NumericalSolution rsol 
)

PetscErrorCode CreateLinearSolution ( LinearSolution sol  ) 

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  ) 

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 LinearPackageSetUp (  ) 

Definition at line 66 of file linear.c.

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 
)

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 
)

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 
)

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 
)

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 
)

PetscErrorCode LinearSystemGetParts ( LinearSystem  system,
Mat *  A,
Mat *  B,
Vec *  Rhs,
Vec *  Sol,
Vec *  Init 
)

PetscErrorCode LinearSystemGetTmpVector ( LinearSystem  sys,
Vec *  tmp 
)

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 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 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 
)

PetscErrorCode LinearSystemTrueDistancePrint ( NumericalProblem  problem,
NumericalSolution  solution,
char *  caption 
)

PetscErrorCode PreprocessedLinearSystemSolution ( LinearSystem  sys,
LinearSolution sol 
)


Generated on Sun Oct 4 04:03:04 2009 for System Preprocessors by  doxygen 1.5.9