M

ecRegisterDynamic - Adds a new vector component implementation

Synopsis

#include "vec.h"  
int VecRegisterDestroy(void)

Synopsis

VecRegisterDynamic(char *name, char *path, char *func_name, int (*create_func)(Vec))

Not Collective

Input Parameters

name - The name of a new user-defined creation routine
path - The path (either absolute or relative) of the library containing this routine
func_name - The name of routine to create method context
create_func - The creation routine itself

Notes

VecRegister() may be called multiple times to add several user-defined vectors

If dynamic libraries are used, then the fourth input argument (routine_create) is ignored.

Sample usage

    VecRegisterDynamic("my_vec","/home/username/my_lib/lib/libO/solaris/libmy.a", "MyVectorCreate", MyVectorCreate);

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

    VecCreate(MPI_Comm, Vec *);
    VecSetType(Vec,"my_vector_name");
or at runtime via the option
    -vec_type my_vector_name

Note: $PETSC_ARCH and $BOPT occuring in pathname will be replaced with appropriate values.

Keywords

Vec, register

See Also

VecRegisterAll(), VecRegisterDestroy()
M*/

#undef __FUNCT__ #define __FUNCT__ "VecRegister" int VecRegister(const char sname[], const char path[], const char name[], int (*function)(Vec)) { char fullname[256]; int ierr;

PetscFunctionBegin; ierr = PetscStrcpy(fullname, path); CHKERRQ(ierr); ierr = PetscStrcat(fullname, ":"); CHKERRQ(ierr); ierr = PetscStrcat(fullname, name); CHKERRQ(ierr); ierr = PetscFListAdd(&VecList, sname, fullname, (void (*)(void)) function); CHKERRQ(ierr); PetscFunctionReturn(0); }

/*@M VecSerializeRegisterDynamic - Adds a serialization method to the vec package.

Synopsis


VecSerializeRegisterDynamic(char *name, char *path, char *func_name, int (*serialize_func)(MPI_Comm, Vec *, PetscViewer, PetscTruth))

Not Collective

Input Parameters

name - The name of a new user-defined serialization routine
path - The path (either absolute or relative) of the library containing this routine
func_name - The name of the serialization routine
serialize_func - The serialization routine itself

Notes

VecSerializeRegister() may be called multiple times to add several user-defined serializers.

If dynamic libraries are used, then the fourth input argument (serialize_func) is ignored.

Sample usage

  VecSerializeRegisterDynamic("my_store", "/home/username/my_lib/lib/libO/solaris/libmy.a", "MyStoreFunc", MyStoreFunc);

Then, your serialization can be chosen with the procedural interface via

    VecSetSerializeType(vec, "my_store")
or at runtime via the option
    -vec_serialize_type my_store

Note: $PETSC_ARCH and $BOPT occuring in pathname will be replaced with appropriate values.

Keywords

Vec, register

See Also

VecSerializeRegisterAll(), VecSerializeRegisterDestroy()
M*/ #undef __FUNCT__ #define __FUNCT__ "VecSerializeRegister" int VecSerializeRegister(const char sname[], const char path[], const char name[], int (*function)(MPI_Comm, Vec *, PetscViewer, PetscTruth)) { char fullname[256]; int ierr;

PetscFunctionBegin; ierr = PetscStrcpy(fullname, path); CHKERRQ(ierr); ierr = PetscStrcat(fullname, ":"); CHKERRQ(ierr); ierr = PetscStrcat(fullname, name); CHKERRQ(ierr); ierr = PetscFListAdd(&VecSerializeList, sname, fullname, (void (*)(void)) function); CHKERRQ(ierr); PetscFunctionReturn(0); }

/*--------------------------------------------------------------------------------------------------------------------*/ #undef __FUNCT__ #define __FUNCT__ "VecRegisterDestroy" /*@C VecRegisterDestroy - Frees the list of Vec methods that were registered by VecRegister().

Not Collective

Keywords

Vec, register, destroy

See Also

VecRegister(), VecRegisterAll(), VecSerializeRegisterDestroy()

Level:advanced
Location:
src/vec/interface/vecreg.c
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/vec/examples/tutorials/ex8.c.html
src/sles/examples/tutorials/ex3.c.html
src/sles/examples/tutorials/ex8.c.html
src/snes/examples/tutorials/ex3.c.html
src/ts/examples/tutorials/ex2.c.html
src/ts/examples/tutorials/ex2f.F.html
src/ts/examples/tutorials/ex2f.h.html
src/dm/da/examples/tutorials/ex1.c.html
src/dm/da/examples/tutorials/ex2.c.html