/*@C ISGetType - Gets the index set type name (as a string) from the IS. Not Collective Input Parameter: . is - The index set Output Parameter: . type - The index set type name Level: intermediate .seealso: ISSetType(), ISCreate() @*/ PetscErrorCode ISGetType(IS is, ISType *type) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(is, IS_CLASSID,1); PetscValidCharPointer(type,2); if (!ISRegisterAllCalled) { ierr = ISRegisterAll(PETSC_NULL);CHKERRQ(ierr); } *type = ((PetscObject)is)->type_name; PetscFunctionReturn(0); }
/*@C ISSetType - Builds a index set, for a particular implementation. Collective on IS Input Parameters: + is - The index set object - method - The name of the index set type Options Database Key: . -is_type <type> - Sets the index set type; use -help for a list of available types Notes: See "petsc/include/petscis.h" for available istor types (for instance, ISGENERAL, ISSTRIDE, or ISBLOCK). Use ISDuplicate() to make a duplicate Level: intermediate .seealso: ISGetType(), ISCreate() @*/ PetscErrorCode ISSetType(IS is, ISType method) { PetscErrorCode (*r)(IS); PetscBool match; PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(is, IS_CLASSID,1); ierr = PetscObjectTypeCompare((PetscObject) is, method, &match);CHKERRQ(ierr); if (match) PetscFunctionReturn(0); if (!ISRegisterAllCalled) {ierr = ISRegisterAll(PETSC_NULL);CHKERRQ(ierr);} ierr = PetscFunctionListFind( ((PetscObject)is)->comm,ISList, method,PETSC_TRUE,(void (**)(void)) &r);CHKERRQ(ierr); if (!r) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_UNKNOWN_TYPE, "Unknown IS type: %s", method); if (is->ops->destroy) { ierr = (*is->ops->destroy)(is);CHKERRQ(ierr); is->ops->destroy = PETSC_NULL; } ierr = (*r)(is);CHKERRQ(ierr); ierr = PetscObjectChangeTypeName((PetscObject)is,method);CHKERRQ(ierr); PetscFunctionReturn(0); }
/*@C ISInitializePackage - This function initializes everything in the IS package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to ISCreateXXXX() when using static libraries. Level: developer .keywords: Vec, initialize, package .seealso: PetscInitialize() @*/ PetscErrorCode ISInitializePackage(void) { char logList[256]; char *className; PetscBool opt; PetscErrorCode ierr; PetscFunctionBegin; if (ISPackageInitialized) PetscFunctionReturn(0); ISPackageInitialized = PETSC_TRUE; /* Register Constructors */ ierr = ISRegisterAll();CHKERRQ(ierr); /* Register Classes */ ierr = PetscClassIdRegister("Index Set",&IS_CLASSID);CHKERRQ(ierr); ierr = PetscClassIdRegister("IS L to G Mapping",&IS_LTOGM_CLASSID);CHKERRQ(ierr); ierr = PetscClassIdRegister("Section",&PETSC_SECTION_CLASSID);CHKERRQ(ierr); /* Process info exclusions */ ierr = PetscOptionsGetString(NULL, "-info_exclude", logList, 256, &opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList, "is", &className);CHKERRQ(ierr); if (className) { ierr = PetscInfoDeactivateClass(IS_CLASSID);CHKERRQ(ierr); ierr = PetscInfoDeactivateClass(IS_LTOGM_CLASSID);CHKERRQ(ierr); } } /* Process summary exclusions */ ierr = PetscOptionsGetString(NULL, "-log_summary_exclude", logList, 256, &opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList, "is", &className);CHKERRQ(ierr); if (className) { ierr = PetscLogEventDeactivateClass(IS_CLASSID);CHKERRQ(ierr); ierr = PetscLogEventDeactivateClass(IS_LTOGM_CLASSID);CHKERRQ(ierr); } } ierr = PetscRegisterFinalize(ISFinalizePackage);CHKERRQ(ierr); PetscFunctionReturn(0); }