Changeset 7766 for trunk/psLib/src/mathtypes
- Timestamp:
- Jun 29, 2006, 4:20:43 PM (20 years ago)
- Location:
- trunk/psLib/src/mathtypes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/mathtypes/psImage.c
r7663 r7766 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.11 0$ $Name: not supported by cvs2svn $12 * @date $Date: 2006-06- 24 00:22:54$11 * @version $Revision: 1.111 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-06-30 02:20:06 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 23 23 #include "psMemory.h" 24 24 #include "psError.h" 25 //#include "psAbort.h"25 #include "psAssert.h" 26 26 #include "psImage.h" 27 27 #include "psString.h" -
trunk/psLib/src/mathtypes/psImage.h
r7579 r7766 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 79$ $Name: not supported by cvs2svn $14 * @date $Date: 2006-06- 15 02:29:12$13 * @version $Revision: 1.80 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2006-06-30 02:20:06 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 242 242 #undef PIXEL_INTERPOLATE_FCNS 243 243 244 /***************************************************************************** 245 PS_IMAGE macros: 246 *****************************************************************************/ 247 #define PS_ASSERT_IMAGE_NON_NULL(NAME, RVAL) PS_ASSERT_GENERAL_IMAGE_NON_NULL(NAME, return RVAL) 248 #define PS_ASSERT_GENERAL_IMAGE_NON_NULL(NAME, CLEANUP) \ 249 if ((NAME) == NULL || (NAME)->data.V == NULL) { \ 250 psError(PS_ERR_BAD_PARAMETER_NULL, true, \ 251 "Unallowable operation: psImage %s or its data is NULL.", \ 252 #NAME); \ 253 CLEANUP; \ 254 } 255 256 #define PS_ASSERT_IMAGE_NON_EMPTY(NAME, RVAL) PS_ASSERT_GENERAL_IMAGE_NON_EMPTY(NAME, return RVAL) 257 #define PS_ASSERT_GENERAL_IMAGE_NON_EMPTY(NAME, CLEANUP) \ 258 if ((NAME)->numCols < 1 || (NAME)->numRows < 1) { \ 259 psError(PS_ERR_BAD_PARAMETER_SIZE, true, \ 260 "Unallowable operation: psImage %s has zero rows or columns (%dx%d).", \ 261 #NAME, (NAME)->numCols, (NAME)->numRows); \ 262 CLEANUP; \ 263 } 264 265 #define PS_ASSERT_IMAGE_TYPE(NAME, TYPE, RVAL) \ 266 if ((NAME)->type.type != TYPE) { \ 267 psError(PS_ERR_BAD_PARAMETER_TYPE, true, \ 268 "Unallowable operation: psImage %s has incorrect type.", \ 269 #NAME); \ 270 return(RVAL); \ 271 } 272 273 #define PS_ASSERT_IMAGES_SIZE_EQUAL(NAME1, NAME2, RVAL) \ 274 if (((NAME1)->numCols != (NAME2)->numCols) || \ 275 ((NAME1)->numRows != (NAME2)->numRows)) { \ 276 psError(PS_ERR_BAD_PARAMETER_SIZE, true, \ 277 "Unallowable operation: psImages %s and %s are not the same size.", \ 278 #NAME1, #NAME2); \ 279 return(RVAL); \ 280 } 281 282 #define PS_ASSERT_IMAGE_SIZE(NAME1, NUM_COLS, NUM_ROWS, RVAL) \ 283 if (((NAME1)->numCols != NUM_COLS) || \ 284 ((NAME1)->numRows != NUM_ROWS)) { \ 285 psError(PS_ERR_BAD_PARAMETER_SIZE, true, \ 286 "Unallowable operation: psImages %s is not the correct size.", \ 287 #NAME1); \ 288 return(RVAL); \ 289 } 290 291 #define PS_IMAGE_PRINT_F32(NAME) \ 292 printf("======== printing %s ========\n", #NAME); \ 293 for (int i = 0 ; i < (NAME)->numRows ; i++) { \ 294 for (int j = 0 ; j < (NAME)->numCols ; j++) { \ 295 printf("%.2f ", (NAME)->data.F32[i][j]); \ 296 } \ 297 printf("\n"); \ 298 }\ 299 300 #define PS_IMAGE_PRINT_F64(NAME) \ 301 printf("======== printing %s ========\n", #NAME); \ 302 for (int i = 0 ; i < (NAME)->numRows ; i++) { \ 303 for (int j = 0 ; j < (NAME)->numCols ; j++) { \ 304 printf("%.2f ", (NAME)->data.F64[i][j]); \ 305 } \ 306 printf("\n"); \ 307 }\ 308 244 309 /// @} 245 310 -
trunk/psLib/src/mathtypes/psVector.h
r7579 r7766 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.5 3$ $Name: not supported by cvs2svn $14 * @date $Date: 2006-06- 15 02:29:12$13 * @version $Revision: 1.54 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2006-06-30 02:20:06 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 269 269 270 270 271 /***************************************************************************** 272 PS_VECTOR macros: 273 *****************************************************************************/ 274 275 #define PS_ASSERT_VECTOR_NON_NULL(NAME, RVAL) PS_ASSERT_GENERAL_VECTOR_NON_NULL(NAME, return RVAL) 276 #define PS_ASSERT_GENERAL_VECTOR_NON_NULL(NAME, CLEANUP) \ 277 if ((NAME) == NULL || (NAME)->data.U8 == NULL) { \ 278 psError(PS_ERR_BAD_PARAMETER_NULL, true, \ 279 "Unallowable operation: psVector %s or its data is NULL.", \ 280 #NAME); \ 281 CLEANUP; \ 282 } \ 283 284 #define PS_ASSERT_VECTOR_NON_EMPTY(NAME, RVAL) PS_ASSERT_GENERAL_VECTOR_NON_EMPTY(NAME, return RVAL) 285 #define PS_ASSERT_GENERAL_VECTOR_NON_EMPTY(NAME, CLEANUP) \ 286 if ((NAME)->n < 1) { \ 287 psError(PS_ERR_BAD_PARAMETER_SIZE, true, \ 288 "Unallowable operation: psVector %s has no elements.", \ 289 #NAME); \ 290 CLEANUP; \ 291 } \ 292 293 #define PS_ASSERT_VECTOR_TYPE_F32_OR_F64(NAME, RVAL) \ 294 if (((NAME)->type.type != PS_TYPE_F32) && ((NAME)->type.type != PS_TYPE_F64)) { \ 295 psError(PS_ERR_BAD_PARAMETER_TYPE, true, \ 296 "psVector %s: bad type(%d)", \ 297 #NAME, NAME->type.type); \ 298 return(RVAL); \ 299 } \ 300 301 #define PS_ASSERT_VECTOR_TYPE_S16_S32_F32(NAME, RVAL) \ 302 if (((NAME)->type.type != PS_TYPE_S16) && ((NAME)->type.type != PS_TYPE_S32) && ((NAME)->type.type != PS_TYPE_F32)) { \ 303 psError(PS_ERR_BAD_PARAMETER_TYPE, true, \ 304 "psVector %s: bad type(%d)", \ 305 #NAME, NAME->type.type); \ 306 return(RVAL); \ 307 } \ 308 309 #define PS_ASSERT_VECTOR_TYPE(NAME, TYPE, RVAL) \ 310 if ((NAME)->type.type != TYPE) { \ 311 psError(PS_ERR_BAD_PARAMETER_TYPE, true, \ 312 "Unallowable operation: psVector %s has incorrect type.", \ 313 #NAME); \ 314 return(RVAL); \ 315 } 316 317 #define PS_ASSERT_VECTORS_SIZE_EQUAL(VEC1, VEC2, RVAL) \ 318 if (VEC1->n != VEC2->n) { \ 319 psError(PS_ERR_BAD_PARAMETER_SIZE, true, \ 320 "psVector %s has size %d, psVector %s has size %d.", \ 321 #VEC1, VEC1->n, #VEC2, VEC2->n); \ 322 return(RVAL); \ 323 } 324 325 #define PS_ASSERT_VECTOR_SIZE(VEC, SIZE, RVAL) \ 326 if (VEC->n != SIZE) { \ 327 psError(PS_ERR_BAD_PARAMETER_SIZE, true, \ 328 "psVector %s has size %d, should be %d.", \ 329 #VEC, VEC->n, SIZE); \ 330 return(RVAL); \ 331 } 332 333 #define PS_ASSERT_VECTOR_TYPE_EQUAL(VEC1, VEC2, RVAL) \ 334 if (VEC1->type.type != VEC2->type.type) { \ 335 psError(PS_ERR_BAD_PARAMETER_SIZE, true, \ 336 "psVector %s has size %d, psVector %s has size %d.", \ 337 #VEC1, VEC1->type.type, #VEC2, VEC2->type.type); \ 338 return(RVAL); \ 339 } 340 341 #define PS_VECTOR_PRINT_F32(NAME) \ 342 if (NAME != NULL) { \ 343 for (int my_i=0;my_i<(NAME)->n;my_i++) { \ 344 printf("%s->data.F32[%d] is %f\n", #NAME, my_i, (NAME)->data.F32[my_i]); \ 345 } \ 346 printf("\n"); \ 347 } else {\ 348 printf("MACRO WARNING: vector %s is NULL.\n", #NAME); \ 349 }\ 350 351 #define PS_VECTOR_PRINT_F64(NAME) \ 352 if (NAME != NULL) { \ 353 for (int my_i=0;my_i<(NAME)->n;my_i++) { \ 354 printf("%s->data.F64[%d] is %f\n", #NAME, my_i, (NAME)->data.F64[my_i]); \ 355 } \ 356 printf("\n"); \ 357 } else {\ 358 printf("MACRO WARNING: vector %s is NULL.\n", #NAME); \ 359 }\ 360 271 361 /// @} 272 362
Note:
See TracChangeset
for help on using the changeset viewer.
