> We could consider this, but really IS is intended to be a static object, not > a dynamic one. > I think Jed's SegBuffer is supposed to be dynamic, and could underlie a > dynamic index > object.
I could be wrong, but my recollection is that the initial reason for the index sets was the bound constrained methods in TAO and the VI methods which dynamically determine the set of active and inactive bounds. Those are inherently dynamic. > Most of the objects in PETSc are fixed size, and when the size changes you > recreate it. The IS vectors can have a fixed size allocation and changing the local number of elements is then a simple assignment. Its like the preallocation of elements in matrices... > IS objects can be views into other memory, so the object could be created but > the backing > memory could be maintained somewhere else so that there is not a big malloc > every time. What is the overhead of PetscMalloc and how do I tell if its cheap or expensive? Inside of ISComplement, for example, there is: ierr = PetscMalloc1(nmax-nmin-unique,&nindices);CHKERRQ(ierr); ierr = ISCreateGeneral(PetscObjectComm((PetscObject)is),cnt,nindices,PETSC_OWN_POINTER,isout);CHKERRQ(ierr); Many of the other methods allocate with the maximum size. Anyway, I am okay keeping the IS design as is. I would not create separate implementations for dynamic versus static index sets as these are logically the same beasts. Todd.
