Changeset 4821
- Timestamp:
- Aug 19, 2005, 11:27:43 AM (21 years ago)
- Location:
- trunk/psLib/src/mathtypes
- Files:
-
- 2 edited
-
psVector.c (modified) (2 diffs)
-
psVector.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/mathtypes/psVector.c
r4597 r4821 9 9 * @author Robert DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1.4 7$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-0 7-22 22:18:23 $11 * @version $Revision: 1.48 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-08-19 21:27:43 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 607 607 return (true); 608 608 } 609 610 611 bool psVectorInit(psVector *image, 612 ...) 613 { 614 615 va_list argp; 616 psU8 vU8; 617 psU16 vU16; 618 psU32 vU32; 619 psU64 vU64; 620 psS8 vS8; 621 psS16 vS16; 622 psS32 vS32; 623 psS64 vS64; 624 psF32 vF32; 625 psF64 vF64; 626 psC32 vC32; 627 psC64 vC64; 628 629 if (image == NULL) 630 return (false); 631 632 va_start (argp, image); 633 634 switch (image->type.type) { 635 case PS_TYPE_U8: 636 vU8 = va_arg (argp, psU32); 637 638 for (long iy = 0; iy < image->n; iy++) { 639 // for (int ix = 0; ix < image->numCols; ix++) { 640 image->data.U8[iy] = vU8; 641 // } 642 } 643 break; 644 645 case PS_TYPE_F32: 646 vF32 = va_arg (argp, psF64); 647 648 for (long iy = 0; iy < image->n; iy++) { 649 // for (int ix = 0; ix < image->numCols; ix++) { 650 image->data.F32[iy] = vF32; 651 // } 652 } 653 return (true); 654 655 case PS_TYPE_F64: 656 vF64 = va_arg (argp, psF64); 657 658 for (long iy = 0; iy < image->n; iy++) { 659 // for (int ix = 0; ix < image->numCols; ix++) { 660 image->data.F64[iy] = vF64; 661 // } 662 } 663 return (true); 664 case PS_TYPE_U16: 665 vU16 = va_arg (argp, psU32); 666 667 for (long iy = 0; iy < image->n; iy++) { 668 image->data.U16[iy] = vU16; 669 } 670 return (true); 671 case PS_TYPE_U32: 672 vU32 = va_arg (argp, psU32); 673 674 for (long iy = 0; iy < image->n; iy++) { 675 image->data.U32[iy] = vU32; 676 } 677 return (true); 678 case PS_TYPE_U64: 679 vU64 = va_arg (argp, psU64); 680 681 for (long iy = 0; iy < image->n; iy++) { 682 image->data.U64[iy] = vU64; 683 } 684 return (true); 685 case PS_TYPE_S8: 686 vS8 = va_arg (argp, psS32); 687 688 for (long iy = 0; iy < image->n; iy++) { 689 image->data.S8[iy] = vS8; 690 } 691 return (true); 692 case PS_TYPE_S16: 693 vS16 = va_arg (argp, psS32); 694 695 for (long iy = 0; iy < image->n; iy++) { 696 image->data.S16[iy] = vS16; 697 } 698 return (true); 699 case PS_TYPE_S32: 700 vS32 = va_arg (argp, psS32); 701 702 for (long iy = 0; iy < image->n; iy++) { 703 image->data.S32[iy] = vS32; 704 } 705 return (true); 706 case PS_TYPE_S64: 707 vS64 = va_arg (argp, psS64); 708 709 for (long iy = 0; iy < image->n; iy++) { 710 image->data.S64[iy] = vS64; 711 } 712 return (true); 713 case PS_TYPE_C32: 714 vC32 = va_arg (argp, psC32); 715 716 for (long iy = 0; iy < image->n; iy++) { 717 image->data.C32[iy] = vC32; 718 } 719 return (true); 720 case PS_TYPE_C64: 721 vC64 = va_arg (argp, psC64); 722 723 for (long iy = 0; iy < image->n; iy++) { 724 image->data.C64[iy] = vC64; 725 } 726 return (true); 727 728 default: 729 psError (PS_ERR_BAD_PARAMETER_TYPE, true, "datatype %d not defined in psImageInit\n", image->type); 730 return (false); 731 } 732 return (false); 733 } 734 735 -
trunk/psLib/src/mathtypes/psVector.h
r4597 r4821 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 39$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-0 7-22 22:18:18$13 * @version $Revision: 1.40 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-08-19 21:27:43 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 206 206 ); 207 207 208 /** Initializes the vector with the given value. 209 * 210 * The input data is cast to match the vector datatype, allowing for integers to be preserved. 211 * 212 * @return bool: True if successful, otherwise false. 213 */ 214 bool psVectorInit( 215 psVector *image, ///< the vector to be initialized 216 ... ///< Variable argument list for initialization 217 ); 218 208 219 /// @} 209 220
Note:
See TracChangeset
for help on using the changeset viewer.
