DiscretizationSerializeRegister

Adds a serialization method to the disc package.

Synopsis

#include "discretization.h"  
int DiscretizationRegisterDestroy(void)

Synopsis


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

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

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

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

    DiscretizationSetSerializeType(disc, "my_store")
or at runtime via the option
    -discretization_serialize_type my_store

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

Keywords

Discretization, register

See Also

DiscretizationSerializeRegisterAll(), DiscretizationSerializeRegisterDestroy()
M*/ #undef __FUNCT__ #define __FUNCT__ "DiscretizationSerializeRegister" int DiscretizationSerializeRegister(const char sname[], const char path[], const char name[], int (*function)(MPI_Comm, Discretization *, 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(&DiscretizationSerializeList, sname, fullname, (void (*)(void)) function); CHKERRQ(ierr); PetscFunctionReturn(0); }

/*-------------------------------------------------------------------------------------------------------------------*/ #undef __FUNCT__ #define __FUNCT__ "DiscretizationRegisterDestroy" /*@C DiscretizationRegisterDestroy - Frees the list of creation routines for discretizations that were registered by DiscretizationRegister().

Not collective

Keywords

Discretization, register, destroy

See Also

DiscretizationRegister(), DiscretizationRegisterAll(), DiscretizationSerializeRegisterDestroy()

Level:advanced
Location:
src/grid/discretization/interface/discreg.c
Index of all Discretization routines
Table of Contents for all manual pages
Index of all manual pages