Commits

BarryFSmith committed e383da1

lots and lots of untested examples

  • Participants
  • Parent commits ca95d6c
  • Branches barry/new-test-makefiles, knepley/fix-quadrature-order 1
    1. next-oct-2014

Comments (0)

Files changed (13)

File src/snes/examples/tutorials/ex10.c

-static const char help[] = "EXAMPLE REMOVED.\n\n";
-
-#undef __FUNCT__
-#define __FUNCT__ "main"
-int main(int argc, char *argv[])
-{
-  PetscErrorCode ierr;
-
-  ierr = PetscInitialize(&argc,&argv,0,help);CHKERRQ(ierr);
-  PetscFinalize();
-  return 0;
-}

File src/snes/examples/tutorials/ex16.c

   Field          ***x,***b;
   PetscInt       sweeps,its;
   PetscReal      atol,rtol,stol;
-  PetscReal      fnorm0,fnorm,ynorm,xnorm;
+  PetscReal      fnorm0,fnorm,ynorm,xnorm = 0.0;
 
   PetscFunctionBegin;
   ierr    = SNESGSGetSweeps(snes,&sweeps);CHKERRQ(ierr);

File src/snes/examples/tutorials/ex33.c

   DM             da;     /* grid */
   Vec            u;      /* solution vector */
   AppCtx         user;   /* user-defined work context */
-  PetscReal      t;      /* time */
+  PetscReal      t = 0.0;      /* time */
   PetscErrorCode ierr;
   PetscInt       n;
 

File src/snes/examples/tutorials/ex56.c

-static char help[] = "REPLACE WITH AN ACTUAL EXAMPLE\n\n";
-
-#undef __FUNCT__
-#define __FUNCT__ "main"
-int main(int argc, char **argv)
-{
-  ierr = PetscInitialize(&argc, &argv, NULL, help);CHKERRQ(ierr);
-  ierr = PetscFinalize();
-  return 0;
-}

File src/snes/examples/tutorials/ex57.c

-static char help[] = "REPLACE WITH AN ACTUAL EXAMPLE\n\n";
-
-#undef __FUNCT__
-#define __FUNCT__ "main"
-int main(int argc, char **argv)
-{
-  ierr = PetscInitialize(&argc, &argv, NULL, help);CHKERRQ(ierr);
-  ierr = PetscFinalize();
-  return 0;
-}

File src/snes/examples/tutorials/ex60.c

   ierr = DMDASetElementType(user.da2,DMDA_ELEMENT_P1);CHKERRQ(ierr);
 
   /* Set x and y coordinates */
-  ierr = DMDASetUniformCoordinates(user.da1,user.xmin,user.xmax,user.ymin,user.ymax,NULL,NULL);CHKERRQ(ierr);
-  ierr = DMDASetUniformCoordinates(user.da2,user.xmin,user.xmax,user.ymin,user.ymax,NULL,NULL);CHKERRQ(ierr);
+  ierr = DMDASetUniformCoordinates(user.da1,user.xmin,user.xmax,user.ymin,user.ymax,0.0,0.0);CHKERRQ(ierr);
+  ierr = DMDASetUniformCoordinates(user.da2,user.xmin,user.xmax,user.ymin,user.ymax,0.0,0.0);CHKERRQ(ierr);
   /* Get global vector x from DM (da1) and duplicate vectors r,xl,xu */
   ierr = DMCreateGlobalVector(user.da1,&x);CHKERRQ(ierr);
   ierr = VecGetSize(x,&N);CHKERRQ(ierr);

File src/snes/examples/tutorials/ex61.c

   ierr = DMDASetElementType(user.da2,DMDA_ELEMENT_P1);CHKERRQ(ierr);
 
   /* Set x and y coordinates */
-  ierr = DMDASetUniformCoordinates(user.da1,user.xmin,user.xmax,user.ymin,user.ymax,NULL,NULL);CHKERRQ(ierr);
-  ierr = DMDASetUniformCoordinates(user.da2,user.xmin,user.xmax,user.ymin,user.ymax,NULL,NULL);CHKERRQ(ierr);
+  ierr = DMDASetUniformCoordinates(user.da1,user.xmin,user.xmax,user.ymin,user.ymax,0.0,0.0);CHKERRQ(ierr);
+  ierr = DMDASetUniformCoordinates(user.da2,user.xmin,user.xmax,user.ymin,user.ymax,0.0,0.0);CHKERRQ(ierr);
 
 
   /* Get global vector x from DM (da1) and duplicate vectors r,xl,xu */
 PetscErrorCode Update_q(AppCtx *user)
 {
   PetscErrorCode ierr;
-  PetscScalar    *q_p,*w1,*w2,max1;
+  PetscScalar    *q_p,*w1,*w2;
   PetscInt       i,n;
 
   PetscFunctionBeginUser;

File src/snes/examples/tutorials/ex63.c

   ierr = DMDASetElementType(user.da2,DMDA_ELEMENT_P1);CHKERRQ(ierr);
 
   /* Set x and y coordinates */
-  ierr = DMDASetUniformCoordinates(user.da1,user.xmin,user.xmax,NULL,NULL,NULL,NULL);CHKERRQ(ierr);
-  ierr = DMDASetUniformCoordinates(user.da2,user.xmin,user.xmax,NULL,NULL,NULL,NULL);CHKERRQ(ierr);
+  ierr = DMDASetUniformCoordinates(user.da1,user.xmin,user.xmax,0.0,0.0,0.0,0.0);CHKERRQ(ierr);
+  ierr = DMDASetUniformCoordinates(user.da2,user.xmin,user.xmax,0.0,0.0,0.0,0.0);CHKERRQ(ierr);
   /* Get global vector x from DM (da1) and duplicate vectors r,xl,xu */
   ierr = DMCreateGlobalVector(user.da1,&x);CHKERRQ(ierr);
   ierr = VecDuplicate(x,&r);CHKERRQ(ierr);
   PetscErrorCode ierr;
   PetscScalar    *q_p, *w1, *w2;
   PetscInt       i,n;
-  PetscScalar    norm1;
 
   PetscFunctionBeginUser;
   ierr = VecPointwiseMult(user->Riv,user->eta,user->eta);CHKERRQ(ierr);
   PetscScalar       x[2];
   Vec               coords;
   const PetscScalar *_coords;
-  PetscViewer       view;
   PetscScalar       xwidth = user->xmax - user->xmin;
 
   PetscFunctionBeginUser;

File src/snes/examples/tutorials/ex64.c

   ierr = DMDASetElementType(user.da2,DMDA_ELEMENT_P1);CHKERRQ(ierr);
 
   /* Set x and y coordinates */
-  ierr = DMDASetUniformCoordinates(user.da1,user.xmin,user.xmax,NULL,NULL,NULL,NULL);CHKERRQ(ierr);
-  ierr = DMDASetUniformCoordinates(user.da2,user.xmin,user.xmax,NULL,NULL,NULL,NULL);CHKERRQ(ierr);
+  ierr = DMDASetUniformCoordinates(user.da1,user.xmin,user.xmax,0.0,0.0,0.0,0.0);CHKERRQ(ierr);
+  ierr = DMDASetUniformCoordinates(user.da2,user.xmin,user.xmax,0.0,0.0,0.0,0.0);CHKERRQ(ierr);
   /* Get global vector x from DM (da1) and duplicate vectors r,xl,xu */
   ierr = DMCreateGlobalVector(user.da1,&x);CHKERRQ(ierr);
   ierr = VecDuplicate(x,&r);CHKERRQ(ierr);

File src/snes/examples/tutorials/ex65.c

   Mat            J;
   PetscScalar    t=0.0;
   /* PetscViewer    view_out, view_p, view_q, view_psi, view_mat; */
-  PetscReal      bounds[] = {1000.0,-1000.,0.0,1.0,1000.0,-1000.0,0.0,1.0,1000.0,-1000.0};
+  PetscReal      PETSC_UNUSED bounds[] = {1000.0,-1000.,0.0,1.0,1000.0,-1000.0,0.0,1.0,1000.0,-1000.0};
 
 
   PetscInitialize(&argc,&argv, (char*)0, help);
   ierr = DMDASetElementType(user.da2,DMDA_ELEMENT_P1);CHKERRQ(ierr);
 
   /* Set x and y coordinates */
-  ierr = DMDASetUniformCoordinates(user.da1,user.xmin,user.xmax,user.ymin,user.ymax,NULL,NULL);CHKERRQ(ierr);
-  ierr = DMDASetUniformCoordinates(user.da2,user.xmin,user.xmax,user.ymin,user.ymax,NULL,NULL);CHKERRQ(ierr);
+  ierr = DMDASetUniformCoordinates(user.da1,user.xmin,user.xmax,user.ymin,user.ymax,0.0,0.0);CHKERRQ(ierr);
+  ierr = DMDASetUniformCoordinates(user.da2,user.xmin,user.xmax,user.ymin,user.ymax,0.0,0.0);CHKERRQ(ierr);
   /* Get global vector x from DM (da1) and duplicate vectors r,xl,xu */
   ierr = DMCreateGlobalVector(user.da1,&x);CHKERRQ(ierr);
   ierr = VecDuplicate(x,&r);CHKERRQ(ierr);
 
   while (t<user.T) {
 
-    char        filename[PETSC_MAX_PATH_LEN];
-    PetscScalar a = 1.0;
-    PetscInt    i;
-    /*PetscViewer  view;*/
-
-
     ierr = SNESSetFunction(snes,r,FormFunction,(void*)&user);CHKERRQ(ierr);
     ierr = SNESSetJacobian(snes,J,J,FormJacobian,(void*)&user);CHKERRQ(ierr);
 
   PetscScalar       x[3],y[3];
   Vec               coords;
   const PetscScalar *_coords;
-  PetscScalar       xwidth = user->xmax - user->xmin, ywidth = user->ymax - user->ymin;
+  PetscScalar       xwidth = user->xmax - user->xmin;
 
   PetscFunctionBeginUser;
   ierr = VecGetLocalSize(X,&n);CHKERRQ(ierr);
 PetscErrorCode Phi_read(AppCtx *user)
 {
   PetscErrorCode ierr;
-  PetscReal      *values;
   PetscViewer    viewer;
   PetscInt       power;
 

File src/snes/examples/tutorials/ex653d.c

   Vec            xl,xu; /* Upper and lower bounds on variables */
   Mat            J;
   PetscScalar    t=0.0;
-  PetscViewer    view_out, view_p, view_q, view_psi, view_mat, view_vtk_cv,view_vtk_eta;
-  char           cv_filename[80],eta_filename[80];
-  PetscReal      bounds[] = {1000.0,-1000.,0.0,1.0,1000.0,-1000.0,0.0,1.0,1000.0,-1000.0};
+  PetscReal      PETSC_UNUSED bounds[] = {1000.0,-1000.,0.0,1.0,1000.0,-1000.0,0.0,1.0,1000.0,-1000.0};
 
 
   PetscInitialize(&argc,&argv, (char*)0, help);
 
   while (t<user.T) {
 
-    char        filename[PETSC_MAX_PATH_LEN];
-    PetscScalar a = 1.0;
-    PetscInt    i;
-    PetscViewer view;
-
-
     ierr = SNESSetFunction(snes,r,FormFunction,(void*)&user);CHKERRQ(ierr);
     ierr = SNESSetJacobian(snes,J,J,FormJacobian,(void*)&user);CHKERRQ(ierr);
 
   PetscErrorCode ierr;
   PetscInt       n,i,j,Xda,Yda,Zda;
   PetscScalar    *xx,*cv_p,*wv_p,*eta_p;
-  PetscViewer    view_out;
 
   /* needed for the void growth case */
   PetscScalar       xmid,ymid,zmid,cv_v=1.0,cv_m=user->Sv*user->cv0,eta_v=1.0,eta_m=0.0,h,lambda;
   PetscErrorCode ierr;
   PetscInt       nele,nen,i,j,n;
   const PetscInt *ele;
-  PetscScalar    dt=user->dt,hx,hy,hz;
+  PetscScalar    hx,hy,hz;
 
   PetscInt    idx[8];
   PetscScalar eM_0[8][8],eM_2[8][8];

File src/snes/examples/tutorials/gmakefile

 # This directory contains SNES example programs for solving systems of
 # nonlinear equations.
 
+PETSCFEATURES="pastix,mumps,superlu,hypre,spai,superlu,superlu_dist,metis,parmetis,sundials,ml,real,complex,single,double,__float128,mpi_win_create,mpi_alltoallw,32bitindices,64bitindices"
+
 #CPPFLAGS	 = -I/PETSc3/geodynamics/PetscSimulationsViewers/src
 CFLAGS           =
 FFLAGS		 =
 EXAMPLESMATLAB   = ex5m.m  ex61genm.m ex61m.m
 DIRS		 = ex10d
 
+EXECUTABLES = $(EXAMPLESC:.c=)
+
+all: ${EXECUTABLES}
 include ${PETSC_DIR}/conf/variables
 include ${PETSC_DIR}/conf/rules
 include ${PETSC_DIR}/${PETSC_ARCH}/conf/gmakevariables
 ex%.o : ex%.c  chkopts
 	-@${PCC} -o $@ -c $< ${PCC_FLAGS} ${CFLAGS} ${CCPPFLAGS}
 
+ex31.h:
+	-${PETSC_DIR}/bin/pythonscripts/PetscGenerateFEMQuadrature.py 2 2 2 1 laplacian 2 1 1 1 gradient 2 1 1 1 identity ${PETSC_DIR}/src/snes/examples/tutorials/ex31.h
+ex31: ex31.h ex31.o chkopts
+	-@${CLINKER} -o $@ $< ${PETSC_SNES_LIB}
+
 ex%f.o : ex%f.F  chkopts
 	-@${FC} -o $@ -c $< ${FC_FLAGS} ${FFLAGS} ${FCPPFLAGS}
 
 	-@${FLINKER} -o $@ $< ${PETSC_SNES_LIB}
 	-@${RM} $<
 
-PETSCFEATURES="pastix,mumps,superlu,hypre,spai,superlu,superlu_dist,metis,parmetis,sundials,ml,real,complex,single,double,__float128,mpi_win_create,mpi_alltoallw,32bitindices,64bitindices"
-#PETSCINSTALLEDFEATURES="hypre,ml,superlu_dist,x,mpi_win_create,mpi_alltoallw,32bitindices"
 runex%: ex%
 	@IFS=',' command read -a packages <<< "${PETSCFEATURES}";\
         IFS=',' command read -a  installedpackages <<< "${PETSCINSTALLEDFEATURES}";\

File src/snes/examples/tutorials/makefile

 ex65: ex65.o  chkopts
 	-${CLINKER} -o ex65 ex65.o ${PETSC_SNES_LIB}
 	${RM} ex65.o
-ex653d: ex653D.o chkopts
+ex653d: ex653d.o chkopts
 	-${CLINKER} -o ex653d ex653D.o ${PETSC_SNES_LIB}
 	${RM} ex653d.o
 ex65dm: ex65dm.o  chkopts