petsc-3.3-p7 2013-05-11

PetscThreadCommGetScalars

Gets pointers to locations for storing three PetscScalars that may be passed to PetscThreadCommRunKernel to ensure that the scalar values remain valid even after the main thread exits the calling function.

Synopsis

#include "petscthreadcomm.h" 
PetscErrorCode PetscThreadCommGetScalars(MPI_Comm comm,PetscScalar **val1, PetscScalar **val2, PetscScalar **val3)

Input Parameters

comm - the MPI communicator having the thread communicator
val1 - pointer to store the first scalar value
val2 - pointer to store the second scalar value
val3 - pointer to store the third scalar value

Notes

This is a utility function to ensure that any scalars passed to PetscThreadCommRunKernel remain valid even after the main thread exits the calling function. If any scalars need to passed to PetscThreadCommRunKernel then these should be first stored in the locations provided by PetscThreadCommGetScalars()

Pass PETSC_NULL if any pointers are not needed.

Called by the main thread only, not from within kernels

Typical usage

PetscScalar *valptr; PetscThreadCommGetScalar(comm,&valptr,PETSC_NULL,PETSC_NULL); *valptr = alpha; (alpha is the scalar you wish to pass in PetscThreadCommRunKernel)

PetscThreadCommRunKernel(comm,(PetscThreadKernel)kernel_func,3,x,y,valptr);

See Also

PetscThreadCommRunKernel()

Level:developer
Location:
src/sys/threadcomm/threadcomm.c
Index of all PetscThreadComm routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/sys/threadcomm/examples/tutorials/ex3.c.html