1 #pragma once 2 3 #include <petsc/private/petscimpl.h> 4 5 PETSC_EXTERN PetscBool PetscRandomRegisterAllCalled; 6 PETSC_EXTERN PetscErrorCode PetscRandomRegisterAll(void); 7 8 typedef struct _PetscRandomOps *PetscRandomOps; 9 struct _PetscRandomOps { 10 /* 0 */ 11 PetscErrorCode (*seed)(PetscRandom); 12 PetscErrorCode (*getvalue)(PetscRandom, PetscScalar *); 13 PetscErrorCode (*getvaluereal)(PetscRandom, PetscReal *); 14 PetscErrorCode (*getvalues)(PetscRandom, PetscInt, PetscScalar *); 15 PetscErrorCode (*getvaluesreal)(PetscRandom, PetscInt, PetscReal *); 16 PetscErrorCode (*destroy)(PetscRandom); 17 PetscErrorCode (*setfromoptions)(PetscRandom, PetscOptionItems); 18 }; 19 20 struct _p_PetscRandom { 21 PETSCHEADER(struct _PetscRandomOps); 22 void *data; /* implementation-specific data */ 23 unsigned long seed; 24 PetscScalar low, width; /* lower bound and width of the interval over 25 which the random numbers are distributed */ 26 PetscBool iset; /* if true, indicates that the user has set the interval */ 27 /* array for shuffling ??? */ 28 }; 29