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