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