petsc-3.3-p7 2013-05-11

PetscHeaderCreate

Creates a PETSc object

Synopsis

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

PETSC_EXTERN PetscErrorCode PetscComposedQuantitiesDestroy(PetscObject obj);
PETSC_EXTERN PetscErrorCode PetscHeaderCreate_Private(PetscObject,PetscClassId,PetscInt,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()

    

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

PETSC_EXTERN PetscErrorCode PetscHeaderDestroy_Private(PetscObject);
PETSC_EXTERN PetscErrorCode PetscObjectCopyFortranFunctionPointers(PetscObject,PetscObject);

/* ---------------------------------------------------------------------------------------*/

#if !defined(PETSC_USE_DEBUG)

#define PetscValidHeaderSpecific(h,ck,arg) do

Input Parameters

tp - the data structure type of the object
pops - the data structure type of the objects operations (for example VecOps)
cook - the classid associated with this object
t - type (no longer should be used)
class_name - string name of class; should be static
com - the MPI Communicator
des - the destroy routine for this object
vie - the view routine for this object

Output Parameter

h -the newly created object

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