[petsc-users] DMPlex cell number containing a point in space
Matthew Knepley
knepley at gmail.com
Tue Sep 24 04:17:00 CDT 2019
On Mon, Sep 23, 2019 at 8:46 PM Swarnava Ghosh <swarnava89 at gmail.com> wrote:
> Hi Matt,
>
> I am trying to get this working. However, It seems that this does not work
> for 3D. I have tets as elements, and the dmplex is serial. I get the
> following error:
>
> 0]PETSC ERROR: No support for this operation for this object type
> [0]PETSC ERROR: I have only coded this for 2D
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
>
> Is there a work around to this? would you please let me know?
>
Did you give ' -dm_plex_hash_location'? It does not seem possible that you
got to this code without giving that option.
Thanks,
Matt
> Also here is my code
>
> PetscSF cellSF=NULL;
> Vec v;
> PetscErrorCode ierr;
>
> // create v;
> VecCreate(PETSC_COMM_SELF,&v);
> VecSetSizes(v,PETSC_DECIDE,3);
> VecSetBlockSize(v,3);
> VecSetFromOptions(v);
>
> VecSetValue(v,0,0.0,INSERT_VALUES);
> VecSetValue(v,1,0.1,INSERT_VALUES);
> VecSetValue(v,2,0.12,INSERT_VALUES);
>
> VecAssemblyBegin(v);
> VecAssemblyEnd(v);
>
> PetscInt bs;
> VecGetBlockSize(v,&bs);
>
> printf("Block size of v=%d \n",bs);
>
> ierr=DMLocatePoints(pCgdft->dmatom,v,DM_POINTLOCATION_NEAREST,&cellSF);
>
> // print vector
> VecView(v,PETSC_VIEWER_STDOUT_SELF);
>
>
> Sincerely,
> SG
>
> On Mon, Sep 16, 2019 at 6:37 AM Matthew Knepley <knepley at gmail.com> wrote:
>
>> On Fri, Sep 6, 2019 at 6:07 PM Swarnava Ghosh via petsc-users <
>> petsc-users at mcs.anl.gov> wrote:
>>
>>> Dear Petsc developers and users,
>>>
>>> I have a DMPlex mesh in 3D. Given a point with (x,y,z) coordinates, I am
>>> trying the find the cell number in which this point lies, and the vertices
>>> of the cell. Is there any DMPlex function that will give me the cell number?
>>>
>>
>> Sorry, I lost this mail.
>>
>> In serial, you can just use DMLocatePoint(). If you have some points and
>> you are not
>> sure which process they might be located on, then you need a
>> DMInterpolation context.
>>
>> Thanks,
>>
>> Matt
>>
>>
>>> Thank you,
>>> SG
>>>
>>
>>
>> --
>> 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
>>
>> https://www.cse.buffalo.edu/~knepley/
>> <http://www.cse.buffalo.edu/~knepley/>
>>
>
--
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
https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190924/5ba207f9/attachment.html>
More information about the petsc-users
mailing list