Actual source code: pointFunction.c

  1: #ifdef PETSC_RCS_HEADER
  2: static char vcid[] = "$Id: pointFunction.c,v 1.19 2000/10/17 13:48:57 knepley Exp $";
  3: #endif

  5: /*
  6:      Defines the interface to the point functions
  7: */

  9: #include "pointFunction.h"    /*I "mesh.h" I*/

 11: #undef  __FUNCT__
 13: /*@
 14:   PointFunctionOne - A PointFunction that is one at all locations.

 16:   Input Parameters:
 17: + n      - number of points
 18: . comp   - number of components
 19: . x,y,z  - coordinates of points
 20: - dummy  - unneeded context variable

 22:    Output Parameter:
 23: . values - location where 1.0 is stored (n*comp times)

 25:   Level: beginner

 27: .keywords point function
 28: .seealso PointFunctionZero(), PointFunctionConstant()
 29: @*/
 30: int PointFunctionOne(int n, int comp, double *x, double *y, double *z, PetscScalar *values, void *dummy)
 31: {
 32:   int i;
 33: 
 35:   for(i = 0; i < n*comp; i++) values[i] = 1.0;
 36:   return(0);
 37: }

 39: #undef  __FUNCT__
 41: /*@
 42:   PointFunctionZero - A PointFunction that is zero at all locations.

 44:   Input Parameters:
 45: + n      - number of points
 46: . comp   - number of components
 47: . x,y,z  - coordinates of points
 48: - dummy  - unneeded context variable

 50:   Output Parameter:
 51: . values - location where 0.0 is stored (n*comp times)

 53:   Level: beginner

 55: .keywords point function
 56: .seealso PointFunctionOne(), PointFunctionConstant()
 57: @*/
 58: int PointFunctionZero(int n, int comp, double *x, double *y, double *z, PetscScalar *values, void *dummy)
 59: {

 63:   PetscMemzero(values, n*comp * sizeof(PetscScalar));
 64:   return(0);
 65: }

 67: #undef  __FUNCT__
 69: /*@
 70:   PointFunctionConstant - A PointFunction that is a constant at all locations. The constant itself
 71:   is a real number pointed to by $ctx$.

 73:   Input Parameters:
 74: + n      - The number of points
 75: . comp   - The number of components
 76: . x,y,z  - The coordinates of points
 77: - ctx    - The constant

 79:   Output Parameter:
 80: . values - The location where the constant is stored (n*comp times)

 82:   Level: beginner

 84: .keywords point function
 85: .seealso PointFunctionOne, PointFunctionZero
 86: @*/
 87: int PointFunctionConstant(int n, int comp, double *x, double *y, double *z, PetscScalar *values, void *ctx)
 88: {
 89:   double c = *(double *) ctx;
 90:   int    i;

 93:   for(i = 0; i < n*comp; i++) values[i] = c;
 94:   return(0);
 95: }