/*@C AOGetType - Gets the AO type name (as a string) from the AO. Not Collective Input Parameter: . ao - The vector Output Parameter: . type - The AO type name Level: intermediate .keywords: ao, get, type, name .seealso: AOSetType(), AOCreate() @*/ PetscErrorCode AOGetType(AO ao, AOType *type) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ao, AO_CLASSID,1); PetscValidPointer(type,2); ierr = AORegisterAll();CHKERRQ(ierr); *type = ((PetscObject)ao)->type_name; PetscFunctionReturn(0); }
/*@C AOGetType - Gets the AO type name (as a string) from the AO. Not Collective Input Parameter: . ao - The vector Output Parameter: . type - The AO type name Level: intermediate .keywords: ao, get, type, name .seealso: AOSetType(), AOCreate() @*/ PetscErrorCode AOGetType(AO ao, const AOType *type) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ao, AO_CLASSID,1); PetscValidCharPointer(type,2); if (!AORegisterAllCalled) { ierr = AORegisterAll(PETSC_NULL);CHKERRQ(ierr); } *type = ((PetscObject)ao)->type_name; PetscFunctionReturn(0); }
/*@C AOSetType - Builds an application ordering for a particular implementation. Collective on AO Input Parameters: + ao - The AO object - method - The name of the AO type Options Database Key: . -ao_type <type> - Sets the AO type; use -help for a list of available types Notes: See "petsc/include/petscao.h" for available AO types (for instance, AOBASIC and AOMEMORYSCALABLE). Level: intermediate .keywords: ao, set, type .seealso: AOGetType(), AOCreate() @*/ PetscErrorCode AOSetType(AO ao, AOType method) { PetscErrorCode (*r)(AO); PetscBool match; PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ao, AO_CLASSID,1); ierr = PetscObjectTypeCompare((PetscObject)ao, method, &match);CHKERRQ(ierr); if (match) PetscFunctionReturn(0); ierr = AORegisterAll();CHKERRQ(ierr); ierr = PetscFunctionListFind(AOList,method,&r);CHKERRQ(ierr); if (!r) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_UNKNOWN_TYPE, "Unknown AO type: %s", method); if (ao->ops->destroy) { ierr = (*ao->ops->destroy)(ao);CHKERRQ(ierr); ao->ops->destroy = NULL; } ierr = (*r)(ao);CHKERRQ(ierr); PetscFunctionReturn(0); }
/*@C AOInitializePackage - This function initializes everything in the AO package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to AOCreate(). Input Parameter: path - The dynamic library path, or PETSC_NULL Level: developer .keywords: AO, initialize, package .seealso: PetscInitialize() @*/ PetscErrorCode AOInitializePackage(const char path[]) { char logList[256]; char *className; PetscBool opt; PetscErrorCode ierr; PetscFunctionBegin; if (AOPackageInitialized) PetscFunctionReturn(0); AOPackageInitialized = PETSC_TRUE; /* Register Classes */ ierr = PetscClassIdRegister("Application Order",&AO_CLASSID);CHKERRQ(ierr); /* Register Constructors */ ierr = AORegisterAll(path);CHKERRQ(ierr); /* Register Events */ ierr = PetscLogEventRegister("AOPetscToApplication", AO_CLASSID,&AO_PetscToApplication);CHKERRQ(ierr); ierr = PetscLogEventRegister("AOApplicationToPetsc", AO_CLASSID,&AO_ApplicationToPetsc);CHKERRQ(ierr); /* Process info exclusions */ ierr = PetscOptionsGetString(PETSC_NULL, "-info_exclude", logList, 256, &opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList, "ao", &className);CHKERRQ(ierr); if (className) { ierr = PetscInfoDeactivateClass(AO_CLASSID);CHKERRQ(ierr); } } /* Process summary exclusions */ ierr = PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList, "ao", &className);CHKERRQ(ierr); if (className) { ierr = PetscLogEventDeactivateClass(AO_CLASSID);CHKERRQ(ierr); } } ierr = PetscRegisterFinalize(AOFinalizePackage);CHKERRQ(ierr); PetscFunctionReturn(0); }