/* PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened. This one registers all the methods that are in the basic PETSc Vec library. */ PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscvec(void) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscSFInitializePackage();CHKERRQ(ierr); ierr = ISInitializePackage();CHKERRQ(ierr); ierr = AOInitializePackage();CHKERRQ(ierr); ierr = VecInitializePackage();CHKERRQ(ierr); ierr = PFInitializePackage();CHKERRQ(ierr); PetscFunctionReturn(0); }
/*@C PetscSFCreate - create a star forest communication context Not Collective Input Arguments: . comm - communicator on which the star forest will operate Output Arguments: . sf - new star forest context Level: intermediate .seealso: PetscSFSetGraph(), PetscSFDestroy() @*/ PetscErrorCode PetscSFCreate(MPI_Comm comm,PetscSF *sf) { PetscErrorCode ierr; PetscSF b; PetscFunctionBegin; PetscValidPointer(sf,2); ierr = PetscSFInitializePackage();CHKERRQ(ierr); ierr = PetscHeaderCreate(b,PETSCSF_CLASSID,"PetscSF","Star Forest","PetscSF",comm,PetscSFDestroy,PetscSFView);CHKERRQ(ierr); b->nroots = -1; b->nleaves = -1; b->nranks = -1; b->rankorder = PETSC_TRUE; b->ingroup = MPI_GROUP_NULL; b->outgroup = MPI_GROUP_NULL; b->graphset = PETSC_FALSE; *sf = b; PetscFunctionReturn(0); }
/* PetscInitialize_DynamicLibraries - Adds the default dynamic link libraries to the search path. */ PETSC_INTERN PetscErrorCode PetscInitialize_DynamicLibraries(void) { char *libname[32]; PetscErrorCode ierr; PetscInt nmax,i; #if defined(PETSC_USE_DYNAMIC_LIBRARIES) && defined(PETSC_USE_SHARED_LIBRARIES) PetscBool preload; #endif PetscFunctionBegin; nmax = 32; ierr = PetscOptionsGetStringArray(NULL,NULL,"-dll_prepend",libname,&nmax,NULL);CHKERRQ(ierr); for (i=0; i<nmax; i++) { ierr = PetscDLLibraryPrepend(PETSC_COMM_WORLD,&PetscDLLibrariesLoaded,libname[i]);CHKERRQ(ierr); ierr = PetscFree(libname[i]);CHKERRQ(ierr); } #if !defined(PETSC_USE_DYNAMIC_LIBRARIES) || !defined(PETSC_USE_SHARED_LIBRARIES) /* This just initializes the most basic PETSc stuff. The classes, from PetscDraw to PetscTS, are initialized the first time an XXCreate() is called. */ ierr = PetscSysInitializePackage();CHKERRQ(ierr); #else preload = PETSC_FALSE; ierr = PetscOptionsGetBool(NULL,NULL,"-dynamic_library_preload",&preload,NULL);CHKERRQ(ierr); if (preload) { PetscBool found; #if defined(PETSC_USE_SINGLE_LIBRARY) ierr = PetscLoadDynamicLibrary("",&found);CHKERRQ(ierr); if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc dynamic library \n You cannot move the dynamic libraries!"); #else ierr = PetscLoadDynamicLibrary("sys",&found);CHKERRQ(ierr); if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc dynamic library \n You cannot move the dynamic libraries!"); ierr = PetscLoadDynamicLibrary("vec",&found);CHKERRQ(ierr); if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc Vec dynamic library \n You cannot move the dynamic libraries!"); ierr = PetscLoadDynamicLibrary("mat",&found);CHKERRQ(ierr); if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc Mat dynamic library \n You cannot move the dynamic libraries!"); ierr = PetscLoadDynamicLibrary("dm",&found);CHKERRQ(ierr); if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc DM dynamic library \n You cannot move the dynamic libraries!"); ierr = PetscLoadDynamicLibrary("ksp",&found);CHKERRQ(ierr); if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc KSP dynamic library \n You cannot move the dynamic libraries!"); ierr = PetscLoadDynamicLibrary("snes",&found);CHKERRQ(ierr); if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc SNES dynamic library \n You cannot move the dynamic libraries!"); ierr = PetscLoadDynamicLibrary("ts",&found);CHKERRQ(ierr); if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc TS dynamic library \n You cannot move the dynamic libraries!"); #endif } #endif nmax = 32; ierr = PetscOptionsGetStringArray(NULL,NULL,"-dll_append",libname,&nmax,NULL);CHKERRQ(ierr); for (i=0; i<nmax; i++) { ierr = PetscDLLibraryAppend(PETSC_COMM_WORLD,&PetscDLLibrariesLoaded,libname[i]);CHKERRQ(ierr); ierr = PetscFree(libname[i]);CHKERRQ(ierr); } #if defined(PETSC_HAVE_THREADSAFETY) /* These must be done here because it is not safe for individual threads to call these initialize routines */ ierr = AOInitializePackage();CHKERRQ(ierr); ierr = PetscSFInitializePackage();CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) ierr = CharacteristicInitializePackage();CHKERRQ(ierr); #endif ierr = ISInitializePackage();CHKERRQ(ierr); ierr = VecInitializePackage();CHKERRQ(ierr); ierr = MatInitializePackage();CHKERRQ(ierr); ierr = DMInitializePackage();CHKERRQ(ierr); ierr = PCInitializePackage();CHKERRQ(ierr); ierr = KSPInitializePackage();CHKERRQ(ierr); ierr = SNESInitializePackage();CHKERRQ(ierr); ierr = TSInitializePackage();CHKERRQ(ierr); ierr = PetscCommDuplicate(PETSC_COMM_SELF,&PETSC_COMM_SELF_INNER,NULL);CHKERRQ(ierr); ierr = PetscCommDuplicate(PETSC_COMM_WORLD,&PETSC_COMM_WORLD_INNER,NULL);CHKERRQ(ierr); #endif PetscFunctionReturn(0); }