xref: /petsc/src/ts/interface/tsreg.c (revision bdad233f16b1da2fc2320f4673f853efec1db8b6)
173f4d377SMatthew Knepley /*$Id: tsreg.c,v 1.71 2001/08/06 21:18:08 bsmith Exp $*/
23f3760d9SBarry Smith 
3e090d566SSatish Balay #include "src/ts/tsimpl.h"      /*I "petscts.h"  I*/
43f3760d9SBarry Smith 
5*bdad233fSMatthew Knepley PetscFList TSList              = PETSC_NULL;
64c49b128SBarry Smith PetscTruth TSRegisterAllCalled = PETSC_FALSE;
73f3760d9SBarry Smith 
84a2ae208SSatish Balay #undef __FUNCT__
94a2ae208SSatish Balay #define __FUNCT__ "TSSetType"
1082bf6240SBarry Smith /*@C
11ae12b187SLois Curfman McInnes   TSSetType - Sets the method for the timestepping solver.
123f3760d9SBarry Smith 
13fee21e36SBarry Smith   Collective on TS
14fee21e36SBarry Smith 
15bef22f13SLois Curfman McInnes   Input Parameters:
16*bdad233fSMatthew Knepley + ts   - The TS context
17*bdad233fSMatthew Knepley - type - A known method
18bef22f13SLois Curfman McInnes 
19ae12b187SLois Curfman McInnes   Options Database Command:
20*bdad233fSMatthew Knepley . -ts_type <type> - Sets the method; use -help for a list of available methods (for instance, euler)
21ae12b187SLois Curfman McInnes 
223f3760d9SBarry Smith    Notes:
23e090d566SSatish Balay    See "petsc/include/petscts.h" for available methods (for instance)
24d5d37b61SLois Curfman McInnes +  TS_EULER - Euler
25bef22f13SLois Curfman McInnes .  TS_PVODE - PVODE interface
26bef22f13SLois Curfman McInnes .  TS_BEULER - Backward Euler
27d5d37b61SLois Curfman McInnes -  TS_PSEUDO - Pseudo-timestepping
283f3760d9SBarry Smith 
29ae12b187SLois Curfman McInnes    Normally, it is best to use the TSSetFromOptions() command and
30ae12b187SLois Curfman McInnes    then set the TS type from the options database rather than by using
31ae12b187SLois Curfman McInnes    this routine.  Using the options database provides the user with
32ae12b187SLois Curfman McInnes    maximum flexibility in evaluating the many different solvers.
33ae12b187SLois Curfman McInnes    The TSSetType() routine is provided for those situations where it
34ae12b187SLois Curfman McInnes    is necessary to set the timestepping solver independently of the
35ae12b187SLois Curfman McInnes    command line or options database.  This might be the case, for example,
36ae12b187SLois Curfman McInnes    when the choice of solver changes during the execution of the
37ae12b187SLois Curfman McInnes    program, and the user's application is taking responsibility for
38ae12b187SLois Curfman McInnes    choosing the appropriate method.  In other words, this routine is
39d5d37b61SLois Curfman McInnes    not for beginners.
40d5d37b61SLois Curfman McInnes 
41d5d37b61SLois Curfman McInnes    Level: intermediate
423f3760d9SBarry Smith 
43ae12b187SLois Curfman McInnes .keywords: TS, set, type
44*bdad233fSMatthew Knepley .seealso TSSetSerializeType()
453f3760d9SBarry Smith @*/
46454a90a3SBarry Smith int TSSetType(TS ts, TSType type)
473f3760d9SBarry Smith {
48*bdad233fSMatthew Knepley   int      (*r)(TS);
496831982aSBarry Smith   PetscTruth match;
50df8cb225SBarry Smith   int        ierr;
51df8cb225SBarry Smith 
523a40ed3dSBarry Smith   PetscFunctionBegin;
53*bdad233fSMatthew Knepley   PetscValidHeaderSpecific(ts, TS_COOKIE);
54*bdad233fSMatthew Knepley   ierr = PetscTypeCompare((PetscObject) ts, type, &match);                                                CHKERRQ(ierr);
55*bdad233fSMatthew Knepley   if (match == PETSC_TRUE) PetscFunctionReturn(0);
56*bdad233fSMatthew Knepley 
57*bdad233fSMatthew Knepley   /* Get the function pointers for the method requested */
58*bdad233fSMatthew Knepley   if (TSRegisterAllCalled == PETSC_FALSE) {
59*bdad233fSMatthew Knepley     ierr = TSRegisterAll(PETSC_NULL);                                                                     CHKERRQ(ierr);
603f3760d9SBarry Smith   }
61*bdad233fSMatthew Knepley   ierr = PetscFListFind(ts->comm, TSList, type, (void (**)(void)) &r);                                    CHKERRQ(ierr);
62*bdad233fSMatthew Knepley   if (!r) SETERRQ1(PETSC_ERR_ARG_OUTOFRANGE, "Unknown TS type: %s", type);
63*bdad233fSMatthew Knepley 
64*bdad233fSMatthew Knepley   if (ts->sles != PETSC_NULL) {
65*bdad233fSMatthew Knepley     ierr = SLESDestroy(ts->sles);                                                                         CHKERRQ(ierr);
66*bdad233fSMatthew Knepley     ts->sles = PETSC_NULL;
67*bdad233fSMatthew Knepley   }
68*bdad233fSMatthew Knepley   if (ts->snes != PETSC_NULL) {
69*bdad233fSMatthew Knepley     ierr = SNESDestroy(ts->snes);                                                                         CHKERRQ(ierr);
70*bdad233fSMatthew Knepley     ts->snes = PETSC_NULL;
71*bdad233fSMatthew Knepley   }
72*bdad233fSMatthew Knepley   if (ts->ops->destroy != PETSC_NULL) {
73*bdad233fSMatthew Knepley     ierr = (*(ts)->ops->destroy)(ts);                                                                     CHKERRQ(ierr);
74*bdad233fSMatthew Knepley   }
75*bdad233fSMatthew Knepley   ierr = (*r)(ts);                                                                                        CHKERRQ(ierr);
76*bdad233fSMatthew Knepley 
77*bdad233fSMatthew Knepley   ierr = PetscObjectChangeTypeName((PetscObject)ts, type);                                                CHKERRQ(ierr);
783a40ed3dSBarry Smith   PetscFunctionReturn(0);
793f3760d9SBarry Smith }
803f3760d9SBarry Smith 
814a2ae208SSatish Balay #undef __FUNCT__
824a2ae208SSatish Balay #define __FUNCT__ "TSGetType"
833f3760d9SBarry Smith /*@C
84fee21e36SBarry Smith   TSGetType - Gets the TS method type (as a string).
853f3760d9SBarry Smith 
86bef22f13SLois Curfman McInnes   Not Collective
87bef22f13SLois Curfman McInnes 
883f3760d9SBarry Smith   Input Parameter:
89*bdad233fSMatthew Knepley . ts - The TS
903f3760d9SBarry Smith 
913f3760d9SBarry Smith   Output Parameter:
92*bdad233fSMatthew Knepley . type - The name of TS method
933f3760d9SBarry Smith 
94d5d37b61SLois Curfman McInnes   Level: intermediate
95d5d37b61SLois Curfman McInnes 
96df8cb225SBarry Smith .keywords: TS, timestepper, get, type, name
97*bdad233fSMatthew Knepley .seealso TSSetType()
983f3760d9SBarry Smith @*/
9982bf6240SBarry Smith int TSGetType(TS ts, TSType *type)
1003f3760d9SBarry Smith {
1013f3760d9SBarry Smith   int ierr;
1023a40ed3dSBarry Smith 
1033a40ed3dSBarry Smith   PetscFunctionBegin;
104*bdad233fSMatthew Knepley   PetscValidHeaderSpecific(ts, TS_COOKIE);
105*bdad233fSMatthew Knepley   PetscValidPointer(type);
106*bdad233fSMatthew Knepley   if (TSRegisterAllCalled == PETSC_FALSE) {
107*bdad233fSMatthew Knepley     ierr = TSRegisterAll(PETSC_NULL);                                                                     CHKERRQ(ierr);
108*bdad233fSMatthew Knepley   }
10982bf6240SBarry Smith   *type = ts->type_name;
1103a40ed3dSBarry Smith   PetscFunctionReturn(0);
1113f3760d9SBarry Smith }
1123f3760d9SBarry Smith 
1134a2ae208SSatish Balay #undef __FUNCT__
114*bdad233fSMatthew Knepley #define __FUNCT__ "TSSetSerializeType"
115*bdad233fSMatthew Knepley /*@C
116*bdad233fSMatthew Knepley   TSSetSerializeType - Sets the serialization method for the ts.
117ca161407SBarry Smith 
118bef22f13SLois Curfman McInnes   Collective on TS
119bef22f13SLois Curfman McInnes 
120*bdad233fSMatthew Knepley   Input Parameters:
121*bdad233fSMatthew Knepley + ts     - The TS context
122*bdad233fSMatthew Knepley - method - A known method
123ca161407SBarry Smith 
124*bdad233fSMatthew Knepley   Options Database Command:
125*bdad233fSMatthew Knepley . -ts_serialize_type <method> - Sets the method; use -help for a list
126*bdad233fSMatthew Knepley                                 of available methods (for instance, gbeuler_binary)
12715091d37SBarry Smith 
128*bdad233fSMatthew Knepley   Notes:
129*bdad233fSMatthew Knepley   See "petsc/include/ts.h" for available methods (for instance)
130*bdad233fSMatthew Knepley . GTS_SER_BEULER_BINARY - Grid Backwards Euler TS to binary file
131d5d37b61SLois Curfman McInnes 
132*bdad233fSMatthew Knepley   Normally, it is best to use the TSSetFromOptions() command and
133*bdad233fSMatthew Knepley   then set the TS type from the options database rather than by using
134*bdad233fSMatthew Knepley   this routine.  Using the options database provides the user with
135*bdad233fSMatthew Knepley   maximum flexibility in evaluating the many different solvers.
136*bdad233fSMatthew Knepley   The TSSetSerializeType() routine is provided for those situations
137*bdad233fSMatthew Knepley   where it is necessary to set the application ordering independently of the
138*bdad233fSMatthew Knepley   command line or options database.  This might be the case, for example,
139*bdad233fSMatthew Knepley   when the choice of solver changes during the execution of the
140*bdad233fSMatthew Knepley   program, and the user's application is taking responsibility for
141*bdad233fSMatthew Knepley   choosing the appropriate method.  In other words, this routine is
142*bdad233fSMatthew Knepley   not for beginners.
143ca161407SBarry Smith 
144*bdad233fSMatthew Knepley   Level: intermediate
145*bdad233fSMatthew Knepley 
146*bdad233fSMatthew Knepley .keywords: TS, set, type, serialization
147*bdad233fSMatthew Knepley .seealso TSSetType()
148ca161407SBarry Smith @*/
149*bdad233fSMatthew Knepley int TSSetSerializeType(TS ts, TSSerializeType method)
150ca161407SBarry Smith {
151*bdad233fSMatthew Knepley   int      (*r)(MPI_Comm, TS *, PetscViewer, PetscTruth);
152*bdad233fSMatthew Knepley   PetscTruth match;
1534bbc92c1SBarry Smith   int        ierr;
154ca161407SBarry Smith 
155ca161407SBarry Smith   PetscFunctionBegin;
156ca161407SBarry Smith   PetscValidHeaderSpecific(ts, TS_COOKIE);
157*bdad233fSMatthew Knepley   ierr = PetscSerializeCompare((PetscObject) ts, method, &match);                                         CHKERRQ(ierr);
158*bdad233fSMatthew Knepley   if (match == PETSC_TRUE) PetscFunctionReturn(0);
159ca161407SBarry Smith 
160*bdad233fSMatthew Knepley   /* Get the function pointers for the method requested but do not call */
161*bdad233fSMatthew Knepley   if (TSSerializeRegisterAllCalled == PETSC_FALSE) {
162*bdad233fSMatthew Knepley     ierr = TSSerializeRegisterAll(PETSC_NULL);                                                            CHKERRQ(ierr);
1634bbc92c1SBarry Smith   }
164*bdad233fSMatthew Knepley   ierr = PetscFListFind(ts->comm, TSSerializeList, method, (void (**)(void)) &r);                         CHKERRQ(ierr);
165*bdad233fSMatthew Knepley   if (!r) SETERRQ1(PETSC_ERR_ARG_WRONG, "Unknown ts serialization type: %s", method);
1664bbc92c1SBarry Smith 
167*bdad233fSMatthew Knepley   ierr = PetscObjectChangeSerializeName((PetscObject) ts, method);                                        CHKERRQ(ierr);
168ca161407SBarry Smith   PetscFunctionReturn(0);
169ca161407SBarry Smith }
170ca161407SBarry Smith 
171*bdad233fSMatthew Knepley #undef __FUNCT__
172*bdad233fSMatthew Knepley #define __FUNCT__ "TSGetSerializeType"
173*bdad233fSMatthew Knepley /*@C
174*bdad233fSMatthew Knepley   TSGetSerializeType - Gets the TS serialization method (as a string).
17582bf6240SBarry Smith 
176*bdad233fSMatthew Knepley   Not collective
177184914b5SBarry Smith 
178*bdad233fSMatthew Knepley   Input Parameter:
179*bdad233fSMatthew Knepley . ts   - The ts
180*bdad233fSMatthew Knepley 
181*bdad233fSMatthew Knepley   Output Parameter:
182*bdad233fSMatthew Knepley . type - The name of TS serialization method
183*bdad233fSMatthew Knepley 
184*bdad233fSMatthew Knepley   Level: intermediate
185*bdad233fSMatthew Knepley 
186*bdad233fSMatthew Knepley .keywords: TS, get, serialize, type, name
187*bdad233fSMatthew Knepley .seealso TSSetType()
188*bdad233fSMatthew Knepley @*/
189*bdad233fSMatthew Knepley int TSGetSerializeType(TS ts, TSSerializeType *type)
190*bdad233fSMatthew Knepley {
191*bdad233fSMatthew Knepley   int ierr;
192*bdad233fSMatthew Knepley 
193*bdad233fSMatthew Knepley   PetscFunctionBegin;
194*bdad233fSMatthew Knepley   PetscValidHeaderSpecific(ts, TS_COOKIE);
195*bdad233fSMatthew Knepley   PetscValidPointer(type);
196*bdad233fSMatthew Knepley   if (TSSerializeRegisterAllCalled == PETSC_FALSE) {
197*bdad233fSMatthew Knepley     ierr = TSSerializeRegisterAll(PETSC_NULL);                                                            CHKERRQ(ierr);
198*bdad233fSMatthew Knepley   }
199*bdad233fSMatthew Knepley   *type = ts->serialize_name;
200*bdad233fSMatthew Knepley   PetscFunctionReturn(0);
201*bdad233fSMatthew Knepley }
202*bdad233fSMatthew Knepley 
203*bdad233fSMatthew Knepley /*--------------------------------------------------------------------------------------------------------------------*/
204*bdad233fSMatthew Knepley /*@C
205*bdad233fSMatthew Knepley   TSRegister - Adds a creation method to the TS package.
206*bdad233fSMatthew Knepley 
207*bdad233fSMatthew Knepley   Synopsis:
208*bdad233fSMatthew Knepley 
209*bdad233fSMatthew Knepley   TSRegister(char *name, char *path, char *func_name, int (*create_func)(TS))
210*bdad233fSMatthew Knepley 
211*bdad233fSMatthew Knepley   Not Collective
212*bdad233fSMatthew Knepley 
213*bdad233fSMatthew Knepley   Input Parameters:
214*bdad233fSMatthew Knepley + name        - The name of a new user-defined creation routine
215*bdad233fSMatthew Knepley . path        - The path (either absolute or relative) of the library containing this routine
216*bdad233fSMatthew Knepley . func_name   - The name of the creation routine
217*bdad233fSMatthew Knepley - create_func - The creation routine itself
218*bdad233fSMatthew Knepley 
219*bdad233fSMatthew Knepley   Notes:
220*bdad233fSMatthew Knepley   TSRegister() may be called multiple times to add several user-defined tses.
221*bdad233fSMatthew Knepley 
222*bdad233fSMatthew Knepley   If dynamic libraries are used, then the fourth input argument (create_func) is ignored.
223*bdad233fSMatthew Knepley 
224*bdad233fSMatthew Knepley   Sample usage:
225*bdad233fSMatthew Knepley .vb
226*bdad233fSMatthew Knepley   TSRegisterDynamic("my_ts", "/home/username/my_lib/lib/libO/solaris/libmy.a", "MyTSCreate", MyTSCreate);
227*bdad233fSMatthew Knepley .ve
228*bdad233fSMatthew Knepley 
229*bdad233fSMatthew Knepley   Then, your ts type can be chosen with the procedural interface via
230*bdad233fSMatthew Knepley .vb
231*bdad233fSMatthew Knepley     TSCreate(MPI_Comm, TS *);
232*bdad233fSMatthew Knepley     TSSetType(vec, "my_ts")
233*bdad233fSMatthew Knepley .ve
234*bdad233fSMatthew Knepley   or at runtime via the option
235*bdad233fSMatthew Knepley .vb
236*bdad233fSMatthew Knepley     -ts_type my_ts
237*bdad233fSMatthew Knepley .ve
238*bdad233fSMatthew Knepley 
239*bdad233fSMatthew Knepley   Note: $PETSC_ARCH and $BOPT occuring in pathname will be replaced with appropriate values.
240*bdad233fSMatthew Knepley 
241*bdad233fSMatthew Knepley   Level: advanced
242*bdad233fSMatthew Knepley 
243*bdad233fSMatthew Knepley .keywords: TS, register
244*bdad233fSMatthew Knepley .seealso: TSRegisterAll(), TSRegisterDestroy()
245*bdad233fSMatthew Knepley @*/
246*bdad233fSMatthew Knepley #undef __FUNCT__
247*bdad233fSMatthew Knepley #define __FUNCT__ "TSRegister"
248*bdad233fSMatthew Knepley int TSRegister(const char sname[], const char path[], const char name[], int (*function)(TS))
249*bdad233fSMatthew Knepley {
250*bdad233fSMatthew Knepley   char fullname[256];
251*bdad233fSMatthew Knepley   int  ierr;
252*bdad233fSMatthew Knepley 
253*bdad233fSMatthew Knepley   PetscFunctionBegin;
254*bdad233fSMatthew Knepley   ierr = PetscStrcpy(fullname, path);                                                                     CHKERRQ(ierr);
255*bdad233fSMatthew Knepley   ierr = PetscStrcat(fullname, ":");                                                                      CHKERRQ(ierr);
256*bdad233fSMatthew Knepley   ierr = PetscStrcat(fullname, name);                                                                     CHKERRQ(ierr);
257*bdad233fSMatthew Knepley   ierr = PetscFListAdd(&TSList, sname, fullname, (void (*)(void)) function);                              CHKERRQ(ierr);
258*bdad233fSMatthew Knepley   PetscFunctionReturn(0);
259*bdad233fSMatthew Knepley }
260*bdad233fSMatthew Knepley 
261*bdad233fSMatthew Knepley /*@C
262*bdad233fSMatthew Knepley   TSSerializeRegister - Adds a serialization method to the ts package.
263*bdad233fSMatthew Knepley 
264*bdad233fSMatthew Knepley   Synopsis:
265*bdad233fSMatthew Knepley 
266*bdad233fSMatthew Knepley   TSSerializeRegister(char *name, char *path, char *func_name,
267*bdad233fSMatthew Knepley                         int (*serialize_func)(MPI_Comm, TS *, PetscViewer, PetscTruth))
268*bdad233fSMatthew Knepley 
269*bdad233fSMatthew Knepley   Not Collective
270*bdad233fSMatthew Knepley 
271*bdad233fSMatthew Knepley   Input Parameters:
272*bdad233fSMatthew Knepley + name           - The name of a new user-defined serialization routine
273*bdad233fSMatthew Knepley . path           - The path (either absolute or relative) of the library containing this routine
274*bdad233fSMatthew Knepley . func_name      - The name of the serialization routine
275*bdad233fSMatthew Knepley - serialize_func - The serialization routine itself
276*bdad233fSMatthew Knepley 
277*bdad233fSMatthew Knepley   Notes:
278*bdad233fSMatthew Knepley   TSSerializeRegister() may be called multiple times to add several user-defined serializers.
279*bdad233fSMatthew Knepley 
280*bdad233fSMatthew Knepley   If dynamic libraries are used, then the fourth input argument (serialize_func) is ignored.
281*bdad233fSMatthew Knepley 
282*bdad233fSMatthew Knepley   Sample usage:
283*bdad233fSMatthew Knepley .vb
284*bdad233fSMatthew Knepley   TSSerializeRegisterDynamic("my_store", "/home/username/my_lib/lib/libO/solaris/libmy.a", "MyStoreFunc", MyStoreFunc);
285*bdad233fSMatthew Knepley .ve
286*bdad233fSMatthew Knepley 
287*bdad233fSMatthew Knepley   Then, your serialization can be chosen with the procedural interface via
288*bdad233fSMatthew Knepley .vb
289*bdad233fSMatthew Knepley     TSSetSerializeType(ts, "my_store")
290*bdad233fSMatthew Knepley .ve
291*bdad233fSMatthew Knepley   or at runtime via the option
292*bdad233fSMatthew Knepley .vb
293*bdad233fSMatthew Knepley     -ts_serialize_type my_store
294*bdad233fSMatthew Knepley .ve
295*bdad233fSMatthew Knepley 
296*bdad233fSMatthew Knepley   Note: $PETSC_ARCH and $BOPT occuring in pathname will be replaced with appropriate values.
297*bdad233fSMatthew Knepley 
298*bdad233fSMatthew Knepley   Level: advanced
299*bdad233fSMatthew Knepley 
300*bdad233fSMatthew Knepley .keywords: ts, register
301*bdad233fSMatthew Knepley .seealso: TSSerializeRegisterAll(), TSSerializeRegisterDestroy()
302*bdad233fSMatthew Knepley M*/
303*bdad233fSMatthew Knepley #undef __FUNCT__
304*bdad233fSMatthew Knepley #define __FUNCT__ "TSSerializeRegister"
305*bdad233fSMatthew Knepley int TSSerializeRegister(const char sname[], const char path[], const char name[],
306*bdad233fSMatthew Knepley                           int (*function)(MPI_Comm, TS *, PetscViewer, PetscTruth))
307*bdad233fSMatthew Knepley {
308*bdad233fSMatthew Knepley   char fullname[256];
309*bdad233fSMatthew Knepley   int  ierr;
310*bdad233fSMatthew Knepley 
311*bdad233fSMatthew Knepley   PetscFunctionBegin;
312*bdad233fSMatthew Knepley   ierr = PetscStrcpy(fullname, path);                                                                     CHKERRQ(ierr);
313*bdad233fSMatthew Knepley   ierr = PetscStrcat(fullname, ":");                                                                      CHKERRQ(ierr);
314*bdad233fSMatthew Knepley   ierr = PetscStrcat(fullname, name);                                                                     CHKERRQ(ierr);
315*bdad233fSMatthew Knepley   ierr = PetscFListAdd(&TSSerializeList, sname, fullname, (void (*)(void)) function);                     CHKERRQ(ierr);
316*bdad233fSMatthew Knepley   PetscFunctionReturn(0);
317*bdad233fSMatthew Knepley }
318*bdad233fSMatthew Knepley 
319*bdad233fSMatthew Knepley /*-------------------------------------------------------------------------------------------------------------------*/
320*bdad233fSMatthew Knepley #undef __FUNCT__
321*bdad233fSMatthew Knepley #define __FUNCT__ "TSRegisterDestroy"
322*bdad233fSMatthew Knepley /*@C
323*bdad233fSMatthew Knepley    TSRegisterDestroy - Frees the list of timestepping routines that were registered by TSREgister().
324*bdad233fSMatthew Knepley 
325*bdad233fSMatthew Knepley    Not Collective
326*bdad233fSMatthew Knepley 
327*bdad233fSMatthew Knepley    Level: advanced
328*bdad233fSMatthew Knepley 
329*bdad233fSMatthew Knepley .keywords: TS, timestepper, register, destroy
330*bdad233fSMatthew Knepley .seealso: TSRegister(), TSRegisterAll(), TSSerializeRegisterDestroy()
331*bdad233fSMatthew Knepley @*/
332*bdad233fSMatthew Knepley int TSRegisterDestroy(void)
333*bdad233fSMatthew Knepley {
334*bdad233fSMatthew Knepley   int ierr;
335*bdad233fSMatthew Knepley 
336*bdad233fSMatthew Knepley   PetscFunctionBegin;
337*bdad233fSMatthew Knepley   if (TSList != PETSC_NULL) {
338*bdad233fSMatthew Knepley     ierr = PetscFListDestroy(&TSList);                                                                    CHKERRQ(ierr);
339*bdad233fSMatthew Knepley     TSList = PETSC_NULL;
340*bdad233fSMatthew Knepley   }
341*bdad233fSMatthew Knepley   TSRegisterAllCalled = PETSC_FALSE;
342*bdad233fSMatthew Knepley   PetscFunctionReturn(0);
343*bdad233fSMatthew Knepley }
344*bdad233fSMatthew Knepley 
345*bdad233fSMatthew Knepley #undef __FUNCT__
346*bdad233fSMatthew Knepley #define __FUNCT__ "TSSerializeRegisterDestroy"
347*bdad233fSMatthew Knepley /*@C
348*bdad233fSMatthew Knepley   TSSerializeRegisterDestroy - Frees the list of serialization routines for
349*bdad233fSMatthew Knepley   timesteppers that were registered by FListAdd().
350*bdad233fSMatthew Knepley 
351*bdad233fSMatthew Knepley   Not collective
352*bdad233fSMatthew Knepley 
353*bdad233fSMatthew Knepley   Level: advanced
354*bdad233fSMatthew Knepley 
355*bdad233fSMatthew Knepley .keywords: ts, serialization, register, destroy
356*bdad233fSMatthew Knepley .seealso: TSSerializeRegisterAll(), TSRegisterDestroy()
357*bdad233fSMatthew Knepley @*/
358*bdad233fSMatthew Knepley int TSSerializeRegisterDestroy()
359*bdad233fSMatthew Knepley {
360*bdad233fSMatthew Knepley   int ierr;
361*bdad233fSMatthew Knepley 
362*bdad233fSMatthew Knepley   PetscFunctionBegin;
363*bdad233fSMatthew Knepley   if (TSSerializeList != PETSC_NULL) {
364*bdad233fSMatthew Knepley     ierr = PetscFListDestroy(&TSSerializeList);                                                           CHKERRQ(ierr);
365*bdad233fSMatthew Knepley     TSSerializeList = PETSC_NULL;
366*bdad233fSMatthew Knepley   }
367*bdad233fSMatthew Knepley   TSSerializeRegisterAllCalled = PETSC_FALSE;
368*bdad233fSMatthew Knepley   PetscFunctionReturn(0);
369*bdad233fSMatthew Knepley }
370