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: /*@
12: PointFunctionOne - A PointFunction that is one at all locations.
14: Input Parameters:
15: + n - number of points
16: . comp - number of components
17: . x,y,z - coordinates of points
18: - dummy - unneeded context variable
20: Output Parameter:
21: . values - location where 1.0 is stored (n*comp times)
23: Level: beginner
25: .keywords point function
26: .seealso PointFunctionZero(), PointFunctionConstant()
27: @*/
28: int PointFunctionOne(int n, int comp, double *x, double *y, double *z, PetscScalar *values, void *dummy)
29: {
30: int i;
31:
33: for(i = 0; i < n*comp; i++) values[i] = 1.0;
34: return(0);
35: }
37: /*@
38: PointFunctionZero - A PointFunction that is zero at all locations.
40: Input Parameters:
41: + n - number of points
42: . comp - number of components
43: . x,y,z - coordinates of points
44: - dummy - unneeded context variable
46: Output Parameter:
47: . values - location where 0.0 is stored (n*comp times)
49: Level: beginner
51: .keywords point function
52: .seealso PointFunctionOne(), PointFunctionConstant()
53: @*/
54: int PointFunctionZero(int n, int comp, double *x, double *y, double *z, PetscScalar *values, void *dummy)
55: {
59: PetscMemzero(values, n*comp * sizeof(PetscScalar));
60: return(0);
61: }
63: /*@
64: PointFunctionConstant - A PointFunction that is a constant at all locations. The constant itself
65: is a real number pointed to by $ctx$.
67: Input Parameters:
68: + n - The number of points
69: . comp - The number of components
70: . x,y,z - The coordinates of points
71: - ctx - The constant
73: Output Parameter:
74: . values - The location where the constant is stored (n*comp times)
76: Level: beginner
78: .keywords point function
79: .seealso PointFunctionOne, PointFunctionZero
80: @*/
81: int PointFunctionConstant(int n, int comp, double *x, double *y, double *z, PetscScalar *values, void *ctx)
82: {
83: double c = *(double *) ctx;
84: int i;
87: for(i = 0; i < n*comp; i++) values[i] = c;
88: return(0);
89: }