[petsc-users] DMPlexUniformRefine

Fande Kong fande.kong at colorado.edu
Tue Apr 14 11:29:08 CDT 2015


Thanks. It does work now.

On Tue, Apr 14, 2015 at 10:27 AM, Matthew Knepley <knepley at gmail.com> wrote:

> On Tue, Apr 14, 2015 at 11:13 AM, Fande Kong <fande.kong at colorado.edu>
> wrote:
>
>> Hi all,
>>
>> I have several lines of code to read a mesh and uniformly refine it.
>> DMPlex can not uniformly refine it. I am using PETSc-3.5.3. The code is
>> very simple like follows:
>>
>> #undef __FUNCT__
>>
>> #define __FUNCT__ "main"
>>
>> int main(int argc, char **argv)
>>
>> {
>>
>>   DM             dm,pdm, refinedMesh;          /* Problem specification
>> */
>>
>>   AppCtx         user;        /* user-defined work context */
>>
>>   PetscErrorCode ierr;
>>
>>
>>   ierr = PetscInitialize(&argc, &argv, NULL, help);CHKERRQ(ierr);
>>
>>
>>   /*ierr = CreateMesh(PETSC_COMM_WORLD, &user, &dm);CHKERRQ(ierr);*/
>>
>>
>>   ierr = DMPlexCreateExodusFromFile(PETSC_COMM_WORLD, "./Tet4.exo",
>> PETSC_FALSE, &dm);CHKERRQ(ierr);
>>
>
>                                                       ^^^^^^^^^^^^ Use
> PETSC_TRUE
>
>    Matt
>
>
>>   ierr = DMPlexDistribute(dm, "metis", 0, NULL, &pdm);CHKERRQ(ierr);
>>
>>   ierr = DMDestroy(&dm);CHKERRQ(ierr);
>>
>>   ierr = DMPlexSetRefinementUniform(pdm, PETSC_TRUE);CHKERRQ(ierr);
>>
>>   ierr = DMRefine(pdm, PETSC_COMM_WORLD, &refinedMesh);CHKERRQ(ierr);
>>
>>   ierr = DMDestroy(&pdm);CHKERRQ(ierr);
>>
>>   ierr = DMDestroy(&refinedMesh);CHKERRQ(ierr);
>>
>>
>>   ierr = PetscFinalize();
>>
>>
>>   return 0;
>>
>> }
>>
>>
>> The mesh file is also attached.
>>
>> Fande,
>>
>>
>
>
> --
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150414/88320f59/attachment.html>


More information about the petsc-users mailing list