<div dir="ltr"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 20, 2014 at 3:31 PM, Jed Brown <span dir="ltr"><<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">Christophe Ortiz <<a href="mailto:christophe.ortiz@ciemat.es">christophe.ortiz@ciemat.es</a>> writes:<br>

> Since for some reasons I need global two-dimensional arrays, what I did is<br>
> the following.<br>
> I declared a PetscScalar **array outside main(), ie before dof is<br>
> determined.<br>
> Then, knowing dof I use malloc inside main() to allocate memory to the<br>
> array. I use then array in different functions and in order to pass it to<br>
> MatSetValues, I copy it to a local and classical two-dimensional<br>
> array[dof][dof] (contiguous memory) which is passed to MatSetValues. It<br>
> works.<br>
<br>
</div>This sounds like a perverse way to structure your code, but if you<br>
insist...<br></blockquote><div><br></div><div>Jeje. Just trying different options... </div></div><br></div></div>