petsc-3.14.5 2021-03-03
Report Typos and Errors

# DMSetNullSpaceConstructor

Provide a callback function which constructs the nullspace for a given field

### Synopsis

    #include "petscdm.h"
    #include "petscdmlabel.h"
    #include "petscds.h"
    PetscErrorCode DMCreateFieldIS(DM dm, PetscInt *numFields, char ***fieldNames, IS **fields)

Logically collective on DM

### Input Parameters

| dm | - The DM
| field | - The field number for the nullspace
| nullsp | - A callback to create the nullspace

### Notes

The callback is intended to provide nullspaces when function spaces are joined or split, such as in DMCreateSubDM(). The calling sequence is

    PetscErrorCode nullsp(DM dm, PetscInt origField, PetscInt field, MatNullSpace *nullSpace)

    dm        - The present DM

    origField - The field number given above, in the original DM

    field     - The field number in dm

    nullSpace - The nullspace for the given field

This function is currently not available from Fortran.

### See Also

DMGetNullSpaceConstructor(), DMSetNearNullSpaceConstructor(), DMGetNearNullSpaceConstructor(), DMCreateSubDM(), DMCreateSuperDM()
*/ PetscErrorCode DMSetNullSpaceConstructor(DM dm, PetscInt field, PetscErrorCode (*nullsp)(DM dm, PetscInt origField, PetscInt field, MatNullSpace *nullSpace)) { PetscFunctionBegin; PetscValidHeaderSpecific(dm, DM_CLASSID, 1); if (field >= 10) SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Cannot handle %d >= 10 fields", field); dm->nullspaceConstructors[field] = nullsp; PetscFunctionReturn(0); }

/*@C DMGetNullSpaceConstructor - Return the callback function which constructs the nullspace for a given field, or NULL

Not collective

### Input Parameters

| dm | - The DM
| field | - The field number for the nullspace

### Output Parameter

| nullsp | - A callback to create the nullspace

### Notes

The callback is intended to provide nullspaces when function spaces are joined or split, such as in DMCreateSubDM(). The calling sequence is

    PetscErrorCode nullsp(DM dm, PetscInt origField, PetscInt field, MatNullSpace *nullSpace)

    dm        - The present DM

    origField - The field number given above, in the original DM

    field     - The field number in dm

    nullSpace - The nullspace for the given field

This function is currently not available from Fortran.

### See Also

DMSetNullSpaceConstructor(), DMSetNearNullSpaceConstructor(), DMGetNearNullSpaceConstructor(), DMCreateSubDM(), DMCreateSuperDM()
*/ PetscErrorCode DMGetNullSpaceConstructor(DM dm, PetscInt field, PetscErrorCode (**nullsp)(DM dm, PetscInt origField, PetscInt field, MatNullSpace *nullSpace)) { PetscFunctionBegin; PetscValidHeaderSpecific(dm, DM_CLASSID, 1); PetscValidPointer(nullsp, 3); if (field >= 10) SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Cannot handle %d >= 10 fields", field); *nullsp = dm->nullspaceConstructors[field]; PetscFunctionReturn(0); }

/*@C DMSetNearNullSpaceConstructor - Provide a callback function which constructs the near-nullspace for a given field

Logically collective on DM

### Input Parameters

| dm | - The DM
| field | - The field number for the nullspace
| nullsp | - A callback to create the near-nullspace

### Notes

The callback is intended to provide nullspaces when function spaces are joined or split, such as in DMCreateSubDM(). The calling sequence is

    PetscErrorCode nullsp(DM dm, PetscInt origField, PetscInt field, MatNullSpace *nullSpace)

    dm        - The present DM

    origField - The field number given above, in the original DM

    field     - The field number in dm

    nullSpace - The nullspace for the given field

This function is currently not available from Fortran.

### See Also

DMGetNearNullSpaceConstructor(), DMSetNullSpaceConstructor(), DMGetNullSpaceConstructor(), DMCreateSubDM(), DMCreateSuperDM()
*/ PetscErrorCode DMSetNearNullSpaceConstructor(DM dm, PetscInt field, PetscErrorCode (*nullsp)(DM dm, PetscInt origField, PetscInt field, MatNullSpace *nullSpace)) { PetscFunctionBegin; PetscValidHeaderSpecific(dm, DM_CLASSID, 1); if (field >= 10) SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Cannot handle %d >= 10 fields", field); dm->nearnullspaceConstructors[field] = nullsp; PetscFunctionReturn(0); }

/*@C DMGetNearNullSpaceConstructor - Return the callback function which constructs the near-nullspace for a given field, or NULL

Not collective

### Input Parameters

| dm | - The DM
| field | - The field number for the nullspace

### Output Parameter

| nullsp | - A callback to create the near-nullspace

### Notes

The callback is intended to provide nullspaces when function spaces are joined or split, such as in DMCreateSubDM(). The calling sequence is

    PetscErrorCode nullsp(DM dm, PetscInt origField, PetscInt field, MatNullSpace *nullSpace)

    dm        - The present DM

    origField - The field number given above, in the original DM

    field     - The field number in dm

    nullSpace - The nullspace for the given field

This function is currently not available from Fortran.

### See Also

DMSetNearNullSpaceConstructor(), DMSetNullSpaceConstructor(), DMGetNullSpaceConstructor(), DMCreateSubDM(), DMCreateSuperDM()
*/ PetscErrorCode DMGetNearNullSpaceConstructor(DM dm, PetscInt field, PetscErrorCode (**nullsp)(DM dm, PetscInt origField, PetscInt field, MatNullSpace *nullSpace)) { PetscFunctionBegin; PetscValidHeaderSpecific(dm, DM_CLASSID, 1); PetscValidPointer(nullsp, 3); if (field >= 10) SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Cannot handle %d >= 10 fields", field); *nullsp = dm->nearnullspaceConstructors[field]; PetscFunctionReturn(0); }

/*@C DMCreateFieldIS - Creates a set of IS objects with the global indices of dofs for each field

Not collective

### Input Parameter

| dm | - the DM object

### Output Parameters

| numFields | - The number of fields (or NULL if not requested)
| fieldNames | - The name for each field (or NULL if not requested)
| fields | - The global indices for each field (or NULL if not requested)

### Notes

The user is responsible for freeing all requested arrays. In particular, every entry of names should be freed with PetscFree(), every entry of fields should be destroyed with ISDestroy(), and both arrays should be freed with PetscFree().

### See Also

DMDestroy(), DMView(), DMCreateInterpolation(), DMCreateColoring(), DMCreateMatrix()

### Level

intermediate

### Location

src/dm/interface/dm.c

### Examples

src/snes/tutorials/ex62.c.html
Index of all DM routines
Table of Contents for all manual pages
Index of all manual pages