M

etscMapRegisterDynamic - Adds a new map component implementation

Synopsis

#include "petscvec.h"  
int PetscMapRegisterDestroy()

Synopsis

PetscMapRegisterDynamic(char *name, char *path, char *func_name, int (*create_func)(PetscMap))

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

PetscMapRegister() may be called multiple times to add several user-defined maptors

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

Sample usage

    PetscMapRegisterDynamic("my_map","/home/username/my_lib/lib/libO/solaris/libmy.a", "MyPetscMapCreate", MyPetscMapCreate);

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

    PetscMapCreate(MPI_Comm, PetscMap *);
    PetscMapSetType(PetscMap,"my_map_name");
or at runtime via the option
    -map_type my_map_name

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

Keywords

PetscMap, register

See Also

PetscMapRegisterAll(), PetscMapRegisterDestroy()
M*/

#undef __FUNCT__ #define __FUNCT__ "PetscMapRegister" int PetscMapRegister(const char sname[], const char path[], const char name[], int (*function)(PetscMap)) { 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(&PetscMapList, sname, fullname, (void (*)(void)) function); CHKERRQ(ierr); PetscFunctionReturn(0); }

/*@M PetscMapSerializeRegisterDynamic - Adds a serialization method to the map package.

Synopsis


PetscMapSerializeRegisterDynamic(char *name, char *path, char *func_name, int (*serialize_func)(MPI_Comm, PetscMap *, 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

PetscMapSerializeRegister() 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

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

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

    PetscMapSetSerializeType(map, "my_store")
or at runtime via the option
    -map_serialize_type my_store

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

Keywords

PetscMap, register

See Also

PetscMapSerializeRegisterAll(), PetscMapSerializeRegisterDestroy()
M*/ #undef __FUNCT__ #define __FUNCT__ "PetscMapSerializeRegister" int PetscMapSerializeRegister(const char sname[], const char path[], const char name[], int (*function)(MPI_Comm, PetscMap *, 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(&PetscMapSerializeList, sname, fullname, (void (*)(void)) function); CHKERRQ(ierr); PetscFunctionReturn(0); }

/*--------------------------------------------------------------------------------------------------------------------*/ #undef __FUNCT__ #define __FUNCT__ "PetscMapRegisterDestroy" /*@C PetscMapRegisterDestroy - Frees the list of PetscMap methods that were registered by PetscMapRegister().

Not collective

Keywords

map, register, destroy

See Also

PetscMapRegister(), PetscMapRegisterAll(), PetscMapSerializeRegisterDestroy()

Level:advanced
Location:
src/vec/interface/mapreg.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