[petsc-users] a question about PetscSectionCreate
Dave May
dave.mayhem23 at gmail.com
Mon May 29 02:47:56 CDT 2017
On Mon, 29 May 2017 at 08:39, leejearl <leejearl at 126.com> wrote:
> Hi, all:
> I have create a IS for every cell in dmplex by the following steps:
> 1. Creating a integer array which size is matched to the number of cells.
> 2. Use the routine "ISCreateGeneral" to create a corresponding IS.
>
> Is there any routine which can create a IS for every cell in the dmplex
> directly?,
>
I don't think so as Plex would have to somehow know what geom quantity to
use to define the size of IS (e.g. vertex, cell, face, edge)
and what is the difference between ISCopy() and ISDuplicate()?
>
ISDuplicate allocates memory for a new with the same comm and layout as the
original IS AND copies values from the original IS into the new one. (Note
that this is slightly different from other duplicate functions like
VecDuplicate which only allocate memory and does not copy values from the
orig vec.)
ISCopy does not allocate memory for the IS (passed as the second arg), it
only performs the copy of values.
Thanks
Dave
>
> Thanks,
> leejearl
>
>
> On 2017年05月28日 19:35, Matthew Knepley wrote:
>
> On Sun, May 28, 2017 at 6:02 AM, Lawrence Mitchell <
> lawrence.mitchell at imperial.ac.uk> wrote:
>
>>
>>
>> > On 28 May 2017, at 09:16, leejearl <leejearl at 126.com> wrote:
>> >
>> > Hi, Dave: I want to store a PetscInt tag for every cell of the dmplex
>> with the struct. Thanks,
>>
>> You probably want to use a DMLabel to store these ids. Unless you have a
>> different I'd for every cell.
>
>
> Several things to think about:
>
> 1) If you want to store a tag for EVERY cell, then just use an IS. Cell
> numberings are guaranteed to be
> contiguous and start from 0.
>
> 2) If you want to tag only SOME cells, then use a DMLabel as Lawrence
> suggests. This uses hash tables
> for fast construction, and sorted lists for fast search and retrieval.
>
> 3) If you want to store a VARIABLE number of data items per cell, then use
> a Section and an array that you allocate.
>
> Matt
>
>
>>
>> Lawrence
>>
>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
> http://www.caam.rice.edu/~mk51/
>
>
> --
> 李季
> 西北工业大学航空学院流体力学系
> Phone: 17792092487
> QQ: 188524324
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170529/fae8a3cc/attachment.html>
More information about the petsc-users
mailing list