IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 7, 2008, 3:31:01 PM (18 years ago)
Author:
eugene
Message:

big update from eam_branch_20081124 with updates to Opihi math

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/include/dvomath.h

    r15878 r20936  
    44# define DVOMATH_H
    55
     6# define OPIHI_NAME_SIZE 1024
     7
    68# define NCHARS 256
     9# define opihi_flt double
     10# define opihi_int int
     11// NOTE: if opihi_int is changed to unsigned, all subtraction and negation operations
     12// need to result in a float value (or 3 - 5 will yield the unexpected value 2^32 - 2)
     13
     14# define REQUIRE_VECTOR_FLT(VECT,RVAL) { \
     15  if (VECT->type != OPIHI_FLT) { \
     16    gprint (GP_ERR, "function requires vector of type FLT\n"); \
     17    return (RVAL); \
     18  } }
     19
     20# define REQUIRE_VECTOR_INT(VECT,RVAL) {        \
     21  if (VECT->type != OPIHI_INT) { \
     22    gprint (GP_ERR, "function requires vector of type INT\n"); \
     23    return (RVAL); \
     24  } }
    725
    826enum {ANYVECTOR, NEWVECTOR, OLDVECTOR};
    927enum {ANYBUFFER, NEWBUFFER, OLDBUFFER};
     28enum {OPIHI_FLT, OPIHI_INT};
    1029
    1130typedef struct {                        /* representation of a variable (0-D) */
     
    1534
    1635typedef struct {                        /* representation of a vector (1-D) */
    17   char name[1024];
    18   float *elements;
     36  char name[OPIHI_NAME_SIZE];
     37  char type;
     38  union {
     39    void      *Ptr;
     40    opihi_flt *Flt;
     41    opihi_int *Int;
     42  } elements;
    1943  int Nelements;
    2044} Vector;
    2145
    2246typedef struct {                        /* representation of buffer (image) */
    23   char name[1024];
    24   char file[1024];
     47  char name[OPIHI_NAME_SIZE];
     48  char file[OPIHI_NAME_SIZE];
    2549  Header header;
    2650  Matrix matrix;
     
    3256  char   *name;
    3357  char    type;
    34   float  *ptr;
    3558  Buffer *buffer;
    3659  Vector *vector;
    37   float   Float;
     60  opihi_flt FltValue;
     61  opihi_int IntValue;
    3862} StackVar;
    3963
     
    87111void          InitVectors           PROTO((void));
    88112int           CopyVector            PROTO((Vector *out, Vector *in));
     113int           ResetVector           PROTO((Vector *vec, char type, int Nelements));
     114int           SetVector             PROTO((Vector *vec, char type, int Nelements));
     115int           CastVector            PROTO((Vector *vec, char type));
     116int           MatchVector           PROTO((Vector *out, Vector *in, char type));
    89117int           MoveVector            PROTO((Vector *out, Vector *in));
    90118int           DeleteVector          PROTO((Vector *vec));
Note: See TracChangeset for help on using the changeset viewer.