[petsc-users] Load Vec from 1D HDF5 dataset MATT READ THIS EMAIL!

Jed Brown jed at jedbrown.org
Fri Mar 20 10:15:58 CDT 2015


Håkon Strandenes <haakon at hakostra.net> writes:

> That formulation is obviously not one of my best. I did not mean that it 
> was consistent with respect to what is done or not done in Python.
>
> My point was that when using DMDA's in PETSc, you consistently 
> "disregard" the dof when dof=1, i.e. create 3D arrays instead of 4D (for 
> a 3D DMDA). 

If I'm writing extensible code, I even solve scalar problems by writing

typedef struct {
  PetscScalar phi; // only one variable now
} Field;

If I add another field later, I don't have to revisit code that only
references phi.  Having this dimension also leaves a place for metadata.

> I think that in case you choose to stick to the policy of adding another 
> dimension for bs=1, you should also add that dimension for a DMDA Vec 
> with dof=1.

What do you mean?  You can use DMDAVecGetArrayDOF when dof=1 if you want.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150320/5b60b494/attachment.pgp>


More information about the petsc-users mailing list