Lines Matching +full:opensolaris +full:- +full:misc
14 …->maxcomps, &header->size, header->maxcomps, &header->key, header->maxcomps, &header->offset, head… in SetUpNetworkHeaderComponentValue()
15 PetscCall(PetscCalloc1(header->maxcomps, &cvalue->data)); in SetUpNetworkHeaderComponentValue()
19 …header->hsize = sizeof(struct _p_DMNetworkComponentHeader) + 5 * header->maxcomps * sizeof(PetscIn… in SetUpNetworkHeaderComponentValue()
20 header->hsize /= sizeof(DMNetworkComponentGenericDataType); in SetUpNetworkHeaderComponentValue()
23 header->hsize = (header->hsize + (8 - 1)) & ~(8 - 1); in SetUpNetworkHeaderComponentValue()
30 DM_Network *network = (DM_Network *)dm->data; in DMNetworkInitializeHeaderComponentData()
34 np = network->cloneshared->pEnd - network->cloneshared->pStart; in DMNetworkInitializeHeaderComponentData()
35 if (network->header) in DMNetworkInitializeHeaderComponentData()
37 network->header[p].maxcomps = defaultnumcomp; in DMNetworkInitializeHeaderComponentData()
38 PetscCall(SetUpNetworkHeaderComponentValue(dm, &network->header[p], &network->cvalue[p])); in DMNetworkInitializeHeaderComponentData()
44 DMNetworkGetPlex - Gets the `DMPLEX` associated with this `DMNETWORK`
49 . dm - the `DMNETWORK` object
52 . plexdm - the `DMPLEX` object
60 DM_Network *network = (DM_Network *)dm->data; in DMNetworkGetPlex()
63 *plexdm = network->plex; in DMNetworkGetPlex()
68 DMNetworkGetNumSubNetworks - Gets the number of subnetworks
73 . dm - the `DMNETWORK` object
76 + nsubnet - local number of subnetworks, pass `NULL` if not needed
77 - Nsubnet - global number of subnetworks, pass `NULL` if not needed
85 DM_Network *network = (DM_Network *)dm->data; in DMNetworkGetNumSubNetworks()
88 if (nsubnet) *nsubnet = network->cloneshared->nsubnet; in DMNetworkGetNumSubNetworks()
89 if (Nsubnet) *Nsubnet = network->cloneshared->Nsubnet; in DMNetworkGetNumSubNetworks()
94 DMNetworkSetNumSubNetworks - Sets the number of subnetworks
99 + dm - the `DMNETWORK` object
100 . nsubnet - local number of subnetworks
101 - Nsubnet - global number of subnetworks
109 DM_Network *network = (DM_Network *)dm->data; in DMNetworkSetNumSubNetworks()
112 …PetscCheck(network->cloneshared->Nsubnet == 0, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_INC… in DMNetworkSetNumSubNetworks()
124 network->cloneshared->Nsubnet = Nsubnet; in DMNetworkSetNumSubNetworks()
125 …network->cloneshared->nsubnet = 0; /* initial value; will be determined by DMNetworkAddSubnetwork(… in DMNetworkSetNumSubNetworks()
126 PetscCall(PetscCalloc1(Nsubnet, &network->cloneshared->subnet)); in DMNetworkSetNumSubNetworks()
129 network->cloneshared->nsvtx = 0; in DMNetworkSetNumSubNetworks()
130 network->cloneshared->Nsvtx = 0; in DMNetworkSetNumSubNetworks()
135 DMNetworkAddSubnetwork - Add a subnetwork
140 + dm - the `DMNETWORK` object
141 . name - name of the subnetwork
142 . ne - number of local edges of this subnetwork
143 - edgelist - list of edges for this subnetwork, this is a one dimensional array with pairs of entri…
147 . netnum - global index of the subnetwork
165 v0 --> v2; v1 --> v2
167 v3 --> v5; v4 --> v5
184 v0 --> v2; v2 --> v1; v1 --> v3;
187 v0 --> v3; v3 --> v2; v2 --> v1;
214 DM_Network *network = (DM_Network *)dm->data; in DMNetworkAddSubnetwork()
215 PetscInt i, Nedge, j, Nvtx, nvtx, nvtx_min = -1, nvtx_max = 0; in DMNetworkAddSubnetwork()
231 Nvtx = nvtx_max - nvtx_min + 1; /* approximated total local nvtx for this subnet */ in DMNetworkAddSubnetwork()
238 PetscCall(PetscBTSet(table, edgelist[i++] - nvtx_min)); in DMNetworkAddSubnetwork()
239 PetscCall(PetscBTSet(table, edgelist[i++] - nvtx_min)); in DMNetworkAddSubnetwork()
254 i = network->cloneshared->nsubnet; in DMNetworkAddSubnetwork()
255 …if (name) PetscCall(PetscStrncpy(network->cloneshared->subnet[i].name, name, sizeof(network->clone… in DMNetworkAddSubnetwork()
256 network->cloneshared->subnet[i].nvtx = nvtx; /* include ghost vertices */ in DMNetworkAddSubnetwork()
257 network->cloneshared->subnet[i].nedge = ne; in DMNetworkAddSubnetwork()
258 network->cloneshared->subnet[i].edgelist = edgelist; in DMNetworkAddSubnetwork()
259 network->cloneshared->subnet[i].Nvtx = Nvtx; in DMNetworkAddSubnetwork()
260 network->cloneshared->subnet[i].Nedge = Nedge; in DMNetworkAddSubnetwork()
262 /* ---------------------------------------------------------- in DMNetworkAddSubnetwork()
266 ----------------------------------------------------------------------- */ in DMNetworkAddSubnetwork()
268 network->cloneshared->subnet[i].vStart = network->cloneshared->NVertices; in DMNetworkAddSubnetwork()
269 …network->cloneshared->subnet[i].vEnd = network->cloneshared->subnet[i].vStart + network->clonesh… in DMNetworkAddSubnetwork()
271 network->cloneshared->nVertices += nvtx; /* include ghost vertices */ in DMNetworkAddSubnetwork()
272 network->cloneshared->NVertices += network->cloneshared->subnet[i].Nvtx; in DMNetworkAddSubnetwork()
275 network->cloneshared->subnet[i].eStart = network->cloneshared->nEdges; in DMNetworkAddSubnetwork()
276 network->cloneshared->subnet[i].eEnd = network->cloneshared->subnet[i].eStart + ne; in DMNetworkAddSubnetwork()
277 network->cloneshared->nEdges += ne; in DMNetworkAddSubnetwork()
278 network->cloneshared->NEdges += network->cloneshared->subnet[i].Nedge; in DMNetworkAddSubnetwork()
280 …PetscCall(PetscStrncpy(network->cloneshared->subnet[i].name, name, sizeof(network->cloneshared->su… in DMNetworkAddSubnetwork()
281 if (netnum) *netnum = network->cloneshared->nsubnet; in DMNetworkAddSubnetwork()
282 network->cloneshared->nsubnet++; in DMNetworkAddSubnetwork()
287 …DMNetworkSharedVertexGetInfo - Get info of a shared vertex struct, see petsc/private/dmnetworkimpl…
292 + dm - the `DM` object
293 - v - vertex point
296 + gidx - global number of this shared vertex in the internal dmplex, pass `NULL` if not needed
297 . n - number of subnetworks that share this vertex, pass `NULL` if not needed
298 - sv - array of size `n`: sv[2*i,2*i+1]=(net[i], idx[i]), i=0,...,n-1, pass `NULL` if not needed
306 DM_Network *network = (DM_Network *)dm->data; in DMNetworkSharedVertexGetInfo()
307 SVtx *svtx = network->cloneshared->svtx; in DMNetworkSharedVertexGetInfo()
312 PetscCall(PetscHMapIGetWithDefault(network->cloneshared->svtable, gidx_tmp + 1, 0, &i)); in DMNetworkSharedVertexGetInfo()
315 i--; in DMNetworkSharedVertexGetInfo()
323 VtxGetInfo - Get info of an input vertex=(net,idx)
326 + Nsvtx - global num of shared vertices
327 . svtx - array of shared vertices (global)
328 - (net,idx) - subnet number and local index for a vertex
331 + gidx - global index of (net,idx)
332 . svtype - see petsc/private/dmnetworkimpl.h
333 - svtx_idx - ordering in the svtx array
343 g_idx = -1; in VtxGetInfo()
369 TableAddSVtx - Add a new shared vertice from sedgelist[k] to a ctable svta
381 gidx = network->cloneshared->subnet[net].vStart + idx; in TableAddSVtx()
390 …SharedVtxCreate - Create an array of global shared vertices. See SVtx and SVtxType in dmnetworkimp…
395 sv(net[0],idx[0]) --> sv(net[1],idx[1])
396 --> sv(net[1],idx[1])
398 --> sv(net[n-1],idx[n-1])
399 and net[0] < net[1] < ... < net[n-1]
408 DM_Network *network = (DM_Network *)dm->data; in SharedVtxCreate()
412 …/* (1) Crete an array of ctables svtas to map (net,idx) -> gidx; a svtas[] for a shared/merged ver… in SharedVtxCreate()
432 …gidx = network->cloneshared->subnet[net].vStart + idx; /* global index of the vertex net.idx befor… in SharedVtxCreate()
438 gidx = network->cloneshared->subnet[net].vStart + idx; in SharedVtxCreate()
442 idx_from--; in SharedVtxCreate()
443 idx_to--; in SharedVtxCreate()
466 PetscCall(PetscHMapICreateWithSize(nta, &network->cloneshared->svtable)); in SharedVtxCreate()
469 svtx: array of SVtx: sv[0]=(net[0],idx[0]) to vertices sv[k], k=1,...,n-1. */ in SharedVtxCreate()
478 svtx[nsv].gidx = network->cloneshared->NVertices; /* initialization */ in SharedVtxCreate()
485 gidx--; in SharedVtxCreate()
486 i--; in SharedVtxCreate()
490 gidx_tmp[k] = gidx; /* gidx in un-merged dmnetwork */ in SharedVtxCreate()
493 …/* current implementation requires sv[]=[net,idx] in ascending order of its gidx in un-merged dmne… in SharedVtxCreate()
503 PetscCall(PetscHMapISet(network->cloneshared->svtable, svtx[nsv].gidx + 1, nsv + 1)); in SharedVtxCreate()
512 network->cloneshared->Nsvtx = nta; in SharedVtxCreate()
513 network->cloneshared->svtx = svtx; in SharedVtxCreate()
518 …GetEdgelist_Coupling - Get an integrated edgelist for dmplex from user-provided subnet[].edgelist …
521 . dm - the dmnetwork object
524 + edges - the integrated edgelist for dmplex
525 - nmerged_ptr - num of vertices being merged
531 DM_Network *network = (DM_Network *)dm->data; in GetEdgelist_Coupling()
533 PetscInt *vidxlTog, Nsv, Nsubnet = network->cloneshared->Nsubnet; in GetEdgelist_Coupling()
534 PetscInt *sedgelist = network->cloneshared->sedgelist, vrange; in GetEdgelist_Coupling()
545 PetscCall(SharedVtxCreate(dm, network->cloneshared->Nsvtx, sedgelist)); in GetEdgelist_Coupling()
546 Nsv = network->cloneshared->Nsvtx; in GetEdgelist_Coupling()
547 svtx = network->cloneshared->svtx; in GetEdgelist_Coupling()
551 PetscCall(PetscMalloc1(network->cloneshared->nVertices, &vidxlTog)); in GetEdgelist_Coupling()
553 PetscCallMPI(MPI_Scan(&network->cloneshared->nVertices, &vrange, 1, MPIU_INT, MPI_SUM, comm)); in GetEdgelist_Coupling()
554 vrange -= network->cloneshared->nVertices; in GetEdgelist_Coupling()
556 …/* (2.2) Create vidxlTog: maps UN-MERGED local vertex index i to global index gidx (plex, excludin… in GetEdgelist_Coupling()
560 network->cloneshared->nsvtx = 0; /* local num of SVtx structs, including ghosts */ in GetEdgelist_Coupling()
562 …for (idx = 0; idx < network->cloneshared->subnet[net].Nvtx; idx++) { /* Note: global subnet[net].N… in GetEdgelist_Coupling()
565 if (network->cloneshared->subnet[net].nvtx) { /* this proc owns sv_to */ in GetEdgelist_Coupling()
567 if (network->cloneshared->subnet[net_from].nvtx == 0) { in GetEdgelist_Coupling()
569 network->cloneshared->nsvtx++; in GetEdgelist_Coupling()
572 nmerged++; /* a shared vertex -- merged */ in GetEdgelist_Coupling()
575 if (svtype == SVFROM && network->cloneshared->subnet[net].nvtx) { in GetEdgelist_Coupling()
577 network->cloneshared->nsvtx++; in GetEdgelist_Coupling()
579 if (network->cloneshared->subnet[net].nvtx) vidxlTog[i++] = gidx; in GetEdgelist_Coupling()
584 …network->cloneshared->nVertices, PETSC_COMM_SELF, PETSC_ERR_ARG_NULL, "%" PetscInt_FMT " != %" Pet… in GetEdgelist_Coupling()
588 network->cloneshared->NVertices -= np; in GetEdgelist_Coupling()
592 for (j = 0; j < network->cloneshared->subnet[net].nedge; j++) { in GetEdgelist_Coupling()
594 …i = network->cloneshared->subnet[net].edgelist[2 * j] + (network->cloneshared->subnet… in GetEdgelist_Coupling()
598 …i = network->cloneshared->subnet[net].edgelist[2 * j + 1] + (network->cloneshared… in GetEdgelist_Coupling()
612 DM_Network *network = (DM_Network *)dm->data; in DMNetworkInitializeNonTopological()
613 PetscInt p, pStart = network->cloneshared->pStart, pEnd = network->cloneshared->pEnd; in DMNetworkInitializeNonTopological()
619 PetscCall(PetscSectionCreate(comm, &network->DataSection)); in DMNetworkInitializeNonTopological()
620 PetscCall(PetscSectionCreate(comm, &network->DofSection)); in DMNetworkInitializeNonTopological()
621 PetscCall(PetscSectionSetChart(network->DataSection, pStart, pEnd)); in DMNetworkInitializeNonTopological()
622 PetscCall(PetscSectionSetChart(network->DofSection, pStart, pEnd)); in DMNetworkInitializeNonTopological()
626 for (p = 0; p < pEnd - pStart; p++) { in DMNetworkInitializeNonTopological()
627 network->header[p].ndata = 0; in DMNetworkInitializeNonTopological()
628 network->header[p].offset[0] = 0; in DMNetworkInitializeNonTopological()
629 network->header[p].offsetvarrel[0] = 0; in DMNetworkInitializeNonTopological()
630 PetscCall(PetscSectionAddDof(network->DataSection, p, network->header[p].hsize)); in DMNetworkInitializeNonTopological()
636 DMNetworkLayoutSetUp - Sets up the bare layout (graph) for the network
641 . dm - the `DMNETWORK` object
655 DM_Network *network = (DM_Network *)dm->data; in DMNetworkLayoutSetUp()
656 …PetscInt i, j, ctr, Nsubnet = network->cloneshared->Nsubnet, np, *edges, *subnetvtx, *subne… in DMNetworkLayoutSetUp()
665 …PetscCheck(network->cloneshared->nsubnet == Nsubnet, PETSC_COMM_SELF, PETSC_ERR_ARG_INCOMP, "Must … in DMNetworkLayoutSetUp()
669 if (network->cloneshared->subnet[net].nvtx) in DMNetworkLayoutSetUp()
670 …PetscCheck(network->cloneshared->subnet[net].nvtx == network->cloneshared->subnet[net].Nvtx, PETSC… in DMNetworkLayoutSetUp()
671 network->cloneshared->subnet[net].nvtx, network->cloneshared->subnet[net].Nvtx); in DMNetworkLayoutSetUp()
678 PetscCall(PetscCalloc1(2 * network->cloneshared->nEdges, &edges)); in DMNetworkLayoutSetUp()
680 if (network->cloneshared->Nsvtx) { /* subnetworks are coupled via shared vertices */ in DMNetworkLayoutSetUp()
683 /* Create a 0-size svtable for query shared vertices */ in DMNetworkLayoutSetUp()
684 PetscCall(PetscHMapICreate(&network->cloneshared->svtable)); in DMNetworkLayoutSetUp()
687 for (j = 0; j < network->cloneshared->subnet[i].nedge; j++) { in DMNetworkLayoutSetUp()
688 …edges[2 * ctr] = network->cloneshared->subnet[i].vStart + network->cloneshared->subnet[i].edge… in DMNetworkLayoutSetUp()
689 …edges[2 * ctr + 1] = network->cloneshared->subnet[i].vStart + network->cloneshared->subnet[i].edge… in DMNetworkLayoutSetUp()
695 /* Create network->plex; One dimensional network, numCorners=2 */ in DMNetworkLayoutSetUp()
696 PetscCall(DMCreate(comm, &network->plex)); in DMNetworkLayoutSetUp()
697 PetscCall(DMSetType(network->plex, DMPLEX)); in DMNetworkLayoutSetUp()
698 PetscCall(DMSetDimension(network->plex, 1)); in DMNetworkLayoutSetUp()
700 …if (size == 1) PetscCall(DMPlexBuildFromCellList(network->plex, network->cloneshared->nEdges, PETS… in DMNetworkLayoutSetUp()
701 …else PetscCall(DMPlexBuildFromCellListParallel(network->plex, network->cloneshared->nEdges, PETSC_… in DMNetworkLayoutSetUp()
703 …PetscCall(DMPlexGetChart(network->plex, &network->cloneshared->pStart, &network->cloneshared->pEnd… in DMNetworkLayoutSetUp()
704 …PetscCall(DMPlexGetHeightStratum(network->plex, 0, &network->cloneshared->eStart, &network->clones… in DMNetworkLayoutSetUp()
705 …PetscCall(DMPlexGetHeightStratum(network->plex, 1, &network->cloneshared->vStart, &network->clones… in DMNetworkLayoutSetUp()
706 np = network->cloneshared->pEnd - network->cloneshared->pStart; in DMNetworkLayoutSetUp()
707 PetscCall(PetscCalloc2(np, &network->header, np, &network->cvalue)); in DMNetworkLayoutSetUp()
714 …PetscCall(PetscCalloc2(network->cloneshared->nEdges, &subnetedge, network->cloneshared->nVertices … in DMNetworkLayoutSetUp()
715 network->cloneshared->subnetedge = subnetedge; in DMNetworkLayoutSetUp()
716 network->cloneshared->subnetvtx = subnetvtx; in DMNetworkLayoutSetUp()
718 network->cloneshared->subnet[j].edges = subnetedge; in DMNetworkLayoutSetUp()
719 … = PetscSafePointerPlusOffset(subnetedge, network->cloneshared->subnet[j].nedg… in DMNetworkLayoutSetUp()
721 network->cloneshared->subnet[j].vertices = subnetvtx; in DMNetworkLayoutSetUp()
722 … = PetscSafePointerPlusOffset(subnetvtx, network->cloneshared->subnet[j].nvtx… in DMNetworkLayoutSetUp()
724 network->cloneshared->svertices = subnetvtx; in DMNetworkLayoutSetUp()
727 np = network->cloneshared->eEnd - network->cloneshared->eStart; in DMNetworkLayoutSetUp()
729 globaledgeoff -= np; in DMNetworkLayoutSetUp()
735 for (j = 0; j < network->cloneshared->subnet[i].nedge; j++) { in DMNetworkLayoutSetUp()
737 network->header[e].index = e + globaledgeoff; /* Global edge index */ in DMNetworkLayoutSetUp()
738 network->header[e].subnetid = i; in DMNetworkLayoutSetUp()
739 network->cloneshared->subnet[i].edges[j] = e; in DMNetworkLayoutSetUp()
742 PetscCall(DMPlexGetCone(network->plex, e, &cone)); in DMNetworkLayoutSetUp()
746 network->header[v].index = edges[2 * e]; /* Global vertex index */ in DMNetworkLayoutSetUp()
747 network->header[v].subnetid = i; /* Subnetwork id */ in DMNetworkLayoutSetUp()
749 …network->cloneshared->subnet[i].vertices[v - network->cloneshared->vStart] = v; /* user's subnet[]… in DMNetworkLayoutSetUp()
751 …vfrom = network->cloneshared->subnet[i].edgelist[2 * ctr… in DMNetworkLayoutSetUp()
752 …network->cloneshared->subnet[i].vertices[vfrom] = v; … in DMNetworkLayoutSetUp()
757 network->header[v].index = edges[2 * e + 1]; /* Global vertex index */ in DMNetworkLayoutSetUp()
758 network->header[v].subnetid = i; /* Subnetwork id */ in DMNetworkLayoutSetUp()
760 …network->cloneshared->subnet[i].vertices[v - network->cloneshared->vStart] = v; /* user's subnet[]… in DMNetworkLayoutSetUp()
762 …vto = network->cloneshared->subnet[i].edgelist[2 * ctr +… in DMNetworkLayoutSetUp()
763 …network->cloneshared->subnet[i].vertices[vto] = v; … in DMNetworkLayoutSetUp()
774 for (v = network->cloneshared->vStart; v < network->cloneshared->vEnd; v++) { in DMNetworkLayoutSetUp()
776 …PetscCall(PetscHMapIGetWithDefault(network->cloneshared->svtable, network->header[v].index + 1, 0,… in DMNetworkLayoutSetUp()
777 if (i) network->cloneshared->svertices[j++] = v; in DMNetworkLayoutSetUp()
780 …/* Create a global section to be used by DMNetworkIsGhostVertex() which is a non-collective routin… in DMNetworkLayoutSetUp()
781 /* see snes_tutorials_network-ex1_4 */ in DMNetworkLayoutSetUp()
782 PetscCall(DMGetGlobalSection(network->plex, §iong)); in DMNetworkLayoutSetUp()
783 /* Initialize non-topological data structures */ in DMNetworkLayoutSetUp()
790 DMNetworkGetSubnetwork - Returns the information about a requested subnetwork
795 + dm - the `DMNETWORK` object
796 - netnum - the global index of the subnetwork
799 + nv - number of vertices (local)
800 . ne - number of edges (local)
801 . vtx - local vertices of the subnetwork
802 - edge - local edges of the subnetwork
817 DM_Network *network = (DM_Network *)dm->data; in DMNetworkGetSubnetwork()
820 …->cloneshared->Nsubnet, PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Subnet index %" PetscInt_FMT "… in DMNetworkGetSubnetwork()
821 if (nv) *nv = network->cloneshared->subnet[netnum].nvtx; in DMNetworkGetSubnetwork()
822 if (ne) *ne = network->cloneshared->subnet[netnum].nedge; in DMNetworkGetSubnetwork()
823 if (vtx) *vtx = network->cloneshared->subnet[netnum].vertices; in DMNetworkGetSubnetwork()
824 if (edge) *edge = network->cloneshared->subnet[netnum].edges; in DMNetworkGetSubnetwork()
829 DMNetworkAddSharedVertices - Add shared vertices that connect two given subnetworks
834 + dm - the `DMNETWORK` object
835 . anetnum - first subnetwork global numbering returned by `DMNetworkAddSubnetwork()`
836 . bnetnum - second subnetwork global numbering returned by `DMNetworkAddSubnetwork()`
837 . nsvtx - number of vertices that are shared by the two subnetworks
838 . asvtx - vertex index in the first subnetwork
839 - bsvtx - vertex index in the second subnetwork
847 DM_Network *network = (DM_Network *)dm->data; in DMNetworkAddSharedVertices()
848 …PetscInt i, nsubnet = network->cloneshared->Nsubnet, *sedgelist, Nsvtx = network->cloneshared->… in DMNetworkAddSharedVertices()
854 /* allocate network->sedgelist to hold at most 2*nsubnet pairs of shared vertices */ in DMNetworkAddSharedVertices()
855 PetscCall(PetscMalloc1(2 * 4 * nsubnet, &network->cloneshared->sedgelist)); in DMNetworkAddSharedVertices()
858 sedgelist = network->cloneshared->sedgelist; in DMNetworkAddSharedVertices()
867 network->cloneshared->Nsvtx = Nsvtx; in DMNetworkAddSharedVertices()
872 DMNetworkGetSharedVertices - Returns the info for the shared vertices
877 . dm - the `DMNETWORK` object
880 + nsv - number of local shared vertices, pass `NULL` if not needed
881 - svtx - local shared vertices, pass `NULL` if not needed
892 DM_Network *net = (DM_Network *)dm->data; in DMNetworkGetSharedVertices()
896 if (nsv) *nsv = net->cloneshared->nsvtx; in DMNetworkGetSharedVertices()
897 if (svtx) *svtx = net->cloneshared->svertices; in DMNetworkGetSharedVertices()
902 DMNetworkRegisterComponent - Registers the network component
907 + dm - the `DMNETWORK` object
908 . name - the component name
909 - size - the storage size in bytes for this component data
912 . key - an integer key that defines the component
923 DM_Network *network = (DM_Network *)dm->data; in DMNetworkRegisterComponent()
929 …if (!network->component) PetscCall(PetscCalloc1(network->max_comps_registered, &network->component… in DMNetworkRegisterComponent()
931 for (i = 0; i < network->ncomponent; i++) { in DMNetworkRegisterComponent()
932 PetscCall(PetscStrcmp(network->component[i].name, name, &flg)); in DMNetworkRegisterComponent()
939 if (network->ncomponent == network->max_comps_registered) { in DMNetworkRegisterComponent()
941 network->max_comps_registered += 2; in DMNetworkRegisterComponent()
942 PetscCall(PetscCalloc1(network->max_comps_registered, &newcomponent)); in DMNetworkRegisterComponent()
944 for (i = 0; i < network->ncomponent; i++) { in DMNetworkRegisterComponent()
945 …PetscCall(PetscStrncpy(newcomponent[i].name, network->component[i].name, sizeof(newcomponent[i].na… in DMNetworkRegisterComponent()
946 newcomponent[i].size = network->component[i].size; in DMNetworkRegisterComponent()
949 PetscCall(PetscFree(network->component)); in DMNetworkRegisterComponent()
951 network->component = newcomponent; in DMNetworkRegisterComponent()
954 component = &network->component[network->ncomponent]; in DMNetworkRegisterComponent()
956 PetscCall(PetscStrncpy(component->name, name, sizeof(component->name))); in DMNetworkRegisterComponent()
958 PetscCall(PetscIntCast(size / sizeof(DMNetworkComponentGenericDataType), &component->size)); in DMNetworkRegisterComponent()
959 *key = network->ncomponent; in DMNetworkRegisterComponent()
960 network->ncomponent++; in DMNetworkRegisterComponent()
965 DMNetworkGetNumVertices - Get the local and global number of vertices for the entire network.
970 . dm - the `DMNETWORK` object
973 + nVertices - the local number of vertices, pass `NULL` if not needed
974 - NVertices - the global number of vertices, pass `NULL` if not needed
982 DM_Network *network = (DM_Network *)dm->data; in DMNetworkGetNumVertices()
988 *nVertices = network->cloneshared->nVertices; in DMNetworkGetNumVertices()
992 *NVertices = network->cloneshared->NVertices; in DMNetworkGetNumVertices()
998 DMNetworkGetNumEdges - Get the local and global number of edges for the entire network.
1003 . dm - the `DMNETWORK` object
1006 + nEdges - the local number of edges, pass `NULL` if not needed
1007 - NEdges - the global number of edges, pass `NULL` if not needed
1015 DM_Network *network = (DM_Network *)dm->data; in DMNetworkGetNumEdges()
1021 *nEdges = network->cloneshared->nEdges; in DMNetworkGetNumEdges()
1025 *NEdges = network->cloneshared->NEdges; in DMNetworkGetNumEdges()
1031 …DMNetworkGetVertexRange - Get the bounds [start, end) (also sometimes called the chart) for the lo…
1036 . dm - the `DMNETWORK` object
1039 + vStart - the first vertex point, pass `NULL` if not needed
1040 - vEnd - one beyond the last vertex point, pass `NULL` if not needed
1048 DM_Network *network = (DM_Network *)dm->data; in DMNetworkGetVertexRange()
1051 if (vStart) *vStart = network->cloneshared->vStart; in DMNetworkGetVertexRange()
1052 if (vEnd) *vEnd = network->cloneshared->vEnd; in DMNetworkGetVertexRange()
1057 …DMNetworkGetEdgeRange - Get the bounds [start, end) (also sometimes called the chart) for the loca…
1062 . dm - the `DMNETWORK` object
1065 + eStart - The first edge point, pass `NULL` if not needed
1066 - eEnd - One beyond the last edge point, pass `NULL` if not needed
1074 DM_Network *network = (DM_Network *)dm->data; in DMNetworkGetEdgeRange()
1078 if (eStart) *eStart = network->cloneshared->eStart; in DMNetworkGetEdgeRange()
1079 if (eEnd) *eEnd = network->cloneshared->eEnd; in DMNetworkGetEdgeRange()
1085 DM_Network *network = (DM_Network *)dm->data; in DMNetworkGetIndex()
1088 if (network->header) { in DMNetworkGetIndex()
1089 *index = network->header[p].index; in DMNetworkGetIndex()
1094 PetscCall(PetscSectionGetOffset(network->DataSection, p, &offsetp)); in DMNetworkGetIndex()
1095 header = (DMNetworkComponentHeader)(network->componentdataarray + offsetp); in DMNetworkGetIndex()
1096 *index = header->index; in DMNetworkGetIndex()
1103 DM_Network *network = (DM_Network *)dm->data; in DMNetworkGetSubnetID()
1106 if (network->header) { in DMNetworkGetSubnetID()
1107 *subnetid = network->header[p].subnetid; in DMNetworkGetSubnetID()
1112 PetscCall(PetscSectionGetOffset(network->DataSection, p, &offsetp)); in DMNetworkGetSubnetID()
1113 header = (DMNetworkComponentHeader)(network->componentdataarray + offsetp); in DMNetworkGetSubnetID()
1114 *subnetid = header->subnetid; in DMNetworkGetSubnetID()
1120 DMNetworkGetGlobalEdgeIndex - Get the global numbering for the edge on the network
1125 + dm - `DMNETWORK` object
1126 - p - edge point
1129 . index - the global numbering for the edge
1143 DMNetworkGetGlobalVertexIndex - Get the global numbering for the vertex on the network
1148 + dm - `DMNETWORK` object
1149 - p - vertex point
1152 . index - the global numbering for the vertex
1166 DMNetworkGetNumComponents - Get the number of components at a vertex/edge
1171 + dm - the `DMNETWORK` object
1172 - p - vertex/edge point
1175 . numcomponents - Number of components at the vertex/edge
1184 DM_Network *network = (DM_Network *)dm->data; in DMNetworkGetNumComponents()
1187 PetscCall(PetscSectionGetOffset(network->DataSection, p, &offset)); in DMNetworkGetNumComponents()
1188 *numcomponents = ((DMNetworkComponentHeader)(network->componentdataarray + offset))->ndata; in DMNetworkGetNumComponents()
1193 …DMNetworkGetLocalVecOffset - Get the offset for accessing the variables associated with a componen…
1198 + dm - the `DMNETWORK` object
1199 . p - the edge or vertex point
1200 - compnum - component number; use ALL_COMPONENTS if no specific component is requested
1203 . offset - the local offset
1221 DM_Network *network = (DM_Network *)dm->data; in DMNetworkGetLocalVecOffset()
1226 PetscCall(PetscSectionGetOffset(network->plex->localSection, p, &offsetp)); in DMNetworkGetLocalVecOffset()
1232 PetscCall(PetscSectionGetOffset(network->DataSection, p, &offsetd)); in DMNetworkGetLocalVecOffset()
1233 header = (DMNetworkComponentHeader)(network->componentdataarray + offsetd); in DMNetworkGetLocalVecOffset()
1234 *offset = offsetp + header->offsetvarrel[compnum]; in DMNetworkGetLocalVecOffset()
1239 …DMNetworkGetGlobalVecOffset - Get the global offset for accessing the variables associated with a …
1244 + dm - the `DMNETWORK` object
1245 . p - the edge or vertex point
1246 - compnum - component number; use ALL_COMPONENTS if no specific component is requested
1249 . offsetg - the global offset
1259 …the vector values with array[offset - rstart] where restart is obtained with `VecGetOwnershipRange…
1265 DM_Network *network = (DM_Network *)dm->data; in DMNetworkGetGlobalVecOffset()
1270 PetscCall(PetscSectionGetOffset(network->plex->globalSection, p, &offsetp)); in DMNetworkGetGlobalVecOffset()
1271 if (offsetp < 0) offsetp = -(offsetp + 1); /* Convert to actual global offset for ghost vertex */ in DMNetworkGetGlobalVecOffset()
1277 PetscCall(PetscSectionGetOffset(network->DataSection, p, &offsetd)); in DMNetworkGetGlobalVecOffset()
1278 header = (DMNetworkComponentHeader)(network->componentdataarray + offsetd); in DMNetworkGetGlobalVecOffset()
1279 *offsetg = offsetp + header->offsetvarrel[compnum]; in DMNetworkGetGlobalVecOffset()
1284 …DMNetworkGetEdgeOffset - Get the offset for accessing the variables associated with the given edge…
1289 + dm - the `DMNETWORK` object
1290 - p - the edge point
1293 . offset - the offset
1301 DM_Network *network = (DM_Network *)dm->data; in DMNetworkGetEdgeOffset()
1304 PetscCall(PetscSectionGetOffset(network->edge.DofSection, p, offset)); in DMNetworkGetEdgeOffset()
1309 …DMNetworkGetVertexOffset - Get the offset for accessing the variables associated with the given ve…
1314 + dm - the `DMNETWORK` object
1315 - p - the vertex point
1318 . offset - the offset
1326 DM_Network *network = (DM_Network *)dm->data; in DMNetworkGetVertexOffset()
1329 p -= network->cloneshared->vStart; in DMNetworkGetVertexOffset()
1330 PetscCall(PetscSectionGetOffset(network->vertex.DofSection, p, offset)); in DMNetworkGetVertexOffset()
1335 …DMNetworkAddComponent - Adds a network component and number of variables at the given point (verte…
1340 + dm - the DMNetwork
1341 . p - the vertex/edge point. These points are local indices provided by `DMNetworkGetSub…
1342 . componentkey - component key returned while registering the component with `DMNetworkRegisterComp…
1343 . compvalue - pointer to the data structure for the component, or `NULL` if the component does n…
1345 - nvar - number of variables for the component at the vertex/edge point, zero if the compon…
1361 DM_Network *network = (DM_Network *)dm->data; in DMNetworkAddComponent()
1362 DMNetworkComponent *component = &network->component[componentkey]; in DMNetworkAddComponent()
1371 …PetscCheck(network->componentsetup == PETSC_FALSE, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG… in DMNetworkAddComponent()
1373 PetscCall(PetscSectionAddDof(network->DofSection, p, nvar)); in DMNetworkAddComponent()
1376 header = &network->header[p]; in DMNetworkAddComponent()
1377 cvalue = &network->cvalue[p]; in DMNetworkAddComponent()
1378 if (header->ndata == header->maxcomps) { in DMNetworkAddComponent()
1382 header->maxcomps += 2; in DMNetworkAddComponent()
1385 …tscCalloc5(header->maxcomps, &compsize, header->maxcomps, &compkey, header->maxcomps, &compoffset,… in DMNetworkAddComponent()
1386 PetscCall(PetscMalloc1(header->maxcomps, &compdata)); in DMNetworkAddComponent()
1389 …header->hsize = sizeof(struct _p_DMNetworkComponentHeader) + 5 * header->maxcomps * sizeof(PetscIn… in DMNetworkAddComponent()
1390 header->hsize /= sizeof(DMNetworkComponentGenericDataType); in DMNetworkAddComponent()
1393 header->hsize = (header->hsize + (8 - 1)) & ~(8 - 1); in DMNetworkAddComponent()
1397 PetscCall(PetscMemcpy(compsize, header->size, header->ndata * sizeof(PetscInt))); in DMNetworkAddComponent()
1398 PetscCall(PetscMemcpy(compkey, header->key, header->ndata * sizeof(PetscInt))); in DMNetworkAddComponent()
1399 PetscCall(PetscMemcpy(compoffset, header->offset, header->ndata * sizeof(PetscInt))); in DMNetworkAddComponent()
1400 PetscCall(PetscMemcpy(compnvar, header->nvar, header->ndata * sizeof(PetscInt))); in DMNetworkAddComponent()
1401 … PetscCall(PetscMemcpy(compoffsetvarrel, header->offsetvarrel, header->ndata * sizeof(PetscInt))); in DMNetworkAddComponent()
1404 PetscCall(PetscMemcpy(compdata, cvalue->data, header->ndata * sizeof(void *))); in DMNetworkAddComponent()
1407 …PetscCall(PetscFree5(header->size, header->key, header->offset, header->nvar, header->offsetvarrel… in DMNetworkAddComponent()
1408 PetscCall(PetscFree(cvalue->data)); in DMNetworkAddComponent()
1411 header->size = compsize; in DMNetworkAddComponent()
1412 header->key = compkey; in DMNetworkAddComponent()
1413 header->offset = compoffset; in DMNetworkAddComponent()
1414 header->nvar = compnvar; in DMNetworkAddComponent()
1415 header->offsetvarrel = compoffsetvarrel; in DMNetworkAddComponent()
1417 cvalue->data = compdata; in DMNetworkAddComponent()
1420 …/* The dofs for datasection point p equals sizeof the header (i.e. header->hsize) + sizes of the c… in DMNetworkAddComponent()
1421 …additional_size = (5 * (header->maxcomps - header->ndata) * sizeof(PetscInt)) / sizeof(DMNetworkCo… in DMNetworkAddComponent()
1422 PetscCall(PetscSectionAddDof(network->DataSection, p, additional_size)); in DMNetworkAddComponent()
1424 header = &network->header[p]; in DMNetworkAddComponent()
1425 cvalue = &network->cvalue[p]; in DMNetworkAddComponent()
1427 compnum = header->ndata; in DMNetworkAddComponent()
1429 header->size[compnum] = component->size; in DMNetworkAddComponent()
1430 PetscCall(PetscSectionAddDof(network->DataSection, p, component->size)); in DMNetworkAddComponent()
1431 header->key[compnum] = componentkey; in DMNetworkAddComponent()
1432 …if (compnum != 0) header->offset[compnum] = header->offset[compnum - 1] + header->size[compnum - 1… in DMNetworkAddComponent()
1433 cvalue->data[compnum] = compvalue; in DMNetworkAddComponent()
1436 header->nvar[compnum] += nvar; in DMNetworkAddComponent()
1437 …if (compnum != 0) header->offsetvarrel[compnum] = header->offsetvarrel[compnum - 1] + header->nvar… in DMNetworkAddComponent()
1439 header->ndata++; in DMNetworkAddComponent()
1444 …DMNetworkGetComponent - Gets the component key, the component data, and the number of variables at…
1449 + dm - the `DMNETWORK` object
1450 . p - vertex/edge point
1451 - compnum - component number; use ALL_COMPONENTS if sum up all the components
1454 + compkey - the key obtained when registering the component (use `NULL` if not required)
1455 . component - the component data (use `NULL` if not required)
1456 - nvar - number of variables (use `NULL` if not required)
1464 DM_Network *network = (DM_Network *)dm->data; in DMNetworkGetComponent()
1470 PetscCall(PetscSectionGetDof(network->DofSection, p, nvar)); in DMNetworkGetComponent()
1474 PetscCall(PetscSectionGetOffset(network->DataSection, p, &offset)); in DMNetworkGetComponent()
1475 header = (DMNetworkComponentHeader)(network->componentdataarray + offset); in DMNetworkGetComponent()
1478 if (compkey) *compkey = header->key[compnum]; in DMNetworkGetComponent()
1480 offset += header->hsize + header->offset[compnum]; in DMNetworkGetComponent()
1481 *(void **)component = network->componentdataarray + offset; in DMNetworkGetComponent()
1485 if (nvar) *nvar = header->nvar[compnum]; in DMNetworkGetComponent()
1495 DM_Network *network = (DM_Network *)dm->data; in DMNetworkComponentSetUp()
1503 PetscCall(PetscSectionSetUp(network->DataSection)); in DMNetworkComponentSetUp()
1504 PetscCall(PetscSectionGetStorageSize(network->DataSection, &arr_size)); in DMNetworkComponentSetUp()
1505 …/* arr_size+1 fixes pipeline test of opensolaris-misc for src/dm/tests/ex10.c -- Do not know why */ in DMNetworkComponentSetUp()
1506 PetscCall(PetscCalloc1(arr_size + 1, &network->componentdataarray)); in DMNetworkComponentSetUp()
1507 componentdataarray = network->componentdataarray; in DMNetworkComponentSetUp()
1508 for (p = network->cloneshared->pStart; p < network->cloneshared->pEnd; p++) { in DMNetworkComponentSetUp()
1509 PetscCall(PetscSectionGetOffset(network->DataSection, p, &offsetp)); in DMNetworkComponentSetUp()
1511 header = &network->header[p]; in DMNetworkComponentSetUp()
1515 PetscCall(PetscMemcpy(headerarr, header->size, header->maxcomps * sizeof(PetscInt))); in DMNetworkComponentSetUp()
1516 headerinfo->size = headerarr; in DMNetworkComponentSetUp()
1517 headerarr += header->maxcomps; in DMNetworkComponentSetUp()
1518 PetscCall(PetscMemcpy(headerarr, header->key, header->maxcomps * sizeof(PetscInt))); in DMNetworkComponentSetUp()
1519 headerinfo->key = headerarr; in DMNetworkComponentSetUp()
1520 headerarr += header->maxcomps; in DMNetworkComponentSetUp()
1521 PetscCall(PetscMemcpy(headerarr, header->offset, header->maxcomps * sizeof(PetscInt))); in DMNetworkComponentSetUp()
1522 headerinfo->offset = headerarr; in DMNetworkComponentSetUp()
1523 headerarr += header->maxcomps; in DMNetworkComponentSetUp()
1524 PetscCall(PetscMemcpy(headerarr, header->nvar, header->maxcomps * sizeof(PetscInt))); in DMNetworkComponentSetUp()
1525 headerinfo->nvar = headerarr; in DMNetworkComponentSetUp()
1526 headerarr += header->maxcomps; in DMNetworkComponentSetUp()
1527 PetscCall(PetscMemcpy(headerarr, header->offsetvarrel, header->maxcomps * sizeof(PetscInt))); in DMNetworkComponentSetUp()
1528 headerinfo->offsetvarrel = headerarr; in DMNetworkComponentSetUp()
1531 cvalue = &network->cvalue[p]; in DMNetworkComponentSetUp()
1532 ncomp = header->ndata; in DMNetworkComponentSetUp()
1535 offset = offsetp + header->hsize + header->offset[i]; in DMNetworkComponentSetUp()
1536 …PetscCall(PetscMemcpy(componentdataarray + offset, cvalue->data[i], header->size[i] * sizeof(DMNet… in DMNetworkComponentSetUp()
1540 for (i = network->cloneshared->pStart; i < network->cloneshared->pEnd; i++) { in DMNetworkComponentSetUp()
1541 …scCall(PetscFree5(network->header[i].size, network->header[i].key, network->header[i].offset, netw… in DMNetworkComponentSetUp()
1542 PetscCall(PetscFree(network->cvalue[i].data)); in DMNetworkComponentSetUp()
1544 PetscCall(PetscFree2(network->header, network->cvalue)); in DMNetworkComponentSetUp()
1551 DM_Network *network = (DM_Network *)dm->data; in DMNetworkVariablesSetUp()
1554 PetscCall(PetscSectionSetUp(network->DofSection)); in DMNetworkVariablesSetUp()
1565 PetscCall(PetscSectionSetChart(*subsection, 0, pend - pstart)); in DMNetworkGetSubSection_private()
1568 PetscCall(PetscSectionSetDof(*subsection, i - pstart, nvar)); in DMNetworkGetSubSection_private()
1582 PetscCall(PetscMalloc1(pend - pstart, &subpoints)); in DMNetworkSetSubMap_private()
1583 for (i = pstart; i < pend; i++) subpoints[i - pstart] = i; in DMNetworkSetSubMap_private()
1584 …PetscCall(ISLocalToGlobalMappingCreate(PetscObjectComm((PetscObject)dm), 1, pend - pstart, subpoin… in DMNetworkSetSubMap_private()
1590 …DMNetworkAssembleGraphStructures - Assembles vertex and edge data structures. Must be called after…
1595 . dm - the `DMNETWORK` Object
1605 …es = [4,5,6]. The new orderings will be specific to the subset (i.e vertices = [0,1,2] <- [4,5,6]).
1615 DM_Network *network = (DM_Network *)dm->data; in DMNetworkAssembleGraphStructures()
1622 …tscCall(DMNetworkSetSubMap_private(dm, network->cloneshared->vStart, network->cloneshared->vEnd, &… in DMNetworkAssembleGraphStructures()
1623 …tscCall(DMNetworkSetSubMap_private(dm, network->cloneshared->eStart, network->cloneshared->eEnd, &… in DMNetworkAssembleGraphStructures()
1625 /* Create local sub-sections */ in DMNetworkAssembleGraphStructures()
1626 …NetworkGetSubSection_private(network->DofSection, network->cloneshared->vStart, network->cloneshar… in DMNetworkAssembleGraphStructures()
1627 …NetworkGetSubSection_private(network->DofSection, network->cloneshared->eStart, network->cloneshar… in DMNetworkAssembleGraphStructures()
1630 PetscCall(PetscSFGetSubSF(network->plex->sf, network->vertex.mapping, &network->vertex.sf)); in DMNetworkAssembleGraphStructures()
1632 …ctionCreateGlobalSection(network->vertex.DofSection, network->vertex.sf, PETSC_TRUE, PETSC_FALSE, … in DMNetworkAssembleGraphStructures()
1633 PetscCall(PetscSFGetSubSF(network->plex->sf, network->edge.mapping, &network->edge.sf)); in DMNetworkAssembleGraphStructures()
1634 …SectionCreateGlobalSection(network->edge.DofSection, network->edge.sf, PETSC_TRUE, PETSC_FALSE, PE… in DMNetworkAssembleGraphStructures()
1637 PetscCall(PetscSectionClone(network->vertex.DofSection, &network->vertex.GlobalDofSection)); in DMNetworkAssembleGraphStructures()
1639 PetscCall(PetscSectionClone(network->edge.DofSection, &network->edge.GlobalDofSection)); in DMNetworkAssembleGraphStructures()
1643 …PetscCall(PetscObjectSetName((PetscObject)network->edge.GlobalDofSection, "Global edge dof section… in DMNetworkAssembleGraphStructures()
1644 …PetscCall(PetscObjectSetName((PetscObject)network->vertex.GlobalDofSection, "Global vertex dof sec… in DMNetworkAssembleGraphStructures()
1645 …PetscCall(PetscSectionViewFromOptions(network->edge.GlobalDofSection, NULL, "-edge_global_section_… in DMNetworkAssembleGraphStructures()
1646 …PetscCall(PetscSectionViewFromOptions(network->vertex.GlobalDofSection, NULL, "-vertex_global_sect… in DMNetworkAssembleGraphStructures()
1652 - add all owing subnetworks that connect to this v to the btable
1659 DM_Network *newDMnetwork = (DM_Network *)dm->data; in SetSubnetIdLookupBT()
1666 PetscCall(PetscSectionGetOffset(newDMnetwork->DataSection, edges[e], &offset)); in SetSubnetIdLookupBT()
1667 header = (DMNetworkComponentHeader)(newDMnetwork->componentdataarray + offset); in SetSubnetIdLookupBT()
1668 PetscCall(PetscBTSet(btable, header->subnetid)); in SetSubnetIdLookupBT()
1674 …DMNetworkDistributeCoordinates - Internal function to distribute the coordinate network and coordi…
1679 + dm - The original `DMNETWORK` object
1680 - migrationSF - The `PetscSF` describing the migration from dm to dmnew
1681 - newDM - The new distributed dmnetwork object.
1686 …DM_Network *newDMnetwork = (DM_Network *)((newDM)->data), *newCoordnetwork, *oldCoord… in DMNetworkDistributeCoordinates()
1703 newCoordnetwork = (DM_Network *)newcdm->data; in DMNetworkDistributeCoordinates()
1704 oldCoordnetwork = (DM_Network *)cdm->data; in DMNetworkDistributeCoordinates()
1712 …all(DMPlexDistributeField(newDMnetwork->plex, migrationSF, oldCoordnetwork->DofSection, oldCoord, … in DMNetworkDistributeCoordinates()
1717 …->plex, migrationSF, oldCoordnetwork->DataSection, MPIU_INT, (void *)oldCoordnetwork->componentdat… in DMNetworkDistributeCoordinates()
1719 PetscCall(PetscSectionGetChart(newCoordnetwork->DataSection, &pStart, &pEnd)); in DMNetworkDistributeCoordinates()
1721 PetscCall(PetscSectionGetOffset(newCoordnetwork->DataSection, p, &offset)); in DMNetworkDistributeCoordinates()
1722 header = (DMNetworkComponentHeader)(newCoordnetwork->componentdataarray + offset); in DMNetworkDistributeCoordinates()
1724 header->size = (PetscInt *)(header + 1); in DMNetworkDistributeCoordinates()
1725 header->key = header->size + header->maxcomps; in DMNetworkDistributeCoordinates()
1726 header->offset = header->key + header->maxcomps; in DMNetworkDistributeCoordinates()
1727 header->nvar = header->offset + header->maxcomps; in DMNetworkDistributeCoordinates()
1728 header->offsetvarrel = header->nvar + header->maxcomps; in DMNetworkDistributeCoordinates()
1731 PetscCall(DMSetLocalSection(newCoordnetwork->plex, newCoordnetwork->DofSection)); in DMNetworkDistributeCoordinates()
1732 PetscCall(DMGetGlobalSection(newCoordnetwork->plex, &newCoordnetwork->GlobalDofSection)); in DMNetworkDistributeCoordinates()
1733 newCoordnetwork->componentsetup = PETSC_TRUE; in DMNetworkDistributeCoordinates()
1739 DMNetworkDistribute - Distributes the network and moves associated component data
1744 + dm - the `DMNETWORK` object
1745 - overlap - the overlap of partitions, 0 is the default
1748 + -dmnetwork_view - Calls `DMView()` at the conclusion of `DMSetUp()`
1749 . -dmnetwork_view_distributed - Calls `DMView()` at the conclusion of `DMNetworkDistribute()`
1750 . -dmnetwork_view_tmpdir - Sets the temporary directory to use when viewing with the `draw` o…
1751 . -dmnetwork_view_all_ranks - Displays all of the subnetworks for each MPI rank
1752 . -dmnetwork_view_rank_range - Displays the subnetworks for the ranks in a comma-separated list
1753 . -dmnetwork_view_no_vertices - Disables displaying the vertices in the network visualization
1754 - -dmnetwork_view_no_numbering - Disables displaying the numbering of edges and vertices in the net…
1759 Distributes the network with <overlap>-overlapping partitioning of the edges.
1767 DM_Network *oldDMnetwork = (DM_Network *)((*dm)->data), *newDMnetwork; in DMNetworkDistribute()
1782 oldDMnetwork->cloneshared->distributecalled = PETSC_TRUE; in DMNetworkDistribute()
1791 newDMnetwork = (DM_Network *)newDM->data; in DMNetworkDistribute()
1792 newDMnetwork->max_comps_registered = oldDMnetwork->max_comps_registered; in DMNetworkDistribute()
1793 PetscCall(PetscMalloc1(newDMnetwork->max_comps_registered, &newDMnetwork->component)); in DMNetworkDistribute()
1796 PetscCall(DMPlexGetPartitioner(oldDMnetwork->plex, &part)); in DMNetworkDistribute()
1800 PetscCall(DMPlexDistribute(oldDMnetwork->plex, overlap, &pointsf, &newDMnetwork->plex)); in DMNetworkDistribute()
1803 PetscCall(PetscSectionCreate(comm, &newDMnetwork->DofSection)); in DMNetworkDistribute()
1804 …PetscCall(PetscSFDistributeSection(pointsf, oldDMnetwork->DofSection, NULL, newDMnetwork->DofSecti… in DMNetworkDistribute()
1807 PetscCall(PetscSectionCreate(comm, &newDMnetwork->DataSection)); in DMNetworkDistribute()
1808 …ork->plex, pointsf, oldDMnetwork->DataSection, MPIU_INT, (void *)oldDMnetwork->componentdataarray,… in DMNetworkDistribute()
1810 …all(PetscSectionGetChart(newDMnetwork->DataSection, &newDMnetwork->cloneshared->pStart, &newDMnetw… in DMNetworkDistribute()
1811 …all(DMPlexGetHeightStratum(newDMnetwork->plex, 0, &newDMnetwork->cloneshared->eStart, &newDMnetwor… in DMNetworkDistribute()
1812 …all(DMPlexGetHeightStratum(newDMnetwork->plex, 1, &newDMnetwork->cloneshared->vStart, &newDMnetwor… in DMNetworkDistribute()
1813 …newDMnetwork->cloneshared->nEdges = newDMnetwork->cloneshared->eEnd - newDMnetwork->cloneshared… in DMNetworkDistribute()
1814 …newDMnetwork->cloneshared->nVertices = newDMnetwork->cloneshared->vEnd - newDMnetwork->cloneshared… in DMNetworkDistribute()
1815 newDMnetwork->cloneshared->NVertices = oldDMnetwork->cloneshared->NVertices; in DMNetworkDistribute()
1816 newDMnetwork->cloneshared->NEdges = oldDMnetwork->cloneshared->NEdges; in DMNetworkDistribute()
1817 newDMnetwork->cloneshared->svtable = oldDMnetwork->cloneshared->svtable; /* global table! */ in DMNetworkDistribute()
1818 oldDMnetwork->cloneshared->svtable = NULL; in DMNetworkDistribute()
1821 PetscCall(DMSetLocalSection(newDMnetwork->plex, newDMnetwork->DofSection)); in DMNetworkDistribute()
1822 PetscCall(DMGetGlobalSection(newDMnetwork->plex, &newDMnetwork->GlobalDofSection)); in DMNetworkDistribute()
1825 newDMnetwork->cloneshared->Nsubnet = oldDMnetwork->cloneshared->Nsubnet; in DMNetworkDistribute()
1826 newDMnetwork->cloneshared->Nsvtx = oldDMnetwork->cloneshared->Nsvtx; in DMNetworkDistribute()
1827 oldDMnetwork->cloneshared->Nsvtx = 0; in DMNetworkDistribute()
1828 newDMnetwork->cloneshared->svtx = oldDMnetwork->cloneshared->svtx; /* global vertices! */ in DMNetworkDistribute()
1829 oldDMnetwork->cloneshared->svtx = NULL; in DMNetworkDistribute()
1830 PetscCall(PetscCalloc1(newDMnetwork->cloneshared->Nsubnet, &newDMnetwork->cloneshared->subnet)); in DMNetworkDistribute()
1835 Nsubnet = newDMnetwork->cloneshared->Nsubnet; in DMNetworkDistribute()
1837 newDMnetwork->cloneshared->subnet[j].Nvtx = oldDMnetwork->cloneshared->subnet[j].Nvtx; in DMNetworkDistribute()
1838 newDMnetwork->cloneshared->subnet[j].Nedge = oldDMnetwork->cloneshared->subnet[j].Nedge; in DMNetworkDistribute()
1842 for (e = newDMnetwork->cloneshared->eStart; e < newDMnetwork->cloneshared->eEnd; e++) { in DMNetworkDistribute()
1843 PetscCall(PetscSectionGetOffset(newDMnetwork->DataSection, e, &offset)); in DMNetworkDistribute()
1844 header = (DMNetworkComponentHeader)(newDMnetwork->componentdataarray + offset); in DMNetworkDistribute()
1847 header->size = (PetscInt *)(header + 1); in DMNetworkDistribute()
1848 header->key = header->size + header->maxcomps; in DMNetworkDistribute()
1849 header->offset = header->key + header->maxcomps; in DMNetworkDistribute()
1850 header->nvar = header->offset + header->maxcomps; in DMNetworkDistribute()
1851 header->offsetvarrel = header->nvar + header->maxcomps; in DMNetworkDistribute()
1853 newDMnetwork->cloneshared->subnet[header->subnetid].nedge++; in DMNetworkDistribute()
1857 if (newDMnetwork->cloneshared->Nsvtx) PetscCall(PetscBTCreate(Nsubnet, &btable)); in DMNetworkDistribute()
1860 for (v = newDMnetwork->cloneshared->vStart; v < newDMnetwork->cloneshared->vEnd; v++) { in DMNetworkDistribute()
1861 PetscCall(PetscSectionGetOffset(newDMnetwork->DataSection, v, &offset)); in DMNetworkDistribute()
1862 header = (DMNetworkComponentHeader)(newDMnetwork->componentdataarray + offset); in DMNetworkDistribute()
1865 header->size = (PetscInt *)(header + 1); in DMNetworkDistribute()
1866 header->key = header->size + header->maxcomps; in DMNetworkDistribute()
1867 header->offset = header->key + header->maxcomps; in DMNetworkDistribute()
1868 header->nvar = header->offset + header->maxcomps; in DMNetworkDistribute()
1869 header->offsetvarrel = header->nvar + header->maxcomps; in DMNetworkDistribute()
1871 /* shared vertices: use gidx=header->index to check if v is a shared vertex */ in DMNetworkDistribute()
1872 gidx = header->index; in DMNetworkDistribute()
1873 PetscCall(PetscHMapIGetWithDefault(newDMnetwork->cloneshared->svtable, gidx + 1, 0, &svtx_idx)); in DMNetworkDistribute()
1874 svtx_idx--; in DMNetworkDistribute()
1877 newDMnetwork->cloneshared->subnet[header->subnetid].nvtx++; in DMNetworkDistribute()
1882 for (j = 0; j < newDMnetwork->cloneshared->svtx[svtx_idx].n; j++) { in DMNetworkDistribute()
1883 sv = newDMnetwork->cloneshared->svtx[svtx_idx].sv + 2 * j; in DMNetworkDistribute()
1885 …if (PetscBTLookup(btable, net)) newDMnetwork->cloneshared->subnet[net].nvtx++; /* sv is on net own… in DMNetworkDistribute()
1892 for (j = 0; j < Nsubnet; j++) nv += newDMnetwork->cloneshared->subnet[j].nvtx; in DMNetworkDistribute()
1893 nv += newDMnetwork->cloneshared->Nsvtx; in DMNetworkDistribute()
1896 …PetscCall(PetscCalloc2(newDMnetwork->cloneshared->nEdges, &subnetedge, nv, &subnetvtx)); /* Maps l… in DMNetworkDistribute()
1897 newDMnetwork->cloneshared->subnetedge = subnetedge; in DMNetworkDistribute()
1898 newDMnetwork->cloneshared->subnetvtx = subnetvtx; in DMNetworkDistribute()
1899 for (j = 0; j < newDMnetwork->cloneshared->Nsubnet; j++) { in DMNetworkDistribute()
1900 newDMnetwork->cloneshared->subnet[j].edges = subnetedge; in DMNetworkDistribute()
1901 subnetedge += newDMnetwork->cloneshared->subnet[j].nedge; in DMNetworkDistribute()
1903 newDMnetwork->cloneshared->subnet[j].vertices = subnetvtx; in DMNetworkDistribute()
1904 subnetvtx += newDMnetwork->cloneshared->subnet[j].nvtx; in DMNetworkDistribute()
1907 newDMnetwork->cloneshared->subnet[j].nvtx = newDMnetwork->cloneshared->subnet[j].nedge = 0; in DMNetworkDistribute()
1909 newDMnetwork->cloneshared->svertices = subnetvtx; in DMNetworkDistribute()
1912 for (e = newDMnetwork->cloneshared->eStart; e < newDMnetwork->cloneshared->eEnd; e++) { in DMNetworkDistribute()
1913 PetscCall(PetscSectionGetOffset(newDMnetwork->DataSection, e, &offset)); in DMNetworkDistribute()
1914 … = (DMNetworkComponentHeader)(newDMnetwork->componentdataarray +… in DMNetworkDistribute()
1915 …newDMnetwork->cloneshared->subnet[header->subnetid].edges[newDMnetwork->cloneshared->subnet[header… in DMNetworkDistribute()
1919 for (v = newDMnetwork->cloneshared->vStart; v < newDMnetwork->cloneshared->vEnd; v++) { in DMNetworkDistribute()
1920 PetscCall(PetscSectionGetOffset(newDMnetwork->DataSection, v, &offset)); in DMNetworkDistribute()
1921 header = (DMNetworkComponentHeader)(newDMnetwork->componentdataarray + offset); in DMNetworkDistribute()
1923 /* coupling vertices: use gidx = header->index to check if v is a coupling vertex */ in DMNetworkDistribute()
1924 …PetscCall(PetscHMapIGetWithDefault(newDMnetwork->cloneshared->svtable, header->index + 1, 0, &svtx… in DMNetworkDistribute()
1925 svtx_idx--; in DMNetworkDistribute()
1927 …newDMnetwork->cloneshared->subnet[header->subnetid].vertices[newDMnetwork->cloneshared->subnet[hea… in DMNetworkDistribute()
1929 newDMnetwork->cloneshared->svertices[nv++] = v; in DMNetworkDistribute()
1934 for (j = 0; j < newDMnetwork->cloneshared->svtx[svtx_idx].n; j++) { in DMNetworkDistribute()
1935 sv = newDMnetwork->cloneshared->svtx[svtx_idx].sv + 2 * j; in DMNetworkDistribute()
1937 …if (PetscBTLookup(btable, net)) newDMnetwork->cloneshared->subnet[net].vertices[newDMnetwork->clon… in DMNetworkDistribute()
1941 newDMnetwork->cloneshared->nsvtx = nv; /* num of local shared vertices */ in DMNetworkDistribute()
1944 newDM->setupcalled = (*dm)->setupcalled; in DMNetworkDistribute()
1945 newDMnetwork->cloneshared->distributecalled = PETSC_TRUE; in DMNetworkDistribute()
1950 if (newDMnetwork->cloneshared->Nsvtx) PetscCall(PetscBTDestroy(&btable)); in DMNetworkDistribute()
1954 PetscCall(DMViewFromOptions(newDM, NULL, "-dmnetwork_view_distributed")); in DMNetworkDistribute()
1961 …PetscSFGetSubSF - Returns an `PetscSF` for a specific subset of points. Leaves are re-numbered to …
1966 + mainsf - `PetscSF` structure
1967 - map - a `ISLocalToGlobalMapping` that contains the subset of points
1970 . subSF - a subset of the `mainSF` for the desired subset.
1992 if (ilocal_map[i] != -1) nleaves_sub += 1; in PetscSFGetSubSF()
1994 /* Re-number ilocal with subset numbering. Need information from roots */ in PetscSFGetSubSF()
2005 if (ilocal_map[i] != -1) { in PetscSFGetSubSF()
2025 DMNetworkGetSupportingEdges - Return the supporting edges for this vertex point
2030 + dm - the `DMNETWORK` object
2031 - vertex - the vertex point
2034 + nedges - number of edges connected to this vertex point
2035 - edges - list of edge points, pass `NULL` if not needed
2043 DM_Network *network = (DM_Network *)dm->data; in DMNetworkGetSupportingEdges()
2046 PetscCall(DMPlexGetSupportSize(network->plex, vertex, nedges)); in DMNetworkGetSupportingEdges()
2047 if (edges) PetscCall(DMPlexGetSupport(network->plex, vertex, edges)); in DMNetworkGetSupportingEdges()
2052 DMNetworkGetConnectedVertices - Return the connected vertices for this edge point
2057 + dm - the `DMNETWORK` object
2058 - edge - the edge point
2061 . vertices - vertices connected to this edge
2069 DM_Network *network = (DM_Network *)dm->data; in DMNetworkGetConnectedVertices()
2072 PetscCall(DMPlexGetCone(network->plex, edge, vertices)); in DMNetworkGetConnectedVertices()
2077 DMNetworkIsSharedVertex - Returns `PETSC_TRUE` if the vertex is shared by subnetworks
2082 + dm - the `DMNETWORK` object
2083 - p - the vertex point
2086 . flag - `PETSC_TRUE` if the vertex is shared by subnetworks
2097 if (dm->setupcalled) { /* DMNetworkGetGlobalVertexIndex() requires DMSetUp() be called */ in DMNetworkIsSharedVertex()
2098 DM_Network *network = (DM_Network *)dm->data; in DMNetworkIsSharedVertex()
2102 PetscCall(PetscHMapIHas(network->cloneshared->svtable, gidx + 1, flag)); in DMNetworkIsSharedVertex()
2120 DMNetworkIsGhostVertex - Returns `PETSC_TRUE` if the vertex is a ghost vertex
2125 + dm - the `DMNETWORK` object
2126 - p - the vertex point
2129 . isghost - `PETSC_TRUE` if the vertex is a ghost point
2137 DM_Network *network = (DM_Network *)dm->data; in DMNetworkIsGhostVertex()
2143 PetscCall(DMGetGlobalSection(network->plex, §iong)); in DMNetworkIsGhostVertex()
2155 PetscCall(DMViewFromOptions(dm, NULL, "-dmnetwork_view")); in DMSetUp_Network()
2161 DMNetworkHasJacobian - Sets global flag for using user's sub Jacobian matrices
2162 -- replaced by DMNetworkSetOption(network,userjacobian,PETSC_TRUE)?
2167 + dm - the `DMNETWORK` object
2168 . eflg - turn the option on (`PETSC_TRUE`) or off (`PETSC_FALSE`) if user provides Jacobian for edg…
2169 - vflg - turn the option on (`PETSC_TRUE`) or off (`PETSC_FALSE`) if user provides Jacobian for ver…
2177 DM_Network *network = (DM_Network *)dm->data; in DMNetworkHasJacobian()
2178 PetscInt nVertices = network->cloneshared->nVertices; in DMNetworkHasJacobian()
2181 network->userEdgeJacobian = eflg; in DMNetworkHasJacobian()
2182 network->userVertexJacobian = vflg; in DMNetworkHasJacobian()
2184 if (eflg && !network->Je) PetscCall(PetscCalloc1(3 * network->cloneshared->nEdges, &network->Je)); in DMNetworkHasJacobian()
2186 if (vflg && !network->Jv && nVertices) { in DMNetworkHasJacobian()
2187 PetscInt i, *vptr, nedges, vStart = network->cloneshared->vStart; in DMNetworkHasJacobian()
2202 PetscCall(PetscCalloc1(2 * nedges_total + nVertices, &network->Jv)); in DMNetworkHasJacobian()
2203 network->Jvptr = vptr; in DMNetworkHasJacobian()
2209 DMNetworkEdgeSetMatrix - Sets user-provided Jacobian matrices for this edge to the network
2214 + dm - the `DMNETWORK` object
2215 . p - the edge point
2216 - J - array (size = 3) of Jacobian submatrices for this edge point:
2226 DM_Network *network = (DM_Network *)dm->data; in DMNetworkEdgeSetMatrix()
2229 …PetscCheck(network->Je, PetscObjectComm((PetscObject)dm), PETSC_ERR_ORDER, "Must call DMNetworkHas… in DMNetworkEdgeSetMatrix()
2232 network->Je[3 * p] = J[0]; in DMNetworkEdgeSetMatrix()
2233 network->Je[3 * p + 1] = J[1]; in DMNetworkEdgeSetMatrix()
2234 network->Je[3 * p + 2] = J[2]; in DMNetworkEdgeSetMatrix()
2240 DMNetworkVertexSetMatrix - Sets user-provided Jacobian matrix for this vertex to the network
2245 + dm - The `DMNETWORK` object
2246 . p - the vertex point
2247 - J - array of Jacobian (size = 2*(num of supporting edges) + 1) submatrices for this vertex point:
2249 J[1+2*i]: i-th supporting edge
2250 J[1+2*i+1]: i-th connected vertex
2258 DM_Network *network = (DM_Network *)dm->data; in DMNetworkVertexSetMatrix()
2259 PetscInt i, *vptr, nedges, vStart = network->cloneshared->vStart; in DMNetworkVertexSetMatrix()
2263 …PetscCheck(network->Jv, PetscObjectComm((PetscObject)dm), PETSC_ERR_ORDER, "Must call DMNetworkHas… in DMNetworkVertexSetMatrix()
2266 vptr = network->Jvptr; in DMNetworkVertexSetMatrix()
2267 network->Jv[vptr[p - vStart]] = J[0]; /* Set Jacobian for this vertex */ in DMNetworkVertexSetMatrix()
2271 for (i = 1; i <= 2 * nedges; i++) network->Jv[vptr[p - vStart] + i] = J[i]; in DMNetworkVertexSetMatrix()
2383 dof = (dof >= 0) ? dof : -(dof + 1); in CreateSubGlobalToLocalMapping_private()
2398 DM_Network *network = (DM_Network *)dm->data; in DMCreateMatrix_Network_Nest()
2407 PetscCall(PetscSectionGetConstrainedStorageSize(network->edge.GlobalDofSection, &eDof)); in DMCreateMatrix_Network_Nest()
2408 PetscCall(PetscSectionGetConstrainedStorageSize(network->vertex.GlobalDofSection, &vDof)); in DMCreateMatrix_Network_Nest()
2431 …PetscCall(CreateSubGlobalToLocalMapping_private(network->edge.GlobalDofSection, network->edge.DofS… in DMCreateMatrix_Network_Nest()
2432 …PetscCall(CreateSubGlobalToLocalMapping_private(network->vertex.GlobalDofSection, network->vertex.… in DMCreateMatrix_Network_Nest()
2464 DM_Network *network = (DM_Network *)dm->data; in DMCreateMatrix_Network()
2470 PetscInt nedges, *vptr = NULL, vc, *rows_v; /* suppress maybe-uninitialized warning */ in DMCreateMatrix_Network()
2479 mtype = dm->mattype; in DMCreateMatrix_Network()
2487 if (!network->userEdgeJacobian && !network->userVertexJacobian) { in DMCreateMatrix_Network()
2489 PetscCall(DMCreateMatrix_Plex(network->plex, J)); in DMCreateMatrix_Network()
2495 PetscCall(DMGetGlobalSection(network->plex, §ionGlobal)); in DMCreateMatrix_Network()
2517 PetscCall(PetscSectionGetDof(network->DofSection, e, &nrows)); in DMCreateMatrix_Network()
2524 PetscCall(PetscSectionGetDof(network->DofSection, cone[v], &ncols)); in DMCreateMatrix_Network()
2526 if (network->Je) { in DMCreateMatrix_Network()
2527 Juser = network->Je[3 * e + 1 + v]; /* Jacobian(e,v) */ in DMCreateMatrix_Network()
2535 if (network->Je) { in DMCreateMatrix_Network()
2536 Juser = network->Je[3 * e]; /* Jacobian(e,e) */ in DMCreateMatrix_Network()
2544 if (vEnd - vStart) vptr = network->Jvptr; in DMCreateMatrix_Network()
2549 PetscCall(PetscSectionGetDof(network->DofSection, v, &nrows)); in DMCreateMatrix_Network()
2567 PetscCall(PetscSectionGetDof(network->DofSection, edges[e], &ncols)); in DMCreateMatrix_Network()
2569 if (network->Jv) { in DMCreateMatrix_Network()
2570 Juser = network->Jv[vptr[v - vStart] + 2 * e + 1]; /* Jacobian(v,e) */ in DMCreateMatrix_Network()
2579 PetscCall(PetscSectionGetDof(network->DofSection, vc, &ncols)); in DMCreateMatrix_Network()
2581 if (network->Jv) { in DMCreateMatrix_Network()
2582 Juser = network->Jv[vptr[v - vStart] + 2 * e + 2]; /* Jacobian(v,vc) */ in DMCreateMatrix_Network()
2596 if (network->Jv) { in DMCreateMatrix_Network()
2597 Juser = network->Jv[vptr[v - vStart]]; /* Jacobian(v,v) */ in DMCreateMatrix_Network()
2633 PetscCall(PetscSectionGetDof(network->DofSection, e, &nrows)); in DMCreateMatrix_Network()
2641 PetscCall(PetscSectionGetDof(network->DofSection, cone[v], &ncols)); in DMCreateMatrix_Network()
2643 if (network->Je) { in DMCreateMatrix_Network()
2644 Juser = network->Je[3 * e + 1 + v]; /* Jacobian(e,v) */ in DMCreateMatrix_Network()
2651 if (network->Je) { in DMCreateMatrix_Network()
2652 Juser = network->Je[3 * e]; /* Jacobian(e,e) */ in DMCreateMatrix_Network()
2662 PetscCall(PetscSectionGetDof(network->DofSection, v, &nrows)); in DMCreateMatrix_Network()
2679 PetscCall(PetscSectionGetDof(network->DofSection, edges[e], &ncols)); in DMCreateMatrix_Network()
2681 if (network->Jv) { in DMCreateMatrix_Network()
2682 Juser = network->Jv[vptr[v - vStart] + 2 * e + 1]; /* Jacobian(v,e) */ in DMCreateMatrix_Network()
2691 PetscCall(PetscSectionGetDof(network->DofSection, vc, &ncols)); in DMCreateMatrix_Network()
2693 if (network->Jv) { in DMCreateMatrix_Network()
2694 Juser = network->Jv[vptr[v - vStart] + 2 * e + 2]; /* Jacobian(v,vc) */ in DMCreateMatrix_Network()
2702 if (network->Jv) { in DMCreateMatrix_Network()
2703 Juser = network->Jv[vptr[v - vStart]]; /* Jacobian(v,v) */ in DMCreateMatrix_Network()
2720 DM_Network *network = (DM_Network *)dm->data; in DMNetworkDestroyComponentData()
2724 if (network->header) { in DMNetworkDestroyComponentData()
2725 np = network->cloneshared->pEnd - network->cloneshared->pStart; in DMNetworkDestroyComponentData()
2727 …scCall(PetscFree5(network->header[j].size, network->header[j].key, network->header[j].offset, netw… in DMNetworkDestroyComponentData()
2728 PetscCall(PetscFree(network->cvalue[j].data)); in DMNetworkDestroyComponentData()
2730 PetscCall(PetscFree2(network->header, network->cvalue)); in DMNetworkDestroyComponentData()
2737 DM_Network *network = (DM_Network *)dm->data; in DMDestroy_Network()
2750 PetscCall(PetscFree(network->Je)); in DMDestroy_Network()
2751 if (network->Jv) { in DMDestroy_Network()
2752 PetscCall(PetscFree(network->Jvptr)); in DMDestroy_Network()
2753 PetscCall(PetscFree(network->Jv)); in DMDestroy_Network()
2755 PetscCall(PetscSectionDestroy(&network->DataSection)); in DMDestroy_Network()
2756 PetscCall(PetscSectionDestroy(&network->DofSection)); in DMDestroy_Network()
2757 PetscCall(PetscFree(network->component)); in DMDestroy_Network()
2758 PetscCall(PetscFree(network->componentdataarray)); in DMDestroy_Network()
2761 PetscCall(DMDestroy(&network->plex)); /* this is cloned in DMClone_Network, so safe to destroy */ in DMDestroy_Network()
2775 PetscCall(ISLocalToGlobalMappingDestroy(&network->vertex.mapping)); in DMDestroy_Network()
2776 PetscCall(PetscSectionDestroy(&network->vertex.DofSection)); in DMDestroy_Network()
2777 PetscCall(PetscSectionDestroy(&network->vertex.GlobalDofSection)); in DMDestroy_Network()
2778 PetscCall(PetscSFDestroy(&network->vertex.sf)); in DMDestroy_Network()
2780 PetscCall(ISLocalToGlobalMappingDestroy(&network->edge.mapping)); in DMDestroy_Network()
2781 PetscCall(PetscSectionDestroy(&network->edge.DofSection)); in DMDestroy_Network()
2782 PetscCall(PetscSectionDestroy(&network->edge.GlobalDofSection)); in DMDestroy_Network()
2783 PetscCall(PetscSFDestroy(&network->edge.sf)); in DMDestroy_Network()
2785 PetscCall(ISDestroy(&network->vieweroptions.viewranks)); in DMDestroy_Network()
2787 if (--network->cloneshared->refct <= 0) { in DMDestroy_Network()
2790 PetscCall(PetscFree(network->cloneshared->vltog)); in DMDestroy_Network()
2791 …for (j = 0; j < network->cloneshared->Nsvtx; j++) PetscCall(PetscFree(network->cloneshared->svtx[j… in DMDestroy_Network()
2792 PetscCall(PetscFree(network->cloneshared->svtx)); in DMDestroy_Network()
2793 PetscCall(PetscFree2(network->cloneshared->subnetedge, network->cloneshared->subnetvtx)); in DMDestroy_Network()
2794 PetscCall(PetscHMapIDestroy(&network->cloneshared->svtable)); in DMDestroy_Network()
2795 PetscCall(PetscFree(network->cloneshared->subnet)); in DMDestroy_Network()
2796 PetscCall(PetscFree(network->cloneshared)); in DMDestroy_Network()
2804 DM_Network *network = (DM_Network *)dm->data; in DMGlobalToLocalBegin_Network()
2807 PetscCall(DMGlobalToLocalBegin(network->plex, g, mode, l)); in DMGlobalToLocalBegin_Network()
2813 DM_Network *network = (DM_Network *)dm->data; in DMGlobalToLocalEnd_Network()
2816 PetscCall(DMGlobalToLocalEnd(network->plex, g, mode, l)); in DMGlobalToLocalEnd_Network()
2822 DM_Network *network = (DM_Network *)dm->data; in DMLocalToGlobalBegin_Network()
2825 PetscCall(DMLocalToGlobalBegin(network->plex, l, mode, g)); in DMLocalToGlobalBegin_Network()
2831 DM_Network *network = (DM_Network *)dm->data; in DMLocalToGlobalEnd_Network()
2834 PetscCall(DMLocalToGlobalEnd(network->plex, l, mode, g)); in DMLocalToGlobalEnd_Network()
2839 DMNetworkGetVertexLocalToGlobalOrdering - Get vertex global index
2844 + dm - the `DMNETWORK` object
2845 - vloc - local vertex ordering, start from 0
2848 . vg - global vertex ordering, start from 0
2856 DM_Network *network = (DM_Network *)dm->data; in DMNetworkGetVertexLocalToGlobalOrdering()
2857 PetscInt *vltog = network->cloneshared->vltog; in DMNetworkGetVertexLocalToGlobalOrdering()
2866 DMNetworkSetVertexLocalToGlobalOrdering - Create and setup vertex local to global map
2871 . dm - the `DMNETWORK` object
2879 DM_Network *network = (DM_Network *)dm->data; in DMNetworkSetVertexLocalToGlobalOrdering()
2897 nroots = network->cloneshared->vEnd - network->cloneshared->vStart; in DMNetworkSetVertexLocalToGlobalOrdering()
2900 network->cloneshared->vltog = vltog; in DMNetworkSetVertexLocalToGlobalOrdering()
2904 …PetscCheck(network->cloneshared->distributecalled, comm, PETSC_ERR_ARG_WRONGSTATE, "Must call DMNe… in DMNetworkSetVertexLocalToGlobalOrdering()
2905 if (network->cloneshared->vltog) PetscCall(PetscFree(network->cloneshared->vltog)); in DMNetworkSetVertexLocalToGlobalOrdering()
2907 …tscCall(DMNetworkSetSubMap_private(dm, network->cloneshared->vStart, network->cloneshared->vEnd, &… in DMNetworkSetVertexLocalToGlobalOrdering()
2908 PetscCall(PetscSFGetSubSF(network->plex->sf, network->vertex.mapping, &network->vertex.sf)); in DMNetworkSetVertexLocalToGlobalOrdering()
2909 vsf = network->vertex.sf; in DMNetworkSetVertexLocalToGlobalOrdering()
2919 ii = nroots - nleaves; /* local number of vertices, excluding ghosts */ in DMNetworkSetVertexLocalToGlobalOrdering()
2922 for (PetscMPIInt i = 2; i < size + 1; i++) vrange[i] += vrange[i - 1]; in DMNetworkSetVertexLocalToGlobalOrdering()
2925 network->cloneshared->vltog = vltog; in DMNetworkSetVertexLocalToGlobalOrdering()
2927 /* Set vltog for non-ghost vertices */ in DMNetworkSetVertexLocalToGlobalOrdering()
2930 PetscCall(DMNetworkIsGhostVertex(dm, i + network->cloneshared->vStart, &ghost)); in DMNetworkSetVertexLocalToGlobalOrdering()
2961 val = (PetscScalar)vltog[lidx]; /* global index for non-ghost vertex computed above */ in DMNetworkSetVertexLocalToGlobalOrdering()
2973 PetscCall(DMNetworkIsGhostVertex(dm, i + network->cloneshared->vStart, &ghost)); in DMNetworkSetVertexLocalToGlobalOrdering()
2992 PetscCall(PetscSectionGetOffset(network->DataSection, p, &offset)); in DMISAddSize_private()
2993 ncomps = ((DMNetworkComponentHeader)(network->componentdataarray + offset))->ndata; in DMISAddSize_private()
2994 header = (DMNetworkComponentHeader)(network->componentdataarray + offset); in DMISAddSize_private()
2997 key = header->key[i]; in DMISAddSize_private()
2998 nvar = header->nvar[i]; in DMISAddSize_private()
3001 if (!blocksize || blocksize[j] == -1) { in DMISAddSize_private()
3015 DM_Network *network = (DM_Network *)dm->data; in DMISComputeIdx_private()
3019 PetscCall(PetscSectionGetOffset(network->DataSection, p, &offset)); in DMISComputeIdx_private()
3020 ncomps = ((DMNetworkComponentHeader)(network->componentdataarray + offset))->ndata; in DMISComputeIdx_private()
3021 header = (DMNetworkComponentHeader)(network->componentdataarray + offset); in DMISComputeIdx_private()
3024 key = header->key[i]; in DMISComputeIdx_private()
3025 nvar = header->nvar[i]; in DMISComputeIdx_private()
3030 if (!blocksize || blocksize[j] == -1) { in DMISComputeIdx_private()
3043 DMNetworkCreateIS - Create an index set object from the global vector of the network
3048 + dm - `DMNETWORK` object
3049 . numkeys - number of keys
3050 . keys - array of keys that define the components of the variables you wish to extract
3051 . blocksize - block size of the variables associated to the component
3052 . nselectedvar - number of variables in each block to select
3053 - selectedvar - the offset into the block of each variable in each block to select
3056 . is - the index set
3061 …-1 to indicate select all the variables of the i-th component, for which nselectvar[i] and selecte…
3068 DM_Network *network = (DM_Network *)dm->data; in DMNetworkCreateIS()
3077 if (!blocksize || blocksize[i] == -1) continue; in DMNetworkCreateIS()
3112 DM_Network *network = (DM_Network *)dm->data; in DMISComputeLocalIdx_private()
3116 PetscCall(PetscSectionGetOffset(network->DataSection, p, &offset)); in DMISComputeLocalIdx_private()
3117 ncomps = ((DMNetworkComponentHeader)(network->componentdataarray + offset))->ndata; in DMISComputeLocalIdx_private()
3118 header = (DMNetworkComponentHeader)(network->componentdataarray + offset); in DMISComputeLocalIdx_private()
3121 key = header->key[i]; in DMISComputeLocalIdx_private()
3122 nvar = header->nvar[i]; in DMISComputeLocalIdx_private()
3127 if (!blocksize || blocksize[j] == -1) { in DMISComputeLocalIdx_private()
3140 DMNetworkCreateLocalIS - Create an index set object from the local vector of the network
3145 + dm - `DMNETWORK` object
3146 . numkeys - number of keys
3147 . keys - array of keys that define the components of the variables you wish to extract
3148 . blocksize - block size of the variables associated to the component
3149 . nselectedvar - number of variables in each block to select
3150 - selectedvar - the offset into the block of each variable in each block to select
3153 . is - the index set
3158 …-1 to indicate select all the variables of the i-th component, for which nselectvar[i] and selecte…
3164 DM_Network *network = (DM_Network *)dm->data; in DMNetworkCreateLocalIS()
3170 if (!blocksize || blocksize[i] == -1) continue; in DMNetworkCreateLocalIS()
3174 pstart = network->cloneshared->pStart; in DMNetworkCreateLocalIS()
3175 pend = network->cloneshared->pEnd; in DMNetworkCreateLocalIS()
3192 …DMNetworkFinalizeComponents - Sets up internal data structures for the sections and components. It…
3198 . dm - the `DMNETWORK` object
3206 DM_Network *network = (DM_Network *)dm->data; in DMNetworkFinalizeComponents()
3209 if (network->componentsetup) PetscFunctionReturn(PETSC_SUCCESS); in DMNetworkFinalizeComponents()
3212 PetscCall(DMSetLocalSection(network->plex, network->DofSection)); in DMNetworkFinalizeComponents()
3213 PetscCall(DMGetGlobalSection(network->plex, &network->GlobalDofSection)); in DMNetworkFinalizeComponents()
3214 network->componentsetup = PETSC_TRUE; in DMNetworkFinalizeComponents()