| Line 21... |
Line 21... |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
*/
|
*/
|
|
|
#include <private/ipimpl.h> /*I "slepcip.h" I*/
|
#include <private/ipimpl.h> /*I "slepcip.h" I*/
|
|
|
PetscClassId IP_CLASSID = 0;
|
PetscClassId IP_CLASSID = 0;
|
PetscLogEvent IP_InnerProduct = 0, IP_Orthogonalize = 0, IP_ApplyMatrix = 0;
|
PetscLogEvent IP_InnerProduct = 0, IP_Orthogonalize = 0, IP_ApplyMatrix = 0;
|
|
|
#undef __FUNCT__
|
#undef __FUNCT__
|
#define __FUNCT__ "IPInitializePackage"
|
#define __FUNCT__ "IPInitializePackage"
|
/*@C
|
/*@C
|
| Line 41... |
Line 41... |
.seealso: SlepcInitialize()
|
.seealso: SlepcInitialize()
|
@*/
|
@*/
|
PetscErrorCode IPInitializePackage(const char *path)
|
PetscErrorCode IPInitializePackage(const char *path)
|
{
|
{
|
static PetscBool initialized = PETSC_FALSE;
|
static PetscBool initialized = PETSC_FALSE;
|
char logList[256];
|
char logList[256];
|
char *className;
|
char *className;
|
PetscBool opt;
|
PetscBool opt;
|
PetscErrorCode ierr;
|
PetscErrorCode ierr;
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
if (initialized) PetscFunctionReturn(0);
|
if (initialized) PetscFunctionReturn(0);
|
initialized = PETSC_TRUE;
|
initialized = PETSC_TRUE;
|
/* Register Classes */
|
/* Register Classes */
|
| Line 97... |
Line 97... |
|
|
.seealso: IPDestroy(), IP
|
.seealso: IPDestroy(), IP
|
@*/
|
@*/
|
PetscErrorCode IPCreate(MPI_Comm comm,IP *newip)
|
PetscErrorCode IPCreate(MPI_Comm comm,IP *newip)
|
{
|
{
|
|
IP ip;
|
PetscErrorCode ierr;
|
PetscErrorCode ierr;
|
IP ip;
|
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
PetscValidPointer(newip,2);
|
PetscValidPointer(newip,2);
|
ierr = PetscHeaderCreate(ip,_p_IP,int,IP_CLASSID,-1,"IP",comm,IPDestroy,IPView);CHKERRQ(ierr);
|
ierr = PetscHeaderCreate(ip,_p_IP,int,IP_CLASSID,-1,"IP",comm,IPDestroy,IPView);CHKERRQ(ierr);
|
*newip = ip;
|
*newip = ip;
|
| Line 113... |
Line 113... |
ip->innerproducts = 0;
|
ip->innerproducts = 0;
|
ip->matrix = PETSC_NULL;
|
ip->matrix = PETSC_NULL;
|
ip->Bx = PETSC_NULL;
|
ip->Bx = PETSC_NULL;
|
ip->xid = 0;
|
ip->xid = 0;
|
ip->xstate = 0;
|
ip->xstate = 0;
|
|
|
PetscFunctionReturn(0);
|
PetscFunctionReturn(0);
|
}
|
}
|
|
|
#undef __FUNCT__
|
#undef __FUNCT__
|
#define __FUNCT__ "IPSetOptionsPrefix"
|
#define __FUNCT__ "IPSetOptionsPrefix"
|
| Line 141... |
Line 140... |
.seealso: IPAppendOptionsPrefix()
|
.seealso: IPAppendOptionsPrefix()
|
@*/
|
@*/
|
PetscErrorCode IPSetOptionsPrefix(IP ip,const char *prefix)
|
PetscErrorCode IPSetOptionsPrefix(IP ip,const char *prefix)
|
{
|
{
|
PetscErrorCode ierr;
|
PetscErrorCode ierr;
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
PetscValidHeaderSpecific(ip,IP_CLASSID,1);
|
PetscValidHeaderSpecific(ip,IP_CLASSID,1);
|
ierr = PetscObjectSetOptionsPrefix((PetscObject)ip,prefix);CHKERRQ(ierr);
|
ierr = PetscObjectSetOptionsPrefix((PetscObject)ip,prefix);CHKERRQ(ierr);
|
PetscFunctionReturn(0);
|
PetscFunctionReturn(0);
|
}
|
}
|
| Line 170... |
Line 170... |
.seealso: IPSetOptionsPrefix()
|
.seealso: IPSetOptionsPrefix()
|
@*/
|
@*/
|
PetscErrorCode IPAppendOptionsPrefix(IP ip,const char *prefix)
|
PetscErrorCode IPAppendOptionsPrefix(IP ip,const char *prefix)
|
{
|
{
|
PetscErrorCode ierr;
|
PetscErrorCode ierr;
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
PetscValidHeaderSpecific(ip,IP_CLASSID,1);
|
PetscValidHeaderSpecific(ip,IP_CLASSID,1);
|
ierr = PetscObjectAppendOptionsPrefix((PetscObject)ip,prefix);CHKERRQ(ierr);
|
ierr = PetscObjectAppendOptionsPrefix((PetscObject)ip,prefix);CHKERRQ(ierr);
|
PetscFunctionReturn(0);
|
PetscFunctionReturn(0);
|
}
|
}
|
| Line 199... |
Line 200... |
|
|
.seealso: IPSetOptionsPrefix(), IPAppendOptionsPrefix()
|
.seealso: IPSetOptionsPrefix(), IPAppendOptionsPrefix()
|
@*/
|
@*/
|
PetscErrorCode IPGetOptionsPrefix(IP ip,const char *prefix[])
|
PetscErrorCode IPGetOptionsPrefix(IP ip,const char *prefix[])
|
{
|
{
|
PetscErrorCode ierr;
|
PetscErrorCode ierr;
|
PetscFunctionBegin;
|
|
PetscValidHeaderSpecific(ip,IP_CLASSID,1);
|
PetscFunctionBegin;
|
PetscValidPointer(prefix,2);
|
PetscValidHeaderSpecific(ip,IP_CLASSID,1);
|
ierr = PetscObjectGetOptionsPrefix((PetscObject)ip, prefix);CHKERRQ(ierr);
|
PetscValidPointer(prefix,2);
|
PetscFunctionReturn(0);
|
ierr = PetscObjectGetOptionsPrefix((PetscObject)ip, prefix);CHKERRQ(ierr);
|
|
PetscFunctionReturn(0);
|
}
|
}
|
|
|
|
|
#undef __FUNCT__
|
#undef __FUNCT__
|
#define __FUNCT__ "IPSetFromOptions"
|
#define __FUNCT__ "IPSetFromOptions"
|
| Line 225... |
Line 227... |
|
|
Level: beginner
|
Level: beginner
|
@*/
|
@*/
|
PetscErrorCode IPSetFromOptions(IP ip)
|
PetscErrorCode IPSetFromOptions(IP ip)
|
{
|
{
|
PetscErrorCode ierr;
|
|
const char *orth_list[2] = { "mgs" , "cgs" };
|
const char *orth_list[2] = { "mgs" , "cgs" };
|
const char *ref_list[3] = { "never" , "ifneeded", "always" };
|
const char *ref_list[3] = { "never" , "ifneeded", "always" };
|
PetscReal r;
|
PetscReal r;
|
PetscInt i,j;
|
PetscInt i,j;
|
|
PetscErrorCode ierr;
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
PetscValidHeaderSpecific(ip,IP_CLASSID,1);
|
PetscValidHeaderSpecific(ip,IP_CLASSID,1);
|
ierr = PetscOptionsBegin(((PetscObject)ip)->comm,((PetscObject)ip)->prefix,"Inner Product (IP) Options","IP");CHKERRQ(ierr);
|
ierr = PetscOptionsBegin(((PetscObject)ip)->comm,((PetscObject)ip)->prefix,"Inner Product (IP) Options","IP");CHKERRQ(ierr);
|
i = ip->orthog_type;
|
i = ip->orthog_type;
|
| Line 369... |
Line 371... |
|
|
.seealso: EPSView(), SVDView(), PetscViewerASCIIOpen()
|
.seealso: EPSView(), SVDView(), PetscViewerASCIIOpen()
|
@*/
|
@*/
|
PetscErrorCode IPView(IP ip,PetscViewer viewer)
|
PetscErrorCode IPView(IP ip,PetscViewer viewer)
|
{
|
{
|
|
PetscBool isascii;
|
PetscErrorCode ierr;
|
PetscErrorCode ierr;
|
PetscBool isascii;
|
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
PetscValidHeaderSpecific(ip,IP_CLASSID,1);
|
PetscValidHeaderSpecific(ip,IP_CLASSID,1);
|
if (!viewer) viewer = PETSC_VIEWER_STDOUT_(((PetscObject)ip)->comm);
|
if (!viewer) viewer = PETSC_VIEWER_STDOUT_(((PetscObject)ip)->comm);
|
PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2);
|
PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2);
|
PetscCheckSameComm(ip,1,viewer,2);
|
PetscCheckSameComm(ip,1,viewer,2);
|
|
|
ierr = PetscTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr);
|
ierr = PetscTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr);
|
if (isascii) {
|
if (isascii) {
|
ierr = PetscObjectPrintClassNamePrefixType((PetscObject)ip,viewer,"IP Object");CHKERRQ(ierr);
|
ierr = PetscObjectPrintClassNamePrefixType((PetscObject)ip,viewer,"IP Object");CHKERRQ(ierr);
|
ierr = PetscViewerASCIIPrintf(viewer," orthogonalization method: ");CHKERRQ(ierr);
|
ierr = PetscViewerASCIIPrintf(viewer," orthogonalization method: ");CHKERRQ(ierr);
|
switch (ip->orthog_type) {
|
switch (ip->orthog_type) {
|