Skip to main content
`Ctrl`+`K`

# DMSwarmCreateGlobalVectorFromFields

Creates a `Vec` object sharing the array associated with a given field set

## Synopsis

    #include "petscdmswarm.h"
    PetscErrorCode DMSwarmCreateGlobalVectorFromFields(DM dm, PetscInt Nf, const char *fieldnames[], Vec *vec)

Collective

## Input Parameters

- dm - a `DMSWARM`

- Nf - the number of fields

- fieldnames - the textual names given to the registered fields

## Output Parameter

- vec - the vector

## Notes

The vector must be returned using a matching call to `DMSwarmDestroyGlobalVectorFromFields()`.

This vector is copyin-copyout, rather than a direct pointer like `DMSwarmCreateGlobalVectorFromField()`

## See Also

`DM`, `DMSWARM`, `DMSwarmRegisterPetscDatatypeField()`, `DMSwarmDestroyGlobalVectorFromFields()`

## Level

beginner

## Location

src/dm/impls/swarm/swarm.c

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