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

Håkon Strandenes haakon at hakostra.net
Fri Mar 20 10:45:43 CDT 2015


On 20. mars 2015 16:15, Jed Brown wrote:
> 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.
>

I mean that if you decide to stick with the current way of 
reading/writing a "plain 1D" Vec with N elements as a N x 1 
array/dataset, you should treat a dof=1 DMDA Vec as an NZ x NY x NX x 1 
array/dataset.

Håkon


More information about the petsc-users mailing list