Re: [petsc-users] Store type (Eigen::Vector2d) in a petsc vec

2019-02-05 Thread Jed Brown via petsc-users
Andrew Parker writes: > Thanks, so you would suggest a flat vector storing u, v, w (or indeed x, y, > z) or interleaved and then construct eigen types on the fly? Interleaved if you want to use Eigen types in the same memory, or if your code (like most applications) benefits more from memory l

Re: [petsc-users] Store type (Eigen::Vector2d) in a petsc vec

2019-02-05 Thread Andrew Parker via petsc-users
Thanks, so you would suggest a flat vector storing u, v, w (or indeed x, y, z) or interleaved and then construct eigen types on the fly? Can I ask, is that because Vec cannot store user defined types (as in it's not templatetable?) Thanks, Andy On Tue, 5 Feb 2019 at 14:22, Jed Brown wrote: > M

Re: [petsc-users] Store type (Eigen::Vector2d) in a petsc vec

2019-02-05 Thread Jed Brown via petsc-users
My suggestion is to use PETSc like usual and inside your residual/Jacobian evaluation, for each cell or batch of cells, create Eigen objects. For size 2d or 3d, it won't matter much whether you make them share memory with the PETSc Vec -- the Eigen types should mostly exist in registers. Andrew P