[petsc-users] DMNetwork - how to interprete the arguments of DMNetworkSetSizes ?
von Ramm, Alexander
Alexander.vonRamm at lrz.de
Thu Nov 7 11:11:51 CST 2019
Hello together,
I'm trying to figure out how to create a DMNetwork, but the proper way to set the parameters eludes me (also there is some discrepancy between the manual https://www.mcs.anl.gov/petsc/petsc-current/docs/manual.pdf (page 166) and the online documenation https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMNetwork/DMNetworkSetSizes.html ).
Currently I'm trying to set a up a simple Network with 8 nodes and 7 edges and distribute it over 2 processors. In the call DMNetworkSetSizes does Nsubnet need to be 1 (one global network, without any further subnetworks) or 2 (one subnetwork per processor) (my guess would be the former).
My current attempt looks like the following:
int main( int argc, char *argv[]) {
PetscInitialize(&argc, &argv, NULL, NULL);
DM dm;
PetscInt NSubnet = 1;
PetscInt nV[1] = {8};
PetscInt nE[1] = {7};
PetscInt NsubnetCouple = 0;
PetscInt nec[0];
DMNetworkCreate(PETSC_COMM_WORLD, &dm);
DMNetworkSetSizes(dm, NSubnet, nV, nE, NsubnetCouple, nec);
PetscInt *edgeList;
PetscMalloc1(14, &edgeList);
edgeList[0] = 0;
edgeList[1] = 4;
edgeList[2] = 1;
edgeList[3] = 4;
edgeList[4] = 2;
edgeList[5] = 5;
edgeList[6] = 3;
edgeList[7] = 5;
edgeList[8] = 4;
edgeList[9] = 6;
edgeList[10] = 5;
edgeList[11] = 6;
edgeList[12] = 6;
edgeList[13] = 7;
PetscInt *edges[1];
edges[0] = edgeList;
DMNetworkSetEdgeList(dm, edges, NULL);
DMNetworkLayoutSetUp(dm);
return 0;
}
Except from the Online Documenation I wasn't able to find any information/example where newest version Petsc was used when setting up a DMNetwork. (I found a few examples using older versions, however I could not figure out how these could solved using the newest version). If some could explain to me the the correct interpretation of the parameters of DMNetworkSetSizes ? Any pointers to examples using the newest API would also be much appreciated.
Thanks and best Regards,
Alex
More information about the petsc-users
mailing list