Actual source code: petscfwk.h

  1: #ifndef __PETSCFWK_H

 4:  #include petsc.h

  6: struct _p_PetscFwk;
  7: typedef struct _p_PetscFwk *PetscFwk;

  9: typedef PetscErrorCode (*PetscFwkComponentConfigure)(PetscFwk fwk, PetscInt state, PetscObject *component);

 11: EXTERN PetscErrorCode  PetscFwkInitializePackage(const char path[]);
 12: EXTERN PetscErrorCode  PetscFwkFinalizePackage(void);

 14: EXTERN PetscErrorCode  PetscFwkCreate(MPI_Comm comm, PetscFwk *fwk);
 15: EXTERN PetscErrorCode  PetscFwkDestroy(PetscFwk fwk);
 16: EXTERN PetscErrorCode  PetscFwkRegisterComponent(PetscFwk fwk, const char componenturl[]);
 17: EXTERN PetscErrorCode  PetscFwkRegisterComponentWithID(PetscFwk fwk, const char componenturl[], PetscInt *id);
 18: EXTERN PetscErrorCode  PetscFwkRegisterDependence(PetscFwk fwk, const char clienturl[], const char serverurl[]);
 19: EXTERN PetscErrorCode  PetscFwkGetComponent(PetscFwk fwk, const char url[], PetscObject *component);
 20: EXTERN PetscErrorCode  PetscFwkGetComponentByID(PetscFwk fwk, PetscInt id, PetscObject *component);
 21: EXTERN PetscErrorCode  PetscFwkConfigure(PetscFwk fwk, PetscInt state);
 22: EXTERN PetscErrorCode  PetscFwkViewConfigurationOrder(PetscFwk fwk, PetscViewer viewerASCII);

 24: /* 
 25:    1) 'Create' a PetscFwk fwk, which is created with fwk.state=0
 26:    2) 'Require' some dependencies by listing the dependent components' URLs. For each newly encountered URL, 
 27:       which has the form [<path>/<lib>]:<name>, the following is done:
 28:       a) <lib> is located along the <path>, and is loaded  
 29:       b) the configuration subroutine Configure of type PetscFwkComponentConfigure, with the symbol '<name>Configure',
 30:          is loaded from the library or from the current object, if <path>/<lib> is missing.  
 31:       c) Configure is then run with 'fwk'=fwk, 'state'=fwk.state (which is zero in this case),
 32:          'component'=component (return parameter), to initialize the component.  
 33:          component is expected to use fwk's comm for its own creation/initialization.
 34:       d) More dependency requirements may be posted during each Configure 
 35:    3) Run PetscFwkConfigure on fwk with 'state' equal to the number of cycles to be executed: 
 36:       fwk is configured to be in state='state' by going through that many cycles. 
 37:       a) Components are sorted topologically according to the dependency graph and the state of the fwk is set to 0.
 38:       b) During each cycle the state of the framework is incremented, components are traversed in the topological order
 39:          and the corresponding Configure routine is run with 'fwk'=fwk, 'state'=fwk.state, 'component'=component.
 40: */
 41: #endif