[petsc-dev] DMplex: Natural Ordering and subDM
Blaise A Bourdin
bourdin at lsu.edu
Tue Nov 21 17:20:48 CST 2017
Hi,
I am fighting with natural ordering in DMplex with multi-fields / multi components DM.
I need to read / write files in a distribution-independent ordering. The natural way to do so is to define the natural ordering as that of the file, then call DMPlexGlobalToNaturalBegin/End before VecView:
The pseudo code would be
DMPlexCreateFromFile(PETSC_COMM_WORLD,ifilename,interpolate,&dmUAS);
// create default section associated with a complicated layout of multiple fields
// (U,\alpha,\sigma)
DMSetUseNatural(dmUAS,PETSC_TRUE);
DMPlexDistribute(dmUAS,0,&migrationSF,&dmDist);
DMGetGlobalVector(dmDist,&UAS);
DMGetGlobalVector(dmDist,&UASNatural);
DMPlexGlobalToNaturalBegin(dmDist,UAS,UASNatural);
DMPlexGlobalToNaturalEnd(dmDist,UAS,UASNatural);
// Do my I/O stuff using UASNatural
If I try to do the same thing one field at a time, things break:
Say that I get the subDM for the first field (U):
DMCreateSubDM(dmDist,1,&fieldU,&ISU,&dmU);
Then dmU->useNatural is PETSC_FALSE and I cannot compute dmU->sfnatural using DMPlexCreateGlobalToNaturalSF since I do not have the “sequential” version of dmU.
What is the proper way to handle this situation? Creating sequential subDMs and calling DMDistribute on each of them is ugly and possibly costly.
Regards,
Blaise
--
Department of Mathematics and Center for Computation & Technology
Louisiana State University, Baton Rouge, LA 70803, USA
Tel. +1 (225) 578 1612, Fax +1 (225) 578 4276 http://www.math.lsu.edu/~bourdin
More information about the petsc-dev
mailing list