PetscHeaderCreate

Creates a PETSc object

Synopsis

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

EXTERN PetscErrorCode PetscComposedQuantitiesDestroy(PetscObject obj);
EXTERN PetscErrorCode PETSC_DLLEXPORT PetscHeaderCreate_Private(PetscObject,PetscCookie,PetscInt,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))

EXTERN PetscErrorCode PETSC_DLLEXPORT PetscHeaderDestroy_Private(PetscObject);

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

#if !defined(PETSC_USE_DEBUG)

#define PetscValidHeaderSpecific(h,ck,arg)
#define PetscValidHeader(h,arg)
#define PetscValidPointer(h,arg)
#define PetscValidCharPointer(h,arg)
#define PetscValidIntPointer(h,arg)
#define PetscValidScalarPointer(h,arg)

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

*/
#define PetscValidHeaderSpecific(h,ck,arg)                                            \

Input Parameters

tp - the data structure type of the object
pops - the data structure type of the objects operations (for example VecOps)
cook - the cookie 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(), PetscCookieRegister()

Level:developer
Location:
include/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