DMNetworkAddComponent — PETSc 3.21.4 documentation

Skip to main content
`Ctrl`+`K`

# DMNetworkAddComponent

Adds a network component and number of variables at the given point (vertex/edge)

## Synopsis

    #include "petscdmnetwork.h"
    PetscErrorCode DMNetworkAddComponent(DM dm, PetscInt p, PetscInt componentkey, void *compvalue, PetscInt nvar)

Collective

## Input Parameters

- dm - the DMNetwork

- p - the vertex/edge point. These points are local indices provided by `DMNetworkGetSubnetwork()`

- componentkey - component key returned while registering the component with `DMNetworkRegisterComponent()`

- compvalue - pointer to the data structure for the component, or `NULL` if the component does not require data, this data is not copied so you cannot free this space until after `DMSetUp()` is called.

- nvar - number of variables for the component at the vertex/edge point, zero if the component does not introduce any degrees of freedom at the point

## Notes

The owning rank and any other ranks that have this point as a ghost location must call this routine to add a component and number of variables in the same order at the given point.

`DMNetworkLayoutSetUp()` must be called before this routine.

## Developer Notes

The requirement that all the ranks with access to a vertex (as owner or as ghost) add all the components comes from a limitation of the underlying implementation based on `DMPLEX`.

## See Also

`DM`, `DMNETWORK`, `DMNetworkGetComponent()`, `DMNetworkGetSubnetwork()`, `DMNetworkIsGhostVertex()`, `DMNetworkLayoutSetUp()`

## Level

beginner

## Location

src/dm/impls/network/network.c

Index of all DMNetwork routines
Table of Contents for all manual pages
Index of all manual pages