IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 24, 2006, 12:55:05 PM (20 years ago)
Author:
Paul Price
Message:

Following today's meeting, we agreed that psVectorAlloc (and therefore
psArrayAlloc also) shall set the number of elements in use to equal the
number of elements allocated. We introduce new functions,
psVectorAllocEmpty and psArrayAllocEmpty, that allocate a vector and set
the length to zero.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/astrom/pmAstrometryObjects.c

    r9639 r9730  
    88*  @author EAM, IfA
    99*
    10 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2006-10-19 02:56:40 $
     10*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2006-10-24 22:55:04 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    7676                            const double RADIUS) // matching radius
    7777{
    78     psArray *matches = psArrayAlloc(x1->n);
    79     matches->n = 0;
     78    psArray *matches = psArrayAllocEmpty(x1->n);
    8079
    8180    const double RADIUS_SQR = PS_SQR(RADIUS);
     
    144143    /* sort both lists by X coord; st1 first */ \
    145144    psVector *x1 = psVectorAlloc(st1->n, PS_TYPE_F64); \
    146     \
    147     x1->n = x1->nalloc; \
    148145    for (int i = 0; i < st1->n; i++) { \
    149146        x1->data.F64[i] = ((pmAstromObj *)st1->data[i])->MEMBER->x; \
     
    153150    \
    154151    psVector *y1 = psVectorAlloc(st1->n, PS_TYPE_F64); \
    155     y1->n = y1->nalloc; \
    156152    for (int i = 0; i < st1->n; i++) { \
    157153        x1->data.F64[i] = ((pmAstromObj *)st1->data[sorted1->data.S32[i]])->MEMBER->x; \
     
    161157    /* now st2 */ \
    162158    psVector *x2 = psVectorAlloc(st2->n, PS_TYPE_F64); \
    163     x2->n = x2->nalloc; \
    164159    for (int i = 0; i < st2->n; i++) { \
    165160        x2->data.F64[i] = ((pmAstromObj *)st2->data[i])->MEMBER->x; \
     
    168163    \
    169164    psVector *y2 = psVectorAlloc(st2->n, PS_TYPE_F64); \
    170     y2->n = y2->nalloc; \
    171165    for (int i = 0; i < st2->n; i++) { \
    172166        x2->data.F64[i] = ((pmAstromObj *)st2->data[sorted2->data.S32[i]])->MEMBER->x; \
     
    236230    psVector *y = psVectorAlloc (match->n, PS_TYPE_F32);
    237231    psVector *wt = psVectorAlloc (match->n, PS_TYPE_F32);
    238     X->n = X->nalloc;
    239     Y->n = Y->nalloc;
    240     x->n = x->nalloc;
    241     y->n = y->nalloc;
    242     wt->n = wt->nalloc;
    243232    // take the matched stars, first fit
    244233    for (int i = 0; i < match->n; i++) {
     
    259248    // constant errors
    260249    psVector *mask = psVectorAlloc (match->n, PS_TYPE_U8);
    261     mask->n = match->n;
    262250    psVectorInit (mask, 0);
    263251
     
    352340
    353341    psArray *new = psArrayAlloc (old->n);
    354     new->n = new->nalloc;
    355342    double cs = cos(angle);
    356343    double sn = sin(angle);
     
    659646    // sort the NP values and choose
    660647    psVector *listNP = psVectorAlloc (nPix*nPix, PS_TYPE_U32);
    661     listNP->n = nPix*nPix;
    662648    int n = 0;
    663649    for (int i = 0; i < nPix; i++) {
     
    780766    psVector *xHist = psVectorAlloc (nBin, PS_TYPE_F32);
    781767    psVector *yHist = psVectorAlloc (nBin, PS_TYPE_F32);
    782     xHist->n = yHist->n = nBin;
    783768    psVectorInit (xHist, 0);
    784769    psVectorInit (yHist, 0);
Note: See TracChangeset for help on using the changeset viewer.