[petsc-dev] Is there a more elegant way to do this?

Jed Brown jedbrown at mcs.anl.gov
Thu May 30 15:35:51 CDT 2013


"Mark F. Adams" <mark.adams at columbia.edu> writes:

> Yes, I currently cache them but cheby does not look for it. So we need
> to have cheby use it and I suppose invalidate it, maybe, when the
> matrix changes….

The PetscObjectComposedData infrastructure automatically invalidates
when the object's "state" changes.  All routines that modify the object
(Mat, in this case) should increment the state counter, so that should
be handled automatically.

Now we have to decide where to store the key.  We could make it a
global, but that's less extensible because it creates a link-time
dependency on whoever created the attribute key.  What about adding a
string name argument to PetscObjectComposedDataRegister and having a
function to find based on the string?

  PetscObjectComposedDataFind("extreme-eigenvalue-estimate",&my_ctx->key); // in setup

  PetscObjectComposedDataGetReal(A,my_ctx->key,value,flag);  // should make this a function, not a macro


I don't know if PetscObjectComposedDataFind is really necessary, but it
would allow PETSc to use attributes that were created by other packages
and that we were only notified about dynamically, which provides more
symmetry between PETSc inside the library and PETSc elsewhere.



More information about the petsc-dev mailing list