:orphan:
# 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 Note
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
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/network/network.c.html#DMNetworkAddComponent">src/dm/impls/network/network.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/impls/network/network.c)


[Index of all DMNetwork routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
