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