Changeset 3332 for issm/trunk/src/c/objects/Param.cpp
- Timestamp:
- 03/24/10 16:53:27 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Param.cpp
r2913 r3332 20 20 /*Object constructors and destructor*/ 21 21 /*FUNCTION Param::constructor {{{1*/ 22 #undef __FUNCT__23 #define __FUNCT__ "Param constructor"24 22 Param::Param(int param_id, char* param_name, int param_type){ 25 23 … … 30 28 (param_type!=DOUBLEVEC) & (param_type!=DOUBLEMAT) & (param_type!=PETSCVEC) & (param_type!=PETSCMAT) 31 29 ){ 32 throw ErrorException(__FUNCT__,exprintf("%s%i"," unknow parameter type ",param_type));30 ISSMERROR(exprintf("%s%i"," unknow parameter type ",param_type)); 33 31 } 34 32 stringarray=NULL; … … 94 92 95 93 default: 96 throw ErrorException(__FUNCT__,exprintf("%s%i","unknow parameter type ",type));94 ISSMERROR(exprintf("%s%i","unknow parameter type ",type)); 97 95 } 98 96 } … … 212 210 213 211 default: 214 throw ErrorException(__FUNCT__,exprintf("%s%i","unknown parameter type",type));212 ISSMERROR(exprintf("%s%i","unknown parameter type",type)); 215 213 } 216 214 … … 221 219 /*}}}*/ 222 220 /*FUNCTION Param::Marshall {{{1*/ 223 #undef __FUNCT__224 #define __FUNCT__ "Marshall"225 221 226 222 void Param::Marshall(char** pmarshalled_dataset){ … … 315 311 316 312 default: 317 throw ErrorException(__FUNCT__,exprintf("%s%i","unknown parameter type",type));313 ISSMERROR(exprintf("%s%i","unknown parameter type",type)); 318 314 break; 319 315 } … … 370 366 371 367 default: 372 throw ErrorException(__FUNCT__,exprintf("%s%i","unknown parameter type",type));368 ISSMERROR(exprintf("%s%i","unknown parameter type",type)); 373 369 } 374 370 … … 384 380 /*}}}*/ 385 381 /*FUNCTION Param::Echo {{{1*/ 386 #undef __FUNCT__387 #define __FUNCT__ "Param echo"388 382 void Param::Echo(void){ 389 383 … … 436 430 437 431 default: 438 throw ErrorException(__FUNCT__,exprintf("%s%i","unknow parameter type ",type));432 ISSMERROR(exprintf("%s%i","unknow parameter type ",type)); 439 433 } 440 434 } … … 447 441 /*}}}*/ 448 442 /*FUNCTION Param::DeepEcho {{{1*/ 449 #undef __FUNCT__450 #define __FUNCT__ "Param Deep Echo"451 443 void Param::DeepEcho(void){ 452 444 … … 498 490 499 491 default: 500 throw ErrorException(__FUNCT__,exprintf("%s%i","unknow parameter type ",type));492 ISSMERROR(exprintf("%s%i","unknow parameter type ",type)); 501 493 } 502 494 } … … 521 513 /*}}}*/ 522 514 /*FUNCTION Param::GetParameterValue(Mat* pmat) {{{1*/ 523 #undef __FUNCT__524 #define __FUNCT__ "GetParameterValue"525 515 526 516 void Param::GetParameterValue(Mat* pmat){ … … 528 518 Mat outmat=NULL; 529 519 530 if(type!=PETSCMAT) throw ErrorException(__FUNCT__,exprintf("%s%i"," error message: trying to recover a Petsc mat from a param with type",type));520 if(type!=PETSCMAT) ISSMERROR(exprintf("%s%i"," error message: trying to recover a Petsc mat from a param with type",type)); 531 521 532 522 if(mat){ … … 547 537 /*}}}*/ 548 538 /*FUNCTION Param::GetParameterValue(double* pdouble) {{{1*/ 549 #undef __FUNCT__550 #define __FUNCT__ "GetParameterValue"551 539 void Param::GetParameterValue(double* pdouble){ 552 540 553 if(type!=DOUBLE) throw ErrorException(__FUNCT__,exprintf("%s%i"," error message: trying to recover a double from a param with type",type));541 if(type!=DOUBLE)ISSMERROR(exprintf("%s%i"," error message: trying to recover a double from a param with type",type)); 554 542 *pdouble=ddouble; 555 543 } 556 544 /*}}}*/ 557 545 /*FUNCTION Param::GetParameterValue(int* pinteger) {{{1*/ 558 #undef __FUNCT__559 #define __FUNCT__ "GetParameterValue"560 546 void Param::GetParameterValue(int* pinteger){ 561 547 562 if(type!=DOUBLE) throw ErrorException(__FUNCT__,exprintf("%s%i"," error message: trying to recover an integer from a param with type",type));548 if(type!=DOUBLE)ISSMERROR(exprintf("%s%i"," error message: trying to recover an integer from a param with type",type)); 563 549 *pinteger=(int)ddouble; 564 550 } 565 551 /*}}}*/ 566 552 /*FUNCTION Param::GetParameterValue(char** pstring) {{{1*/ 567 #undef __FUNCT__568 #define __FUNCT__ "GetParameterValue"569 553 void Param::GetParameterValue(char** pstring){ 570 554 571 555 char* outstring=NULL; 572 556 573 if(type!=STRING) throw ErrorException(__FUNCT__,exprintf("%s%i"," error message: trying to recover a string from a param with type",type));557 if(type!=STRING)ISSMERROR(exprintf("%s%i"," error message: trying to recover a string from a param with type",type)); 574 558 outstring=(char*)xmalloc((strlen(string)+1)*sizeof(char)); 575 559 strcpy(outstring,string); … … 579 563 /*}}}*/ 580 564 /*FUNCTION Param::GetParameterValue(char*** pstringarray) {{{1*/ 581 #undef __FUNCT__582 #define __FUNCT__ "GetParameterValue"583 565 void Param::GetParameterValue(char*** pstringarray){ 584 566 585 567 int i; 586 if(type!=STRINGARRAY) throw ErrorException(__FUNCT__,exprintf("%s%i"," error message: trying to recover a string array from a param with type",type));568 if(type!=STRINGARRAY)ISSMERROR(exprintf("%s%i"," error message: trying to recover a string array from a param with type",type)); 587 569 588 570 char** outstringarray=NULL; … … 597 579 /*}}}*/ 598 580 /*FUNCTION Param::GetParameterValue(double** pdoublearray) {{{1*/ 599 #undef __FUNCT__600 #define __FUNCT__ "GetParameterValue"601 581 602 582 void Param::GetParameterValue(double** pdoublearray){ … … 605 585 double* outdoublearray=NULL; 606 586 607 if((type!=DOUBLEVEC) & (type!=DOUBLEMAT)) throw ErrorException(__FUNCT__,exprintf("%s%i"," error message: trying to recover a double array from a param with type",type));587 if((type!=DOUBLEVEC) & (type!=DOUBLEMAT)) ISSMERROR(exprintf("%s%i"," error message: trying to recover a double array from a param with type",type)); 608 588 609 589 if(type==DOUBLEVEC){ … … 627 607 /*}}}*/ 628 608 /*FUNCTION Param::GetParameterValue(Vec* pvec) {{{1*/ 629 #undef __FUNCT__630 #define __FUNCT__ "GetParameterValue"631 609 void Param::GetParameterValue(Vec* pvec){ 632 610 633 611 Vec outvec=NULL; 634 612 635 if(type!=PETSCVEC) throw ErrorException(__FUNCT__,exprintf("%s%i"," error message: trying to recover a Petsc vec from a param with type",type));613 if(type!=PETSCVEC) ISSMERROR(exprintf("%s%i"," error message: trying to recover a Petsc vec from a param with type",type)); 636 614 637 615 if(vec){ … … 657 635 /*}}}*/ 658 636 /*FUNCTION Param::SetDouble(double value) {{{1*/ 659 #undef __FUNCT__660 #define __FUNCT__ "SetDouble"661 637 void Param::SetDouble(double value){ 662 if (type!=DOUBLE) throw ErrorException(__FUNCT__,exprintf("%s%i"," trying to set double for type",type));638 if (type!=DOUBLE) ISSMERROR(exprintf("%s%i"," trying to set double for type",type)); 663 639 ddouble=value; 664 640 } 665 641 /*}}}*/ 666 642 /*FUNCTION Param::SetDouble(int value) {{{1*/ 667 #undef __FUNCT__668 #define __FUNCT__ "SetDouble"669 643 void Param::SetDouble(int value){ 670 if (type!=DOUBLE) throw ErrorException(__FUNCT__,exprintf("%s%i"," trying to set double for type",type));644 if (type!=DOUBLE) ISSMERROR(exprintf("%s%i"," trying to set double for type",type)); 671 645 ddouble=(double)value; 672 646 } 673 647 /*}}}*/ 674 648 /*FUNCTION Param::SetDoubleMat {{{1*/ 675 #undef __FUNCT__676 #define __FUNCT__ "SetDoubleMat"677 649 void Param::SetDoubleMat(double* value,int pM,int pN){ 678 650 679 if (type!=DOUBLEMAT) throw ErrorException(__FUNCT__,exprintf("%s%i"," trying to set doublematrix type",type));651 if (type!=DOUBLEMAT) ISSMERROR(exprintf("%s%i"," trying to set doublematrix type",type)); 680 652 681 653 this->M=pM; … … 688 660 /*}}}*/ 689 661 /*FUNCTION Param::SetDoubleVec(double* value,int size) {{{1*/ 690 #undef __FUNCT__691 #define __FUNCT__ "SetDoubleVec"692 662 void Param::SetDoubleVec(double* value,int size){ 693 if (type!=DOUBLEVEC) throw ErrorException(__FUNCT__,exprintf("%s%i"," trying to set doublevecfor type",type));663 if (type!=DOUBLEVEC) ISSMERROR(exprintf("%s%i"," trying to set doublevecfor type",type)); 694 664 695 665 M=size; … … 706 676 /*}}}*/ 707 677 /*FUNCTION Param::SetDoubleVec(double* value,int size, int numberofdofs) {{{1*/ 708 #undef __FUNCT__709 #define __FUNCT__ "SetDoubleVec"710 678 void Param::SetDoubleVec(double* value,int size, int numberofdofs){ 711 if (type!=DOUBLEVEC) throw ErrorException(__FUNCT__,exprintf("%s%i"," trying to set doublevecfor type",type));679 if (type!=DOUBLEVEC) ISSMERROR(exprintf("%s%i"," trying to set doublevecfor type",type)); 712 680 713 681 M=size; … … 720 688 /*}}}*/ 721 689 /*FUNCTION Param::SetString {{{1*/ 722 #undef __FUNCT__723 #define __FUNCT__ "SetString"724 690 void Param::SetString(char* value){ 725 if (type!=STRING) throw ErrorException(__FUNCT__,exprintf("%s%i"," trying to set string for type",type));691 if (type!=STRING) ISSMERROR(exprintf("%s%i"," trying to set string for type",type)); 726 692 strcpy(string,value); 727 693 } 728 694 /*}}}*/ 729 695 /*FUNCTION Param::SetStringArray {{{1*/ 730 #undef __FUNCT__731 #define __FUNCT__ "SetStringArray"732 696 void Param::SetStringArray(char** value,int size){ 733 697 734 698 int i; 735 if (type!=STRINGARRAY) throw ErrorException(__FUNCT__,exprintf("%s%i"," trying to set string for type",type));699 if (type!=STRINGARRAY) ISSMERROR(exprintf("%s%i"," trying to set string for type",type)); 736 700 M=size; 737 701 stringarray=(char**)xmalloc(M*sizeof(char*)); … … 744 708 /*}}}*/ 745 709 /*FUNCTION Param::SetVec {{{1*/ 746 #undef __FUNCT__747 #define __FUNCT__ "SetVec"748 710 void Param::SetVec(Vec value){ 749 711
Note:
See TracChangeset
for help on using the changeset viewer.