You couldn't simply template the dereference, you would need to have a way to reformat the data into single/double-precision, and PETSc assumes you are giving it a raw C pointer. This would have the effect of potentially generating an expensive data copy every time you need to hand your object to PETSc. I think you would be much better served by deciding ahead of time whether you will need a single or double-precision PETSc and writing your code accordingly with that assumption.
A On Tue, Jun 29, 2010 at 6:21 PM, Umut Tabak <u.tabak at tudelft.nl> wrote: > Luke Bloy wrote: > >> Thanks for the response. Thats unfortunate as i use many different types >> of matrices that i would like use with petsc. >> >> I'm not much of a c++ whiz, >> > me neither ;) > > but i'm curious if something like an adaptor would be possible that would >> make a >> (float *) behave like a (petscscalar *) as far as petsc was concerned? >> Thoughts? >> > I am not sure if these kinds of pointer conversions are safe if you do not > know that what 'petscscalar *' really is, you might check the docs. > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20100629/703cc2c0/attachment.htm>
