xref: /petsc/src/sys/objects/inherit.c (revision 2950f7e747d61362df6d6e1effb073d957ada526)
1 #define PETSC_DLL
2 /*
3      Provides utility routines for manipulating any type of PETSc object.
4 */
5 #include "petscsys.h"  /*I   "petscsys.h"    I*/
6 
7 EXTERN PetscErrorCode PetscObjectGetComm_Petsc(PetscObject,MPI_Comm *);
8 EXTERN PetscErrorCode PetscObjectCompose_Petsc(PetscObject,const char[],PetscObject);
9 EXTERN PetscErrorCode PetscObjectQuery_Petsc(PetscObject,const char[],PetscObject *);
10 EXTERN PetscErrorCode PetscObjectComposeFunction_Petsc(PetscObject,const char[],const char[],void (*)(void));
11 EXTERN PetscErrorCode PetscObjectQueryFunction_Petsc(PetscObject,const char[],void (**)(void));
12 
13 #undef __FUNCT__
14 #define __FUNCT__ "PetscHeaderCreate_Private"
15 /*
16    PetscHeaderCreate_Private - Creates a base PETSc object header and fills
17    in the default values.  Called by the macro PetscHeaderCreate().
18 */
19 PetscErrorCode PETSCSYS_DLLEXPORT PetscHeaderCreate_Private(PetscObject h,PetscClassId classid,PetscInt type,const char class_name[],MPI_Comm comm,
20                                          PetscErrorCode (*des)(PetscObject),PetscErrorCode (*vie)(PetscObject,PetscViewer))
21 {
22   static PetscInt idcnt = 1;
23   PetscErrorCode  ierr;
24 
25   PetscFunctionBegin;
26   h->classid                = classid;
27   h->type                   = type;
28   h->class_name             = (char*)class_name;
29   h->prefix                 = 0;
30   h->refct                  = 1;
31   h->amem                   = -1;
32   h->id                     = idcnt++;
33   h->parentid               = 0;
34   h->qlist                  = 0;
35   h->olist                  = 0;
36   h->bops->destroy          = des;
37   h->bops->view             = vie;
38   h->bops->getcomm          = PetscObjectGetComm_Petsc;
39   h->bops->compose          = PetscObjectCompose_Petsc;
40   h->bops->query            = PetscObjectQuery_Petsc;
41   h->bops->composefunction  = PetscObjectComposeFunction_Petsc;
42   h->bops->queryfunction    = PetscObjectQueryFunction_Petsc;
43   ierr = PetscCommDuplicate(comm,&h->comm,&h->tag);CHKERRQ(ierr);
44   PetscFunctionReturn(0);
45 }
46 
47 extern PetscBool      PetscMemoryCollectMaximumUsage;
48 extern PetscLogDouble PetscMemoryMaximumUsage;
49 
50 #undef __FUNCT__
51 #define __FUNCT__ "PetscHeaderDestroy_Private"
52 /*
53     PetscHeaderDestroy_Private - Destroys a base PETSc object header. Called by
54     the macro PetscHeaderDestroy().
55 */
56 PetscErrorCode PETSCSYS_DLLEXPORT PetscHeaderDestroy_Private(PetscObject h)
57 {
58   PetscErrorCode ierr;
59 
60   PetscFunctionBegin;
61 #if defined(PETSC_HAVE_AMS)
62   if (PetscAMSPublishAll) {
63     ierr = PetscObjectUnPublish((PetscObject)h);CHKERRQ(ierr);
64   }
65 #endif
66   if (PetscMemoryCollectMaximumUsage) {
67     PetscLogDouble usage;
68     ierr = PetscMemoryGetCurrentUsage(&usage);CHKERRQ(ierr);
69     if (usage > PetscMemoryMaximumUsage) PetscMemoryMaximumUsage = usage;
70   }
71   /* first destroy things that could execute arbitrary code */
72   if (h->python_destroy) {
73     void           *python_context          = h->python_context;
74     PetscErrorCode (*python_destroy)(void*) = h->python_destroy;
75     h->python_context = 0;
76     h->python_destroy = 0;
77     ierr = (*python_destroy)(python_context);CHKERRQ(ierr);
78   }
79   ierr = PetscOListDestroy(h->olist);CHKERRQ(ierr);
80   ierr = PetscCommDestroy(&h->comm);CHKERRQ(ierr);
81   /* next destroy other things */
82   h->classid = PETSCFREEDHEADER;
83   ierr = PetscFree(h->bops);CHKERRQ(ierr);
84   ierr = PetscFListDestroy(&h->qlist);CHKERRQ(ierr);
85   ierr = PetscFree(h->type_name);CHKERRQ(ierr);
86   ierr = PetscFree(h->name);CHKERRQ(ierr);
87   ierr = PetscFree(h->prefix);CHKERRQ(ierr);
88   ierr = PetscFree(h->fortran_func_pointers);CHKERRQ(ierr);
89   ierr = PetscFree(h->intcomposeddata);CHKERRQ(ierr);
90   ierr = PetscFree(h->intcomposedstate);CHKERRQ(ierr);
91   ierr = PetscFree(h->realcomposeddata);CHKERRQ(ierr);
92   ierr = PetscFree(h->realcomposedstate);CHKERRQ(ierr);
93   ierr = PetscFree(h->scalarcomposeddata);CHKERRQ(ierr);
94   ierr = PetscFree(h->scalarcomposedstate);CHKERRQ(ierr);
95   PetscFunctionReturn(0);
96 }
97 
98 #undef __FUNCT__
99 #define __FUNCT__ "PetscObjectAddOptionsHandler"
100 /*@C
101     PetscObjectAddOptionsHandler - Adds an additional function to check for options when XXXSetFromOptions() is called.
102 
103     Not Collective
104 
105     Input Parameter:
106 +   obj - the PETSc object
107 .   handle - function that checks for options
108 .   destroy - function to destroy context if provided
109 -   ctx - optional context for check function
110 
111     Level: developer
112 
113 
114 .seealso: KSPSetFromOptions(), PCSetFromOptions(), SNESSetFromOptions(), PetscObjectProcessOptionsHandlers(), PetscObjectDestroyOptionsHandlers()
115 
116 @*/
117 PetscErrorCode PETSCSYS_DLLEXPORT PetscObjectAddOptionsHandler(PetscObject obj,PetscErrorCode (*handle)(PetscObject,void*),PetscErrorCode (*destroy)(PetscObject,void*),void *ctx)
118 {
119   PetscFunctionBegin;
120   if (obj->noptionhandler >= PETSC_MAX_OPTIONS_HANDLER) SETERRQ(obj->comm,PETSC_ERR_ARG_OUTOFRANGE,"To many options handlers added");
121   obj->optionhandler[obj->noptionhandler]   = handle;
122   obj->optiondestroy[obj->noptionhandler]   = destroy;
123   obj->optionctx[obj->noptionhandler++]     = ctx;
124   PetscFunctionReturn(0);
125 }
126 
127 #undef __FUNCT__
128 #define __FUNCT__ "PetscObjectProcessOptionsHandlers"
129 /*@C
130     PetscObjectProcessOptionsHandlers - Calls all the options handler attached to an object
131 
132     Not Collective
133 
134     Input Parameter:
135 .   obj - the PETSc object
136 
137     Level: developer
138 
139 
140 .seealso: KSPSetFromOptions(), PCSetFromOptions(), SNESSetFromOptions(), PetscObjectAddOptionsHandler(), PetscObjectDestroyOptionsHandlers()
141 
142 @*/
143 PetscErrorCode PETSCSYS_DLLEXPORT PetscObjectProcessOptionsHandlers(PetscObject obj)
144 {
145   PetscInt       i;
146   PetscErrorCode ierr;
147 
148   PetscFunctionBegin;
149   for (i=0; i<obj->noptionhandler; i++) {
150     ierr = (*obj->optionhandler[i])(obj,obj->optionctx[i]);CHKERRQ(ierr);
151   }
152   PetscFunctionReturn(0);
153 }
154 
155 #undef __FUNCT__
156 #define __FUNCT__ "PetscObjectDestroyOptionsHandlers"
157 /*@C
158     PetscObjectDestroyOptionsHandlers - Destroys all the option handlers attached to an objeft
159 
160     Not Collective
161 
162     Input Parameter:
163 .   obj - the PETSc object
164 
165     Level: developer
166 
167 
168 .seealso: KSPSetFromOptions(), PCSetFromOptions(), SNESSetFromOptions(), PetscObjectAddOptionsHandler(), PetscObjectProcessOptionsHandlers()
169 
170 @*/
171 PetscErrorCode PETSCSYS_DLLEXPORT PetscObjectDestroyOptionsHandlers(PetscObject obj)
172 {
173   PetscInt       i;
174   PetscErrorCode ierr;
175 
176   PetscFunctionBegin;
177   for (i=0; i<obj->noptionhandler; i++) {
178     ierr = (*obj->optiondestroy[i])(obj,obj->optionctx[i]);CHKERRQ(ierr);
179   }
180   obj->noptionhandler = 0;
181   PetscFunctionReturn(0);
182 }
183 
184 
185 #undef __FUNCT__
186 #define __FUNCT__ "PetscObjectReference"
187 /*@
188    PetscObjectReference - Indicates to any PetscObject that it is being
189    referenced by another PetscObject. This increases the reference
190    count for that object by one.
191 
192    Logically Collective on PetscObject
193 
194    Input Parameter:
195 .  obj - the PETSc object. This must be cast with (PetscObject), for example,
196          PetscObjectReference((PetscObject)mat);
197 
198    Level: advanced
199 
200 .seealso: PetscObjectCompose(), PetscObjectDereference()
201 @*/
202 PetscErrorCode PETSCSYS_DLLEXPORT PetscObjectReference(PetscObject obj)
203 {
204   PetscFunctionBegin;
205   PetscValidHeader(obj,1);
206   obj->refct++;
207   PetscFunctionReturn(0);
208 }
209 
210 #undef __FUNCT__
211 #define __FUNCT__ "PetscObjectGetReference"
212 /*@
213    PetscObjectGetReference - Gets the current reference count for
214    any PETSc object.
215 
216    Not Collective
217 
218    Input Parameter:
219 .  obj - the PETSc object; this must be cast with (PetscObject), for example,
220          PetscObjectGetReference((PetscObject)mat,&cnt);
221 
222    Output Parameter:
223 .  cnt - the reference count
224 
225    Level: advanced
226 
227 .seealso: PetscObjectCompose(), PetscObjectDereference(), PetscObjectReference()
228 @*/
229 PetscErrorCode PETSCSYS_DLLEXPORT PetscObjectGetReference(PetscObject obj,PetscInt *cnt)
230 {
231   PetscFunctionBegin;
232   PetscValidHeader(obj,1);
233   PetscValidIntPointer(cnt,2);
234   *cnt = obj->refct;
235   PetscFunctionReturn(0);
236 }
237 
238 #undef __FUNCT__
239 #define __FUNCT__ "PetscObjectDereference"
240 /*@
241    PetscObjectDereference - Indicates to any PetscObject that it is being
242    referenced by one less PetscObject. This decreases the reference
243    count for that object by one.
244 
245    Collective on PetscObject if reference reaches 0 otherwise Logically Collective
246 
247    Input Parameter:
248 .  obj - the PETSc object; this must be cast with (PetscObject), for example,
249          PetscObjectDereference((PetscObject)mat);
250 
251    Level: advanced
252 
253 .seealso: PetscObjectCompose(), PetscObjectReference()
254 @*/
255 PetscErrorCode PETSCSYS_DLLEXPORT PetscObjectDereference(PetscObject obj)
256 {
257   PetscErrorCode ierr;
258 
259   PetscFunctionBegin;
260   PetscValidHeader(obj,1);
261   if (obj->bops->destroy) {
262     ierr = (*obj->bops->destroy)(obj);CHKERRQ(ierr);
263   } else if (!--obj->refct) {
264     SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"This PETSc object does not have a generic destroy routine");
265   }
266   PetscFunctionReturn(0);
267 }
268 
269 /* ----------------------------------------------------------------------- */
270 /*
271      The following routines are the versions private to the PETSc object
272      data structures.
273 */
274 #undef __FUNCT__
275 #define __FUNCT__ "PetscObjectGetComm_Petsc"
276 PetscErrorCode PetscObjectGetComm_Petsc(PetscObject obj,MPI_Comm *comm)
277 {
278   PetscFunctionBegin;
279   *comm = obj->comm;
280   PetscFunctionReturn(0);
281 }
282 
283 #undef __FUNCT__
284 #define __FUNCT__ "PetscObjectCompose_Petsc"
285 PetscErrorCode PetscObjectCompose_Petsc(PetscObject obj,const char name[],PetscObject ptr)
286 {
287   PetscErrorCode ierr;
288   char           *tname;
289 
290   PetscFunctionBegin;
291   if (ptr) {
292     ierr = PetscOListReverseFind(ptr->olist,obj,&tname);CHKERRQ(ierr);
293     if (tname) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"An object cannot be composed with an object that was compose with it");
294   }
295   ierr = PetscOListAdd(&obj->olist,name,ptr);CHKERRQ(ierr);
296   PetscFunctionReturn(0);
297 }
298 
299 #undef __FUNCT__
300 #define __FUNCT__ "PetscObjectQuery_Petsc"
301 PetscErrorCode PetscObjectQuery_Petsc(PetscObject obj,const char name[],PetscObject *ptr)
302 {
303   PetscErrorCode ierr;
304 
305   PetscFunctionBegin;
306   ierr = PetscOListFind(obj->olist,name,ptr);CHKERRQ(ierr);
307   PetscFunctionReturn(0);
308 }
309 
310 #undef __FUNCT__
311 #define __FUNCT__ "PetscObjectComposeFunction_Petsc"
312 PetscErrorCode PetscObjectComposeFunction_Petsc(PetscObject obj,const char name[],const char fname[],void (*ptr)(void))
313 {
314   PetscErrorCode ierr;
315 
316   PetscFunctionBegin;
317   ierr = PetscFListAdd(&obj->qlist,name,fname,ptr);CHKERRQ(ierr);
318   PetscFunctionReturn(0);
319 }
320 
321 #undef __FUNCT__
322 #define __FUNCT__ "PetscObjectQueryFunction_Petsc"
323 PetscErrorCode PetscObjectQueryFunction_Petsc(PetscObject obj,const char name[],void (**ptr)(void))
324 {
325   PetscErrorCode ierr;
326 
327   PetscFunctionBegin;
328   ierr = PetscFListFind(obj->qlist,obj->comm,name,ptr);CHKERRQ(ierr);
329   PetscFunctionReturn(0);
330 }
331 
332 /*
333         These are the versions that are usable to any CCA compliant objects
334 */
335 #undef __FUNCT__
336 #define __FUNCT__ "PetscObjectCompose"
337 /*@C
338    PetscObjectCompose - Associates another PETSc object with a given PETSc object.
339 
340    Not Collective
341 
342    Input Parameters:
343 +  obj - the PETSc object; this must be cast with (PetscObject), for example,
344          PetscObjectCompose((PetscObject)mat,...);
345 .  name - name associated with the child object
346 -  ptr - the other PETSc object to associate with the PETSc object; this must also be
347          cast with (PetscObject)
348 
349    Level: advanced
350 
351    Notes:
352    The second objects reference count is automatically increased by one when it is
353    composed.
354 
355    Replaces any previous object that had the same name.
356 
357    If ptr is null and name has previously been composed using an object, then that
358    entry is removed from the obj.
359 
360    PetscObjectCompose() can be used with any PETSc object (such as
361    Mat, Vec, KSP, SNES, etc.) or any user-provided object.  See
362    PetscContainerCreate() for info on how to create an object from a
363    user-provided pointer that may then be composed with PETSc objects.
364 
365    Concepts: objects^composing
366    Concepts: composing objects
367 
368 .seealso: PetscObjectQuery(), PetscContainerCreate()
369 @*/
370 PetscErrorCode PETSCSYS_DLLEXPORT PetscObjectCompose(PetscObject obj,const char name[],PetscObject ptr)
371 {
372   PetscErrorCode ierr;
373 
374   PetscFunctionBegin;
375   PetscValidHeader(obj,1);
376   PetscValidCharPointer(name,2);
377   if (ptr) PetscValidHeader(ptr,3);
378   ierr = (*obj->bops->compose)(obj,name,ptr);CHKERRQ(ierr);
379   PetscFunctionReturn(0);
380 }
381 
382 
383 
384 #undef __FUNCT__
385 #define __FUNCT__ "PetscObjectQuery"
386 /*@C
387    PetscObjectQuery  - Gets a PETSc object associated with a given object.
388 
389    Not Collective
390 
391    Input Parameters:
392 +  obj - the PETSc object
393          Thus must be cast with a (PetscObject), for example,
394          PetscObjectCompose((PetscObject)mat,...);
395 .  name - name associated with child object
396 -  ptr - the other PETSc object associated with the PETSc object, this must also be
397          cast with (PetscObject)
398 
399    Level: advanced
400 
401    Concepts: objects^composing
402    Concepts: composing objects
403    Concepts: objects^querying
404    Concepts: querying objects
405 
406 .seealso: PetscObjectQuery()
407 @*/
408 PetscErrorCode PETSCSYS_DLLEXPORT PetscObjectQuery(PetscObject obj,const char name[],PetscObject *ptr)
409 {
410   PetscErrorCode ierr;
411 
412   PetscFunctionBegin;
413   PetscValidHeader(obj,1);
414   PetscValidCharPointer(name,2);
415   PetscValidPointer(ptr,3);
416   ierr = (*obj->bops->query)(obj,name,ptr);CHKERRQ(ierr);
417   PetscFunctionReturn(0);
418 }
419 
420 #undef __FUNCT__
421 #define __FUNCT__ "PetscObjectComposeFunction"
422 PetscErrorCode PETSCSYS_DLLEXPORT PetscObjectComposeFunction(PetscObject obj,const char name[],const char fname[],void (*ptr)(void))
423 {
424   PetscErrorCode ierr;
425 
426   PetscFunctionBegin;
427   PetscValidHeader(obj,1);
428   PetscValidCharPointer(name,2);
429   PetscValidCharPointer(fname,3);
430   ierr = (*obj->bops->composefunction)(obj,name,fname,ptr);CHKERRQ(ierr);
431   PetscFunctionReturn(0);
432 }
433 
434 #undef __FUNCT__
435 #define __FUNCT__ "PetscObjectQueryFunction"
436 /*@C
437    PetscObjectQueryFunction - Gets a function associated with a given object.
438 
439    Logically Collective on PetscObject
440 
441    Input Parameters:
442 +  obj - the PETSc object; this must be cast with (PetscObject), for example,
443          PetscObjectQueryFunction((PetscObject)ksp,...);
444 -  name - name associated with the child function
445 
446    Output Parameter:
447 .  ptr - function pointer
448 
449    Level: advanced
450 
451    Concepts: objects^composing functions
452    Concepts: composing functions
453    Concepts: functions^querying
454    Concepts: objects^querying
455    Concepts: querying objects
456 
457 .seealso: PetscObjectComposeFunctionDynamic()
458 @*/
459 PetscErrorCode PETSCSYS_DLLEXPORT PetscObjectQueryFunction(PetscObject obj,const char name[],void (**ptr)(void))
460 {
461   PetscErrorCode ierr;
462 
463   PetscFunctionBegin;
464   PetscValidHeader(obj,1);
465   PetscValidCharPointer(name,2);
466   ierr = (*obj->bops->queryfunction)(obj,name,ptr);CHKERRQ(ierr);
467   PetscFunctionReturn(0);
468 }
469 
470 struct _p_PetscContainer {
471   PETSCHEADER(int);
472   void   *ptr;
473   PetscErrorCode (*userdestroy)(void*);
474 };
475 
476 #undef __FUNCT__
477 #define __FUNCT__ "PetscContainerGetPointer"
478 /*@C
479    PetscContainerGetPointer - Gets the pointer value contained in the container.
480 
481    Not Collective
482 
483    Input Parameter:
484 .  obj - the object created with PetscContainerCreate()
485 
486    Output Parameter:
487 .  ptr - the pointer value
488 
489    Level: advanced
490 
491 .seealso: PetscContainerCreate(), PetscContainerDestroy(),
492           PetscContainerSetPointer()
493 @*/
494 PetscErrorCode PETSCSYS_DLLEXPORT PetscContainerGetPointer(PetscContainer obj,void **ptr)
495 {
496   PetscFunctionBegin;
497   PetscValidHeaderSpecific(obj,PETSC_CONTAINER_CLASSID,1);
498   PetscValidPointer(ptr,2);
499   *ptr = obj->ptr;
500   PetscFunctionReturn(0);
501 }
502 
503 
504 #undef __FUNCT__
505 #define __FUNCT__ "PetscContainerSetPointer"
506 /*@C
507    PetscContainerSetPointer - Sets the pointer value contained in the container.
508 
509    Logically Collective on PetscContainer
510 
511    Input Parameters:
512 +  obj - the object created with PetscContainerCreate()
513 -  ptr - the pointer value
514 
515    Level: advanced
516 
517 .seealso: PetscContainerCreate(), PetscContainerDestroy(),
518           PetscContainerGetPointer()
519 @*/
520 PetscErrorCode PETSCSYS_DLLEXPORT PetscContainerSetPointer(PetscContainer obj,void *ptr)
521 {
522   PetscFunctionBegin;
523   PetscValidHeaderSpecific(obj,PETSC_CONTAINER_CLASSID,1);
524   if (ptr) PetscValidPointer(ptr,2);
525   obj->ptr = ptr;
526   PetscFunctionReturn(0);
527 }
528 
529 #undef __FUNCT__
530 #define __FUNCT__ "PetscContainerDestroy"
531 /*@C
532    PetscContainerDestroy - Destroys a PETSc container object.
533 
534    Collective on PetscContainer
535 
536    Input Parameter:
537 .  obj - an object that was created with PetscContainerCreate()
538 
539    Level: advanced
540 
541 .seealso: PetscContainerCreate()
542 @*/
543 PetscErrorCode PETSCSYS_DLLEXPORT PetscContainerDestroy(PetscContainer obj)
544 {
545   PetscErrorCode ierr;
546   PetscFunctionBegin;
547   PetscValidHeaderSpecific(obj,PETSC_CONTAINER_CLASSID,1);
548   if (--((PetscObject)obj)->refct > 0) PetscFunctionReturn(0);
549   if (obj->userdestroy) (*obj->userdestroy)(obj->ptr);
550   ierr = PetscHeaderDestroy(obj);CHKERRQ(ierr);
551   PetscFunctionReturn(0);
552 }
553 
554 #undef __FUNCT__
555 #define __FUNCT__ "PetscContainerSetUserDestroy"
556 /*@C
557    PetscContainerSetUserDestroy - Sets name of the user destroy function.
558 
559    Logically Collective on PetscContainer
560 
561    Input Parameter:
562 +  obj - an object that was created with PetscContainerCreate()
563 -  des - name of the user destroy function
564 
565    Level: advanced
566 
567 .seealso: PetscContainerDestroy()
568 @*/
569 PetscErrorCode PETSCSYS_DLLEXPORT PetscContainerSetUserDestroy(PetscContainer obj, PetscErrorCode (*des)(void*))
570 {
571   PetscFunctionBegin;
572   PetscValidHeaderSpecific(obj,PETSC_CONTAINER_CLASSID,1);
573   obj->userdestroy = des;
574   PetscFunctionReturn(0);
575 }
576 
577 PetscClassId PETSCSYS_DLLEXPORT PETSC_CONTAINER_CLASSID;
578 
579 #undef __FUNCT__
580 #define __FUNCT__ "PetscContainerCreate"
581 /*@C
582    PetscContainerCreate - Creates a PETSc object that has room to hold
583    a single pointer. This allows one to attach any type of data (accessible
584    through a pointer) with the PetscObjectCompose() function to a PetscObject.
585    The data item itself is attached by a call to PetscContainerSetPointer.
586 
587    Collective on MPI_Comm
588 
589    Input Parameters:
590 .  comm - MPI communicator that shares the object
591 
592    Output Parameters:
593 .  container - the container created
594 
595    Level: advanced
596 
597 .seealso: PetscContainerDestroy(), PetscContainerSetPointer(), PetscContainerGetPointer()
598 @*/
599 PetscErrorCode PETSCSYS_DLLEXPORT PetscContainerCreate(MPI_Comm comm,PetscContainer *container)
600 {
601   PetscErrorCode ierr;
602   PetscContainer contain;
603 
604   PetscFunctionBegin;
605   PetscValidPointer(container,2);
606   ierr = PetscHeaderCreate(contain,_p_PetscContainer,PetscInt,PETSC_CONTAINER_CLASSID,0,"PetscContainer",comm,PetscContainerDestroy,0);CHKERRQ(ierr);
607   *container = contain;
608   PetscFunctionReturn(0);
609 }
610 
611 #undef __FUNCT__
612 #define __FUNCT__ "PetscObjectSetFromOptions"
613 /*@
614    PetscObjectSetFromOptions - Sets generic parameters from user options.
615 
616    Collective on obj
617 
618    Input Parameter:
619 .  obj - the PetscObjcet
620 
621    Options Database Keys:
622 
623    Notes:
624    We have no generic options at present, so this does nothing
625 
626    Level: beginner
627 
628 .keywords: set, options, database
629 .seealso: PetscObjectSetOptionsPrefix(), PetscObjectGetOptionsPrefix()
630 @*/
631 PetscErrorCode PETSCSYS_DLLEXPORT PetscObjectSetFromOptions(PetscObject obj)
632 {
633   PetscFunctionBegin;
634   PetscValidHeader(obj,1);
635   PetscFunctionReturn(0);
636 }
637 
638 #undef __FUNCT__
639 #define __FUNCT__ "PetscObjectSetUp"
640 /*@
641    PetscObjectSetUp - Sets up the internal data structures for the later use.
642 
643    Collective on PetscObject
644 
645    Input Parameters:
646 .  obj - the PetscObject
647 
648    Notes:
649    This does nothing at present.
650 
651    Level: advanced
652 
653 .keywords: setup
654 .seealso: PetscObjectDestroy()
655 @*/
656 PetscErrorCode PETSCSYS_DLLEXPORT PetscObjectSetUp(PetscObject obj)
657 {
658   PetscFunctionBegin;
659   PetscValidHeader(obj,1);
660   PetscFunctionReturn(0);
661 }
662