Commits

BarryFSmith committed 59e4f3c

unified PetscObjectStateXXX() commands. Fixed PetscObjectStateQuery() to PetscObjectStateGet()

Comments (0)

Files changed (9)

include/petsc-private/petscimpl.h

 
    Level: developer
 
-   seealso: PetscObjectStateQuery(), PetscObjectStateDecrease()
+   seealso: PetscObjectStateGet()
 
    Concepts: state
 
 M*/
 #define PetscObjectStateIncrease(obj) ((obj)->state++,0)
 
-/*MC
-   PetscObjectStateDecrease - Decreases the state of any PetscObject,
-   regardless of the type.
-
-   Synopsis:
-   #include "petscsys.h"
-   PetscErrorCode PetscObjectStateDecrease(PetscObject obj)
-
-   Not Collective
-
-   Input Parameter:
-.  obj - any PETSc object, for example a Vec, Mat or KSP. This must be
-         cast with a (PetscObject), for example,
-         PetscObjectStateIncrease((PetscObject)mat);
-
-   Notes: object state is an integer which gets increased every time
-   the object is changed. By saving and later querying the object state
-   one can determine whether information about the object is still current.
-   Currently, state is maintained for Vec and Mat objects.
-
-   Level: developer
-
-   seealso: PetscObjectStateQuery(), PetscObjectStateIncrease()
-
-   Concepts: state
-
-M*/
-#define PetscObjectStateDecrease(obj) ((obj)->state--,0)
-
-PETSC_EXTERN PetscErrorCode PetscObjectStateQuery(PetscObject,PetscInt*);
-PETSC_EXTERN PetscErrorCode PetscObjectSetState(PetscObject,PetscInt);
+PETSC_EXTERN PetscErrorCode PetscObjectStateGet(PetscObject,PetscInt*);
+PETSC_EXTERN PetscErrorCode PetscObjectStateSet(PetscObject,PetscInt);
 PETSC_EXTERN PetscErrorCode PetscObjectComposedDataRegister(PetscInt*);
 PETSC_EXTERN PetscErrorCode PetscObjectComposedDataIncreaseInt(PetscObject);
 PETSC_EXTERN PetscErrorCode PetscObjectComposedDataIncreaseIntstar(PetscObject);

src/docs/website/developers/index.html

         <li><a href="#master-tarball">access tarballs directly from 'master' branch.</a></li>
         <li><a href="#nightly-tarball">access the nightly tarball snapshot</a> at <a href="http://ftp.mcs.anl.gov/pub/petsc/petsc-dev.tar.gz">http://ftp.mcs.anl.gov/pub/petsc/petsc-dev.tar.gz</a></li>
       </ol>
-      (If you prefer <a href="http://www.selenic.com/mercurial">Mercurial</a> over Git, there is also a <a href=" https://bitbucket.org/petsc/petsc-hg">Mercurial mirror of the PETSc master branch</a> available.)
 
       <a name="using-git"><h3>1. Using Git</h3></a><a href="http://git-scm.com/downloads">Install Git</a> if it is not already installed on your machine.
 

src/docs/website/documentation/changes/dev.html

       </div>
 
       <h4>General:</h4>
+      <ul>
+        <li>PetscObjectStateQuery() is now corrected with PetscObjectStateGet()</li>
+      </ul>
       <h4>IS:</h4>
       <h4>PF:</h4>
       <h4>Vec:</h4>

src/sys/ftn-custom/zsys.c

 #define chkmemfortran_             CHKMEMFORTRAN
 #define petscoffsetfortran_        PETSCOFFSETFORTRAN
 #define petscobjectstateincrease_  PETSCOBJECTSTATEINCREASE
-#define petscobjectstatedecrease_  PETSCOBJECTSTATEDECREASE
 #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
 #define petscoffsetfortran_        petscoffsetfortran
 #define chkmemfortran_             chkmemfortran
 #define flush__                    flush_
 #define petscobjectstateincrease_  petscobjectstateincrease
-#define petscobjectstatedecrease_  petscobjectstatedecrease
 #endif
 
 PETSC_EXTERN void PETSC_STDCALL petscobjectstateincrease_(PetscObject *obj, PetscErrorCode *ierr)
 {
   *ierr = PetscObjectStateIncrease(*obj);
 }
-PETSC_EXTERN void PETSC_STDCALL petscobjectstatedecrease_(PetscObject *obj, PetscErrorCode *ierr)
-{
-  *ierr = PetscObjectStateDecrease(*obj);
-}
-
 
 #if defined(PETSC_MISSING_FORTRAN_FLUSH_)
 void flush__(int unit)

src/sys/objects/state.c

 #include <petsc-private/petscimpl.h>  /*I   "petscsys.h"    I*/
 
 #undef __FUNCT__
-#define __FUNCT__ "PetscObjectStateQuery"
+#define __FUNCT__ "PetscObjectStateGet"
 /*@C
-   PetscObjectStateQuery - Gets the state of any PetscObject,
+   PetscObjectStateGet - Gets the state of any PetscObject,
    regardless of the type.
 
    Not Collective
    Input Parameter:
 .  obj - any PETSc object, for example a Vec, Mat or KSP. This must be
          cast with a (PetscObject), for example,
-         PetscObjectStateQuery((PetscObject)mat,&state);
+         PetscObjectStateGet((PetscObject)mat,&state);
 
    Output Parameter:
 .  state - the object state
 
    Level: advanced
 
-   seealso: PetscObjectStateIncrease(), PetscObjectSetState()
+   seealso: PetscObjectStateIncrease(), PetscObjectStateSet()
 
    Concepts: state
 
 @*/
-PetscErrorCode  PetscObjectStateQuery(PetscObject obj,PetscInt *state)
+PetscErrorCode  PetscObjectStateGet(PetscObject obj,PetscInt *state)
 {
   PetscFunctionBegin;
   PetscValidHeader(obj,1);
 }
 
 #undef __FUNCT__
-#define __FUNCT__ "PetscObjectSetState"
+#define __FUNCT__ "PetscObjectStateSet"
 /*@C
-   PetscObjectSetState - Sets the state of any PetscObject,
+   PetscObjectStateSet - Sets the state of any PetscObject,
    regardless of the type.
 
    Not Collective
    Input Parameter:
 +  obj - any PETSc object, for example a Vec, Mat or KSP. This must be
          cast with a (PetscObject), for example,
-         PetscObjectSetState((PetscObject)mat,state);
+         PetscObjectStateSet((PetscObject)mat,state);
 -  state - the object state
 
    Notes: This function should be used with extreme caution. There is
 
    Level: advanced
 
-   seealso: PetscObjectStateQuery(),PetscObjectStateIncrease()
+   seealso: PetscObjectStateGet(),PetscObjectStateIncrease()
 
    Concepts: state
 
 @*/
-PetscErrorCode  PetscObjectSetState(PetscObject obj,PetscInt state)
+PetscErrorCode  PetscObjectStateSet(PetscObject obj,PetscInt state)
 {
   PetscFunctionBegin;
   PetscValidHeader(obj,1);

src/ts/interface/ts.c

   ierr = DMGetDMTS(dm,&tsdm);CHKERRQ(ierr);
   ierr = DMTSGetRHSJacobian(dm,&rhsjacobianfunc,&ctx);CHKERRQ(ierr);
   ierr = DMTSGetIJacobian(dm,&ijacobianfunc,NULL);CHKERRQ(ierr);
-  ierr = PetscObjectStateQuery((PetscObject)U,&Ustate);CHKERRQ(ierr);
+  ierr = PetscObjectStateGet((PetscObject)U,&Ustate);CHKERRQ(ierr);
   if (ts->rhsjacobian.time == t && (ts->problem_type == TS_LINEAR || (ts->rhsjacobian.X == U && ts->rhsjacobian.Xstate == Ustate))) {
     *flg = ts->rhsjacobian.mstructure;
     PetscFunctionReturn(0);
   }
   ts->rhsjacobian.time       = t;
   ts->rhsjacobian.X          = U;
-  ierr                       = PetscObjectStateQuery((PetscObject)U,&ts->rhsjacobian.Xstate);CHKERRQ(ierr);
+  ierr                       = PetscObjectStateGet((PetscObject)U,&ts->rhsjacobian.Xstate);CHKERRQ(ierr);
   ts->rhsjacobian.mstructure = *flg;
   PetscFunctionReturn(0);
 }

src/vec/vec/impls/mpi/commonmpvec.c

   PetscInt       gstate,lstate;
 
   PetscFunctionBegin;
-  ierr = PetscObjectStateQuery((PetscObject)g,&gstate);CHKERRQ(ierr);
-  ierr = PetscObjectStateQuery((PetscObject)l,&lstate);CHKERRQ(ierr);
-  ierr = PetscObjectSetState((PetscObject)g,PetscMax(gstate,lstate));CHKERRQ(ierr);
-  ierr = PetscObjectSetState((PetscObject)l,PetscMax(gstate,lstate));CHKERRQ(ierr);
+  ierr = PetscObjectStateGet((PetscObject)g,&gstate);CHKERRQ(ierr);
+  ierr = PetscObjectStateGet((PetscObject)l,&lstate);CHKERRQ(ierr);
+  ierr = PetscObjectStateSet((PetscObject)g,PetscMax(gstate,lstate));CHKERRQ(ierr);
+  ierr = PetscObjectStateSet((PetscObject)l,PetscMax(gstate,lstate));CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }
 

src/vec/vec/interface/rvector.c

   }
   /* Record the state when the subvector was gotten so we know whether its values need to be put back */
   if (VecGetSubVectorSavedStateId < 0) {ierr = PetscObjectComposedDataRegister(&VecGetSubVectorSavedStateId);CHKERRQ(ierr);}
-  ierr = PetscObjectStateQuery((PetscObject)Z,&state);CHKERRQ(ierr);
+  ierr = PetscObjectStateGet((PetscObject)Z,&state);CHKERRQ(ierr);
   ierr = PetscObjectComposedDataSetInt((PetscObject)Z,VecGetSubVectorSavedStateId,state);CHKERRQ(ierr);
   *Y   = Z;
   PetscFunctionReturn(0);
     PetscInt  savedstate=0,newstate;
     PetscBool valid;
     ierr = PetscObjectComposedDataGetInt((PetscObject)*Y,VecGetSubVectorSavedStateId,savedstate,valid);CHKERRQ(ierr);
-    ierr = PetscObjectStateQuery((PetscObject)*Y,&newstate);CHKERRQ(ierr);
+    ierr = PetscObjectStateGet((PetscObject)*Y,&newstate);CHKERRQ(ierr);
     if (valid && savedstate < newstate) {
       /* We might need to copy entries back, first check whether we have no-copy view */
       PetscInt  gstart,gend,start;

src/vec/vec/utils/vinv.c

 @*/
 PetscErrorCode  VecEqual(Vec vec1,Vec vec2,PetscBool  *flg)
 {
-  PetscScalar    *v1,*v2;
-  PetscErrorCode ierr;
-  PetscInt       n1,n2,N1,N2;
-  PetscInt       state1,state2;
-  PetscBool      flg1;
+  const PetscScalar  *v1,*v2;
+  PetscErrorCode     ierr;
+  PetscInt           n1,n2,N1,N2;
+  PetscBool          flg1;
 
   PetscFunctionBegin;
   PetscValidHeaderSpecific(vec1,VEC_CLASSID,1);
       ierr = VecGetLocalSize(vec2,&n2);CHKERRQ(ierr);
       if (n1 != n2) flg1 = PETSC_FALSE;
       else {
-        ierr = PetscObjectStateQuery((PetscObject) vec1,&state1);CHKERRQ(ierr);
-        ierr = PetscObjectStateQuery((PetscObject) vec2,&state2);CHKERRQ(ierr);
-        ierr = VecGetArray(vec1,&v1);CHKERRQ(ierr);
-        ierr = VecGetArray(vec2,&v2);CHKERRQ(ierr);
-#if defined(PETSC_USE_COMPLEX)
-        {
-          PetscInt k;
-          flg1 = PETSC_TRUE;
-          for (k=0; k<n1; k++) {
-            if (PetscRealPart(v1[k]) != PetscRealPart(v2[k]) || PetscImaginaryPart(v1[k]) != PetscImaginaryPart(v2[k])) {
-              flg1 = PETSC_FALSE;
-              break;
-            }
-          }
-        }
-#else
+        ierr = VecGetArrayRead(vec1,&v1);CHKERRQ(ierr);
+        ierr = VecGetArrayRead(vec2,&v2);CHKERRQ(ierr);
         ierr = PetscMemcmp(v1,v2,n1*sizeof(PetscScalar),&flg1);CHKERRQ(ierr);
-#endif
-        ierr = VecRestoreArray(vec1,&v1);CHKERRQ(ierr);
-        ierr = VecRestoreArray(vec2,&v2);CHKERRQ(ierr);
-        ierr = PetscObjectSetState((PetscObject) vec1,state1);CHKERRQ(ierr);
-        ierr = PetscObjectSetState((PetscObject) vec2,state2);CHKERRQ(ierr);
+        ierr = VecRestoreArrayRead(vec1,&v1);CHKERRQ(ierr);
+        ierr = VecRestoreArrayRead(vec2,&v2);CHKERRQ(ierr);
       }
     }
     /* combine results from all processors */
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.