Changeset 5517
- Timestamp:
- Nov 15, 2005, 10:10:32 AM (21 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 6 edited
-
math/psConstants.h (modified) (5 diffs)
-
math/psSpline.c (modified) (7 diffs)
-
math/psSpline.h (modified) (1 diff)
-
math/psStats.c (modified) (3 diffs)
-
sys/psAbort.c (modified) (2 diffs)
-
types/psMetadata.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psConstants.h
r5294 r5517 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.7 8$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-1 0-12 21:02:20$8 * @version $Revision: 1.79 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-11-15 20:10:32 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 222 222 the wrong type. 223 223 *****************************************************************************/ 224 #define PS_WARN_PTR_NON_NULL(NAME) \ 225 if ((NAME) == NULL) { \ 226 psLogMsg(__func__, PS_LOG_WARN, "WARNING: %s is NULL.", #NAME); \ 227 } \ 228 224 229 #define PS_ASSERT_PTR_NON_NULL(NAME, RVAL) PS_ASSERT_GENERAL_PTR_NON_NULL(NAME, return RVAL) 225 230 #define PS_ASSERT_GENERAL_PTR_NON_NULL(NAME, CLEANUP) \ … … 501 506 PS_POLY macros: 502 507 *****************************************************************************/ 508 #define PS_ASSERT_POLY1D(NAME, RVAL) \ 509 if (false == psMemCheckPolynomial1D(NAME)) { \ 510 psError(PS_ERR_BAD_PARAMETER_NULL, true, \ 511 "Unallowable operation: argument %s is not a psPolynomial1D struct.\n",\ 512 #NAME); \ 513 return(RVAL); \ 514 } \ 515 503 516 #define PS_ASSERT_POLY_NON_NULL(NAME, RVAL) \ 504 517 if ((NAME) == NULL || (NAME)->coeff == NULL) { \ … … 582 595 printf("%s->coeff[%d] is %f\n", #NAME, i, NAME->coeff[i]); \ 583 596 }\ 597 598 /***************************************************************************** 599 PS_SPLINE macros: 600 *****************************************************************************/ 601 #define PS_ASSERT_SPLINE(NAME, RVAL) \ 602 if (false == psMemCheckSpline1D(NAME)) { \ 603 psError(PS_ERR_BAD_PARAMETER_NULL, true, \ 604 "Unallowable operation: argument %s is not a psSpline1D struct.\n",\ 605 #NAME); \ 606 return(RVAL); \ 607 } \ 608 609 #define PS_ASSERT_SPLINE_NON_NULL(NAME, RVAL) \ 610 if ((NAME) == NULL) { \ 611 psError(PS_ERR_BAD_PARAMETER_NULL, true, \ 612 "Unallowable operation: psSpline1D %s is NULL.", \ 613 #NAME); \ 614 return(RVAL); \ 615 } \ 584 616 585 617 /***************************************************************************** … … 755 787 ((A) * (A)) 756 788 789 #define PRINT_MEMLEAKS(NUM) \ 790 printf("A: ---------------------------------------- (ID: %d)\n", NUM); \ 791 memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false); \ 792 printf("B: ---------------------------------------- (%d)\n", memLeaks); \ 793 757 794 # define PS_SWAP(X,Y) {double tmp=(X); (X) = (Y); (Y) = tmp;} -
trunk/psLib/src/math/psSpline.c
r5180 r5517 7 7 * splines. 8 8 * 9 * @version $Revision: 1.13 1$ $Name: not supported by cvs2svn $10 * @date $Date: 2005- 09-29 20:06:58$9 * @version $Revision: 1.132 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-11-15 20:10:32 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 496 496 PS_ASSERT_VECTOR_NON_NULL(y, NULL); 497 497 PS_ASSERT_VECTOR_TYPE_F32_OR_F64(y, NULL); 498 PS_ASSERT_INT_LARGER_THAN_OR_EQUAL(y->n, 2, NULL); 498 499 psS32 numSplines = (y->n)-1; 499 500 psTrace(__func__, 5, "numSplines is %d\n", numSplines); 501 502 // 503 // Create the psSpline1D struct. 504 // 505 psSpline1D *spline = psSpline1DAlloc(); 506 spline->n = numSplines; 507 spline->spline = (psPolynomial1D **) psAlloc(numSplines * sizeof(psPolynomial1D *)); 508 for (psS32 i=0;i<numSplines;i++) { 509 spline->spline[i] = psPolynomial1DAlloc(3, PS_POLYNOMIAL_ORD); 510 } 511 500 512 // 501 513 // The following code ensures that xPtr and yPtr points to a psF32 psVector. 502 514 // 503 psVector *xPtr = NULL; 515 // XXX: When you debug, use the vector copy and create routines here: 516 // 517 518 spline->knots = psVectorAlloc(y->n, PS_TYPE_F32); 504 519 if (x != NULL) { 505 520 PS_ASSERT_VECTOR_NON_NULL(x, NULL); 521 PS_ASSERT_VECTORS_SIZE_EQUAL(x, y, NULL); 506 522 PS_ASSERT_VECTOR_TYPE_F32_OR_F64(x, NULL); 507 PS_ASSERT_VECTORS_SIZE_EQUAL(x, y, NULL); 508 // Convert x to F32 if necessary. 509 if (PS_TYPE_F64 == x->type.type) { 510 xPtr = psVectorCopy(NULL, x, PS_TYPE_F32); 511 } else if (PS_TYPE_F32 == x->type.type) { 512 xPtr = (psVector *) x; 523 if (x->type.type == PS_TYPE_F32) { 524 for (psS32 i = 0 ; i < x->n ; i++) { 525 spline->knots->data.F32[i] = x->data.F32[i]; 526 } 527 } else if (x->type.type == PS_TYPE_F64) { 528 for (psS32 i = 0 ; i < x->n ; i++) { 529 spline->knots->data.F32[i] = (psF32) x->data.F64[i]; 530 } 513 531 } 514 532 } else { 515 // Allocate an index vector for x 516 xPtr = psVectorCreate(NULL, 0.0, (psF64) y->n, 1.0, PS_TYPE_F32); 517 } 533 for (psS32 i = 0 ; i < y->n ; i++) { 534 spline->knots->data.F32[i] = (psF32) i; 535 } 536 } 537 psVector *xPtr = spline->knots; 518 538 519 539 psVector *yPtr = NULL; … … 526 546 527 547 // 528 // Create the psSpline1D struct.529 //530 psSpline1D *spline = psSpline1DAlloc();531 spline->n = numSplines;532 spline->spline = (psPolynomial1D **) psAlloc(numSplines * sizeof(psPolynomial1D *));533 for (psS32 i=0;i<numSplines;i++) {534 spline->spline[i] = psPolynomial1DAlloc(3, PS_POLYNOMIAL_ORD);535 }536 spline->knots = psVectorCopy(NULL, xPtr, PS_TYPE_F32);537 //538 548 // Generate the second derivatives at each data point. 539 549 // … … 548 558 psF32 H = xPtr->data.F32[i+1] - xPtr->data.F32[i]; 549 559 if (fabs(H) <= FLT_EPSILON) { 550 psError(PS_ERR_UNKNOWN, false, "x data points are not distinct (%d %d).\n", i, i+1); 560 psError(PS_ERR_UNKNOWN, false, "x data points are not distinct (%d %d) (%f %f).\n", 561 i, i+1, xPtr->data.F32[i], xPtr->data.F32[i+1]); 551 562 } 552 563 psTrace(__func__, 6, "x data (%f - %f) (%f)\n", xPtr->data.F32[i], xPtr->data.F32[i+1], H); … … 609 620 } 610 621 611 if ((x == NULL) || (PS_TYPE_F64 == x->type.type)) {612 psFree(xPtr);613 }614 622 if (PS_TYPE_F64 == y->type.type) { 615 623 psFree(yPtr); … … 618 626 return(spline); 619 627 } 628 629 void PS_POLY1D_PRINT( 630 psPolynomial1D *poly) 631 { 632 printf("-------------- PS_POLY1D_PRINT() --------------\n"); 633 printf("poly->nX is %d\n", poly->nX); 634 for (psS32 i = 0 ; i < (1 + poly->nX) ; i++) { 635 printf("poly->coeff[%d] is %f\n", i, poly->coeff[i]); 636 } 637 } 638 639 void PS_PRINT_SPLINE2(psSpline1D *mySpline) 640 { 641 printf("-------------- PS_PRINT_SPLINE2() --------------\n"); 642 printf("mySpline->n is %d\n", mySpline->n); 643 for (psS32 i = 0 ; i < mySpline->n ; i++) { 644 PS_POLY1D_PRINT(mySpline->spline[i]); 645 } 646 PS_VECTOR_PRINT_F32(mySpline->knots); 647 } 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 620 683 621 684 … … 650 713 // 651 714 psLogMsg(__func__, PS_LOG_WARN, 652 "psSpline1DEval(): x ordinate (%f) is outside the spline range (%f - %f).", 653 x, spline->knots->data.F32[0], 654 spline->knots->data.F32[n-1]); 715 "psSpline1DEval(): x ordinate (%f) is outside the spline range (%f - %f) (%d).", 716 x, spline->knots->data.F32[0], spline->knots->data.F32[n-1], n); 655 717 656 718 if (x < spline->knots->data.F32[0]) { -
trunk/psLib/src/math/psSpline.h
r5155 r5517 6 6 * and evaluate splines. 7 7 * 8 * XXX: What is the purpose of the SplineAlloc() function? 9 * 8 10 * @ingroup GROUP00 9 11 * 10 12 * @author GLG, MHPCC 11 13 * 12 * @version $Revision: 1.5 7$ $Name: not supported by cvs2svn $13 * @date $Date: 2005- 09-27 23:16:59$14 * @version $Revision: 1.58 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-11-15 20:10:32 $ 14 16 * 15 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii -
trunk/psLib/src/math/psStats.c
r5116 r5517 1 1 /** @file psStats.c 2 2 * \brief basic statistical operations 3 * @ingroup Stat s3 * @ingroup Stat 4 4 * 5 5 * This file will hold the definition of the histogram and stats data … … 17 17 * 18 18 * 19 * @version $Revision: 1.1 49$ $Name: not supported by cvs2svn $20 * @date $Date: 2005- 09-24 00:46:45$19 * @version $Revision: 1.150 $ $Name: not supported by cvs2svn $ 20 * @date $Date: 2005-11-15 20:10:32 $ 21 21 * 22 22 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 1676 1676 memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false); \ 1677 1677 printf("B: ---------------------------------------- (%d)\n", memLeaks); \ 1678 */1679 1678 #define PRINT_MEMLEAKS(NUM) \ 1680 1679 memLeaks = currentId; 1680 */ 1681 1681 1682 1682 -
trunk/psLib/src/sys/psAbort.c
r4307 r5517 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2005- 06-17 23:39:51$12 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-11-15 20:10:32 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 24 24 { 25 25 va_list argPtr; // variable list arguement pointer 26 27 26 // Get the variable list parameters to pass to logging function 28 27 va_start(argPtr, format); -
trunk/psLib/src/types/psMetadata.c
r5454 r5517 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.8 8$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-1 0-29 00:05:53$14 * @version $Revision: 1.89 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-11-15 20:10:32 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 966 966 logLevel = 5; 967 967 } 968 psLogSetLevel (logLevel); // XXX: This function should return an error if the log level is invalid968 psLogSetLevel(logLevel); // XXX: This function should return an error if the log level is invalid 969 969 970 970 if ( (argnum = psArgumentGet(*argc, argv, "-logfmt")) ) {
Note:
See TracChangeset
for help on using the changeset viewer.
