[petsc-users] [EXTERNAL] Re: Is there anything like a "DMPlexSetCones()" ?

Ferrand, Jesus A. FERRANJ2 at my.erau.edu
Mon May 6 09:17:52 CDT 2024


"The cone sizes are used to allocate the array to hold the cones. How would you have an array holding the cone information without knowing the sizes?"

      You're right, I must first know the sizes (which I determine from the file).
      It lists the number of cells and their types by sequential chunks.

      The issue I am trying to describe, is that because I cannot know the number of local vertices a priori, the pipeline DMSetChart()->DMPlexSetConeSize()->DMSetUp() essentially produces a redundant array (because I already have the connectivity that I read from the file).
      As far as I can tell, in my case, the end result of calling these APIs is already available, hence my wish for a "DMPlexSetCones()".
      If such an API existed, I would then attempt to retroactively set the Chart and the ConeSizes.

      Like you hinted in a reply, for this extra array to be worthwhile, I would have to keep it as a global numbering list (which I want to by the way).
      I was hoping to at least keep them in the DM's global PetscSection as offsets.
      Unfortunately, PetscSection has a similar workflow to DM: PetscSectionSetChart(), PetscSectionAddDof(), PetscSectionSetUp(), PetscSectionSetOffset().
      

________________________________
From: Matthew Knepley <knepley at gmail.com>
Sent: Monday, May 6, 2024 7:52 AM
To: Ferrand, Jesus A. <FERRANJ2 at my.erau.edu>
Cc: petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
Subject: Re: [EXTERNAL] Re: [petsc-users] Is there anything like a "DMPlexSetCones()" ?

On Fri, May 3, 2024 at 7:32 PM Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>> wrote:
"Right, but that means that the connectivity you read in is not in local numbering. You will have to renumber it, so making a copy is probably necessary anyway. This is the same sort of processing I do for the parallel read."

      True, the connectivity is read in global numbering.
      Renumbering is facilitated by the table from PetscHashSetI.
      The connectivity list I am able to renumber in place though, I don't see the need to have another interim copy of the numbers.
      My concern is that I have two memory chunks that both contain the same information.
      The only reason It has to be this way is because I can't manually set the Cones first and the Chart/ConeSizes second.

The cone sizes are used to allocate the array to hold the cones. How would you have an array holding the cone information without knowing the sizes?

  Thanks,

    Matt

________________________________
From: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Sent: Friday, May 3, 2024 6:45 PM
To: Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [EXTERNAL] Re: [petsc-users] Is there anything like a "DMPlexSetCones()" ?

On Wed, May 1, 2024 at 6:30 PM Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>> wrote:
"You know the number of cells if you can read connectivity. Do you mean that the format does not tell you
the number of vertices?"

Sort of...
So, the format does provide the number of vertices, however, due to the way I read the data in parallel I don't know immediately how many local vertices there will be.
Which prevents me from knowing the chart a priori.
I figured out the number of vertices using PetscHashSetI to determine the number of unique entries in the connectivity list.

Right, but that means that the connectivity you read in is not in local numbering. You will have to renumber it, so making a copy is probably necessary anyway. This is the same sort of processing I do for the parallel read.

  Thanks,

     Matt

________________________________
From: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Sent: Wednesday, May 1, 2024 8:52 PM
To: Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [EXTERNAL] Re: [petsc-users] Is there anything like a "DMPlexSetCones()" ?

On Wed, May 1, 2024 at 4:23 PM Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>> wrote:
Matt:

My bad again, I need to clarify something that I just realized doesn't make sense.
I said: "The nature of the I/O makes it so that I need to read the connectivity before I get a semblance of buffer sizes."
Scratch that, obviously, if I can read the connectivity, I know the buffer sizes.

What I should have said is that I cannot know the "chart" that one sets in DMPlexSetChart() a priori like in most cases.
I need to determine the chart from the connectivity lists.

You know the number of cells if you can read connectivity. Do you mean that the format does not tell you
the number of vertices?

  Thanks,

    Matt

________________________________
From: Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>>
Sent: Wednesday, May 1, 2024 8:17 PM
To: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [EXTERNAL] Re: [petsc-users] Is there anything like a "DMPlexSetCones()" ?

Matt:

"I do not understand the "flag check". What is that?"

      My bad, I should have referred to the "dm->setupcalled".
      I believe this PetscBool is checked by the other DM (not just DMPlex) APIs.
      The subsequent checks for dm->setupcalled == PETSC_TRUE is what I meant to say.
      Here's a copy of DMSetUp().

PetscErrorCode<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscErrorCode/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-BV3mYuw$ > DMSetUp<https://urldefense.us/v3/__https://petsc.org/release/manualpages/DM/DMSetUp/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-CMnaFo8$ >(DM<https://urldefense.us/v3/__https://petsc.org/release/manualpages/DM/DM/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-UUpirwU$ > dm)
817: {
818:   PetscFunctionBegin<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscFunctionBegin/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-YcDnMyU$ >;
820:   if (dm->setupcalled) PetscFunctionReturn<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscFunctionReturn/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-IHg61OE$ >(PETSC_SUCCESS<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscErrorCode/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-BV3mYuw$ >);
821:   PetscTryTypeMethod<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscTryTypeMethod/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD--roQk-8$ >(dm, setup);
822:   dm->setupcalled = PETSC_TRUE<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PETSC_TRUE/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-6I9S4aE$ >;
823:   PetscFunctionReturn<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscFunctionReturn/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-IHg61OE$ >(PETSC_SUCCESS<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscErrorCode/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-BV3mYuw$ >);
824: }

"We could make a DMPlexSetCones(), but as you point out, the workflow for DMSetUp() would have to change. Where does the memory come from for your connectivity?"
      It's a memory that I myself allocate based on a file's contents.
      The nature of the I/O makes it so that I need to read the connectivity before I get a semblance of buffer sizes.
      Otherwise, I would stick to the tried and tested way.

Also, when replying to the PETSc developers, users must reply to petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> and not just to the individual email accounts of the developers, right?




________________________________
From: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Sent: Wednesday, May 1, 2024 8:07 PM
To: Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: [EXTERNAL] Re: [petsc-users] Is there anything like a "DMPlexSetCones()" ?

CAUTION: This email originated outside of Embry-Riddle Aeronautical University. Do not click links or open attachments unless you recognize the sender and know the content is safe.

On Wed, May 1, 2024 at 3:34 PM Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>> wrote:
This Message Is From an External Sender
This message came from outside your organization.

Dear PETSc team:

For a project that I'm working on, I need to manually build a DMPlex.
>From studying the source code of the various APIs in which the plex is built from some supported file format, I get that the workflow is this:


  1.
DMPlexSetChart() <-- Input nCells + nVerts
  2.
DMPlexSetConeSize() <-- Input ConeSize for each point in [0,nCells)
  3.
DMSetUp() – Allocates memory internally.
  4.
DMPlexGetCones() --> Gives you the memory onto which to write the cell connectivity.
  5.
*Write connectivity*
  6.
DMPlexReorderCell() <-- For each point in [0,nCells)

I'm in a situation where the memory given by step (4) is available a-priori.
I was hoping to skip steps 2, 3 , and 4 with something like a "DMPlexSetCones()", but such an API does not exist.
My current workaround is to implement steps 2 through 4 as always and have double the memory allocated in the interim (my instance + DM's internal instance).
I was thinking of looking for the name of the struct member and = it to my memory, but I can't overcome the flag check in DMSetUp() during later calls to DMPlexGetCones() or DMPlexGetTransitiveClosure().

I do not understand the "flag check". What is that?

We could make a DMPlexSetCones(), but as you point out, the workflow for DMSetUp() would have to change. Where does the memory come from for your connectivity?

  Thanks,

    Matt



Sincerely:

J.A. Ferrand

Embry-Riddle Aeronautical University - Daytona Beach - FL
Ph.D. Candidate, Aerospace Engineering

M.Sc. Aerospace Engineering

B.Sc. Aerospace Engineering

B.Sc. Computational Mathematics


Phone: (386)-843-1829

Email(s): ferranj2 at my.erau.edu<mailto:ferranj2 at my.erau.edu>

    jesus.ferrand at gmail.com<mailto:jesus.ferrand at gmail.com>


--
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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-x-OTHfg$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-kBIt_QE$ >

________________________________
From: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Sent: Wednesday, May 1, 2024 8:07 PM
To: Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: [EXTERNAL] Re: [petsc-users] Is there anything like a "DMPlexSetCones()" ?

CAUTION: This email originated outside of Embry-Riddle Aeronautical University. Do not click links or open attachments unless you recognize the sender and know the content is safe.

On Wed, May 1, 2024 at 3:34 PM Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>> wrote:
This Message Is From an External Sender
This message came from outside your organization.

Dear PETSc team:

For a project that I'm working on, I need to manually build a DMPlex.
>From studying the source code of the various APIs in which the plex is built from some supported file format, I get that the workflow is this:


  1.
DMPlexSetChart() <-- Input nCells + nVerts
  2.
DMPlexSetConeSize() <-- Input ConeSize for each point in [0,nCells)
  3.
DMSetUp() – Allocates memory internally.
  4.
DMPlexGetCones() --> Gives you the memory onto which to write the cell connectivity.
  5.
*Write connectivity*
  6.
DMPlexReorderCell() <-- For each point in [0,nCells)

I'm in a situation where the memory given by step (4) is available a-priori.
I was hoping to skip steps 2, 3 , and 4 with something like a "DMPlexSetCones()", but such an API does not exist.
My current workaround is to implement steps 2 through 4 as always and have double the memory allocated in the interim (my instance + DM's internal instance).
I was thinking of looking for the name of the struct member and = it to my memory, but I can't overcome the flag check in DMSetUp() during later calls to DMPlexGetCones() or DMPlexGetTransitiveClosure().

I do not understand the "flag check". What is that?

We could make a DMPlexSetCones(), but as you point out, the workflow for DMSetUp() would have to change. Where does the memory come from for your connectivity?

  Thanks,

    Matt



Sincerely:

J.A. Ferrand

Embry-Riddle Aeronautical University - Daytona Beach - FL
Ph.D. Candidate, Aerospace Engineering

M.Sc. Aerospace Engineering

B.Sc. Aerospace Engineering

B.Sc. Computational Mathematics


Phone: (386)-843-1829

Email(s): ferranj2 at my.erau.edu<mailto:ferranj2 at my.erau.edu>

    jesus.ferrand at gmail.com<mailto:jesus.ferrand at gmail.com>


--
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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-x-OTHfg$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-kBIt_QE$ >


--
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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-x-OTHfg$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-kBIt_QE$ >

________________________________
From: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Sent: Wednesday, May 1, 2024 8:52 PM
To: Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [EXTERNAL] Re: [petsc-users] Is there anything like a "DMPlexSetCones()" ?

On Wed, May 1, 2024 at 4:23 PM Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>> wrote:
Matt:

My bad again, I need to clarify something that I just realized doesn't make sense.
I said: "The nature of the I/O makes it so that I need to read the connectivity before I get a semblance of buffer sizes."
Scratch that, obviously, if I can read the connectivity, I know the buffer sizes.

What I should have said is that I cannot know the "chart" that one sets in DMPlexSetChart() a priori like in most cases.
I need to determine the chart from the connectivity lists.

You know the number of cells if you can read connectivity. Do you mean that the format does not tell you
the number of vertices?

  Thanks,

    Matt

________________________________
From: Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>>
Sent: Wednesday, May 1, 2024 8:17 PM
To: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [EXTERNAL] Re: [petsc-users] Is there anything like a "DMPlexSetCones()" ?

Matt:

"I do not understand the "flag check". What is that?"

      My bad, I should have referred to the "dm->setupcalled".
      I believe this PetscBool is checked by the other DM (not just DMPlex) APIs.
      The subsequent checks for dm->setupcalled == PETSC_TRUE is what I meant to say.
      Here's a copy of DMSetUp().

PetscErrorCode<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscErrorCode/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-BV3mYuw$ > DMSetUp<https://urldefense.us/v3/__https://petsc.org/release/manualpages/DM/DMSetUp/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-CMnaFo8$ >(DM<https://urldefense.us/v3/__https://petsc.org/release/manualpages/DM/DM/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-UUpirwU$ > dm)
817: {
818:   PetscFunctionBegin<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscFunctionBegin/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-YcDnMyU$ >;
820:   if (dm->setupcalled) PetscFunctionReturn<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscFunctionReturn/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-IHg61OE$ >(PETSC_SUCCESS<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscErrorCode/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-BV3mYuw$ >);
821:   PetscTryTypeMethod<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscTryTypeMethod/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD--roQk-8$ >(dm, setup);
822:   dm->setupcalled = PETSC_TRUE<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PETSC_TRUE/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-6I9S4aE$ >;
823:   PetscFunctionReturn<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscFunctionReturn/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-IHg61OE$ >(PETSC_SUCCESS<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscErrorCode/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-BV3mYuw$ >);
824: }

"We could make a DMPlexSetCones(), but as you point out, the workflow for DMSetUp() would have to change. Where does the memory come from for your connectivity?"
      It's a memory that I myself allocate based on a file's contents.
      The nature of the I/O makes it so that I need to read the connectivity before I get a semblance of buffer sizes.
      Otherwise, I would stick to the tried and tested way.

Also, when replying to the PETSc developers, users must reply to petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> and not just to the individual email accounts of the developers, right?




________________________________
From: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Sent: Wednesday, May 1, 2024 8:07 PM
To: Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: [EXTERNAL] Re: [petsc-users] Is there anything like a "DMPlexSetCones()" ?

CAUTION: This email originated outside of Embry-Riddle Aeronautical University. Do not click links or open attachments unless you recognize the sender and know the content is safe.

On Wed, May 1, 2024 at 3:34 PM Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>> wrote:
This Message Is From an External Sender
This message came from outside your organization.

Dear PETSc team:

For a project that I'm working on, I need to manually build a DMPlex.
>From studying the source code of the various APIs in which the plex is built from some supported file format, I get that the workflow is this:


  1.
DMPlexSetChart() <-- Input nCells + nVerts
  2.
DMPlexSetConeSize() <-- Input ConeSize for each point in [0,nCells)
  3.
DMSetUp() – Allocates memory internally.
  4.
DMPlexGetCones() --> Gives you the memory onto which to write the cell connectivity.
  5.
*Write connectivity*
  6.
DMPlexReorderCell() <-- For each point in [0,nCells)

I'm in a situation where the memory given by step (4) is available a-priori.
I was hoping to skip steps 2, 3 , and 4 with something like a "DMPlexSetCones()", but such an API does not exist.
My current workaround is to implement steps 2 through 4 as always and have double the memory allocated in the interim (my instance + DM's internal instance).
I was thinking of looking for the name of the struct member and = it to my memory, but I can't overcome the flag check in DMSetUp() during later calls to DMPlexGetCones() or DMPlexGetTransitiveClosure().

I do not understand the "flag check". What is that?

We could make a DMPlexSetCones(), but as you point out, the workflow for DMSetUp() would have to change. Where does the memory come from for your connectivity?

  Thanks,

    Matt



Sincerely:

J.A. Ferrand

Embry-Riddle Aeronautical University - Daytona Beach - FL
Ph.D. Candidate, Aerospace Engineering

M.Sc. Aerospace Engineering

B.Sc. Aerospace Engineering

B.Sc. Computational Mathematics


Phone: (386)-843-1829

Email(s): ferranj2 at my.erau.edu<mailto:ferranj2 at my.erau.edu>

    jesus.ferrand at gmail.com<mailto:jesus.ferrand at gmail.com>


--
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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-x-OTHfg$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-kBIt_QE$ >

________________________________
From: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Sent: Wednesday, May 1, 2024 8:07 PM
To: Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: [EXTERNAL] Re: [petsc-users] Is there anything like a "DMPlexSetCones()" ?

CAUTION: This email originated outside of Embry-Riddle Aeronautical University. Do not click links or open attachments unless you recognize the sender and know the content is safe.

On Wed, May 1, 2024 at 3:34 PM Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>> wrote:
This Message Is From an External Sender
This message came from outside your organization.

Dear PETSc team:

For a project that I'm working on, I need to manually build a DMPlex.
>From studying the source code of the various APIs in which the plex is built from some supported file format, I get that the workflow is this:


  1.
DMPlexSetChart() <-- Input nCells + nVerts
  2.
DMPlexSetConeSize() <-- Input ConeSize for each point in [0,nCells)
  3.
DMSetUp() – Allocates memory internally.
  4.
DMPlexGetCones() --> Gives you the memory onto which to write the cell connectivity.
  5.
*Write connectivity*
  6.
DMPlexReorderCell() <-- For each point in [0,nCells)

I'm in a situation where the memory given by step (4) is available a-priori.
I was hoping to skip steps 2, 3 , and 4 with something like a "DMPlexSetCones()", but such an API does not exist.
My current workaround is to implement steps 2 through 4 as always and have double the memory allocated in the interim (my instance + DM's internal instance).
I was thinking of looking for the name of the struct member and = it to my memory, but I can't overcome the flag check in DMSetUp() during later calls to DMPlexGetCones() or DMPlexGetTransitiveClosure().

I do not understand the "flag check". What is that?

We could make a DMPlexSetCones(), but as you point out, the workflow for DMSetUp() would have to change. Where does the memory come from for your connectivity?

  Thanks,

    Matt



Sincerely:

J.A. Ferrand

Embry-Riddle Aeronautical University - Daytona Beach - FL
Ph.D. Candidate, Aerospace Engineering

M.Sc. Aerospace Engineering

B.Sc. Aerospace Engineering

B.Sc. Computational Mathematics


Phone: (386)-843-1829

Email(s): ferranj2 at my.erau.edu<mailto:ferranj2 at my.erau.edu>

    jesus.ferrand at gmail.com<mailto:jesus.ferrand at gmail.com>


--
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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-x-OTHfg$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-kBIt_QE$ >


--
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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-x-OTHfg$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-kBIt_QE$ >


--
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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-x-OTHfg$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-kBIt_QE$ >

________________________________
From: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Sent: Friday, May 3, 2024 6:45 PM
To: Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [EXTERNAL] Re: [petsc-users] Is there anything like a "DMPlexSetCones()" ?

On Wed, May 1, 2024 at 6:30 PM Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>> wrote:
"You know the number of cells if you can read connectivity. Do you mean that the format does not tell you
the number of vertices?"

Sort of...
So, the format does provide the number of vertices, however, due to the way I read the data in parallel I don't know immediately how many local vertices there will be.
Which prevents me from knowing the chart a priori.
I figured out the number of vertices using PetscHashSetI to determine the number of unique entries in the connectivity list.

Right, but that means that the connectivity you read in is not in local numbering. You will have to renumber it, so making a copy is probably necessary anyway. This is the same sort of processing I do for the parallel read.

  Thanks,

     Matt

________________________________
From: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Sent: Wednesday, May 1, 2024 8:52 PM
To: Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [EXTERNAL] Re: [petsc-users] Is there anything like a "DMPlexSetCones()" ?

On Wed, May 1, 2024 at 4:23 PM Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>> wrote:
Matt:

My bad again, I need to clarify something that I just realized doesn't make sense.
I said: "The nature of the I/O makes it so that I need to read the connectivity before I get a semblance of buffer sizes."
Scratch that, obviously, if I can read the connectivity, I know the buffer sizes.

What I should have said is that I cannot know the "chart" that one sets in DMPlexSetChart() a priori like in most cases.
I need to determine the chart from the connectivity lists.

You know the number of cells if you can read connectivity. Do you mean that the format does not tell you
the number of vertices?

  Thanks,

    Matt

________________________________
From: Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>>
Sent: Wednesday, May 1, 2024 8:17 PM
To: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [EXTERNAL] Re: [petsc-users] Is there anything like a "DMPlexSetCones()" ?

Matt:

"I do not understand the "flag check". What is that?"

      My bad, I should have referred to the "dm->setupcalled".
      I believe this PetscBool is checked by the other DM (not just DMPlex) APIs.
      The subsequent checks for dm->setupcalled == PETSC_TRUE is what I meant to say.
      Here's a copy of DMSetUp().

PetscErrorCode<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscErrorCode/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-BV3mYuw$ > DMSetUp<https://urldefense.us/v3/__https://petsc.org/release/manualpages/DM/DMSetUp/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-CMnaFo8$ >(DM<https://urldefense.us/v3/__https://petsc.org/release/manualpages/DM/DM/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-UUpirwU$ > dm)
817: {
818:   PetscFunctionBegin<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscFunctionBegin/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-YcDnMyU$ >;
820:   if (dm->setupcalled) PetscFunctionReturn<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscFunctionReturn/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-IHg61OE$ >(PETSC_SUCCESS<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscErrorCode/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-BV3mYuw$ >);
821:   PetscTryTypeMethod<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscTryTypeMethod/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD--roQk-8$ >(dm, setup);
822:   dm->setupcalled = PETSC_TRUE<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PETSC_TRUE/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-6I9S4aE$ >;
823:   PetscFunctionReturn<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscFunctionReturn/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-IHg61OE$ >(PETSC_SUCCESS<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscErrorCode/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-BV3mYuw$ >);
824: }

"We could make a DMPlexSetCones(), but as you point out, the workflow for DMSetUp() would have to change. Where does the memory come from for your connectivity?"
      It's a memory that I myself allocate based on a file's contents.
      The nature of the I/O makes it so that I need to read the connectivity before I get a semblance of buffer sizes.
      Otherwise, I would stick to the tried and tested way.

Also, when replying to the PETSc developers, users must reply to petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> and not just to the individual email accounts of the developers, right?




________________________________
From: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Sent: Wednesday, May 1, 2024 8:07 PM
To: Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: [EXTERNAL] Re: [petsc-users] Is there anything like a "DMPlexSetCones()" ?

CAUTION: This email originated outside of Embry-Riddle Aeronautical University. Do not click links or open attachments unless you recognize the sender and know the content is safe.

On Wed, May 1, 2024 at 3:34 PM Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>> wrote:
This Message Is From an External Sender
This message came from outside your organization.

Dear PETSc team:

For a project that I'm working on, I need to manually build a DMPlex.
>From studying the source code of the various APIs in which the plex is built from some supported file format, I get that the workflow is this:


  1.
DMPlexSetChart() <-- Input nCells + nVerts
  2.
DMPlexSetConeSize() <-- Input ConeSize for each point in [0,nCells)
  3.
DMSetUp() – Allocates memory internally.
  4.
DMPlexGetCones() --> Gives you the memory onto which to write the cell connectivity.
  5.
*Write connectivity*
  6.
DMPlexReorderCell() <-- For each point in [0,nCells)

I'm in a situation where the memory given by step (4) is available a-priori.
I was hoping to skip steps 2, 3 , and 4 with something like a "DMPlexSetCones()", but such an API does not exist.
My current workaround is to implement steps 2 through 4 as always and have double the memory allocated in the interim (my instance + DM's internal instance).
I was thinking of looking for the name of the struct member and = it to my memory, but I can't overcome the flag check in DMSetUp() during later calls to DMPlexGetCones() or DMPlexGetTransitiveClosure().

I do not understand the "flag check". What is that?

We could make a DMPlexSetCones(), but as you point out, the workflow for DMSetUp() would have to change. Where does the memory come from for your connectivity?

  Thanks,

    Matt



Sincerely:

J.A. Ferrand

Embry-Riddle Aeronautical University - Daytona Beach - FL
Ph.D. Candidate, Aerospace Engineering

M.Sc. Aerospace Engineering

B.Sc. Aerospace Engineering

B.Sc. Computational Mathematics


Phone: (386)-843-1829

Email(s): ferranj2 at my.erau.edu<mailto:ferranj2 at my.erau.edu>

    jesus.ferrand at gmail.com<mailto:jesus.ferrand at gmail.com>


--
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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-x-OTHfg$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-kBIt_QE$ >

________________________________
From: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Sent: Wednesday, May 1, 2024 8:07 PM
To: Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: [EXTERNAL] Re: [petsc-users] Is there anything like a "DMPlexSetCones()" ?

CAUTION: This email originated outside of Embry-Riddle Aeronautical University. Do not click links or open attachments unless you recognize the sender and know the content is safe.

On Wed, May 1, 2024 at 3:34 PM Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>> wrote:
This Message Is From an External Sender
This message came from outside your organization.

Dear PETSc team:

For a project that I'm working on, I need to manually build a DMPlex.
>From studying the source code of the various APIs in which the plex is built from some supported file format, I get that the workflow is this:


  1.
DMPlexSetChart() <-- Input nCells + nVerts
  2.
DMPlexSetConeSize() <-- Input ConeSize for each point in [0,nCells)
  3.
DMSetUp() – Allocates memory internally.
  4.
DMPlexGetCones() --> Gives you the memory onto which to write the cell connectivity.
  5.
*Write connectivity*
  6.
DMPlexReorderCell() <-- For each point in [0,nCells)

I'm in a situation where the memory given by step (4) is available a-priori.
I was hoping to skip steps 2, 3 , and 4 with something like a "DMPlexSetCones()", but such an API does not exist.
My current workaround is to implement steps 2 through 4 as always and have double the memory allocated in the interim (my instance + DM's internal instance).
I was thinking of looking for the name of the struct member and = it to my memory, but I can't overcome the flag check in DMSetUp() during later calls to DMPlexGetCones() or DMPlexGetTransitiveClosure().

I do not understand the "flag check". What is that?

We could make a DMPlexSetCones(), but as you point out, the workflow for DMSetUp() would have to change. Where does the memory come from for your connectivity?

  Thanks,

    Matt



Sincerely:

J.A. Ferrand

Embry-Riddle Aeronautical University - Daytona Beach - FL
Ph.D. Candidate, Aerospace Engineering

M.Sc. Aerospace Engineering

B.Sc. Aerospace Engineering

B.Sc. Computational Mathematics


Phone: (386)-843-1829

Email(s): ferranj2 at my.erau.edu<mailto:ferranj2 at my.erau.edu>

    jesus.ferrand at gmail.com<mailto:jesus.ferrand at gmail.com>


--
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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-x-OTHfg$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-kBIt_QE$ >


--
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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-x-OTHfg$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-kBIt_QE$ >

________________________________
From: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Sent: Wednesday, May 1, 2024 8:52 PM
To: Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [EXTERNAL] Re: [petsc-users] Is there anything like a "DMPlexSetCones()" ?

On Wed, May 1, 2024 at 4:23 PM Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>> wrote:
Matt:

My bad again, I need to clarify something that I just realized doesn't make sense.
I said: "The nature of the I/O makes it so that I need to read the connectivity before I get a semblance of buffer sizes."
Scratch that, obviously, if I can read the connectivity, I know the buffer sizes.

What I should have said is that I cannot know the "chart" that one sets in DMPlexSetChart() a priori like in most cases.
I need to determine the chart from the connectivity lists.

You know the number of cells if you can read connectivity. Do you mean that the format does not tell you
the number of vertices?

  Thanks,

    Matt

________________________________
From: Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>>
Sent: Wednesday, May 1, 2024 8:17 PM
To: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [EXTERNAL] Re: [petsc-users] Is there anything like a "DMPlexSetCones()" ?

Matt:

"I do not understand the "flag check". What is that?"

      My bad, I should have referred to the "dm->setupcalled".
      I believe this PetscBool is checked by the other DM (not just DMPlex) APIs.
      The subsequent checks for dm->setupcalled == PETSC_TRUE is what I meant to say.
      Here's a copy of DMSetUp().

PetscErrorCode<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscErrorCode/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-BV3mYuw$ > DMSetUp<https://urldefense.us/v3/__https://petsc.org/release/manualpages/DM/DMSetUp/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-CMnaFo8$ >(DM<https://urldefense.us/v3/__https://petsc.org/release/manualpages/DM/DM/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-UUpirwU$ > dm)
817: {
818:   PetscFunctionBegin<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscFunctionBegin/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-YcDnMyU$ >;
820:   if (dm->setupcalled) PetscFunctionReturn<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscFunctionReturn/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-IHg61OE$ >(PETSC_SUCCESS<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscErrorCode/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-BV3mYuw$ >);
821:   PetscTryTypeMethod<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscTryTypeMethod/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD--roQk-8$ >(dm, setup);
822:   dm->setupcalled = PETSC_TRUE<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PETSC_TRUE/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-6I9S4aE$ >;
823:   PetscFunctionReturn<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscFunctionReturn/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-IHg61OE$ >(PETSC_SUCCESS<https://urldefense.us/v3/__https://petsc.org/release/manualpages/Sys/PetscErrorCode/__;!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-BV3mYuw$ >);
824: }

"We could make a DMPlexSetCones(), but as you point out, the workflow for DMSetUp() would have to change. Where does the memory come from for your connectivity?"
      It's a memory that I myself allocate based on a file's contents.
      The nature of the I/O makes it so that I need to read the connectivity before I get a semblance of buffer sizes.
      Otherwise, I would stick to the tried and tested way.

Also, when replying to the PETSc developers, users must reply to petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> and not just to the individual email accounts of the developers, right?




________________________________
From: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Sent: Wednesday, May 1, 2024 8:07 PM
To: Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: [EXTERNAL] Re: [petsc-users] Is there anything like a "DMPlexSetCones()" ?

CAUTION: This email originated outside of Embry-Riddle Aeronautical University. Do not click links or open attachments unless you recognize the sender and know the content is safe.

On Wed, May 1, 2024 at 3:34 PM Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>> wrote:
This Message Is From an External Sender
This message came from outside your organization.

Dear PETSc team:

For a project that I'm working on, I need to manually build a DMPlex.
>From studying the source code of the various APIs in which the plex is built from some supported file format, I get that the workflow is this:


  1.
DMPlexSetChart() <-- Input nCells + nVerts
  2.
DMPlexSetConeSize() <-- Input ConeSize for each point in [0,nCells)
  3.
DMSetUp() – Allocates memory internally.
  4.
DMPlexGetCones() --> Gives you the memory onto which to write the cell connectivity.
  5.
*Write connectivity*
  6.
DMPlexReorderCell() <-- For each point in [0,nCells)

I'm in a situation where the memory given by step (4) is available a-priori.
I was hoping to skip steps 2, 3 , and 4 with something like a "DMPlexSetCones()", but such an API does not exist.
My current workaround is to implement steps 2 through 4 as always and have double the memory allocated in the interim (my instance + DM's internal instance).
I was thinking of looking for the name of the struct member and = it to my memory, but I can't overcome the flag check in DMSetUp() during later calls to DMPlexGetCones() or DMPlexGetTransitiveClosure().

I do not understand the "flag check". What is that?

We could make a DMPlexSetCones(), but as you point out, the workflow for DMSetUp() would have to change. Where does the memory come from for your connectivity?

  Thanks,

    Matt



Sincerely:

J.A. Ferrand

Embry-Riddle Aeronautical University - Daytona Beach - FL
Ph.D. Candidate, Aerospace Engineering

M.Sc. Aerospace Engineering

B.Sc. Aerospace Engineering

B.Sc. Computational Mathematics


Phone: (386)-843-1829

Email(s): ferranj2 at my.erau.edu<mailto:ferranj2 at my.erau.edu>

    jesus.ferrand at gmail.com<mailto:jesus.ferrand at gmail.com>


--
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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-x-OTHfg$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-kBIt_QE$ >

________________________________
From: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Sent: Wednesday, May 1, 2024 8:07 PM
To: Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: [EXTERNAL] Re: [petsc-users] Is there anything like a "DMPlexSetCones()" ?

CAUTION: This email originated outside of Embry-Riddle Aeronautical University. Do not click links or open attachments unless you recognize the sender and know the content is safe.

On Wed, May 1, 2024 at 3:34 PM Ferrand, Jesus A. <FERRANJ2 at my.erau.edu<mailto:FERRANJ2 at my.erau.edu>> wrote:
This Message Is From an External Sender
This message came from outside your organization.

Dear PETSc team:

For a project that I'm working on, I need to manually build a DMPlex.
>From studying the source code of the various APIs in which the plex is built from some supported file format, I get that the workflow is this:


  1.
DMPlexSetChart() <-- Input nCells + nVerts
  2.
DMPlexSetConeSize() <-- Input ConeSize for each point in [0,nCells)
  3.
DMSetUp() – Allocates memory internally.
  4.
DMPlexGetCones() --> Gives you the memory onto which to write the cell connectivity.
  5.
*Write connectivity*
  6.
DMPlexReorderCell() <-- For each point in [0,nCells)

I'm in a situation where the memory given by step (4) is available a-priori.
I was hoping to skip steps 2, 3 , and 4 with something like a "DMPlexSetCones()", but such an API does not exist.
My current workaround is to implement steps 2 through 4 as always and have double the memory allocated in the interim (my instance + DM's internal instance).
I was thinking of looking for the name of the struct member and = it to my memory, but I can't overcome the flag check in DMSetUp() during later calls to DMPlexGetCones() or DMPlexGetTransitiveClosure().

I do not understand the "flag check". What is that?

We could make a DMPlexSetCones(), but as you point out, the workflow for DMSetUp() would have to change. Where does the memory come from for your connectivity?

  Thanks,

    Matt



Sincerely:

J.A. Ferrand

Embry-Riddle Aeronautical University - Daytona Beach - FL
Ph.D. Candidate, Aerospace Engineering

M.Sc. Aerospace Engineering

B.Sc. Aerospace Engineering

B.Sc. Computational Mathematics


Phone: (386)-843-1829

Email(s): ferranj2 at my.erau.edu<mailto:ferranj2 at my.erau.edu>

    jesus.ferrand at gmail.com<mailto:jesus.ferrand at gmail.com>


--
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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-x-OTHfg$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-kBIt_QE$ >


--
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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-x-OTHfg$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-kBIt_QE$ >


--
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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-x-OTHfg$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-kBIt_QE$ >


--
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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-x-OTHfg$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!YA9N-9_O6-4rSg848GHyIY2nSendFsTvYClTS9F7288syR3Qqj7dAAwx9vwfVzBedRxEAI057ebAdXwzNbD-kBIt_QE$ >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240506/bf7f14a8/attachment-0001.html>


More information about the petsc-users mailing list