petsc-3.5.4 2015-05-23
Report Typos and Errors

PetscHeaderCreate

Creates a PETSc object of a particular class, indicated by tp

Synopsis

#define PetscHeaderCreate(h,tp,pops,classid,class_name,descr,mansec,com,des,vie) \
  (PetscNew(&(h)) ||                                                  \
   PetscNew(&(((PetscObject)(h))->bops)) ||                            \
   PetscNew(&((h)->ops)) ||                                                \
   PetscHeaderCreate_Private((PetscObject)h,classid,class_name,descr,mansec,com,(PetscObjectFunction)des,(PetscObjectViewerFunction)vie) || \
   PetscLogObjectCreate(h) ||                                                   \
   PetscLogObjectMemory((PetscObject)h, sizeof(struct tp) + sizeof(PetscOps) + sizeof(pops)))

PETSC_EXTERN PetscErrorCode PetscComposedQuantitiesDestroy(PetscObject obj);
PETSC_EXTERN PetscErrorCode PetscHeaderCreate_Private(PetscObject,PetscClassId,const char[],const char[],const char[],MPI_Comm,PetscErrorCode (*)(PetscObject*),PetscErrorCode (*)(PetscObject,PetscViewer));

/*@C
    PetscHeaderDestroy - Final step in destroying a PetscObject

    Input Parameters:
.   h - the header created with PetscHeaderCreate()

    

   Developer Note: This currently is a CPP macro because it accesses (*h)->ops which is a field in the derived class but not the PetscObject base class

.seealso: PetscHeaderCreate()
@*/
#define PetscHeaderDestroy(h)                         \
  (PetscHeaderDestroy_Private((PetscObject)(*h)) ||   \
   PetscFree((*h)->ops) ||                            \
   PetscFree(*h))

PETSC_EXTERN PetscErrorCode PetscHeaderDestroy_Private(PetscObject);
PETSC_EXTERN PetscErrorCode PetscObjectCopyFortranFunctionPointers(PetscObject,PetscObject);
PETSC_EXTERN PetscErrorCode PetscObjectSetFortranCallback(PetscObject,PetscFortranCallbackType,PetscFortranCallbackId*,void(*)(void),void *ctx);
PETSC_EXTERN PetscErrorCode PetscObjectGetFortranCallback(PetscObject,PetscFortranCallbackType,PetscFortranCallbackId,void(**)(void),void **ctx);

PETSC_INTERN PetscErrorCode PetscCitationsInitialize(void);
PETSC_INTERN PetscErrorCode PetscOptionsFindPair_Private(const char[],const char[],char**,PetscBool*);

PETSC_EXTERN PetscBool PetscCheckPointer(const void*,PetscDataType);

/*
    Macros to test if a PETSc object is valid and if pointers are valid
*/
#if !defined(PETSC_USE_DEBUG)

#define PetscValidHeaderSpecific(h,ck,arg) do

Input Parameters

tp - the data structure type of the object (for example _p_Vec)
pops - the data structure type of the objects operations (for example VecOps)
classid - the classid associated with this object (for example VEC_CLASSID)
class_name - string name of class; should be static (for example "Vec")
com - the MPI Communicator
des - the destroy routine for this object (for example VecDestroy())
vie - the view routine for this object (for example VecView())

Output Parameter

h -the newly created object

Developer Note: This currently is a CPP macro because it takes the types (for example _p_Vec and VecOps) as arguments

See Also

PetscHeaderDestroy(), PetscClassIdRegister()

Level:developer
Location:
include/petsc-private/petscimpl.h
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/snes/examples/tutorials/ex48.c.html
src/ts/examples/tutorials/ex14.c.html