source: CIVL/examples/compare/PETSc/petsc.h@ a552cec

1.23 2.0 main test-branch
Last change on this file since a552cec was 406474f, checked in by Si Li <sili@…>, 10 years ago

add macro

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@3367 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*
2 * self-defined petsc.h header for provesa examples: ex2a.c, ex2b.c,ex2c.c,ex2d.c.
3 * https://repo.anl-external.org/repos/provesa/codes/mxm/
4 */
5
6#ifndef _PETSC_
7#define _PETSC_
8
9#include <math.h>
10#define PetscExpScalar(x) exp(x)
11
12/* -------Types------- */
13
14/* PetscErrorCode - datatype used for return error code from almost all PETSc functions */
15typedef int PetscErrorCode;
16
17/* PETSc type that represents a PetscReal.
18 * This is the same as a PetscReal except in code that is automatically differentiated it
19 * is treated as a constant (not an indendent or dependent variable)
20 */
21typedef double PassiveReal;
22
23/* PETSc type that represents integer - used primarily to represent size of arrays and indexing
24 * into arrays. Its size can be * configured with the option-with-64-bit-indices - to be either
25 * 32bit or 64bit [default 32 bit ints]
26 */
27typedef int PetscInt;
28
29/* PetscReal - PETSc type that represents a real number version of PetscScalar */
30typedef double PetscReal;
31
32/* PetscScalar - PETSc type that represents either a double precision real number, a double precision
33 * complex number, a single precision real number, a long double or an int - if the code is configured
34 * with --with-scalar-type=real, complex --with-precision=single,double,__float128
35 */
36typedef double PetscScalar;
37
38/* C struct that contains information about a structured grid and a processors logical location in it. */
39typedef struct DMDALocalInfo {
40 // PetscInt dim,dof,sw;
41 PetscInt mx,my,mz; /* global number of grid points in each direction */
42 PetscInt xs,ys,zs; /* starting point of this processor, excluding ghosts */
43 PetscInt xm,ym,zm; /* number of grid points on this processor, excluding ghosts */
44 //PetscInt gxs,gys,gzs; /* starting point of this processor including ghosts */
45 //PetscInt gxm,gym,gzm; /* number of grid points on this processor including ghosts */
46} DMDALocalInfo;
47
48/* ----------Functions---------- */
49
50/* First executable line of each PETSc function, used for error handling. Final line of PETSc
51 * functions should be PetscFunctionReturn(0);
52 */
53#define PetscFunctionBegin
54
55/* Last executable line of each PETSc function used for error handling. Replaces return() */
56//void PetscFunctionReturn(0);
57#define PetscFunctionReturn(x) return(x)
58
59/* Adds floating point operations to the global counter. */
60PetscErrorCode PetscLogFlops(double );
61
62/* Checks error code, if non-zero it calls the error handler and then returns */
63PetscErrorCode CHKERRQ(PetscErrorCode );
64
65/*
66#undef __FUNCT__
67#define __FUNCT__ "PetscLogFlops"
68PETSC_STATIC_INLINE PetscErrorCode PetscLogFlops(PetscLogDouble n)
69{
70 PetscFunctionBegin;
71#if defined(PETSC_USE_DEBUG)
72 if (n < 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Cannot log negative flops");
73#endif
74 petsc_TotalFlops += PETSC_FLOPS_PER_OP*n;
75 PetscFunctionReturn(0);
76}
77*/
78
79#endif
Note: See TracBrowser for help on using the repository browser.