Commits

Matt Knepley committed de4eb38

TS ex9bus: Fixed MatSetValues argument

Hg-commit: 4561ec88783f9573d3ba410a26b5a930e71c8739

Comments (0)

Files changed (1)

src/ts/examples/tutorials/power_grid/stability_9bus/ex9bus.c

 {
   PetscErrorCode ierr;
   SNES           snes;
+  PetscScalar    atmp = (PetscScalar) a;
   PetscInt       i,row;
 
   PetscFunctionBegin;
   ierr = ResidualJacobian(snes,X,A,B,flag,user);CHKERRQ(ierr);
   for (i=0;i < ngen;i++) {
     row = 9*i;
-    ierr = MatSetValues(*A,1,&row,1,&row,&a,ADD_VALUES);CHKERRQ(ierr);
+    ierr = MatSetValues(*A,1,&row,1,&row,&atmp,ADD_VALUES);CHKERRQ(ierr);
     row  = 9*i+1;
-    ierr = MatSetValues(*A,1,&row,1,&row,&a,ADD_VALUES);CHKERRQ(ierr);
+    ierr = MatSetValues(*A,1,&row,1,&row,&atmp,ADD_VALUES);CHKERRQ(ierr);
     row  = 9*i+2;
-    ierr = MatSetValues(*A,1,&row,1,&row,&a,ADD_VALUES);CHKERRQ(ierr);
+    ierr = MatSetValues(*A,1,&row,1,&row,&atmp,ADD_VALUES);CHKERRQ(ierr);
     row  = 9*i+3;
-    ierr = MatSetValues(*A,1,&row,1,&row,&a,ADD_VALUES);CHKERRQ(ierr);
+    ierr = MatSetValues(*A,1,&row,1,&row,&atmp,ADD_VALUES);CHKERRQ(ierr);
     row  = 9*i+6;
-    ierr = MatSetValues(*A,1,&row,1,&row,&a,ADD_VALUES);CHKERRQ(ierr);
+    ierr = MatSetValues(*A,1,&row,1,&row,&atmp,ADD_VALUES);CHKERRQ(ierr);
     row  = 9*i+7;
-    ierr = MatSetValues(*A,1,&row,1,&row,&a,ADD_VALUES);CHKERRQ(ierr);
+    ierr = MatSetValues(*A,1,&row,1,&row,&atmp,ADD_VALUES);CHKERRQ(ierr);
     row  = 9*i+8;
-    ierr = MatSetValues(*A,1,&row,1,&row,&a,ADD_VALUES);CHKERRQ(ierr);
+    ierr = MatSetValues(*A,1,&row,1,&row,&atmp,ADD_VALUES);CHKERRQ(ierr);
   }
   ierr = MatAssemblyBegin(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
   ierr = MatAssemblyEnd(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);