<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Good Morning,<div><br></div><div>For the past few years, I have been working to integrate CAD into PETSc. Over this time, I've worked with Dr. Knepley to enable PETSc to open and utilize STEP, IGES, EGADS and EGADSlite files. We've also worked to expose the geometry's parameters (Control Points, Weights) as well as their gradients for direct manipulation through PETSc allowing numerical optimization of the geometry underpinning the domain's discretization (mesh).</div><div><br></div><div>I'm currently trying to make this functionality usable through PETSc only functions (wrapper functions) so users don't have to learn the underlying CAD library. To achieve this, I need to do the following things in PETSc.</div><div><ol><li>Create a new PETSc object which is typedef of the underlying library's object. Where/what file should I include this typedef?</li><ul><li>I currently defined it in the petscsystypes.h with the following code.</li></ul></ol></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div dir="ltr"><div dir="ltr"><div>#if defined(PETSC_HAVE_EGADS)</div></div></div></blockquote></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><div>#include <egads.h></div></div></div></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><div>#include <egads_lite.h></div></div></div></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><div>typedef ego PetscGeom;</div></div></div></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><div>#endif</div></div></div></blockquote></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><ul><li>This appears to work but I know it is not a final solution because on updating PETSc I get warnings saying that a few defined variables are being redefined by other header files. How do I properly incorporate this into PETSc as part of an optional capability?</li></ul></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">2. Create wrapper functions where I need to return information back to the main code? I currently have defined the wrapper function signatures in plexdmplex.h as:<br></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><ul><li>PETSC_EXTERN PetscErrorCode DMPlexGetGeomModelBodies(DM, PetscGeom *, PetscInt); // EGADS<br></li></ul></blockquote></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>In my main code, I use the following. After completion, I would like DMPlexGetGeomModelBodies() to return the PetscGeom object which is usually an array of 'ego' objects and the number of objects in the array of the 'ego' objects.</div><div><br></div></blockquote></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div dir="ltr"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>PetscGeom  *newBodies = NULL;</div></blockquote></div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">PetscInt   numBodies = 0;</blockquote></div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">PetscCall(DMPlexGetGeomModelBodies(dmNozzle, &newBodies, numBodies));</blockquote></div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">PetscCall(PetscPrintf(PETSC_COMM_SELF, "    Nb = %d  ||  numBodies = %d \n", Nb, numBodies));<br></blockquote></div></blockquote><div><br></div><div>I'm fairly certain I'm getting tripped up on how to properly pass these objects between my main code and the new PETSc functions I'm trying to develop. Any assistance/direction/insights you could provide is greatly appreciated.</div><div><br></div><div>Thank you</div><div>Brandon Denton</div><div><br></div><div><br></div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><br></blockquote></div></blockquote></div>