Commits

Lisandro Dalcin  committed 5f647ea

Fix bookkeeping of iga->setup flag

  • Participants
  • Parent commits 0b59af1

Comments (0)

Files changed (2)

File src/petiga.c

   if (order < 0)
     SETERRQ1(((PetscObject)iga)->comm,PETSC_ERR_ARG_WRONGSTATE,
              "Order must be nonnegative, got %D",order);
-  if (order == iga->order) PetscFunctionReturn(0);
-  if (iga->setup) {iga->setup = PETSC_FALSE; iga->setupstage--;}
+  if (iga->order == order) PetscFunctionReturn(0);
   iga->order = order;
+  iga->setup = PETSC_FALSE;
   PetscFunctionReturn(0);
 }
 
   if (q == PETSC_DECIDE && iga->axis[i]->p > 0) q = iga->axis[i]->p + 1;
   if (q <= 0) SETERRQ1(((PetscObject)iga)->comm,PETSC_ERR_ARG_OUTOFRANGE,"Number of quadrature points %D must be positive",q);
   if (q == rule->nqp) PetscFunctionReturn(0);
-  if (iga->setup) {iga->setup = PETSC_FALSE; iga->setupstage--;}
   ierr = IGARuleInit(rule,q);CHKERRQ(ierr);
+  iga->setup = PETSC_FALSE;
   PetscFunctionReturn(0);
 }
 

File src/petigaio.c

              "Number of space dimensions must be in range [1,3], got %D",dim);
   if (iga->geometry > 0 && iga->geometry != dim)
     SETERRQ2(((PetscObject)iga)->comm,PETSC_ERR_ARG_WRONGSTATE,
-             "Cannot change IGA spatial dim to %D after it was set to %D",dim,iga->geometry);
-  if (iga->geometry == 0) iga->setup = PETSC_FALSE;
+             "Cannot change IGA geometry dim to %D after it was set to %D",dim,iga->geometry);
+  if (iga->geometry == dim) PetscFunctionReturn(0);
   iga->geometry = dim;
+  iga->setup = PETSC_FALSE;
   PetscFunctionReturn(0);
 }
 
   if (iga->property > 0 && iga->property != dim)
     SETERRQ2(((PetscObject)iga)->comm,PETSC_ERR_ARG_WRONGSTATE,
              "Cannot change IGA property dim to %D after it was set to %D",dim,iga->property);
-  if (iga->property == 0) iga->setup = PETSC_FALSE;
+  if (iga->property == dim) PetscFunctionReturn(0);
   iga->property = dim;
+  iga->setup = PETSC_FALSE;
   PetscFunctionReturn(0);
 }