<div dir="ltr">Dear PETSc --<div><br></div><div>This is an "am I using it correctly" question. Probably the API has the current design because of something I am missing.</div><div><br></div><div>First, a quote from the PETSc manual which I fully understand; it works great and gives literate code (to the extent possible...):</div><div><br></div><div>"""</div><div>The recommended approach for multi-component PDEs is to declare a struct representing the fields defined<div>at each node of the grid, e.g.</div><div><br></div><div>typedef struct {</div><div>PetscScalar u,v,omega,temperature;</div><div>} Node;</div><div><br></div><div>and write residual evaluation using</div><div><br></div><div>Node **f,**u;</div><div>DMDAVecGetArray(DM da,Vec local,&u);</div><div>DMDAVecGetArray(DM da,Vec global,&f);</div><div>...</div><div>f[i][j].omega = ...</div><div>...</div><div>DMDAVecRestoreArray(DM da,Vec local,&u);</div><div>DMDAVecRestoreArray(DM da,Vec global,&f);</div><div>"""</div><div><br></div><div>Now the three questions:</div><div><br></div><div>1) The third argument to DMDAVec{Get,Restore}Array() is of type "void *". It makes the above convenient. But the third argument of the unstructured version Vec{Get,Restore}Array() is of type "PetscScalar **", which means that in an unstructured case, with the same Node struct, I would write</div><div><div>"VecGetArray(DM da,Vec local,(PetscScalar **)&u);"</div></div><div>to get the same functionality. Why is it this way? More specifically, why not have the argument to VecGetArray() be of type "void *"?</div><div><br></div><div>2) Given that the "recommended approach" above works just fine, why do DMDAVec{Get,Restore}ArrayDOF() exist? (I.e. is there something I am missing about C indexing?)</div><div><br></div><div>3) There are parts of the PETSc API that refer to "dof" and parts that refer to "block size". Is this a systematic distinction with an underlying reason? It seems "block size" is more generic, but also it seems that it could replace "dof" everywhere.</div><div><br></div><div>Thanks for addressing silly questions.</div><div><br></div><div>Ed</div><div><br></div><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Ed Bueler<br>Dept of Math and Stat and Geophysical Institute<br>University of Alaska Fairbanks<br>Fairbanks, AK 99775-6660<br>301C Chapman and 410D Elvey<br>907 474-7693 and 907 474-7199 (fax 907 474-5394)</div>
</div></div>