# PetscSpaceRegister
Adds a new `PetscSpace` implementation 
## Synopsis
```
#include "petscfe.h"  
PetscErrorCode PetscSpaceRegister(const char sname[], PetscErrorCode (*function)(PetscSpace))
```
Not Collective


## Input Parameters

- ***name        -*** The name of a new user-defined creation routine
- ***create_func -*** The creation routine for the implementation type



## Sample usage
```none
    PetscSpaceRegister("my_space", MyPetscSpaceCreate);
```


Then, your PetscSpace type can be chosen with the procedural interface via
```none
    PetscSpaceCreate(MPI_Comm, PetscSpace *);
    PetscSpaceSetType(PetscSpace, "my_space");
```

or at runtime via the option
```none
    -petscspace_type my_space
```





## Note
`PetscSpaceRegister()` may be called multiple times to add several user-defined types of `PetscSpace`.  The creation function is called
when the type is set to 'name'.


## See Also
 `PetscSpace`, `PetscSpaceRegisterAll()`, `PetscSpaceRegisterDestroy()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/dt/space/interface/space.c.html#PetscSpaceRegister">src/dm/dt/space/interface/space.c</A>


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


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