:orphan: # PetscMemoryAccessMode Describes the intended usage of a memory region ## Synopsis ``` #include typedef enum { PETSC_MEMORY_ACCESS_READ = 0x1, // 01 PETSC_MEMORY_ACCESS_WRITE = 0x2, // 10 PETSC_MEMORY_ACCESS_READ_WRITE = 0x3, // 11 } PetscMemoryAccessMode; ``` ## Values - ***`PETSC_MEMORY_ACCESS_READ` -*** Read only - ***`PETSC_MEMORY_ACCESS_WRITE` -*** Write only - ***`PETSC_MEMORY_ACCESS_READ_WRITE` -*** Read and write ## Notes This `enum` is a bitmask with the following encoding (assuming 2 bit): ```none PETSC_MEMORY_ACCESS_READ = 0b01 PETSC_MEMORY_ACCESS_WRITE = 0b10 PETSC_MEMORY_ACCESS_READ_WRITE = 0b11 // consequently PETSC_MEMORY_ACCESS_READ | PETSC_MEMORY_ACCESS_WRITE = PETSC_MEMORY_ACCESS_READ_WRITE ``` The following convenience macros are also provided: - ***`PetscMemoryAccessRead(mode)` -*** `true` if `mode` is any kind of read, `false` otherwise - ***`PetscMemoryAccessWrite(mode)` -*** `true` if `mode` is any kind of write, `false` otherwise ## Developer Notes This enum uses a function (`PetscMemoryAccessModeToString()`) to convert values to string representation, so cannot be used in `PetscOptionsEnum()`. ## See Also `PetscMemoryAccessModeToString()`, `PetscDevice`, `PetscDeviceContext` ## Level beginner ## Location include/petscdevicetypes.h --- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/include/petscdevicetypes.h) [Index of all Sys routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)