Actual source code: tscreate.c

  1: #ifdef PETSC_RCS_HEADER
  2: static char vcid[] = "$Id: tscreate.c,v 1.7 2000/01/10 03:54:25 knepley Exp $";
  3: #endif

 5:  #include src/ts/tsimpl.h

  9: static int TSPublish_Petsc(PetscObject obj)
 10: {
 11: #if defined(PETSC_HAVE_AMS)
 12:   TS   v = (TS) obj;
 13:   int  ierr;
 14: #endif  


 18: #if defined(PETSC_HAVE_AMS)
 19:   /* if it is already published then return */
 20:   if (v->amem >=0) return(0);

 22:   PetscObjectPublishBaseBegin(obj);
 23:   AMS_Memory_add_field((AMS_Memory)v->amem,"Step",&v->steps,1,AMS_INT,AMS_READ,
 24:                                 AMS_COMMON,AMS_REDUCT_UNDEF);
 25:   AMS_Memory_add_field((AMS_Memory)v->amem,"Time",&v->ptime,1,AMS_DOUBLE,AMS_READ,
 26:                                 AMS_COMMON,AMS_REDUCT_UNDEF);
 27:   AMS_Memory_add_field((AMS_Memory)v->amem,"CurrentTimeStep",&v->time_step,1,
 28:                                AMS_DOUBLE,AMS_READ,AMS_COMMON,AMS_REDUCT_UNDEF);
 29:   PetscObjectPublishBaseEnd(obj);
 30: #endif
 31:   return(0);
 32: }

 34: #undef  __FUNCT__
 36: /*@C
 37:   TSCreate - This function creates an empty timestepper. The problem type can then be set with TSSetProblemType() and the 
 38:        type of solver can then be set with TSSetType().

 40:   Collective on MPI_Comm

 42:   Input Parameter:
 43: . comm - The communicator

 45:   Output Parameter:
 46: . ts   - The TS

 48:   Level: beginner

 50: .keywords: TS, create
 51: .seealso: TSSetType(), TSSetUp(), TSDestroy(), MeshCreate(), TSSetProblemType()
 52: @*/
 53: int TSCreate(MPI_Comm comm, TS *ts) {
 54:   TS  t;

 59:   *ts = PETSC_NULL;
 60: #ifndef PETSC_USE_DYNAMIC_LIBRARIES
 61:   TSInitializePackage(PETSC_NULL);
 62: #endif

 64:   PetscHeaderCreate(t, _p_TS, struct _TSOps, TS_COOKIE, -1, "TS", comm, TSDestroy, TSView);
 65:   PetscLogObjectCreate(t);
 66:   PetscLogObjectMemory(t, sizeof(struct _p_TS));
 67:   PetscMemzero(t->ops, sizeof(struct _TSOps));
 68:   t->bops->publish    = TSPublish_Petsc;
 69:   t->type_name        = PETSC_NULL;

 71:   t->ops->applymatrixbc = TSDefaultSystemMatrixBC;
 72:   t->ops->applyrhsbc    = TSDefaultRhsBC;
 73:   t->ops->applysolbc    = TSDefaultSolutionBC;
 74:   t->ops->prestep       = TSDefaultPreStep;
 75:   t->ops->update        = TSDefaultUpdate;
 76:   t->ops->poststep      = TSDefaultPostStep;

 78:   /* General TS description */
 79:   t->problem_type       = TS_LINEAR;
 80:   t->vec_sol            = PETSC_NULL;
 81:   t->vec_sol_always     = PETSC_NULL;
 82:   t->numbermonitors     = 0;
 83:   t->isGTS              = PETSC_FALSE;
 84:   t->isExplicit         = PETSC_NULL;
 85:   t->Iindex             = PETSC_NULL;
 86:   t->ksp               = PETSC_NULL;
 87:   t->A                  = PETSC_NULL;
 88:   t->B                  = PETSC_NULL;
 89:   t->snes               = PETSC_NULL;
 90:   t->funP               = PETSC_NULL;
 91:   t->jacP               = PETSC_NULL;
 92:   t->setupcalled        = 0;
 93:   t->data               = PETSC_NULL;
 94:   t->user               = PETSC_NULL;
 95:   t->max_steps          = 5000;
 96:   t->max_time           = 5.0;
 97:   t->time_step          = .1;
 98:   t->time_step_old      = t->time_step;
 99:   t->initial_time_step  = t->time_step;
100:   t->steps              = 0;
101:   t->ptime              = 0.0;
102:   t->linear_its         = 0;
103:   t->nonlinear_its      = 0;
104:   t->work               = PETSC_NULL;
105:   t->nwork              = 0;

107:   *ts = t;
108:   return(0);
109: }