petsc-3.7.1 2016-05-15
Report Typos and Errors

PetscRandomRegister

Adds a new PetscRandom component implementation

Synopsis

#include "petscsys.h" 
PetscErrorCode  PetscRandomRegister(const char sname[], PetscErrorCode (*function)(PetscRandom))
Not Collective Many br

Input Parameters

name - The name of a new user-defined creation routine Many br
create_func - The creation routine itself Many br

Notes

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

Sample usage

    PetscRandomRegister("my_rand",  MyPetscRandomtorCreate);
Many br

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

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

Notes: For an example of the code needed to interface your own random number generator see Many brsrc/sys/random/impls/rand/rand.c Many br

Many br

Keywords

PetscRandom, register

See Also

PetscRandomRegisterAll(), PetscRandomRegisterDestroy(), PetscRandomRegister()

Level:advanced
Location:
src/sys/classes/random/interface/randreg.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages