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