Skip to main content
`Ctrl`+`K`

# PetscSpaceRegister

Adds a new `PetscSpace` implementation

## Synopsis

    #include "petscfe.h"
    PetscErrorCode PetscSpaceRegister(const char sname[], PetscErrorCode (*function)(PetscSpace))

Not Collective, No Fortran Support

## Input Parameters

- sname - The name of a new user-defined creation routine

- function - The creation routine for the implementation type

## Example Usage

        PetscSpaceRegister("my_space", MyPetscSpaceCreate);

Then, your PetscSpace type can be chosen with the procedural interface via

        PetscSpaceCreate(MPI_Comm, PetscSpace *);
        PetscSpaceSetType(PetscSpace, "my_space");

or at runtime via the option

        -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

src/dm/dt/space/interface/space.c

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