petsc-3.3-p7 2013-05-11

PetscRandomRegisterDynamic

Adds a new PetscRandom component implementation

Synopsis

PetscErrorCode PetscRandomRegisterDynamic(const char *name, const char *path, const char *func_name, PetscErrorCode (*create_func)(PetscRandom))
Not Collective

Input Parameters

name - The name of a new user-defined creation routine
path - The path (either absolute or relative) of the library containing this routine
func_name - The name of routine to create method context
create_func - The creation routine itself

Notes

PetscRandomRegisterDynamic() may be called multiple times to add several user-defined randome number generators

If dynamic libraries are used, then the fourth input argument (routine_create) is ignored.

Sample usage

    PetscRandomRegisterDynamic("my_rand","/home/username/my_lib/lib/libO/solaris/libmy.a", "MyPetscRandomtorCreate", MyPetscRandomtorCreate);

Then, your random type can be chosen with the procedural interface via

    PetscRandomCreate(MPI_Comm, PetscRandom *);
    PetscRandomSetType(PetscRandom,"my_random_name");
or at runtime via the option
    -random_type my_random_name

Notes: $PETSC_ARCH occuring in pathname will be replaced with appropriate values.

For an example of the code needed to interface your own random number generator see src/sys/random/impls/rand/rand.c

Keywords

PetscRandom, register

See Also

PetscRandomRegisterAll(), PetscRandomRegisterDestroy(), PetscRandomRegister()

Level:advanced
Location:
include/petscsys.h
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages