1. petsc
  2. PETSc
  3. petsc

Commits

Shrirang Abhyankar  committed 734e873

Fixed the check for locating the event interval.

  • Participants
  • Parent commits b454970
  • Branches master

Comments (0)

Files changed (1)

File src/ts/event/tsevent.c

View file
   }
 
   for (i = 0; i < event->nevents; i++) {
-    if ((event->direction[i] < 0 && PetscSign(PetscRealPart(event->fvalue[i])) <= 0 && PetscSign(PetscRealPart(event->fvalue_prev[i])) >= 0) || \
-        (event->direction[i] > 0 && PetscSign(PetscRealPart(event->fvalue[i])) >= 0 && PetscSign(PetscRealPart(event->fvalue_prev[i])) <= 0) || \
-        (event->direction[i] == 0 && PetscSign(PetscRealPart(event->fvalue[i]))*PetscSign(PetscRealPart(event->fvalue_prev[i])) <= 0)) {
+    if ((event->direction[i] < 0 && PetscSign(PetscRealPart(event->fvalue[i])) < 0 && (PetscSign(PetscRealPart(event->fvalue[i])) != PetscSign(PetscRealPart(event->fvalue_prev[i])))) || \
+	(event->direction[i] > 0 && PetscSign(PetscRealPart(event->fvalue[i])) > 0 && (PetscSign(PetscRealPart(event->fvalue[i])) != PetscSign(PetscRealPart(event->fvalue_prev[i])))) || \
+	(event->direction[i] = 0 && (PetscSign(PetscRealPart(event->fvalue[i])) != PetscSign(PetscRealPart(event->fvalue_prev[i]))))) {
 
       event->status = TSEVENT_LOCATED_INTERVAL;
       rollback = 1;