IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1440


Ignore:
Timestamp:
Aug 9, 2004, 1:34:58 PM (22 years ago)
Author:
desonia
Message:

cleanup of some indent-induced madness.

Location:
trunk/psLib/src
Files:
84 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astro/psCoord.c

    r1407 r1440  
    1111*  @author George Gusciora, MHPCC
    1212*
    13 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-08-07 00:06:06 $
     13*  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-08-09 23:34:57 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3232
    3333// This is the only function in this file which I understand.
    34 psPlane *psPlaneTransformApply(psPlane * out, const psPlaneTransform * transform, const psPlane * coords)
     34psPlane* psPlaneTransformApply(psPlane* out, const psPlaneTransform* transform, const psPlane* coords)
    3535{
    3636    if (out == NULL) {
    37         out = (psPlane *) psAlloc(sizeof(psPlane));
     37        out = (psPlane* ) psAlloc(sizeof(psPlane));
    3838    }
    3939    out->x = transform->x->coeff[0][0] +
     
    4848// This transformation takes into account parameters beyond an objects
    4949// spatial coordinates: term3 and term4.
    50 psPlane *psPlaneDistortApply(psPlane * out,
    51                              const psPlaneDistort * transform,
    52                              const psPlane * coords, float term3, float term4)
     50psPlane* psPlaneDistortApply(psPlane* out,
     51                             const psPlaneDistort* transform,
     52                             const psPlane* coords, float term3, float term4)
    5353{
    5454    if (out == NULL) {
    55         out = (psPlane *) psAlloc(sizeof(psPlane));
     55        out = (psPlane* ) psAlloc(sizeof(psPlane));
    5656    }
    5757
     
    7070
    7171// This function prototype has been modified since the SDRS.
    72 psSphereTransform *psSphereTransformAlloc(double NPlat, double Xo, double xo)
    73 {
    74     psSphereTransform *tmp = (psSphereTransform *) psAlloc(sizeof(psSphereTransform));
     72psSphereTransform* psSphereTransformAlloc(double NPlat, double Xo, double xo)
     73{
     74    psSphereTransform* tmp = (psSphereTransform* ) psAlloc(sizeof(psSphereTransform));
    7575
    7676    tmp->sinPhi = sin(NPlat);
     
    8989// there are no typo's.
    9090
    91 psSphere *psSphereTransformApply(psSphere * out, const psSphereTransform * transform, const psSphere * coord)
     91psSphere* psSphereTransformApply(psSphere* out, const psSphereTransform* transform, const psSphere* coord)
    9292{
    9393    double sinY = 0.0;
     
    100100
    101101    if (out == NULL) {
    102         out = (psSphere *) psAlloc(sizeof(psSphere));
     102        out = (psSphere* ) psAlloc(sizeof(psSphere));
    103103    }
    104104
     
    117117}
    118118
    119 psSphereTransform *psSphereTransformICRStoEcliptic(psTime time)
     119psSphereTransform* psSphereTransformICRStoEcliptic(psTime time)
    120120{
    121121    struct tm *tmTime = psTimeToTM(time);
     
    129129}
    130130
    131 psSphereTransform *psSphereTransformEcliptictoICRS(psTime time)
     131psSphereTransform* psSphereTransformEcliptictoICRS(psTime time)
    132132{
    133133    struct tm *tmTime = psTimeToTM(time);
     
    141141}
    142142
    143 psSphereTransform *psSphereTransformICRStoGalatic(void)
     143psSphereTransform* psSphereTransformICRStoGalatic(void)
    144144{
    145145    return (psSphereTransformAlloc(62.6, 282.25, 33.0));
    146146}
    147147
    148 psSphereTransform *psSphereTransformGalatictoICRS(void)
     148psSphereTransform* psSphereTransformGalatictoICRS(void)
    149149{
    150150    return (psSphereTransformAlloc(-62.6, 33.0, 282.25));
     
    178178// XXX: Waiting for the definition of the PS_PROJ_PAR projection.
    179179// XXX: Waiting for the definition of the PS_PROJ_GLS projection.
    180 psPlane *psProject(const psSphere * coord, const psProjection * projection)
     180psPlane* psProject(const psSphere* coord, const psProjection* projection)
    181181{
    182182    float R = 0.0;
    183183    float alpha = 0.0;
    184     psPlane *tmp = (psPlane *) psAlloc(sizeof(psPlane));
     184    psPlane* tmp = (psPlane* ) psAlloc(sizeof(psPlane));
    185185
    186186    if (projection->type == PS_PROJ_TAN) {
     
    220220// XXX: Waiting for the definition of the PS_PROJ_PAR projection.
    221221// XXX: Waiting for the definition of the PS_PROJ_GLS projection.
    222 psSphere *psDeproject(const psPlane * coord, const psProjection * projection)
     222psSphere* psDeproject(const psPlane* coord, const psProjection* projection)
    223223{
    224224    float R = 0.0;
     
    226226    float chu1 = 0.0;
    227227    float chu2 = 0.0;
    228     psSphere *tmp = (psSphere *) psAlloc(sizeof(psSphere));
     228    psSphere* tmp = (psSphere* ) psAlloc(sizeof(psSphere));
    229229
    230230    if (projection->type == PS_PROJ_TAN) {
     
    267267// XXX: Do I need to check for unacceptable transformation parameters?
    268268// Maybe, if the points are on the North/South Pole, etc?
    269 psSphere *psSphereGetOffset(const psSphere * restrict position1,
    270                             const psSphere * restrict position2,
     269psSphere* psSphereGetOffset(const psSphere* restrict position1,
     270                            const psSphere* restrict position2,
    271271                            psSphereOffsetMode mode, psSphereOffsetUnit unit)
    272272{
    273     // psPlane *lin;
     273    // psPlane* lin;
    274274    psProjection proj;
    275     psSphere *tmp;
     275    psSphere* tmp;
    276276    double tmpR = 0.0;
    277277    double tmpD = 0.0;
     
    313313        }
    314314
    315         tmp = (psSphere *) psAlloc(sizeof(psSphere));
     315        tmp = (psSphere* ) psAlloc(sizeof(psSphere));
    316316        tmp->r = tmpR;
    317317        tmp->d = tmpD;
     
    328328// Maybe, if the points are on the North/South Pole, etc?
    329329// XXX: I copied the algorithm from the ADD exactly.
    330 psSphere *psSphereSetOffset(const psSphere * restrict position,
    331                             const psSphere * restrict offset,
     330psSphere* psSphereSetOffset(const psSphere* restrict position,
     331                            const psSphere* restrict offset,
    332332                            psSphereOffsetMode mode, psSphereOffsetUnit unit)
    333333{
    334334    psPlane lin;
    335     psSphere *tmp;
     335    psSphere* tmp;
    336336    psProjection proj;
    337337    double tmpR = 0.0;
     
    368368        }
    369369
    370         tmp = (psSphere *) psAlloc(sizeof(psSphere));
     370        tmp = (psSphere* ) psAlloc(sizeof(psSphere));
    371371        tmp->r = position->r + tmpR;
    372372        tmp->r = position->d + tmpD;
  • trunk/psLib/src/astro/psCoord.h

    r1426 r1440  
    1111*  @author George Gusciora, MHPCC
    1212*
    13 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-08-09 22:44:25 $
     13*  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-08-09 23:34:57 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7272typedef struct
    7373{
    74     psDPolynomial2D *x;         ///< 2D polynomial transform of X coordinates
    75     psDPolynomial2D *y;         ///< 2D polynomial transform of Y coordinates
     74    psDPolynomial2D* x;         ///< 2D polynomial transform of X coordinates
     75    psDPolynomial2D* y;         ///< 2D polynomial transform of Y coordinates
    7676}
    7777psPlaneTransform;
     
    9191typedef struct
    9292{
    93     psDPolynomial4D *x;         ///< 4D polynomial transform of X coordinates
    94     psDPolynomial4D *y;         ///< 4D polynomial transform of Y coordinates
     93    psDPolynomial4D* x;         ///< 4D polynomial transform of X coordinates
     94    psDPolynomial4D* y;         ///< 4D polynomial transform of Y coordinates
    9595}
    9696psPlaneDistort;
     
    171171 *
    172172 */
    173 psPlane *psPlaneTransformApply(psPlane * out,   ///< a psPlane to recycle.  If NULL, a new one is generated.
    174                                const psPlaneTransform * transform,      ///< the transform to apply
    175                                const psPlane * coords   ///< the coordinate to apply the transform above.
     173psPlane* psPlaneTransformApply(psPlane* out,   ///< a psPlane to recycle.  If NULL, a new one is generated.
     174                               const psPlaneTransform* transform,      ///< the transform to apply
     175                               const psPlane* coords   ///< the coordinate to apply the transform above.
    176176                              );
    177177
     
    179179 *
    180180 */
    181 psPlane *psPlaneDistortApply(psPlane * out,     ///< a psPlane to recycle.  If NULL, a new one is generated.
    182                              const psPlaneDistort * transform,  ///< the transform to apply
    183                              const psPlane * coords,    ///< the coordinate to apply the transform above.
     181psPlane* psPlaneDistortApply(psPlane* out,     ///< a psPlane to recycle.  If NULL, a new one is generated.
     182                             const psPlaneDistort* transform,  ///< the transform to apply
     183                             const psPlane* coords,    ///< the coordinate to apply the transform above.
    184184                             float term3,       ///< third term -- maybe magnitude
    185185                             float term4        ///< forth term -- maybe color
     
    189189 *
    190190 */
    191 psSphereTransform *psSphereTransformAlloc(double NPlat, ///< north pole latitude
     191psSphereTransform* psSphereTransformAlloc(double NPlat, ///< north pole latitude
    192192        double Xo,    ///< First PT of Ares lon
    193193        double xo     ///< First PT of Ares equiv lon
     
    197197 *
    198198 */
    199 psSphere *psSphereTransformApply(psSphere * out,        ///< a psSphere to recycle.  If NULL, a new one is
     199psSphere* psSphereTransformApply(psSphere* out,        ///< a psSphere to recycle.  If NULL, a new one is
    200200                                 // generated.
    201                                  const psSphereTransform * transform,   ///< the transform to apply
    202                                  const psSphere * coord ///< the coordinate to apply the transform above.x
     201                                 const psSphereTransform* transform,   ///< the transform to apply
     202                                 const psSphere* coord ///< the coordinate to apply the transform above.x
    203203                                );
    204204
    205 psSphereTransform *psSphereTransformICRStoEcliptic(psTime time);
    206 
    207 psSphereTransform *psSphereTransformEcliptictoICRS(psTime time);
    208 
    209 psSphereTransform *psSphereTransformICRStoGalatic(void);
    210 
    211 psSphereTransform *psSphereTransformGalatictoICRS(void);
    212 
    213 psPlane *psProject(const psSphere * coord, const psProjection * projection);
    214 
    215 psSphere *psDeproject(const psPlane * coord, const psProjection * projection);
    216 
    217 psSphere *psSphereGetOffset(const psSphere * restrict position1,
    218                             const psSphere * restrict position2,
     205psSphereTransform* psSphereTransformICRStoEcliptic(psTime time);
     206
     207psSphereTransform* psSphereTransformEcliptictoICRS(psTime time);
     208
     209psSphereTransform* psSphereTransformICRStoGalatic(void);
     210
     211psSphereTransform* psSphereTransformGalatictoICRS(void);
     212
     213psPlane* psProject(const psSphere* coord, const psProjection* projection);
     214
     215psSphere* psDeproject(const psPlane* coord, const psProjection* projection);
     216
     217psSphere* psSphereGetOffset(const psSphere* restrict position1,
     218                            const psSphere* restrict position2,
    219219                            psSphereOffsetMode mode, psSphereOffsetUnit unit);
    220220
    221 psSphere *psSphereSetOffset(const psSphere * restrict position,
    222                             const psSphere * restrict offset,
     221psSphere* psSphereSetOffset(const psSphere* restrict position,
     222                            const psSphere* restrict offset,
    223223                            psSphereOffsetMode mode, psSphereOffsetUnit unit);
    224224
  • trunk/psLib/src/astronomy/psAstrometry.c

    r1407 r1440  
    99*  @author George Gusciora, MHPCC
    1010*
    11 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-08-07 00:06:06 $
     11*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-08-09 23:34:57 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2121#include "psMemory.h"
    2222
    23 static void grommitFree(psGrommit * grommit);
    24 static int checkValidChipCoords(double x, double y, psChip * tmpChip);
    25 static int checkValidImageCoords(double x, double y, psImage * tmpImage);
    26 
    27 psExposure *psExposureAlloc(double ra, double dec, double hourAngle,
     23static void grommitFree(psGrommit* grommit);
     24static int checkValidChipCoords(double x, double y, psChip* tmpChip);
     25static int checkValidImageCoords(double x, double y, psImage* tmpImage);
     26
     27psExposure* psExposureAlloc(double ra, double dec, double hourAngle,
    2828                            double zenith, double azimuth, double localTime, float date,
    2929                            float rotAngle, float temperature, float pressure, float humidity,
    3030                            float exposureTime)
    3131{
    32     psExposure *exp = psAlloc(sizeof(psExposure));
     32    psExposure* exp = psAlloc(sizeof(psExposure));
    3333
    3434    *(double *)&exp->ra = ra;
     
    4949}
    5050
    51 psGrommit *psGrommitAlloc(const psExposure * exp)
     51psGrommit* psGrommitAlloc(const psExposure* exp)
    5252{
    5353    double *slaGrommit = (double *)psAlloc(14 * sizeof(double));
    54     psGrommit *grommit = (psGrommit *) psAlloc(sizeof(psGrommit));
     54    psGrommit* grommit = (psGrommit* ) psAlloc(sizeof(psGrommit));
    5555
    5656    /*
     
    7979}
    8080
    81 void p_psGrommitFree(psGrommit * grommit)
     81void p_psGrommitFree(psGrommit* grommit)
    8282{
    8383    psFree(grommit);
    8484}
    8585
    86 psCell *psCellinFPA(psCell * out, const psPlane * coord, const psFPA * FPA)
    87 {
    88     psChip *tmpChip = NULL;
    89     psCell *tmpCell = NULL;
     86psCell* psCellinFPA(psCell* out, const psPlane* coord, const psFPA* FPA)
     87{
     88    psChip* tmpChip = NULL;
     89    psCell* tmpCell = NULL;
    9090
    9191    tmpChip = psChipinFPA(tmpChip, coord, FPA);
     
    9494}
    9595
    96 int checkValidChipCoords(double x, double y, psChip * tmpChip)
     96int checkValidChipCoords(double x, double y, psChip* tmpChip)
    9797{
    9898    return (0);
    9999}
    100100
    101 psChip *psChipinFPA(psChip * out, const psPlane * coord, const psFPA * FPA)
    102 {
    103     psArray *chips = FPA->chips;
     101psChip* psChipinFPA(psChip* out, const psPlane* coord, const psFPA* FPA)
     102{
     103    psArray* chips = FPA->chips;
    104104    int nChips = chips->n;
    105     psPlane *tmpCoord = NULL;
     105    psPlane* tmpCoord = NULL;
    106106
    107107    for (int i = 0; i < nChips; i++) {
    108         psChip *tmpChip = chips->data[i];
     108        psChip* tmpChip = chips->data[i];
    109109
    110110        tmpCoord = psPlaneTransformApply(tmpCoord, tmpChip->fromFPA, coord);
     
    120120}
    121121
    122 int checkValidImageCoords(double x, double y, psImage * tmpImage)
     122int checkValidImageCoords(double x, double y, psImage* tmpImage)
    123123{
    124124    if ((x < 0.0) || (x > (double)tmpImage->numCols) || (y < 0.0) || (y > (double)tmpImage->numRows)) {
     
    140140XXX: must deallocate memory.
    141141 *****************************************************************************/
    142 psCell *psCellinChip(psCell * out, const psPlane * coord, const psChip * chip)
    143 {
    144     psPlane *tmpCoord = NULL;
    145     psArray *cells;
     142psCell* psCellinChip(psCell* out, const psPlane* coord, const psChip* chip)
     143{
     144    psPlane* tmpCoord = NULL;
     145    psArray* cells;
    146146
    147147    if (chip == NULL) {
     
    156156
    157157    for (int i = 0; i < cells->n; i++) {
    158         psCell *tmpCell = (psCell *) cells->data[i];
    159         psArray *readouts = tmpCell->readouts;
     158        psCell* tmpCell = (psCell* ) cells->data[i];
     159        psArray* readouts = tmpCell->readouts;
    160160
    161161        if (readouts != NULL) {
    162162            for (int j = 0; j < readouts->n; j++) {
    163                 psReadout *tmpReadout = readouts->data[j];
     163                psReadout* tmpReadout = readouts->data[j];
    164164
    165165                tmpCoord = psPlaneTransformApply(tmpCoord, tmpCell->fromChip, coord);
     
    173173}
    174174
    175 psPlane *psCoordCelltoChip(psPlane * out, const psPlane * in, const psCell * cell)
     175psPlane* psCoordCelltoChip(psPlane* out, const psPlane* in, const psCell* cell)
    176176{
    177177    return (psPlaneTransformApply(out, cell->toChip, in));
    178178}
    179179
    180 psPlane *psCoordChipToFPA(psPlane * out, const psPlane * in, const psChip * chip)
     180psPlane* psCoordChipToFPA(psPlane* out, const psPlane* in, const psChip* chip)
    181181{
    182182    return (psPlaneTransformApply(out, chip->toFPA, in));
    183183}
    184184
    185 psPlane *psCoordFPAtoTP(psPlane * out, const psPlane * in, const psFPA * fpa)
     185psPlane* psCoordFPAtoTP(psPlane* out, const psPlane* in, const psFPA* fpa)
    186186{
    187187    // XXX: This code doesn't work; fpa->toTangentPlane is of the wrong type.
     
    191191
    192192// XXX: must wrap SLA_QAPQK here.
    193 psSphere *psCoordTPtoSky(psSphere * out, const psPlane * in, const psGrommit * grommit)
     193psSphere* psCoordTPtoSky(psSphere* out, const psPlane* in, const psGrommit* grommit)
    194194{
    195195    /*
     
    202202}
    203203
    204 psPlane *psCoordCellToFPA(psPlane * out, const psPlane * in, const psCell * cell)
     204psPlane* psCoordCellToFPA(psPlane* out, const psPlane* in, const psCell* cell)
    205205{
    206206    return (psPlaneTransformApply(out, cell->toFPA, in));
     
    210210// transformation, as well as a few psPlane structs.  Can this be implemented
    211211// better?
    212 psSphere *psCoordCelltoSky(psSphere * out, const psPlane * in, const psCell * cell)
    213 {
    214     psPlane *tmp1 = NULL;
    215     psPlane *tmp2 = NULL;
    216     psFPA *parFPA = (cell->parent)->parent;
    217     psGrommit *tmpGrommit = NULL;
     212psSphere* psCoordCelltoSky(psSphere* out, const psPlane* in, const psCell* cell)
     213{
     214    psPlane* tmp1 = NULL;
     215    psPlane* tmp2 = NULL;
     216    psFPA* parFPA = (cell->parent)->parent;
     217    psGrommit* tmpGrommit = NULL;
    218218
    219219    tmp1 = psPlaneTransformApply(tmp1, cell->toFPA, in);
     
    230230}
    231231
    232 psSphere *psCoordCelltoSkyQuick(psSphere * out, const psPlane * in, const psCell * cell)
    233 {
    234     psPlane *tmp1 = NULL;
     232psSphere* psCoordCelltoSkyQuick(psSphere* out, const psPlane* in, const psCell* cell)
     233{
     234    psPlane* tmp1 = NULL;
    235235
    236236    tmp1 = psPlaneTransformApply(tmp1, cell->toSky, in);
     
    245245
    246246// XXX: must wrap SLA_AOPQK here.
    247 psPlane *psCoordSkytoTP(psPlane * out, const psSphere * in, const psGrommit * grommit)
     247psPlane* psCoordSkytoTP(psPlane* out, const psSphere* in, const psGrommit* grommit)
    248248{
    249249    extern void sla_AOPQK(RAP, DAP, AOPRMS, AOB, ZOB, HOB, DOB, ROB);
     
    255255
    256256    if (out == NULL) {
    257         out = (psPlane *) psAlloc(sizeof(psPlane));
     257        out = (psPlane* ) psAlloc(sizeof(psPlane));
    258258    }
    259259
     
    264264}
    265265
    266 psPlane *psCoordTPtoFPA(psPlane * out, const psPlane * in, const psFPA * fpa)
     266psPlane* psCoordTPtoFPA(psPlane* out, const psPlane* in, const psFPA* fpa)
    267267{
    268268    return (psPlaneTransformApply(out, fpa->fromTangentPlane, in));
    269269}
    270270
    271 psPlane *psCoordFPAtoChip(psPlane * out, const psPlane * in, const psChip * chip)
     271psPlane* psCoordFPAtoChip(psPlane* out, const psPlane* in, const psChip* chip)
    272272{
    273273    return (psPlaneTransformApply(out, chip->fromFPA, in));
    274274}
    275275
    276 psPlane *psCoordChiptoCell(psPlane * out, const psPlane * in, const psCell * cell)
     276psPlane* psCoordChiptoCell(psPlane* out, const psPlane* in, const psCell* cell)
    277277{
    278278    return (psPlaneTransformApply(out, cell->fromChip, in));
    279279}
    280280
    281 psPlane *psCoordSkytoCell(psPlane * out, const psSphere * in, const psCell * cell)
     281psPlane* psCoordSkytoCell(psPlane* out, const psSphere* in, const psCell* cell)
    282282{
    283283    out = psCoordSkytoTP(out, in, tmpGrommit);
     
    289289}
    290290
    291 psPlane *psCoordSkytoCellQuick(psPlane * out, const psSphere * in, const psCell * cell)
     291psPlane* psCoordSkytoCellQuick(psPlane* out, const psSphere* in, const psCell* cell)
    292292{
    293293    if (out == NULL) {
    294         out = (psPlane *) psAlloc(sizeof(psPlane));
    295     }
    296 
    297     return (out);
    298 }
     294        out = (psPlane* ) psAlloc(sizeof(psPlane));
     295    }
     296
     297    return (out);
     298}
  • trunk/psLib/src/astronomy/psAstrometry.h

    r1426 r1440  
    99*  @author George Gusciora, MHPCC
    1010*
    11 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-08-09 22:44:25 $
     11*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-08-09 23:34:57 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    100100    const int row0;             ///< Offset from the bottom of chip.
    101101
    102     psImage *image;             ///< imaging area of Readout
    103     psList *objects;            ///< objects derived from Readout
    104     psMetadata *metadata;       ///< readout-level metadata
     102    psImage* image;             ///< imaging area of Readout
     103    psList* objects;            ///< objects derived from Readout
     104    psMetadata* metadata;       ///< readout-level metadata
    105105}
    106106psReadout;
     
    117117typedef struct psCell
    118118{
    119     psArray *readouts;          ///< readouts from the cell
    120     psMetadata *metadata;       ///< cell-level metadata
    121 
    122     psPlaneTransform *toChip;   ///< transformations from cell to chip coordinates
    123     psPlaneTransform *fromChip; ///< transformations from chip to cell coordinates
    124     psPlaneTransform *toFPA;    ///< transformations from cell to FPA coordinates
    125     psPlaneTransform *toSky;    ///< transformations from cell to sky coordinates
    126 
    127     struct psChip *parent;      ///< chip in which contains this cell
     119    psArray* readouts;          ///< readouts from the cell
     120    psMetadata* metadata;       ///< cell-level metadata
     121
     122    psPlaneTransform* toChip;   ///< transformations from cell to chip coordinates
     123    psPlaneTransform* fromChip; ///< transformations from chip to cell coordinates
     124    psPlaneTransform* toFPA;    ///< transformations from cell to FPA coordinates
     125    psPlaneTransform* toSky;    ///< transformations from cell to sky coordinates
     126
     127    struct psChip* parent;      ///< chip in which contains this cell
    128128}
    129129psCell;
     
    139139typedef struct psChip
    140140{
    141     psArray *cells;             ///< cells in the chip
    142     psMetadata *metadata;       ///< chip-level metadata
    143 
    144     psPlaneTransform *toFPA;    ///< transformation from chip to FPA coordinates
    145     psPlaneTransform *fromFPA;  ///< transformation from FPA to chip coordinates
    146 
    147     struct psFPA *parent;       ///< FPA which contains this chip
     141    psArray* cells;             ///< cells in the chip
     142    psMetadata* metadata;       ///< chip-level metadata
     143
     144    psPlaneTransform* toFPA;    ///< transformation from chip to FPA coordinates
     145    psPlaneTransform* fromFPA;  ///< transformation from FPA to chip coordinates
     146
     147    struct psFPA* parent;       ///< FPA which contains this chip
    148148}
    149149psChip;
     
    164164typedef struct psFPA
    165165{
    166     psArray *chips;             ///< chips in the focal plane array
    167     psMetadata *metadata;       ///< focal-plane's metadata
    168 
    169     psPlaneDistort *fromTangentPlane;   ///< transformation from tangent plane to focal plane
    170     psPlaneDistort *toTangentPlane;     ///< transformation from focal plane to tangent plane
    171     psFixedPattern *pattern;    ///< fixed pattern residual offsets
    172 
    173     const struct psExposure *exposure;  ///< information about this exposure
    174 
    175     psPhotSystem *colorPlus;    ///< Color reference
    176     psPhotSystem *colorMinus;   ///< Color reference
     166    psArray* chips;             ///< chips in the focal plane array
     167    psMetadata* metadata;       ///< focal-plane's metadata
     168
     169    psPlaneDistort* fromTangentPlane;   ///< transformation from tangent plane to focal plane
     170    psPlaneDistort* toTangentPlane;     ///< transformation from focal plane to tangent plane
     171    psFixedPattern* pattern;    ///< fixed pattern residual offsets
     172
     173    const struct psExposure* exposure;  ///< information about this exposure
     174
     175    psPhotSystem* colorPlus;    ///< Color reference
     176    psPhotSystem* colorMinus;   ///< Color reference
    177177
    178178    float rmsX;                 ///< RMS for x transformation fits
     
    214214psExposure;
    215215
    216 psExposure *psExposureAlloc(double ra,  ///< Telescope boresight, right ascention
     216psExposure* psExposureAlloc(double ra,  ///< Telescope boresight, right ascention
    217217                            double dec, ///< Telescope boresight, declination
    218218                            double hourAngle,   ///< Hour angle
     
    233233 *  exposure.
    234234 *
    235  *  @return psGrommit*     New grommit structure.
    236  */
    237 psGrommit *psGrommitAlloc(const psExposure * exp        ///< the cooresponding exposure structure.
     235 *  @return psGrommit* New grommit structure.
     236 */
     237psGrommit* psGrommitAlloc(const psExposure* exp        ///< the cooresponding exposure structure.
    238238                         );
    239239
    240 psCell *psCellinFPA(psCell * out, const psPlane * coord, const psFPA * FPA);
    241 
    242 psChip *psChipinFPA(psChip * out, const psPlane * coord, const psFPA * FPA);
    243 
    244 psCell *psCellinChip(psCell * out, const psPlane * coord, const psChip * chip);
    245 
    246 psPlane *psCoordCelltoChip(psPlane * out, const psPlane * in, const psCell * cell);
    247 
    248 psPlane *psCoordChipToFPA(psPlane * out, const psPlane * in, const psChip * chip);
    249 
    250 psPlane *psCoordFPAtoTP(psPlane * out, const psPlane * in, const psFPA * fpa);
    251 
    252 psSphere *psCoordTPtoSky(psSphere * out, const psPlane * in, const psGrommit * grommit);
    253 
    254 psPlane *psCoordCellToFPA(psPlane * out, const psPlane * in, const psCell * cell);
    255 
    256 psSphere *psCoordCelltoSky(psSphere * out, const psPlane * in, const psCell * cell);
    257 
    258 psSphere *psCoordCelltoSkyQuick(psSphere * out, const psPlane * in, const psCell * cell);
    259 
    260 psPlane *psCoordSkytoTP(psPlane * out, const psSphere * in, const psGrommit * grommit);
    261 
    262 psPlane *psCoordTPtoFPA(psPlane * out, const psPlane * in, const psFPA * fpa);
    263 
    264 psPlane *psCoordFPAtoChip(psPlane * out, const psPlane * in, const psChip * chip);
    265 
    266 psPlane *psCoordChiptoCell(psPlane * out, const psPlane * in, const psCell * cell);
    267 
    268 psPlane *psCoordSkytoCell(psPlane * out, const psSphere * in, const psCell * cell);
    269 
    270 psPlane *psCoordSkytoCellQuick(psPlane * out, const psSphere * in, const psCell * cell);
     240psCell* psCellinFPA(psCell* out, const psPlane* coord, const psFPA* FPA);
     241
     242psChip* psChipinFPA(psChip* out, const psPlane* coord, const psFPA* FPA);
     243
     244psCell* psCellinChip(psCell* out, const psPlane* coord, const psChip* chip);
     245
     246psPlane* psCoordCelltoChip(psPlane* out, const psPlane* in, const psCell* cell);
     247
     248psPlane* psCoordChipToFPA(psPlane* out, const psPlane* in, const psChip* chip);
     249
     250psPlane* psCoordFPAtoTP(psPlane* out, const psPlane* in, const psFPA* fpa);
     251
     252psSphere* psCoordTPtoSky(psSphere* out, const psPlane* in, const psGrommit* grommit);
     253
     254psPlane* psCoordCellToFPA(psPlane* out, const psPlane* in, const psCell* cell);
     255
     256psSphere* psCoordCelltoSky(psSphere* out, const psPlane* in, const psCell* cell);
     257
     258psSphere* psCoordCelltoSkyQuick(psSphere* out, const psPlane* in, const psCell* cell);
     259
     260psPlane* psCoordSkytoTP(psPlane* out, const psSphere* in, const psGrommit* grommit);
     261
     262psPlane* psCoordTPtoFPA(psPlane* out, const psPlane* in, const psFPA* fpa);
     263
     264psPlane* psCoordFPAtoChip(psPlane* out, const psPlane* in, const psChip* chip);
     265
     266psPlane* psCoordChiptoCell(psPlane* out, const psPlane* in, const psCell* cell);
     267
     268psPlane* psCoordSkytoCell(psPlane* out, const psSphere* in, const psCell* cell);
     269
     270psPlane* psCoordSkytoCellQuick(psPlane* out, const psSphere* in, const psCell* cell);
    271271
    272272#endif
  • trunk/psLib/src/astronomy/psCoord.c

    r1407 r1440  
    1111*  @author George Gusciora, MHPCC
    1212*
    13 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-08-07 00:06:06 $
     13*  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-08-09 23:34:57 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3232
    3333// This is the only function in this file which I understand.
    34 psPlane *psPlaneTransformApply(psPlane * out, const psPlaneTransform * transform, const psPlane * coords)
     34psPlane* psPlaneTransformApply(psPlane* out, const psPlaneTransform* transform, const psPlane* coords)
    3535{
    3636    if (out == NULL) {
    37         out = (psPlane *) psAlloc(sizeof(psPlane));
     37        out = (psPlane* ) psAlloc(sizeof(psPlane));
    3838    }
    3939    out->x = transform->x->coeff[0][0] +
     
    4848// This transformation takes into account parameters beyond an objects
    4949// spatial coordinates: term3 and term4.
    50 psPlane *psPlaneDistortApply(psPlane * out,
    51                              const psPlaneDistort * transform,
    52                              const psPlane * coords, float term3, float term4)
     50psPlane* psPlaneDistortApply(psPlane* out,
     51                             const psPlaneDistort* transform,
     52                             const psPlane* coords, float term3, float term4)
    5353{
    5454    if (out == NULL) {
    55         out = (psPlane *) psAlloc(sizeof(psPlane));
     55        out = (psPlane* ) psAlloc(sizeof(psPlane));
    5656    }
    5757
     
    7070
    7171// This function prototype has been modified since the SDRS.
    72 psSphereTransform *psSphereTransformAlloc(double NPlat, double Xo, double xo)
    73 {
    74     psSphereTransform *tmp = (psSphereTransform *) psAlloc(sizeof(psSphereTransform));
     72psSphereTransform* psSphereTransformAlloc(double NPlat, double Xo, double xo)
     73{
     74    psSphereTransform* tmp = (psSphereTransform* ) psAlloc(sizeof(psSphereTransform));
    7575
    7676    tmp->sinPhi = sin(NPlat);
     
    8989// there are no typo's.
    9090
    91 psSphere *psSphereTransformApply(psSphere * out, const psSphereTransform * transform, const psSphere * coord)
     91psSphere* psSphereTransformApply(psSphere* out, const psSphereTransform* transform, const psSphere* coord)
    9292{
    9393    double sinY = 0.0;
     
    100100
    101101    if (out == NULL) {
    102         out = (psSphere *) psAlloc(sizeof(psSphere));
     102        out = (psSphere* ) psAlloc(sizeof(psSphere));
    103103    }
    104104
     
    117117}
    118118
    119 psSphereTransform *psSphereTransformICRStoEcliptic(psTime time)
     119psSphereTransform* psSphereTransformICRStoEcliptic(psTime time)
    120120{
    121121    struct tm *tmTime = psTimeToTM(time);
     
    129129}
    130130
    131 psSphereTransform *psSphereTransformEcliptictoICRS(psTime time)
     131psSphereTransform* psSphereTransformEcliptictoICRS(psTime time)
    132132{
    133133    struct tm *tmTime = psTimeToTM(time);
     
    141141}
    142142
    143 psSphereTransform *psSphereTransformICRStoGalatic(void)
     143psSphereTransform* psSphereTransformICRStoGalatic(void)
    144144{
    145145    return (psSphereTransformAlloc(62.6, 282.25, 33.0));
    146146}
    147147
    148 psSphereTransform *psSphereTransformGalatictoICRS(void)
     148psSphereTransform* psSphereTransformGalatictoICRS(void)
    149149{
    150150    return (psSphereTransformAlloc(-62.6, 33.0, 282.25));
     
    178178// XXX: Waiting for the definition of the PS_PROJ_PAR projection.
    179179// XXX: Waiting for the definition of the PS_PROJ_GLS projection.
    180 psPlane *psProject(const psSphere * coord, const psProjection * projection)
     180psPlane* psProject(const psSphere* coord, const psProjection* projection)
    181181{
    182182    float R = 0.0;
    183183    float alpha = 0.0;
    184     psPlane *tmp = (psPlane *) psAlloc(sizeof(psPlane));
     184    psPlane* tmp = (psPlane* ) psAlloc(sizeof(psPlane));
    185185
    186186    if (projection->type == PS_PROJ_TAN) {
     
    220220// XXX: Waiting for the definition of the PS_PROJ_PAR projection.
    221221// XXX: Waiting for the definition of the PS_PROJ_GLS projection.
    222 psSphere *psDeproject(const psPlane * coord, const psProjection * projection)
     222psSphere* psDeproject(const psPlane* coord, const psProjection* projection)
    223223{
    224224    float R = 0.0;
     
    226226    float chu1 = 0.0;
    227227    float chu2 = 0.0;
    228     psSphere *tmp = (psSphere *) psAlloc(sizeof(psSphere));
     228    psSphere* tmp = (psSphere* ) psAlloc(sizeof(psSphere));
    229229
    230230    if (projection->type == PS_PROJ_TAN) {
     
    267267// XXX: Do I need to check for unacceptable transformation parameters?
    268268// Maybe, if the points are on the North/South Pole, etc?
    269 psSphere *psSphereGetOffset(const psSphere * restrict position1,
    270                             const psSphere * restrict position2,
     269psSphere* psSphereGetOffset(const psSphere* restrict position1,
     270                            const psSphere* restrict position2,
    271271                            psSphereOffsetMode mode, psSphereOffsetUnit unit)
    272272{
    273     // psPlane *lin;
     273    // psPlane* lin;
    274274    psProjection proj;
    275     psSphere *tmp;
     275    psSphere* tmp;
    276276    double tmpR = 0.0;
    277277    double tmpD = 0.0;
     
    313313        }
    314314
    315         tmp = (psSphere *) psAlloc(sizeof(psSphere));
     315        tmp = (psSphere* ) psAlloc(sizeof(psSphere));
    316316        tmp->r = tmpR;
    317317        tmp->d = tmpD;
     
    328328// Maybe, if the points are on the North/South Pole, etc?
    329329// XXX: I copied the algorithm from the ADD exactly.
    330 psSphere *psSphereSetOffset(const psSphere * restrict position,
    331                             const psSphere * restrict offset,
     330psSphere* psSphereSetOffset(const psSphere* restrict position,
     331                            const psSphere* restrict offset,
    332332                            psSphereOffsetMode mode, psSphereOffsetUnit unit)
    333333{
    334334    psPlane lin;
    335     psSphere *tmp;
     335    psSphere* tmp;
    336336    psProjection proj;
    337337    double tmpR = 0.0;
     
    368368        }
    369369
    370         tmp = (psSphere *) psAlloc(sizeof(psSphere));
     370        tmp = (psSphere* ) psAlloc(sizeof(psSphere));
    371371        tmp->r = position->r + tmpR;
    372372        tmp->r = position->d + tmpD;
  • trunk/psLib/src/astronomy/psCoord.h

    r1426 r1440  
    1111*  @author George Gusciora, MHPCC
    1212*
    13 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-08-09 22:44:25 $
     13*  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-08-09 23:34:57 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7272typedef struct
    7373{
    74     psDPolynomial2D *x;         ///< 2D polynomial transform of X coordinates
    75     psDPolynomial2D *y;         ///< 2D polynomial transform of Y coordinates
     74    psDPolynomial2D* x;         ///< 2D polynomial transform of X coordinates
     75    psDPolynomial2D* y;         ///< 2D polynomial transform of Y coordinates
    7676}
    7777psPlaneTransform;
     
    9191typedef struct
    9292{
    93     psDPolynomial4D *x;         ///< 4D polynomial transform of X coordinates
    94     psDPolynomial4D *y;         ///< 4D polynomial transform of Y coordinates
     93    psDPolynomial4D* x;         ///< 4D polynomial transform of X coordinates
     94    psDPolynomial4D* y;         ///< 4D polynomial transform of Y coordinates
    9595}
    9696psPlaneDistort;
     
    171171 *
    172172 */
    173 psPlane *psPlaneTransformApply(psPlane * out,   ///< a psPlane to recycle.  If NULL, a new one is generated.
    174                                const psPlaneTransform * transform,      ///< the transform to apply
    175                                const psPlane * coords   ///< the coordinate to apply the transform above.
     173psPlane* psPlaneTransformApply(psPlane* out,   ///< a psPlane to recycle.  If NULL, a new one is generated.
     174                               const psPlaneTransform* transform,      ///< the transform to apply
     175                               const psPlane* coords   ///< the coordinate to apply the transform above.
    176176                              );
    177177
     
    179179 *
    180180 */
    181 psPlane *psPlaneDistortApply(psPlane * out,     ///< a psPlane to recycle.  If NULL, a new one is generated.
    182                              const psPlaneDistort * transform,  ///< the transform to apply
    183                              const psPlane * coords,    ///< the coordinate to apply the transform above.
     181psPlane* psPlaneDistortApply(psPlane* out,     ///< a psPlane to recycle.  If NULL, a new one is generated.
     182                             const psPlaneDistort* transform,  ///< the transform to apply
     183                             const psPlane* coords,    ///< the coordinate to apply the transform above.
    184184                             float term3,       ///< third term -- maybe magnitude
    185185                             float term4        ///< forth term -- maybe color
     
    189189 *
    190190 */
    191 psSphereTransform *psSphereTransformAlloc(double NPlat, ///< north pole latitude
     191psSphereTransform* psSphereTransformAlloc(double NPlat, ///< north pole latitude
    192192        double Xo,    ///< First PT of Ares lon
    193193        double xo     ///< First PT of Ares equiv lon
     
    197197 *
    198198 */
    199 psSphere *psSphereTransformApply(psSphere * out,        ///< a psSphere to recycle.  If NULL, a new one is
     199psSphere* psSphereTransformApply(psSphere* out,        ///< a psSphere to recycle.  If NULL, a new one is
    200200                                 // generated.
    201                                  const psSphereTransform * transform,   ///< the transform to apply
    202                                  const psSphere * coord ///< the coordinate to apply the transform above.x
     201                                 const psSphereTransform* transform,   ///< the transform to apply
     202                                 const psSphere* coord ///< the coordinate to apply the transform above.x
    203203                                );
    204204
    205 psSphereTransform *psSphereTransformICRStoEcliptic(psTime time);
    206 
    207 psSphereTransform *psSphereTransformEcliptictoICRS(psTime time);
    208 
    209 psSphereTransform *psSphereTransformICRStoGalatic(void);
    210 
    211 psSphereTransform *psSphereTransformGalatictoICRS(void);
    212 
    213 psPlane *psProject(const psSphere * coord, const psProjection * projection);
    214 
    215 psSphere *psDeproject(const psPlane * coord, const psProjection * projection);
    216 
    217 psSphere *psSphereGetOffset(const psSphere * restrict position1,
    218                             const psSphere * restrict position2,
     205psSphereTransform* psSphereTransformICRStoEcliptic(psTime time);
     206
     207psSphereTransform* psSphereTransformEcliptictoICRS(psTime time);
     208
     209psSphereTransform* psSphereTransformICRStoGalatic(void);
     210
     211psSphereTransform* psSphereTransformGalatictoICRS(void);
     212
     213psPlane* psProject(const psSphere* coord, const psProjection* projection);
     214
     215psSphere* psDeproject(const psPlane* coord, const psProjection* projection);
     216
     217psSphere* psSphereGetOffset(const psSphere* restrict position1,
     218                            const psSphere* restrict position2,
    219219                            psSphereOffsetMode mode, psSphereOffsetUnit unit);
    220220
    221 psSphere *psSphereSetOffset(const psSphere * restrict position,
    222                             const psSphere * restrict offset,
     221psSphere* psSphereSetOffset(const psSphere* restrict position,
     222                            const psSphere* restrict offset,
    223223                            psSphereOffsetMode mode, psSphereOffsetUnit unit);
    224224
  • trunk/psLib/src/astronomy/psMetadata.c

    r1431 r1440  
    1212*  @author Ross Harman, MHPCC
    1313*
    14 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2004-08-09 23:06:10 $
     14*  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2004-08-09 23:34:57 $
    1616*
    1717*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8888
    8989/*****************************************************************************/
    90 static void metadataItemFree(psMetadataItem * metadataItem)
     90static void metadataItemFree(psMetadataItem* metadataItem)
    9191{
    9292    psMetadataType type;
     
    109109}
    110110
    111 static void metadataFree(psMetadata * metadata)
     111static void metadataFree(psMetadata* metadata)
    112112{
    113113    if (metadata == NULL) {
     
    124124/*****************************************************************************/
    125125
    126 psMetadataItem *psMetadataItemAlloc(const char *name, psMetadataType type, const char *comment, ...)
     126psMetadataItem* psMetadataItemAlloc(const char *name, psMetadataType type, const char *comment, ...)
    127127{
    128128    va_list argPtr;
    129     psMetadataItem *metadataItem = NULL;
     129    psMetadataItem* metadataItem = NULL;
    130130
    131131    // Get the variable list parameters to pass to allocation function
     
    141141}
    142142
    143 psMetadataItem *psMetadataItemAllocV(const char *name, psMetadataType type, const char *comment,
     143psMetadataItem* psMetadataItemAllocV(const char *name, psMetadataType type, const char *comment,
    144144                                     va_list argPtr)
    145145{
    146     psMetadataItem *metadataItem = NULL;
     146    psMetadataItem* metadataItem = NULL;
    147147
    148148    if (name == NULL) {
     
    151151    }
    152152    // Allocate metadata item
    153     metadataItem = (psMetadataItem *) psAlloc(sizeof(psMetadataItem));
     153    metadataItem = (psMetadataItem* ) psAlloc(sizeof(psMetadataItem));
    154154    if (metadataItem == NULL) {
    155155        psAbort(__func__, "Failed to allocate memory");
     
    211211}
    212212
    213 psMetadata *psMetadataAlloc(void)
    214 {
    215     psList *list = NULL;
    216     psHash *table = NULL;
    217     psMetadata *metadata = NULL;
     213psMetadata* psMetadataAlloc(void)
     214{
     215    psList* list = NULL;
     216    psHash* table = NULL;
     217    psMetadata* metadata = NULL;
    218218
    219219    // Allocate metadata
    220     metadata = (psMetadata *) psAlloc(sizeof(psMetadata));
     220    metadata = (psMetadata* ) psAlloc(sizeof(psMetadata));
    221221    if (metadata == NULL) {
    222222        psAbort(__func__, "Failed to allocate metadata");
     
    226226
    227227    // Allocate metadata's internal containers
    228     list = (psList *) psListAlloc(NULL);
     228    list = (psList* ) psListAlloc(NULL);
    229229    if (list == NULL) {
    230230        psAbort(__func__, "Failed to allocate list");
    231231    }
    232232
    233     table = (psHash *) psHashAlloc(10);
     233    table = (psHash* ) psHashAlloc(10);
    234234    if (table == NULL) {
    235235        psAbort(__func__, "Failed to allocate table");
     
    242242}
    243243
    244 bool psMetadataAddItem(psMetadata * restrict md, int where, psMetadataItem * restrict metadataItem)
     244bool psMetadataAddItem(psMetadata* restrict md, int where, psMetadataItem* restrict metadataItem)
    245245{
    246246    char *key = NULL;
    247     psHash *mdTable = NULL;
    248     psList *mdList = NULL;
    249     psMetadataItem *value = NULL;
     247    psHash* mdTable = NULL;
     248    psList* mdList = NULL;
     249    psMetadataItem* value = NULL;
    250250    psMetadataType type = PS_META_ITEM_SET;
    251251
     
    280280    }
    281281    // Check if key is already in table
    282     value = (psMetadataItem *) psHashLookup(mdTable, key);
     282    value = (psMetadataItem* ) psHashLookup(mdTable, key);
    283283    if (value != NULL && type != PS_META_ITEM_SET) {
    284284
     
    316316}
    317317
    318 bool psMetadataAdd(psMetadata * restrict md, int where, const char *name, psMetadataType type,
     318bool psMetadataAdd(psMetadata* restrict md, int where, const char *name, psMetadataType type,
    319319                   const char *comment, ...)
    320320{
    321321    va_list argPtr;
    322     psMetadataItem *metadataItem = NULL;
     322    psMetadataItem* metadataItem = NULL;
    323323
    324324    va_start(argPtr, comment);
     
    339339}
    340340
    341 bool psMetadataRemove(psMetadata * restrict md, int where, const char *restrict key)
     341bool psMetadataRemove(psMetadata* restrict md, int where, const char *restrict key)
    342342{
    343343    int numChildren = 0;
    344     psList *mdList = NULL;
    345     psHash *mdTable = NULL;
    346     psMetadataItem *entry = NULL;
    347     psMetadataItem *entryChild = NULL;
     344    psList* mdList = NULL;
     345    psHash* mdTable = NULL;
     346    psMetadataItem* entry = NULL;
     347    psMetadataItem* entryChild = NULL;
    348348
    349349
     
    368368
    369369        // Remove by key name
    370         entry = (psMetadataItem *) psHashLookup(mdTable, key);
     370        entry = (psMetadataItem* ) psHashLookup(mdTable, key);
    371371        if (entry == NULL) {
    372372            psError(__func__, "Couldn't find metadata item. Name: %s", key);
     
    419419}
    420420
    421 psMetadataItem *psMetadataLookup(psMetadata * restrict md, const char *restrict key)
    422 {
    423     psHash *mdTable = NULL;
    424     psMetadataItem *entry = NULL;
     421psMetadataItem* psMetadataLookup(psMetadata* restrict md, const char *restrict key)
     422{
     423    psHash* mdTable = NULL;
     424    psMetadataItem* entry = NULL;
    425425
    426426
     
    441441    }
    442442
    443     entry = (psMetadataItem *) psHashLookup(mdTable, key);
     443    entry = (psMetadataItem* ) psHashLookup(mdTable, key);
    444444    if (entry == NULL) {
    445445        psError(__func__, "Could not find metadata item. Key: %s", key);
     
    450450}
    451451
    452 psMetadataItem *psMetadataGet(psMetadata * restrict md, int where)
    453 {
    454     psList *mdList = NULL;
    455     psMetadataItem *entry = NULL;
     452psMetadataItem* psMetadataGet(psMetadata* restrict md, int where)
     453{
     454    psList* mdList = NULL;
     455    psMetadataItem* entry = NULL;
    456456
    457457
     
    467467    }
    468468
    469     entry = (psMetadataItem *) psListGet(mdList, where);
     469    entry = (psMetadataItem* ) psListGet(mdList, where);
    470470    if (entry == NULL) {
    471471        psError(__func__, "Couldn't find metadata item with given index. Index: %d", where);
     
    476476}
    477477
    478 bool psMetadataSetIterator(psMetadata * restrict md, int where)
    479 {
    480     psList *mdList = NULL;
     478bool psMetadataSetIterator(psMetadata* restrict md, int where)
     479{
     480    psList* mdList = NULL;
    481481
    482482    if (md == NULL) {
     
    496496}
    497497
    498 psMetadataItem *psMetadataGetNext(psMetadata * restrict md, const char *restrict match, int which)
    499 {
    500     psList *mdList = NULL;
    501     psMetadataItem *entry = NULL;
     498psMetadataItem* psMetadataGetNext(psMetadata* restrict md, const char *restrict match, int which)
     499{
     500    psList* mdList = NULL;
     501    psMetadataItem* entry = NULL;
    502502
    503503    mdList = md->list;
     
    532532}
    533533
    534 psMetadataItem *psMetadataGetPrevious(psMetadata * restrict md, const char *restrict match, int which)
    535 {
    536     psList *mdList = NULL;
    537     psMetadataItem *entry = NULL;
     534psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, int which)
     535{
     536    psList* mdList = NULL;
     537    psMetadataItem* entry = NULL;
    538538
    539539    mdList = md->list;
     
    568568}
    569569
    570 void psMetadataItemPrint(FILE * fd, const char *format, const psMetadataItem * restrict metadataItem)
     570void psMetadataItemPrint(FILE * fd, const char *format, const psMetadataItem* restrict metadataItem)
    571571{
    572572    psMetadataType type;
     
    616616}
    617617
    618 psMetadata *psMetadataFReadHeader(psMetadata * output, char *extName, int extNum, fitsfile * fd)
     618psMetadata* psMetadataFReadHeader(psMetadata* output, char *extName, int extNum, fitsfile * fd)
    619619{
    620620    bool tempBool;
  • trunk/psLib/src/astronomy/psMetadata.h

    r1426 r1440  
    1111*  @author Ross Harman, MHPCC
    1212*
    13 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-08-09 22:44:25 $
     13*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-08-09 23:34:57 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6666    } data;                     ///< Union for data types.
    6767    char *comment;              ///< Optional comment ("", not NULL).
    68     psList *restrict items;     ///< List of psMetadataItems with same name.
     68    psList* restrict items;     ///< List of psMetadataItems with same name.
    6969}
    7070psMetadataItem;
     
    7878typedef struct psMetadata
    7979{
    80     psList *restrict list;
    81     psHash *restrict table;
     80    psList* restrict list;
     81    psHash* restrict table;
    8282}
    8383psMetadata;
     
    100100 * specified size and type.
    101101 *
    102  * @return psMetadataItem*: Pointer metadata item.
    103  */
    104 psMetadataItem *psMetadataItemAlloc(const char *name,   ///< Name of metadata item.
     102 * @return psMetadataItem* : Pointer metadata item.
     103 */
     104psMetadataItem* psMetadataItemAlloc(const char *name,   ///< Name of metadata item.
    105105                                    psMetadataType type,        ///< Type of metadata item.
    106106                                    const char *comment,        ///< Comment for metadata item.
     
    119119 * specified size and type.
    120120 *
    121  * @return psMetadataItem*: Pointer metadata item.
    122  */
    123 psMetadataItem *psMetadataItemAllocV(const char *name,  ///< Name of metadata item.
     121 * @return psMetadataItem* : Pointer metadata item.
     122 */
     123psMetadataItem* psMetadataItemAllocV(const char *name,  ///< Name of metadata item.
    124124                                     psMetadataType type,       ///< Type of metadata item.
    125125                                     const char *comment,       ///< Comment for metadata item.
     
    132132 * Returns an empty metadata container with fully allocated internal metadata containers.
    133133 *
    134  * @return psMetadata*: Pointer metadata.
    135  */
    136 psMetadata *psMetadataAlloc(void        ///< Void.
     134 * @return psMetadata* : Pointer metadata.
     135 */
     136psMetadata* psMetadataAlloc(void        ///< Void.
    137137                           );
    138138
     
    143143 * @return bool: True for success, false for failure.
    144144 */
    145 bool psMetadataAddItem(psMetadata * restrict md,        ///< Metadata collection to insert metadat item.
     145bool psMetadataAddItem(psMetadata* restrict md,        ///< Metadata collection to insert metadat item.
    146146                       int where,       ///< Location to be added.
    147                        psMetadataItem * restrict item   ///< Metadata item to be added.
     147                       psMetadataItem* restrict item   ///< Metadata item to be added.
    148148                      );
    149149
     
    154154 * @return bool: True for success, false for failure.
    155155 */
    156 bool psMetadataAdd(psMetadata * restrict md,    ///< Metadata collection to insert metadat item.
     156bool psMetadataAdd(psMetadata* restrict md,    ///< Metadata collection to insert metadat item.
    157157                   int where,   ///< Location to be added.
    158158                   const char *name,    ///< Name of metadata item.
     
    171171 * @return bool: True for success, false for failure.
    172172 */
    173 bool psMetadataRemove(psMetadata * restrict md, ///< Metadata collection to insert metadat item.
     173bool psMetadataRemove(psMetadata* restrict md, ///< Metadata collection to insert metadat item.
    174174                      int where,        ///< Location to be removed.
    175175                      const char *restrict key  ///< Name of metadata key.
     
    181181 * returned. If the item is not found, null is returned.
    182182 *
    183  * @return psMetadataItem*: Pointer metadata item.
    184  */
    185 psMetadataItem *psMetadataLookup(psMetadata * restrict md,      ///< Metadata collection to insert metadat
     183 * @return psMetadataItem* : Pointer metadata item.
     184 */
     185psMetadataItem* psMetadataLookup(psMetadata* restrict md,      ///< Metadata collection to insert metadat
    186186                                 // item.
    187187                                 const char *restrict key       ///< Name of metadata key.
     
    192192 * Items may be found in the metadata by their entry position in the list container.
    193193 *
    194  * @return psMetadataItem*: Pointer metadata item.
    195  */
    196 psMetadataItem *psMetadataGet(psMetadata * restrict md, ///< Metadata collection to insert metadat item.
     194 * @return psMetadataItem* : Pointer metadata item.
     195 */
     196psMetadataItem* psMetadataGet(psMetadata* restrict md, ///< Metadata collection to insert metadat item.
    197197                              int where ///< Location to be retrieved.
    198198                             );
     
    204204 * @return void: void.
    205205 */
    206 bool psMetadataSetIterator(psMetadata * restrict md,    ///< Metadata collection to iterate.
     206bool psMetadataSetIterator(psMetadata* restrict md,    ///< Metadata collection to iterate.
    207207                           int where    ///< Location of iterator.
    208208                          );
     
    212212 * Get next metadata item in iterator list.
    213213 *
    214  * @return psMetadataItem*: Pointer metadata item.
    215  */
    216 psMetadataItem *psMetadataGetNext(psMetadata * restrict md,     ///< Metadata collection to iterate.
     214 * @return psMetadataItem* : Pointer metadata item.
     215 */
     216psMetadataItem* psMetadataGetNext(psMetadata* restrict md,     ///< Metadata collection to iterate.
    217217                                  const char *restrict match,   ///< Beginning of key name.
    218218                                  int which     ///< Iterator to be used.
     
    223223 * Get previous metadata item in iterator list.
    224224 *
    225  * @return psMetadataItem*: Pointer metadata item.
    226  */
    227 psMetadataItem *psMetadataGetPrevious(psMetadata * restrict md, ///< Metadata collection to iterate.
     225 * @return psMetadataItem* : Pointer metadata item.
     226 */
     227psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, ///< Metadata collection to iterate.
    228228                                      const char *restrict match,       ///< Beginning of key name.
    229229                                      int which ///< Iterator to be used.
     
    238238 * metadata type is any other data type, printing is not allowed.
    239239 *
    240  * @return psMetadataItem*: Pointer metadata item.
     240 * @return psMetadataItem* : Pointer metadata item.
    241241 */
    242242void psMetadataItemPrint(FILE * fd,     ///< Pointer to file to write metadata item.
    243243                         const char *format,    ///< Format to print metadata item.
    244                          const psMetadataItem * restrict metadataItem   ///< Metadata item to print.
     244                         const psMetadataItem* restrict metadataItem   ///< Metadata item to print.
    245245                        );
    246246
     
    250250 * unimplemented.
    251251 *
    252  * @return psMetadata*: Pointer metadata.
    253  */
    254 psMetadata *psMetadataReadHeader(psMetadata * output,   ///< Resulting metadata from read.
     252 * @return psMetadata* : Pointer metadata.
     253 */
     254psMetadata* psMetadataReadHeader(psMetadata* output,   ///< Resulting metadata from read.
    255255                                 char *extname, ///< File name extension string.
    256256                                 int extnum,    ///< File name extension number. Starts at 1.
     
    262262 * Read a metadata header from file. If the file is not found, an error is reported.
    263263 *
    264  * @return psMetadata*: Pointer metadata.
    265  */
    266 psMetadata *psMetadataFReadHeader(psMetadata * output,  ///< Resulting metadata from read.
     264 * @return psMetadata* : Pointer metadata.
     265 */
     266psMetadata* psMetadataFReadHeader(psMetadata* output,  ///< Resulting metadata from read.
    267267                                  char *extName,        ///< File name extension string.
    268268                                  int extNum,   ///< File name extension number.
  • trunk/psLib/src/collections/psArray.c

    r1407 r1440  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-08-07 00:06:06 $
     11 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-08-09 23:34:57 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3232
    3333/*****************************************************************************/
    34 static void arrayFree(psArray * restrict psArr);
     34static void arrayFree(psArray* restrict psArr);
    3535
    3636/*****************************************************************************/
     
    3939
    4040/*****************************************************************************/
    41 psArray *psArrayAlloc(unsigned int nalloc)
     41psArray* psArrayAlloc(unsigned int nalloc)
    4242{
    43     psArray *psArr = NULL;
     43    psArray* psArr = NULL;
    4444
    4545    // Invalid nalloc
     
    4949    }
    5050    // Create vector struct
    51     psArr = (psArray *) psAlloc(sizeof(psArray));
     51    psArr = (psArray* ) psAlloc(sizeof(psArray));
    5252    p_psMemSetDeallocator(psArr, (psFreeFcn) arrayFree);
    5353
     
    6161}
    6262
    63 psArray *psArrayRealloc(unsigned int nalloc, psArray * restrict in)
     63psArray* psArrayRealloc(unsigned int nalloc, psArray* restrict in)
    6464{
    6565    // Invalid nalloc
     
    8787}
    8888
    89 static void arrayFree(psArray * restrict psArr)
     89static void arrayFree(psArray* restrict psArr)
    9090{
    9191    if (psArr == NULL) {
     
    9898}
    9999
    100 void psArrayElementFree(psArray * restrict psArr)
     100void psArrayElementFree(psArray* restrict psArr)
    101101{
    102102
     
    111111}
    112112
    113 psArray *psArraySort(psArray * in, psComparePtrFcn compare)
     113psArray* psArraySort(psArray* in, psComparePtrFcn compare)
    114114{
    115115    if (in == NULL) {
  • trunk/psLib/src/collections/psArray.h

    r1426 r1440  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-08-09 22:44:25 $
     14 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-08-09 23:34:57 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3636    unsigned int nalloc;        ///< Total number of elements available.
    3737    unsigned int n;             ///< Number of elements in use.
    38     psPTR *data;                ///< An Array of pointer elements
     38    psPTR* data;                ///< An Array of pointer elements
    3939}
    4040psArray;
     
    5151 * data
    5252 *
    53  * @return psArray*: Pointer to psArray.
     53 * @return psArray* : Pointer to psArray.
    5454 *
    5555 */
    56 psArray *psArrayAlloc(unsigned int nalloc       ///< Total number of elements to make available.
     56psArray* psArrayAlloc(unsigned int nalloc       ///< Total number of elements to make available.
    5757                     );
    5858
     
    6262 * of data.
    6363 *
    64  * @return psArray*: Pointer to psArray.
     64 * @return psArray* : Pointer to psArray.
    6565 *
    6666 */
    67 psArray *psArrayRealloc(unsigned int nalloc,    ///< Total number of elements to make available.
    68                         psArray * restrict psArr        ///< array to reallocate.
     67psArray* psArrayRealloc(unsigned int nalloc,    ///< Total number of elements to make available.
     68                        psArray* restrict psArr        ///< array to reallocate.
    6969                       );
    7070
     
    7676 *
    7777 */
    78 void psArrayElementFree(psArray * restrict psArr        ///< Void pointer array to destroy.
     78void psArrayElementFree(psArray* restrict psArr        ///< Void pointer array to destroy.
    7979                       );
    8080
     
    8484 *  to specify how the objects on the array should be sorted.
    8585 *
    86  *  @return psArray*       The sorted array.
     86 *  @return psArray* The sorted array.
    8787 */
    88 psArray *psArraySort(psArray * in, psComparePtrFcn compare);
     88psArray* psArraySort(psArray* in, psComparePtrFcn compare);
    8989
    9090/// @}
  • trunk/psLib/src/collections/psBitSet.c

    r1407 r1440  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-08-07 00:06:06 $
     13 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-08-09 23:34:57 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7070
    7171/*****************************************************************************/
    72 static void psBitSetFree(psBitSet * restrict inBitSet);
     72static void psBitSetFree(psBitSet* restrict inBitSet);
    7373
    7474/** Private function to create a mask.
     
    9595
    9696/*****************************************************************************/
    97 psBitSet *psBitSetAlloc(int n)
     97psBitSet* psBitSetAlloc(int n)
    9898{
    9999    int numBytes = 0;
    100     psBitSet *newObj = NULL;
     100    psBitSet* newObj = NULL;
    101101
    102102    if (n <= 0) {
     
    125125}
    126126
    127 static void psBitSetFree(psBitSet * restrict inBitSet)
     127static void psBitSetFree(psBitSet* restrict inBitSet)
    128128{
    129129    if (inBitSet == NULL) {
     
    134134}
    135135
    136 psBitSet *psBitSetSet(psBitSet * inBitSet, int bit)
     136psBitSet* psBitSetSet(psBitSet* inBitSet, int bit)
    137137{
    138138    char *byte = NULL;
     
    155155}
    156156
    157 bool psBitSetTest(const psBitSet * inBitSet, int bit)
     157bool psBitSetTest(const psBitSet* inBitSet, int bit)
    158158{
    159159    char *byte = NULL;
     
    178178}
    179179
    180 psBitSet *psBitSetOp(psBitSet * outBitSet, const psBitSet * restrict inBitSet1, char *operator,
    181                      const psBitSet * restrict inBitSet2)
     180psBitSet* psBitSetOp(psBitSet* outBitSet, const psBitSet* restrict inBitSet1, char *operator,
     181                     const psBitSet* restrict inBitSet2)
    182182{
    183183    int i = 0;
     
    241241}
    242242
    243 psBitSet *psBitSetNot(psBitSet * outBitSet, const psBitSet * restrict inBitSet)
     243psBitSet* psBitSetNot(psBitSet* outBitSet, const psBitSet* restrict inBitSet)
    244244{
    245245    int i = 0;
     
    278278}
    279279
    280 char *psBitSetToString(const psBitSet * restrict inBitSet)
     280char *psBitSetToString(const psBitSet* restrict inBitSet)
    281281{
    282282    int i = 0;
  • trunk/psLib/src/collections/psBitSet.h

    r1407 r1440  
    1313 *  @author Ross Harman, MHPCC
    1414 *
    15  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2004-08-07 00:06:06 $
     15 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2004-08-09 23:34:57 $
    1717 *
    1818 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5656 *  allocation.
    5757 *
    58  *  @return  psBitSet*: Pointer to struct containing array of bits and size of array.
     58 *  @return  psBitSet* : Pointer to struct containing array of bits and size of array.
    5959 */
    6060
    6161/*@null@*/
    6262
    63 psBitSet *psBitSetAlloc(int n
     63psBitSet* psBitSetAlloc(int n
    6464                        /**< Number of bits in psBitSet array */
    6565                       );
     
    7171 *  an array with two elements would result in an psBitSet that looks like 00000000 00001000.
    7272 *
    73  *  @return  psBitSet*: Pointer to struct containing psBitSet.
     73 *  @return  psBitSet* : Pointer to struct containing psBitSet.
    7474 */
    75 psBitSet *psBitSetSet(
     75psBitSet* psBitSetSet(
    7676
    77     /* @returned@ */ psBitSet * restrict inMask,
     77    /* @returned@ */ psBitSet* restrict inMask,
    7878    /**< Pointer to psBitSet to be set. */
    7979
     
    9191 */
    9292
    93 bool psBitSetTest(const psBitSet * restrict inMask,
     93bool psBitSetTest(const psBitSet* restrict inMask,
    9494                  /**< Pointer psBitSet to be tested. */
    9595
     
    102102 *  be performed and an error message will be logged.
    103103 *
    104  *  @return  psBitSet*: Pointer to struct containing result of binary operation.
     104 *  @return  psBitSet* : Pointer to struct containing result of binary operation.
    105105 */
    106 psBitSet *psBitSetOp(
     106psBitSet* psBitSetOp(
    107107
    108     /* @returned@ */ psBitSet * restrict outMask,
     108    /* @returned@ */ psBitSet* restrict outMask,
    109109    /**< Resulting psBitSet from binary operation */
    110110
    111     const psBitSet * restrict inMask1,
     111    const psBitSet* restrict inMask1,
    112112    /**< First psBitSet on which to operate */
    113113
    114114    char *operator,         /**< Bit operation */
    115115
    116     const psBitSet * restrict inMask2
     116    const psBitSet* restrict inMask2
    117117    /**< First psBitSet on which to operate */
    118118);
     
    122122 *  Toggles bits in a psBitset. All zero bits are set to one and all one bits are set to zero.
    123123 *
    124  *  @return  psBitSet*: Pointer to struct containing result of operation.
     124 *  @return  psBitSet* : Pointer to struct containing result of operation.
    125125 */
    126126
    127 psBitSet *psBitSetNot(psBitSet * outBitSet,
     127psBitSet* psBitSetNot(psBitSet* outBitSet,
    128128                      /**< Resulting psBitSet from operation */
    129129
    130                       const psBitSet * restrict inBitSet
     130                      const psBitSet* restrict inBitSet
    131131                      /**< Input psBitSet */
    132132                     );
     
    140140 */
    141141
    142 char *psBitSetToString(const psBitSet * restrict inMask
     142char *psBitSetToString(const psBitSet* restrict inMask
    143143                       /**< psBitSet to convert */
    144144                      );
  • trunk/psLib/src/collections/psHash.c

    r1420 r1440  
    1111*  @author George Gusciora, MHPCC
    1212*
    13 *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-08-09 20:29:43 $
     13*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-08-09 23:34:57 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2626#include "psAbort.h"
    2727
    28 static psHashBucket *hashBucketAlloc(const char *key, void *data, psHashBucket * next);
    29 static void hashBucketFree(psHashBucket * bucket);
    30 static void *doHashWork(psHash * table, const char *key, void *data, bool remove
     28static psHashBucket* hashBucketAlloc(const char *key, void *data, psHashBucket* next);
     29static void hashBucketFree(psHashBucket* bucket);
     30static void *doHashWork(psHash* table, const char *key, void *data, bool remove
    3131                           );
    32 static void hashFree(psHash * table);
     32static void hashFree(psHash* table);
    3333
    3434/******************************************************************************
     
    4040    The linked list
    4141 *****************************************************************************/
    42 psList *psHashKeyList(psHash * table)
     42psList* psHashKeyList(psHash* table)
    4343{
    4444    int i = 0;                  // Loop index variable
    45     psList *myLinkList = NULL;  // The output data structure
    46     psHashBucket *ptr = NULL;   // Used to step thru linked list.
     45    psList* myLinkList = NULL;  // The output data structure
     46    psHashBucket* ptr = NULL;   // Used to step thru linked list.
    4747
    4848    if (table == NULL) {
     
    8181    the new hash bucket.
    8282 *****************************************************************************/
    83 static psHashBucket *hashBucketAlloc(const char *key, void *data, psHashBucket * next)
     83static psHashBucket* hashBucketAlloc(const char *key, void *data, psHashBucket* next)
    8484{
    8585    if (key == NULL) {
     
    8787    }
    8888    // Allocate memory for the new hash bucket.
    89     psHashBucket *bucket = psAlloc(sizeof(psHashBucket));
     89    psHashBucket* bucket = psAlloc(sizeof(psHashBucket));
    9090
    9191    p_psMemSetDeallocator(bucket, (psFreeFcn) hashBucketFree);
     
    114114    NONE
    115115 *****************************************************************************/
    116 static void hashBucketFree(psHashBucket * bucket)
     116static void hashBucketFree(psHashBucket* bucket)
    117117{
    118118    if (bucket == NULL) {
     
    133133    The new hash table.
    134134 *****************************************************************************/
    135 psHash *psHashAlloc(int nbucket)        // initial number of buckets
     135psHash* psHashAlloc(int nbucket)        // initial number of buckets
    136136{
    137137    int i = 0;                  // loop index variable
    138138
    139139    // Create the new hash table.
    140     psHash *table = psAlloc(sizeof(psHash));
     140    psHash* table = psAlloc(sizeof(psHash));
    141141
    142142    p_psMemSetDeallocator(table, (psFreeFcn) hashFree);
    143143
    144144    // Allocate memory for the buckets.
    145     table->buckets = psAlloc(nbucket * sizeof(psHashBucket *));
     145    table->buckets = psAlloc(nbucket * sizeof(psHashBucket* ));
    146146    table->nbucket = nbucket;
    147147
     
    168168    NONE
    169169 *****************************************************************************/
    170 static void hashFree(psHash * table)
     170static void hashFree(psHash* table)
    171171{
    172172    int i = 0;                  // Loop index variable.
     
    210210there is little common code between those functions.
    211211  *****************************************************************************/
    212 static void *doHashWork(psHash * table, const char *key, void *data, bool remove
     212static void *doHashWork(psHash* table, const char *key, void *data, bool remove
    213213                           )
    214214{
     
    217217    // "hashed" from the key.
    218218    char *tmpchar = NULL;       // Used in computing the hash function.
    219     psHashBucket *ptr = NULL;   // Used to retrieve the hash bucket.
    220     psHashBucket *optr = NULL;  // "original pointer": used to step
     219    psHashBucket* ptr = NULL;   // Used to retrieve the hash bucket.
     220    psHashBucket* optr = NULL;  // "original pointer": used to step
    221221
    222222    // thru the linked list for a bucket.
     
    338338    boolean value defining success or failure
    339339 *****************************************************************************/
    340 bool psHashAdd(psHash * table, const char *key, void *data)
     340bool psHashAdd(psHash* table, const char *key, void *data)
    341341{
    342342    if (table == NULL) {
     
    364364    The data associated with that key.
    365365 *****************************************************************************/
    366 void *psHashLookup(psHash * table,      // table to lookup key in
     366void *psHashLookup(psHash* table,      // table to lookup key in
    367367                   const char *key)     // key to lookup
    368368{
     
    387387    boolean value defining success or failure
    388388 *****************************************************************************/
    389 bool psHashRemove(psHash * table, const char *key)
     389bool psHashRemove(psHash* table, const char *key)
    390390{
    391391    void *data = NULL;
  • trunk/psLib/src/collections/psHash.h

    r1426 r1440  
    1111 *  @author George Gusciora, MHPCC
    1212 *   
    13  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-08-09 22:44:25 $
     13 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-08-09 23:34:57 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3131    char *key;                  ///< key for this item of data
    3232    void *data;                 ///< the data itself
    33     struct psHashBucket *next;  ///< list of other possible keys
     33    struct psHashBucket* next;  ///< list of other possible keys
    3434}
    3535psHashBucket;
     
    4141{
    4242    int nbucket;                ///< Number of buckets in hash table.
    43     psHashBucket **buckets;     ///< The bucket data.
     43    psHashBucket* *buckets;     ///< The bucket data.
    4444}
    4545psHash;
    4646
    4747/// Allocate hash buckets in table.
    48 psHash *psHashAlloc(int nbucket ///< The number of buckets to allocate.
     48psHash* psHashAlloc(int nbucket ///< The number of buckets to allocate.
    4949                   );
    5050
    5151/// Insert entry into table.
    52 bool psHashAdd(psHash * table,  ///< table to insert in
     52bool psHashAdd(psHash* table,  ///< table to insert in
    5353               const char *key, ///< key to use
    5454               void *data       ///< data to insert
     
    5656
    5757/// Lookup key in table.
    58 void *psHashLookup(psHash * table,      ///< table to lookup key in
     58void *psHashLookup(psHash* table,      ///< table to lookup key in
    5959                   const char *key      ///< key to lookup
    6060                  );
    6161
    6262/// Remove key from table.
    63 bool psHashRemove(psHash * table,       ///< table to lookup key in
     63bool psHashRemove(psHash* table,       ///< table to lookup key in
    6464                  const char *key       ///< key to lookup
    6565                 );
    6666
    6767/// List all keys in table.
    68 psList *psHashKeyList(psHash * table    ///< table to list keys from.
     68psList* psHashKeyList(psHash* table    ///< table to list keys from.
    6969                     );
    7070
  • trunk/psLib/src/collections/psList.c

    r1407 r1440  
    77 *  @author Robert Daniel DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-08-07 00:06:06 $
     9 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-08-09 23:34:57 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2929
    3030// private functions.
    31 static psListElem *listGetIterator(psList * list);
    32 static int listGetIteratorIndex(psList * list);
    33 static void listSetIterator(psList * list, int where, bool lockList);
    34 static void listFree(psList * list);
    35 
    36 psList *psListAlloc(void *data)
    37 {
    38     psList *list = psAlloc(sizeof(psList));
     31static psListElem* listGetIterator(psList* list);
     32static int listGetIteratorIndex(psList* list);
     33static void listSetIterator(psList* list, int where, bool lockList);
     34static void listFree(psList* list);
     35
     36psList* psListAlloc(void *data)
     37{
     38    psList* list = psAlloc(sizeof(psList));
    3939
    4040    p_psMemSetDeallocator(list, (psFreeFcn) listFree);
     
    5555}
    5656
    57 static void listFree(psList * list)
     57static void listFree(psList* list)
    5858{
    5959    if (list == NULL) {
     
    6464    ;
    6565
    66     for (psListElem * ptr = list->head; ptr != NULL;) {
    67         psListElem *next = ptr->next;
     66    for (psListElem* ptr = list->head; ptr != NULL;) {
     67        psListElem* next = ptr->next;
    6868
    6969        psFree(ptr->data);
     
    8181}
    8282
    83 bool psListAdd(psList * list, void *data, int where)
    84 {
    85     psListElem *position;
    86     psListElem *elem;
     83bool psListAdd(psList* list, void *data, int where)
     84{
     85    psListElem* position;
     86    psListElem* elem;
    8787    int cursorIndex = 0;
    8888
     
    168168 * Remove an element from a list
    169169 */
    170 bool psListRemove(psList * list, void *data, int which)
    171 {
    172     psListElem *elem = NULL;    // element to remove
     170bool psListRemove(psList* list, void *data, int which)
     171{
     172    psListElem* elem = NULL;    // element to remove
    173173    int cursorIndex = 0;
    174174
     
    186186        int i = 0;              // index
    187187
    188         for (psListElem * ptr = list->head; ptr != NULL; ptr = ptr->next) {
     188        for (psListElem* ptr = list->head; ptr != NULL; ptr = ptr->next) {
    189189            if (ptr->data == data) {
    190190                which = i;
     
    243243}
    244244
    245 void psListSetIterator(psList * list, int where)
     245void psListSetIterator(psList* list, int where)
    246246{
    247247    listSetIterator(list, where, true);
    248248}
    249249
    250 void listSetIterator(psList * list, int where, bool lockList)
    251 {
    252     psListElem *cursor;
     250void listSetIterator(psList* list, int where, bool lockList)
     251{
     252    psListElem* cursor;
    253253    int position;
    254254
     
    340340}
    341341
    342 psListElem *listGetIterator(psList * list)
     342psListElem* listGetIterator(psList* list)
    343343{
    344344    if (list == NULL) {
     
    355355}
    356356
    357 int listGetIteratorIndex(psList * list)
     357int listGetIteratorIndex(psList* list)
    358358{
    359359    if (list->iter == ITER_INIT_HEAD) {
     
    366366}
    367367
    368 void *psListGet(psList * list, int which)
    369 {
    370     psListElem *element;
     368void *psListGet(psList* list, int which)
     369{
     370    psListElem* element;
    371371
    372372    psListSetIterator(list, which);
     
    383383 * and now return the previous/next element of the list
    384384 */
    385 void *psListGetNext(psList * list)
     385void *psListGetNext(psList* list)
    386386{
    387387    return psListGet(list, PS_LIST_NEXT);
    388388}
    389389
    390 void *psListGetPrevious(psList * list)
     390void *psListGetPrevious(psList* list)
    391391{
    392392    return psListGet(list, PS_LIST_PREVIOUS);
    393393}
    394394
    395 void *psListGetCurrent(psList * list)
     395void *psListGetCurrent(psList* list)
    396396{
    397397    return psListGet(list, PS_LIST_CURRENT);
     
    401401 * Convert a psList to/from a psVoidPtrArray
    402402 */
    403 psArray *psListToArray(psList * restrict list)
    404 {
    405     psListElem *ptr;
     403psArray* psListToArray(psList* restrict list)
     404{
     405    psListElem* ptr;
    406406    unsigned int n;
    407     psArray *restrict arr;
     407    psArray* restrict arr;
    408408
    409409    if (list == NULL) {
     
    429429}
    430430
    431 psList *psArrayToList(psArray * arr)
     431psList* psArrayToList(psArray* arr)
    432432{
    433433    unsigned int n;
    434     psList *list;               // list of elements
     434    psList* list;               // list of elements
    435435
    436436    if (arr == NULL) {
     
    447447}
    448448
    449 psList *psListSort(psList * list, psComparePtrFcn compare)
    450 {
    451     psArray *arr;
     449psList* psListSort(psList* list, psComparePtrFcn compare)
     450{
     451    psArray* arr;
    452452
    453453    if (list == NULL) {
  • trunk/psLib/src/collections/psList.h

    r1426 r1440  
    1010 *  @ingroup LinkedList
    1111 *
    12  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-09 22:44:25 $
     12 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-08-09 23:34:57 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4444typedef struct psListElem
    4545{
    46     struct psListElem *prev;    ///< previous link in list
    47     struct psListElem *next;    ///< next link in list
     46    struct psListElem* prev;    ///< previous link in list
     47    struct psListElem* next;    ///< next link in list
    4848    void *data;                 ///< real data item
    4949}
     
    5858{
    5959    unsigned int size;          ///< number of elements on list
    60     psListElem *head;           ///< first element on list (may be NULL)
    61     psListElem *tail;           ///< last element on list (may be NULL)
    62     psListElem *iter;           ///< iteration cursor
     60    psListElem* head;           ///< first element on list (may be NULL)
     61    psListElem* tail;           ///< last element on list (may be NULL)
     62    psListElem* iter;           ///< iteration cursor
    6363    unsigned int iterIndex;     ///< the numeric position of the iteration cursor in the list
    6464    pthread_mutex_t lock;       ///< mutex to lock a node during changes
     
    6868/** Creates a psList linked list object.
    6969 *
    70  *  @return psList*     A new psList object.
     70 *  @return psList* A new psList object.
    7171 */
    72 psList *psListAlloc(void *data
     72psList* psListAlloc(void *data
    7373                    ///< initial data item; may be NULL if no an empty psList is desired
    7474                   )
     
    7777/** Adds an element to a psList at position given.
    7878 *
    79  *  @return psList*     The psList with added data item.  If list parameter is
     79 *  @return psList* The psList with added data item.  If list parameter is
    8080 *                      NULL, the return value will also be NULL.
    8181 */
    82 bool psListAdd(psList * restrict list,  ///< list to add to (if NULL, nothing is done)
     82bool psListAdd(psList* restrict list,  ///< list to add to (if NULL, nothing is done)
    8383               void *data,      ///< data item to add.  If NULL, list is not modified.
    8484               int where        ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.
     
    8989 *  @return bool        TRUE if element is successfully removed, otherwise FALSE.
    9090 */
    91 bool psListRemove(psList * restrict list,
     91bool psListRemove(psList* restrict list,
    9292                  ///< list to remove element from
    9393                  void *data,
     
    104104 *                      NULL is returned.
    105105 */
    106 void *psListGet(psList * restrict list, ///< list to retrieve element from
     106void *psListGet(psList* restrict list, ///< list to retrieve element from
    107107                int which       ///< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN
    108108               );
     
    112112 *
    113113 */
    114 void psListSetIterator(psList * restrict list,  ///< list to retrieve element from
     114void psListSetIterator(psList* restrict list,  ///< list to retrieve element from
    115115                       int where        ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
    116116                      );
     
    123123 *                      parameter was NULL.
    124124 */
    125 void *psListGetNext(psList * restrict list      ///< list to retrieve element from
     125void *psListGetNext(psList* restrict list      ///< list to retrieve element from
    126126                   );
    127127
     
    133133 *                      iterator is not valid or list parameter was NULL.
    134134 */
    135 void *psListGetCurrent(psList * restrict list   ///< list to retrieve element from
     135void *psListGetCurrent(psList* restrict list   ///< list to retrieve element from
    136136                      );
    137137
     
    143143 *                      parameter was NULL.
    144144 */
    145 void *psListGetPrevious(psList * restrict list  ///< list to retrieve element from
     145void *psListGetPrevious(psList* restrict list  ///< list to retrieve element from
    146146                       );
    147147
    148148/** Convert a linked list to an array
    149149 *
    150  *  @return psArray*   A new psArray populated with elements from the list,
     150 *  @return psArray* A new psArray populated with elements from the list,
    151151 *                      or NULL if the given dlist parameter is NULL.
    152152 */
    153 psArray *psListToArray(psList * dlist   ///< List to convert
     153psArray* psListToArray(psList* dlist   ///< List to convert
    154154                      );
    155155
    156156/** Convert array to a doubly-linked list
    157157 *
    158  *  @return psList*     A new psList populated with elements formt the psArray,
     158 *  @return psList* A new psList populated with elements formt the psArray,
    159159 *                      or NULL is the given arr parameter is NULL.
    160160 */
    161 psList *psArrayToList(psArray * arr     ///< vector to convert
     161psList* psArrayToList(psArray* arr     ///< vector to convert
    162162                     );
    163163
    164 psList *psListSort(psList * list, psComparePtrFcn compare);
     164psList* psListSort(psList* list, psComparePtrFcn compare);
    165165
    166166/// @} End of DataGroup Functions
  • trunk/psLib/src/collections/psMetadata.c

    r1432 r1440  
    1212*  @author Ross Harman, MHPCC
    1313*
    14 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2004-08-09 23:06:10 $
     14*  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2004-08-09 23:34:57 $
    1616*
    1717*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8888
    8989/*****************************************************************************/
    90 static void metadataItemFree(psMetadataItem * metadataItem)
     90static void metadataItemFree(psMetadataItem* metadataItem)
    9191{
    9292    psMetadataType type;
     
    109109}
    110110
    111 static void metadataFree(psMetadata * metadata)
     111static void metadataFree(psMetadata* metadata)
    112112{
    113113    if (metadata == NULL) {
     
    124124/*****************************************************************************/
    125125
    126 psMetadataItem *psMetadataItemAlloc(const char *name, psMetadataType type, const char *comment, ...)
     126psMetadataItem* psMetadataItemAlloc(const char *name, psMetadataType type, const char *comment, ...)
    127127{
    128128    va_list argPtr;
    129     psMetadataItem *metadataItem = NULL;
     129    psMetadataItem* metadataItem = NULL;
    130130
    131131    // Get the variable list parameters to pass to allocation function
     
    141141}
    142142
    143 psMetadataItem *psMetadataItemAllocV(const char *name, psMetadataType type, const char *comment,
     143psMetadataItem* psMetadataItemAllocV(const char *name, psMetadataType type, const char *comment,
    144144                                     va_list argPtr)
    145145{
    146     psMetadataItem *metadataItem = NULL;
     146    psMetadataItem* metadataItem = NULL;
    147147
    148148    if (name == NULL) {
     
    151151    }
    152152    // Allocate metadata item
    153     metadataItem = (psMetadataItem *) psAlloc(sizeof(psMetadataItem));
     153    metadataItem = (psMetadataItem* ) psAlloc(sizeof(psMetadataItem));
    154154    if (metadataItem == NULL) {
    155155        psAbort(__func__, "Failed to allocate memory");
     
    211211}
    212212
    213 psMetadata *psMetadataAlloc(void)
    214 {
    215     psList *list = NULL;
    216     psHash *table = NULL;
    217     psMetadata *metadata = NULL;
     213psMetadata* psMetadataAlloc(void)
     214{
     215    psList* list = NULL;
     216    psHash* table = NULL;
     217    psMetadata* metadata = NULL;
    218218
    219219    // Allocate metadata
    220     metadata = (psMetadata *) psAlloc(sizeof(psMetadata));
     220    metadata = (psMetadata* ) psAlloc(sizeof(psMetadata));
    221221    if (metadata == NULL) {
    222222        psAbort(__func__, "Failed to allocate metadata");
     
    226226
    227227    // Allocate metadata's internal containers
    228     list = (psList *) psListAlloc(NULL);
     228    list = (psList* ) psListAlloc(NULL);
    229229    if (list == NULL) {
    230230        psAbort(__func__, "Failed to allocate list");
    231231    }
    232232
    233     table = (psHash *) psHashAlloc(10);
     233    table = (psHash* ) psHashAlloc(10);
    234234    if (table == NULL) {
    235235        psAbort(__func__, "Failed to allocate table");
     
    242242}
    243243
    244 bool psMetadataAddItem(psMetadata * restrict md, int where, psMetadataItem * restrict metadataItem)
     244bool psMetadataAddItem(psMetadata* restrict md, int where, psMetadataItem* restrict metadataItem)
    245245{
    246246    char *key = NULL;
    247     psHash *mdTable = NULL;
    248     psList *mdList = NULL;
    249     psMetadataItem *value = NULL;
     247    psHash* mdTable = NULL;
     248    psList* mdList = NULL;
     249    psMetadataItem* value = NULL;
    250250    psMetadataType type = PS_META_ITEM_SET;
    251251
     
    280280    }
    281281    // Check if key is already in table
    282     value = (psMetadataItem *) psHashLookup(mdTable, key);
     282    value = (psMetadataItem* ) psHashLookup(mdTable, key);
    283283    if (value != NULL && type != PS_META_ITEM_SET) {
    284284
     
    316316}
    317317
    318 bool psMetadataAdd(psMetadata * restrict md, int where, const char *name, psMetadataType type,
     318bool psMetadataAdd(psMetadata* restrict md, int where, const char *name, psMetadataType type,
    319319                   const char *comment, ...)
    320320{
    321321    va_list argPtr;
    322     psMetadataItem *metadataItem = NULL;
     322    psMetadataItem* metadataItem = NULL;
    323323
    324324    va_start(argPtr, comment);
     
    339339}
    340340
    341 bool psMetadataRemove(psMetadata * restrict md, int where, const char *restrict key)
     341bool psMetadataRemove(psMetadata* restrict md, int where, const char *restrict key)
    342342{
    343343    int numChildren = 0;
    344     psList *mdList = NULL;
    345     psHash *mdTable = NULL;
    346     psMetadataItem *entry = NULL;
    347     psMetadataItem *entryChild = NULL;
     344    psList* mdList = NULL;
     345    psHash* mdTable = NULL;
     346    psMetadataItem* entry = NULL;
     347    psMetadataItem* entryChild = NULL;
    348348
    349349
     
    368368
    369369        // Remove by key name
    370         entry = (psMetadataItem *) psHashLookup(mdTable, key);
     370        entry = (psMetadataItem* ) psHashLookup(mdTable, key);
    371371        if (entry == NULL) {
    372372            psError(__func__, "Couldn't find metadata item. Name: %s", key);
     
    419419}
    420420
    421 psMetadataItem *psMetadataLookup(psMetadata * restrict md, const char *restrict key)
    422 {
    423     psHash *mdTable = NULL;
    424     psMetadataItem *entry = NULL;
     421psMetadataItem* psMetadataLookup(psMetadata* restrict md, const char *restrict key)
     422{
     423    psHash* mdTable = NULL;
     424    psMetadataItem* entry = NULL;
    425425
    426426
     
    441441    }
    442442
    443     entry = (psMetadataItem *) psHashLookup(mdTable, key);
     443    entry = (psMetadataItem* ) psHashLookup(mdTable, key);
    444444    if (entry == NULL) {
    445445        psError(__func__, "Could not find metadata item. Key: %s", key);
     
    450450}
    451451
    452 psMetadataItem *psMetadataGet(psMetadata * restrict md, int where)
    453 {
    454     psList *mdList = NULL;
    455     psMetadataItem *entry = NULL;
     452psMetadataItem* psMetadataGet(psMetadata* restrict md, int where)
     453{
     454    psList* mdList = NULL;
     455    psMetadataItem* entry = NULL;
    456456
    457457
     
    467467    }
    468468
    469     entry = (psMetadataItem *) psListGet(mdList, where);
     469    entry = (psMetadataItem* ) psListGet(mdList, where);
    470470    if (entry == NULL) {
    471471        psError(__func__, "Couldn't find metadata item with given index. Index: %d", where);
     
    476476}
    477477
    478 bool psMetadataSetIterator(psMetadata * restrict md, int where)
    479 {
    480     psList *mdList = NULL;
     478bool psMetadataSetIterator(psMetadata* restrict md, int where)
     479{
     480    psList* mdList = NULL;
    481481
    482482    if (md == NULL) {
     
    496496}
    497497
    498 psMetadataItem *psMetadataGetNext(psMetadata * restrict md, const char *restrict match, int which)
    499 {
    500     psList *mdList = NULL;
    501     psMetadataItem *entry = NULL;
     498psMetadataItem* psMetadataGetNext(psMetadata* restrict md, const char *restrict match, int which)
     499{
     500    psList* mdList = NULL;
     501    psMetadataItem* entry = NULL;
    502502
    503503    mdList = md->list;
     
    532532}
    533533
    534 psMetadataItem *psMetadataGetPrevious(psMetadata * restrict md, const char *restrict match, int which)
    535 {
    536     psList *mdList = NULL;
    537     psMetadataItem *entry = NULL;
     534psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, int which)
     535{
     536    psList* mdList = NULL;
     537    psMetadataItem* entry = NULL;
    538538
    539539    mdList = md->list;
     
    568568}
    569569
    570 void psMetadataItemPrint(FILE * fd, const char *format, const psMetadataItem * restrict metadataItem)
     570void psMetadataItemPrint(FILE * fd, const char *format, const psMetadataItem* restrict metadataItem)
    571571{
    572572    psMetadataType type;
     
    616616}
    617617
    618 psMetadata *psMetadataFReadHeader(psMetadata * output, char *extName, int extNum, fitsfile * fd)
     618psMetadata* psMetadataFReadHeader(psMetadata* output, char *extName, int extNum, fitsfile * fd)
    619619{
    620620    bool tempBool;
  • trunk/psLib/src/collections/psMetadata.h

    r1426 r1440  
    1111*  @author Ross Harman, MHPCC
    1212*
    13 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-08-09 22:44:25 $
     13*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-08-09 23:34:57 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6666    } data;                     ///< Union for data types.
    6767    char *comment;              ///< Optional comment ("", not NULL).
    68     psList *restrict items;     ///< List of psMetadataItems with same name.
     68    psList* restrict items;     ///< List of psMetadataItems with same name.
    6969}
    7070psMetadataItem;
     
    7878typedef struct psMetadata
    7979{
    80     psList *restrict list;
    81     psHash *restrict table;
     80    psList* restrict list;
     81    psHash* restrict table;
    8282}
    8383psMetadata;
     
    100100 * specified size and type.
    101101 *
    102  * @return psMetadataItem*: Pointer metadata item.
    103  */
    104 psMetadataItem *psMetadataItemAlloc(const char *name,   ///< Name of metadata item.
     102 * @return psMetadataItem* : Pointer metadata item.
     103 */
     104psMetadataItem* psMetadataItemAlloc(const char *name,   ///< Name of metadata item.
    105105                                    psMetadataType type,        ///< Type of metadata item.
    106106                                    const char *comment,        ///< Comment for metadata item.
     
    119119 * specified size and type.
    120120 *
    121  * @return psMetadataItem*: Pointer metadata item.
    122  */
    123 psMetadataItem *psMetadataItemAllocV(const char *name,  ///< Name of metadata item.
     121 * @return psMetadataItem* : Pointer metadata item.
     122 */
     123psMetadataItem* psMetadataItemAllocV(const char *name,  ///< Name of metadata item.
    124124                                     psMetadataType type,       ///< Type of metadata item.
    125125                                     const char *comment,       ///< Comment for metadata item.
     
    132132 * Returns an empty metadata container with fully allocated internal metadata containers.
    133133 *
    134  * @return psMetadata*: Pointer metadata.
    135  */
    136 psMetadata *psMetadataAlloc(void        ///< Void.
     134 * @return psMetadata* : Pointer metadata.
     135 */
     136psMetadata* psMetadataAlloc(void        ///< Void.
    137137                           );
    138138
     
    143143 * @return bool: True for success, false for failure.
    144144 */
    145 bool psMetadataAddItem(psMetadata * restrict md,        ///< Metadata collection to insert metadat item.
     145bool psMetadataAddItem(psMetadata* restrict md,        ///< Metadata collection to insert metadat item.
    146146                       int where,       ///< Location to be added.
    147                        psMetadataItem * restrict item   ///< Metadata item to be added.
     147                       psMetadataItem* restrict item   ///< Metadata item to be added.
    148148                      );
    149149
     
    154154 * @return bool: True for success, false for failure.
    155155 */
    156 bool psMetadataAdd(psMetadata * restrict md,    ///< Metadata collection to insert metadat item.
     156bool psMetadataAdd(psMetadata* restrict md,    ///< Metadata collection to insert metadat item.
    157157                   int where,   ///< Location to be added.
    158158                   const char *name,    ///< Name of metadata item.
     
    171171 * @return bool: True for success, false for failure.
    172172 */
    173 bool psMetadataRemove(psMetadata * restrict md, ///< Metadata collection to insert metadat item.
     173bool psMetadataRemove(psMetadata* restrict md, ///< Metadata collection to insert metadat item.
    174174                      int where,        ///< Location to be removed.
    175175                      const char *restrict key  ///< Name of metadata key.
     
    181181 * returned. If the item is not found, null is returned.
    182182 *
    183  * @return psMetadataItem*: Pointer metadata item.
    184  */
    185 psMetadataItem *psMetadataLookup(psMetadata * restrict md,      ///< Metadata collection to insert metadat
     183 * @return psMetadataItem* : Pointer metadata item.
     184 */
     185psMetadataItem* psMetadataLookup(psMetadata* restrict md,      ///< Metadata collection to insert metadat
    186186                                 // item.
    187187                                 const char *restrict key       ///< Name of metadata key.
     
    192192 * Items may be found in the metadata by their entry position in the list container.
    193193 *
    194  * @return psMetadataItem*: Pointer metadata item.
    195  */
    196 psMetadataItem *psMetadataGet(psMetadata * restrict md, ///< Metadata collection to insert metadat item.
     194 * @return psMetadataItem* : Pointer metadata item.
     195 */
     196psMetadataItem* psMetadataGet(psMetadata* restrict md, ///< Metadata collection to insert metadat item.
    197197                              int where ///< Location to be retrieved.
    198198                             );
     
    204204 * @return void: void.
    205205 */
    206 bool psMetadataSetIterator(psMetadata * restrict md,    ///< Metadata collection to iterate.
     206bool psMetadataSetIterator(psMetadata* restrict md,    ///< Metadata collection to iterate.
    207207                           int where    ///< Location of iterator.
    208208                          );
     
    212212 * Get next metadata item in iterator list.
    213213 *
    214  * @return psMetadataItem*: Pointer metadata item.
    215  */
    216 psMetadataItem *psMetadataGetNext(psMetadata * restrict md,     ///< Metadata collection to iterate.
     214 * @return psMetadataItem* : Pointer metadata item.
     215 */
     216psMetadataItem* psMetadataGetNext(psMetadata* restrict md,     ///< Metadata collection to iterate.
    217217                                  const char *restrict match,   ///< Beginning of key name.
    218218                                  int which     ///< Iterator to be used.
     
    223223 * Get previous metadata item in iterator list.
    224224 *
    225  * @return psMetadataItem*: Pointer metadata item.
    226  */
    227 psMetadataItem *psMetadataGetPrevious(psMetadata * restrict md, ///< Metadata collection to iterate.
     225 * @return psMetadataItem* : Pointer metadata item.
     226 */
     227psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, ///< Metadata collection to iterate.
    228228                                      const char *restrict match,       ///< Beginning of key name.
    229229                                      int which ///< Iterator to be used.
     
    238238 * metadata type is any other data type, printing is not allowed.
    239239 *
    240  * @return psMetadataItem*: Pointer metadata item.
     240 * @return psMetadataItem* : Pointer metadata item.
    241241 */
    242242void psMetadataItemPrint(FILE * fd,     ///< Pointer to file to write metadata item.
    243243                         const char *format,    ///< Format to print metadata item.
    244                          const psMetadataItem * restrict metadataItem   ///< Metadata item to print.
     244                         const psMetadataItem* restrict metadataItem   ///< Metadata item to print.
    245245                        );
    246246
     
    250250 * unimplemented.
    251251 *
    252  * @return psMetadata*: Pointer metadata.
    253  */
    254 psMetadata *psMetadataReadHeader(psMetadata * output,   ///< Resulting metadata from read.
     252 * @return psMetadata* : Pointer metadata.
     253 */
     254psMetadata* psMetadataReadHeader(psMetadata* output,   ///< Resulting metadata from read.
    255255                                 char *extname, ///< File name extension string.
    256256                                 int extnum,    ///< File name extension number. Starts at 1.
     
    262262 * Read a metadata header from file. If the file is not found, an error is reported.
    263263 *
    264  * @return psMetadata*: Pointer metadata.
    265  */
    266 psMetadata *psMetadataFReadHeader(psMetadata * output,  ///< Resulting metadata from read.
     264 * @return psMetadata* : Pointer metadata.
     265 */
     266psMetadata* psMetadataFReadHeader(psMetadata* output,  ///< Resulting metadata from read.
    267267                                  char *extName,        ///< File name extension string.
    268268                                  int extNum,   ///< File name extension number.
  • trunk/psLib/src/collections/psScalar.c

    r1407 r1440  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-08-07 00:06:06 $
     11 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-08-09 23:34:57 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7171
    7272/*****************************************************************************/
    73 psScalar *psScalarAlloc(psC64 value, psElemType dataType)
     73psScalar* psScalarAlloc(psC64 value, psElemType dataType)
    7474{
    75     psScalar *scalar = NULL;
     75    psScalar* scalar = NULL;
    7676
    7777    // Create scalar
    78     scalar = (psScalar *) psAlloc(sizeof(psScalar));
     78    scalar = (psScalar* ) psAlloc(sizeof(psScalar));
    7979    if (scalar == NULL) {
    8080        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
     
    128128}
    129129
    130 void psScalarFree(psScalar * restrict scalar)
     130void psScalarFree(psScalar* restrict scalar)
    131131{
    132132    if (scalar == NULL) {
  • trunk/psLib/src/collections/psScalar.h

    r1426 r1440  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-08-09 22:44:25 $
     13 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-08-09 23:34:57 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6262 * Accepts a complex 64 bit float for input value, as max size, but resizes according to
    6363 * correct type.
    64  * @return psScalar*: Pointer to psScalar.
     64 * @return psScalar* : Pointer to psScalar.
    6565 *
    6666 */
    67 psScalar *psScalarAlloc(psC64 value,    ///< Data to be put into psScalar.
     67psScalar* psScalarAlloc(psC64 value,    ///< Data to be put into psScalar.
    6868                        psElemType dataType     ///< Type of data to be held by psScalar.
    6969                       );
     
    7676 *
    7777 */
    78 void psScalarFree(psScalar * restrict scalar    ///< Scalar to free.
     78void psScalarFree(psScalar* restrict scalar    ///< Scalar to free.
    7979                 );
    8080
  • trunk/psLib/src/collections/psVector.c

    r1407 r1440  
    99*  @author Ross Harman, MHPCC
    1010*
    11 *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-08-07 00:06:06 $
     11*  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-08-09 23:34:57 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6767
    6868/*****************************************************************************/
    69 static void vectorFree(psVector * restrict psVec);
     69static void vectorFree(psVector* restrict psVec);
    7070
    7171/*****************************************************************************/
     
    7474
    7575/*****************************************************************************/
    76 psVector *psVectorAlloc(unsigned int nalloc, psElemType elemType)
    77 {
    78     psVector *psVec = NULL;
     76psVector* psVectorAlloc(unsigned int nalloc, psElemType elemType)
     77{
     78    psVector* psVec = NULL;
    7979    int elementSize = 0;
    8080
     
    8888
    8989    // Create vector struct
    90     psVec = (psVector *) psAlloc(sizeof(psVector));
     90    psVec = (psVector* ) psAlloc(sizeof(psVector));
    9191    p_psMemSetDeallocator(psVec, (psFreeFcn) vectorFree);
    9292
     
    102102}
    103103
    104 psVector *psVectorRealloc(unsigned int nalloc, psVector * restrict in)
     104psVector* psVectorRealloc(unsigned int nalloc, psVector* restrict in)
    105105{
    106106    int elementSize = 0;
     
    130130}
    131131
    132 psVector *psVectorRecycle(psVector * restrict in, unsigned int nalloc, psElemType type)
     132psVector* psVectorRecycle(psVector* restrict in, unsigned int nalloc, psElemType type)
    133133{
    134134    psElemType elemType;
     
    160160}
    161161
    162 psVector *psVectorSort(psVector * restrict outVector, const psVector * restrict inVector)
     162psVector* psVectorSort(psVector* restrict outVector, const psVector* restrict inVector)
    163163{
    164164    int inN = 0;
     
    261261}
    262262
    263 psVector *psVectorSortIndex(psVector * restrict outVector, const psVector * restrict inVector)
     263psVector* psVectorSortIndex(psVector* restrict outVector, const psVector* restrict inVector)
    264264{
    265265    int inN = 0;
     
    270270    int *outVec = NULL;
    271271    double diff = 0.0f;
    272     psVector *tmpVector = NULL;
     272    psVector* tmpVector = NULL;
    273273    psElemType inType = 0;
    274274
     
    348348}
    349349
    350 static void vectorFree(psVector * restrict psVec)
     350static void vectorFree(psVector* restrict psVec)
    351351{
    352352    if (psVec == NULL) {
  • trunk/psLib/src/collections/psVector.h

    r1426 r1440  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-08-09 22:44:25 $
     14 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-08-09 23:34:57 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3838
    3939    union {
    40         psU8 *U8;               ///< Unsigned 8-bit integer data.
    41         psU16 *U16;             ///< Unsigned 16-bit integer data.
    42         psU32 *U32;             ///< Unsigned 32-bit integer data.
    43         psU64 *U64;             ///< Unsigned 64-bit integer data.
    44         psS8 *S8;               ///< Signed 8-bit integer data.
    45         psS16 *S16;             ///< Signed 16-bit integer data.
    46         psS32 *S32;             ///< Signed 32-bit integer data.
    47         psS64 *S64;             ///< Signed 64-bit integer data.
    48         psF32 *F32;             ///< Single-precision float data.
    49         psF64 *F64;             ///< Double-precision float data.
    50         psC32 *C32;             ///< Single-precision complex data.
    51         psC64 *C64;             ///< Double-precision complex data.
     40        psU8* U8;               ///< Unsigned 8-bit integer data.
     41        psU16* U16;             ///< Unsigned 16-bit integer data.
     42        psU32* U32;             ///< Unsigned 32-bit integer data.
     43        psU64* U64;             ///< Unsigned 64-bit integer data.
     44        psS8* S8;               ///< Signed 8-bit integer data.
     45        psS16* S16;             ///< Signed 16-bit integer data.
     46        psS32* S32;             ///< Signed 32-bit integer data.
     47        psS64* S64;             ///< Signed 64-bit integer data.
     48        psF32* F32;             ///< Single-precision float data.
     49        psF64* F64;             ///< Double-precision float data.
     50        psC32* C32;             ///< Single-precision complex data.
     51        psC64* C64;             ///< Double-precision complex data.
    5252        psPTR V;                ///< Pointer to data.
    5353    } data;                     ///< Union for data types.
     
    6565 * Uses psLib memory allocation functions to create a vector collection of data as defined by the psType type.
    6666 *
    67  * @return psVector*: Pointer to psVector.
     67 * @return psVector* : Pointer to psVector.
    6868 *
    6969 */
    70 psVector *psVectorAlloc(unsigned int nalloc,    ///< Total number of elements to make available.
     70psVector* psVectorAlloc(unsigned int nalloc,    ///< Total number of elements to make available.
    7171                        psElemType dataType     ///< Type of data to be held by vector.
    7272                       );
     
    7777 * according to the psType type member contained within the vector.
    7878 *
    79  * @return psVector*: Pointer to psVector.
     79 * @return psVector* : Pointer to psVector.
    8080 *
    8181 */
    82 psVector *psVectorRealloc(unsigned int nalloc,  ///< Total number of elements to make available.
    83                           psVector * restrict psVec     ///< Vector to reallocate.
     82psVector* psVectorRealloc(unsigned int nalloc,  ///< Total number of elements to make available.
     83                          psVector* restrict psVec     ///< Vector to reallocate.
    8484                         );
    8585
     
    8989 * according to the psElemType type parameter.
    9090 *
    91  * @return psVector*: Pointer to psVector.
     91 * @return psVector* : Pointer to psVector.
    9292 *
    9393 */
    94 psVector *psVectorRecycle(psVector * restrict psVec,
     94psVector* psVectorRecycle(psVector* restrict psVec,
    9595                          ///< Vector to recycle.  If NULL, a new vector is created.  No effort taken to
    9696                          // preserve the values.
     
    104104 *  all non-complex data types.
    105105 *
    106  *  @return  psFloatArray*: Pointer to sorted psFloatArray.
     106 *  @return  psFloatArray* : Pointer to sorted psFloatArray.
    107107 */
    108108
    109 psVector *psVectorSort(psVector * restrict outVector,   ///< the output vector to recycle, or NULL if new
     109psVector* psVectorSort(psVector* restrict outVector,   ///< the output vector to recycle, or NULL if new
    110110                       // vector desired.
    111                        const psVector * restrict inVector       ///< the vector to sort.
     111                       const psVector* restrict inVector       ///< the vector to sort.
    112112                      );
    113113
     
    117117 *  sorted float values based on pre-sort index positions. 
    118118 *
    119  *  @return  psIntArray*: Pointer to psIntArray of sorted indices.
     119 *  @return  psIntArray* : Pointer to psIntArray of sorted indices.
    120120 */
    121121
    122 psVector *psVectorSortIndex(psVector * restrict outVector, const psVector * restrict inVector);
     122psVector* psVectorSortIndex(psVector* restrict outVector, const psVector* restrict inVector);
    123123
    124124/// @}
  • trunk/psLib/src/dataManip/psFFT.c

    r1407 r1440  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2004-08-07 00:06:06 $
     8*  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2004-08-09 23:34:57 $
    1010*
    1111*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2828static bool p_fftwWisdomImported = false;
    2929
    30 psImage *psImageFFT(psImage * out, const psImage * in, psFftDirection direction)
     30psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction)
    3131{
    3232    unsigned int numCols;
     
    9393}
    9494
    95 psImage *psImageReal(psImage * out, const psImage * in)
     95psImage* psImageReal(psImage* out, const psImage* in)
    9696{
    9797    psElemType type;
     
    117117
    118118    if (type == PS_TYPE_C32) {
    119         psF32 *outRow;
    120         psC32 *inRow;
     119        psF32* outRow;
     120        psC32* inRow;
    121121
    122122        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
     
    130130        }
    131131    } else if (type == PS_TYPE_C64) {
    132         psF64 *outRow;
    133         psC64 *inRow;
     132        psF64* outRow;
     133        psC64* inRow;
    134134
    135135        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
     
    151151}
    152152
    153 psImage *psImageImaginary(psImage * out, const psImage * in)
     153psImage* psImageImaginary(psImage* out, const psImage* in)
    154154{
    155155    psElemType type;
     
    177177
    178178    if (type == PS_TYPE_C32) {
    179         psF32 *outRow;
    180         psC32 *inRow;
     179        psF32* outRow;
     180        psC32* inRow;
    181181
    182182        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
     
    190190        }
    191191    } else if (type == PS_TYPE_C64) {
    192         psF64 *outRow;
    193         psC64 *inRow;
     192        psF64* outRow;
     193        psC64* inRow;
    194194
    195195        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
     
    211211}
    212212
    213 psImage *psImageComplex(psImage * out, psImage * real, const psImage * imag)
     213psImage* psImageComplex(psImage* out, psImage* real, const psImage* imag)
    214214{
    215215    psElemType type;
     
    251251
    252252    if (type == PS_TYPE_F32) {
    253         psC32 *outRow;
    254         psF32 *realRow;
    255         psF32 *imagRow;
     253        psC32* outRow;
     254        psF32* realRow;
     255        psF32* imagRow;
    256256
    257257        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
     
    267267        }
    268268    } else if (type == PS_TYPE_F64) {
    269         psC64 *outRow;
    270         psF64 *realRow;
    271         psF64 *imagRow;
     269        psC64* outRow;
     270        psF64* realRow;
     271        psF64* imagRow;
    272272
    273273        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
     
    290290}
    291291
    292 psImage *psImageConjugate(psImage * out, const psImage * in)
     292psImage* psImageConjugate(psImage* out, const psImage* in)
    293293{
    294294    psElemType type;
     
    314314
    315315    if (type == PS_TYPE_C32) {
    316         psC32 *outRow;
    317         psC32 *inRow;
     316        psC32* outRow;
     317        psC32* inRow;
    318318
    319319        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
     
    327327        }
    328328    } else if (type == PS_TYPE_C64) {
    329         psC64 *outRow;
    330         psC64 *inRow;
     329        psC64* outRow;
     330        psC64* inRow;
    331331
    332332        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
     
    348348}
    349349
    350 psImage *psImagePowerSpectrum(psImage * out, const psImage * in)
     350psImage* psImagePowerSpectrum(psImage* out, const psImage* in)
    351351{
    352352    psElemType type;
     
    373373
    374374    if (type == PS_TYPE_C32) {
    375         psF32 *outRow;
    376         psC32 *inRow;
     375        psF32* outRow;
     376        psC32* inRow;
    377377        psF32 real;
    378378        psF32 imag;
     
    390390        }
    391391    } else if (type == PS_TYPE_C64) {
    392         psF64 *outRow;
    393         psC64 *inRow;
     392        psF64* outRow;
     393        psC64* inRow;
    394394        psF64 real;
    395395        psF64 imag;
     
    418418/************************************** Vector Functions ***************************************/
    419419
    420 psVector *psVectorFFT(psVector * out, const psVector * in, psFftDirection direction)
     420psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction)
    421421{
    422422    unsigned int numElements;
     
    464464    if (type == PS_TYPE_F32) {
    465465        // need to convert to complex
    466         psC32 *outVec = out->data.C32;
    467         psF32 *inVec = in->data.F32;
     466        psC32* outVec = out->data.C32;
     467        psF32* inVec = in->data.F32;
    468468
    469469        for (unsigned int i = 0; i < numElements; i++) {
     
    471471        }
    472472    } else {
    473         psC32 *outVec = out->data.C32;
    474         psC32 *inVec = in->data.C32;
     473        psC32* outVec = out->data.C32;
     474        psC32* inVec = in->data.C32;
    475475
    476476        for (unsigned int i = 0; i < numElements; i++) {
     
    498498}
    499499
    500 psVector *psVectorReal(psVector * out, const psVector * in)
     500psVector* psVectorReal(psVector* out, const psVector* in)
    501501{
    502502    psElemType type;
     
    523523
    524524    if (type == PS_TYPE_C32) {
    525         psF32 *outVec;
    526         psC32 *inVec = in->data.C32;
     525        psF32* outVec;
     526        psC32* inVec = in->data.C32;
    527527
    528528        out = psVectorRecycle(out, numElements, PS_TYPE_F32);
     
    542542}
    543543
    544 psVector *psVectorImaginary(psVector * out, const psVector * in)
     544psVector* psVectorImaginary(psVector* out, const psVector* in)
    545545{
    546546    psElemType type;
     
    567567
    568568    if (type == PS_TYPE_C32) {
    569         psF32 *outVec;
    570         psC32 *inVec = in->data.C32;
     569        psF32* outVec;
     570        psC32* inVec = in->data.C32;
    571571
    572572        out = psVectorRecycle(out, numElements, PS_TYPE_F32);
     
    586586}
    587587
    588 psVector *psVectorComplex(psVector * out, psVector * real, const psVector * imag)
     588psVector* psVectorComplex(psVector* out, psVector* real, const psVector* imag)
    589589{
    590590    psElemType type;
     
    616616
    617617    if (type == PS_TYPE_F32) {
    618         psC32 *outVec;
    619         psF32 *realVec = real->data.F32;
    620         psF32 *imagVec = imag->data.F32;
     618        psC32* outVec;
     619        psF32* realVec = real->data.F32;
     620        psF32* imagVec = imag->data.F32;
    621621
    622622        out = psVectorRecycle(out, numElements, PS_TYPE_C32);
     
    636636}
    637637
    638 psVector *psVectorConjugate(psVector * out, const psVector * in)
     638psVector* psVectorConjugate(psVector* out, const psVector* in)
    639639{
    640640    psElemType type;
     
    662662
    663663    if (type == PS_TYPE_C32) {
    664         psC32 *outVec;
    665         psC32 *inVec = in->data.C32;
     664        psC32* outVec;
     665        psC32* inVec = in->data.C32;
    666666
    667667        out = psVectorRecycle(out, numElements, PS_TYPE_C32);
     
    681681}
    682682
    683 psVector *psVectorPowerSpectrum(psVector * out, const psVector * in)
     683psVector* psVectorPowerSpectrum(psVector* out, const psVector* in)
    684684{
    685685    psElemType type;
     
    708708
    709709    if (type == PS_TYPE_C32) {
    710         psF32 *outVec;
    711         psC32 *inVec = in->data.C32;
     710        psF32* outVec;
     711        psC32* inVec = in->data.C32;
    712712        psF32 inAbs1;
    713713        psF32 inAbs2;
  • trunk/psLib/src/dataManip/psFFT.h

    r1426 r1440  
    88 *  @author Robert DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-08-09 22:44:25 $
     10 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-08-09 23:34:57 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3333} psFftDirection;
    3434
    35 psImage *psImageFFT(psImage * out, const psImage * in, psFftDirection direction);
    36 psImage *psImageReal(psImage * out, const psImage * in);
    37 psImage *psImageImaginary(psImage * out, const psImage * in);
    38 psImage *psImageComplex(psImage * out, psImage * real, const psImage * imag);
    39 psImage *psImageConjugate(psImage * out, const psImage * in);
    40 psImage *psImagePowerSpectrum(psImage * out, const psImage * in);
     35psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction);
     36psImage* psImageReal(psImage* out, const psImage* in);
     37psImage* psImageImaginary(psImage* out, const psImage* in);
     38psImage* psImageComplex(psImage* out, psImage* real, const psImage* imag);
     39psImage* psImageConjugate(psImage* out, const psImage* in);
     40psImage* psImagePowerSpectrum(psImage* out, const psImage* in);
    4141
    42 psVector *psVectorFFT(psVector * out, const psVector * in, psFftDirection direction);
    43 psVector *psVectorReal(psVector * out, const psVector * in);
    44 psVector *psVectorImaginary(psVector * out, const psVector * in);
    45 psVector *psVectorComplex(psVector * out, psVector * real, const psVector * imag);
    46 psVector *psVectorConjugate(psVector * out, const psVector * in);
    47 psVector *psVectorPowerSpectrum(psVector * out, const psVector * in);
     42psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction);
     43psVector* psVectorReal(psVector* out, const psVector* in);
     44psVector* psVectorImaginary(psVector* out, const psVector* in);
     45psVector* psVectorComplex(psVector* out, psVector* real, const psVector* imag);
     46psVector* psVectorConjugate(psVector* out, const psVector* in);
     47psVector* psVectorPowerSpectrum(psVector* out, const psVector* in);
    4848
    4949/// @}
  • trunk/psLib/src/dataManip/psFunctions.c

    r1407 r1440  
    88 *  polynomials.  It also contains a Gaussian functions.
    99 *
    10  *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-08-07 00:06:06 $
     10 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-08-09 23:34:57 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4949
    5050/*****************************************************************************/
    51 static void polynomial1DFree(psPolynomial1D * myPoly);
    52 static void polynomial2DFree(psPolynomial2D * myPoly);
    53 static void polynomial3DFree(psPolynomial3D * myPoly);
    54 static void polynomial4DFree(psPolynomial4D * myPoly);
    55 static void dPolynomial1DFree(psDPolynomial1D * myPoly);
    56 static void dPolynomial2DFree(psDPolynomial2D * myPoly);
    57 static void dPolynomial3DFree(psDPolynomial3D * myPoly);
    58 static void dPolynomial4DFree(psDPolynomial4D * myPoly);
     51static void polynomial1DFree(psPolynomial1D* myPoly);
     52static void polynomial2DFree(psPolynomial2D* myPoly);
     53static void polynomial3DFree(psPolynomial3D* myPoly);
     54static void polynomial4DFree(psPolynomial4D* myPoly);
     55static void dPolynomial1DFree(psDPolynomial1D* myPoly);
     56static void dPolynomial2DFree(psDPolynomial2D* myPoly);
     57static void dPolynomial3DFree(psDPolynomial3D* myPoly);
     58static void dPolynomial4DFree(psDPolynomial4D* myPoly);
    5959
    6060/*****************************************************************************/
     
    120120 NOTE: There is no way to seed the random generator.
    121121 *****************************************************************************/
    122 psVector *psGaussianDev(float mean, float sigma, int Npts)
    123 {
    124     psVector *gauss = NULL;
     122psVector* psGaussianDev(float mean, float sigma, int Npts)
     123{
     124    psVector* gauss = NULL;
    125125    const gsl_rng_type *T = NULL;
    126126    gsl_rng *r = NULL;
     
    144144    This routine must allocate memory for the polynomial structures.
    145145 *****************************************************************************/
    146 psPolynomial1D *psPolynomial1DAlloc(int n)
     146psPolynomial1D* psPolynomial1DAlloc(int n)
    147147{
    148148    int i = 0;
    149     psPolynomial1D *newPoly = NULL;
    150 
    151     newPoly = (psPolynomial1D *) psAlloc(sizeof(psPolynomial1D));
     149    psPolynomial1D* newPoly = NULL;
     150
     151    newPoly = (psPolynomial1D* ) psAlloc(sizeof(psPolynomial1D));
    152152    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial1DFree);
    153153    newPoly->n = n;
     
    164164}
    165165
    166 psPolynomial2D *psPolynomial2DAlloc(int nX, int nY)
    167 {
    168     int x = 0;
    169     int y = 0;
    170     psPolynomial2D *newPoly = NULL;
    171 
    172     newPoly = (psPolynomial2D *) psAlloc(sizeof(psPolynomial2D));
     166psPolynomial2D* psPolynomial2DAlloc(int nX, int nY)
     167{
     168    int x = 0;
     169    int y = 0;
     170    psPolynomial2D* newPoly = NULL;
     171
     172    newPoly = (psPolynomial2D* ) psAlloc(sizeof(psPolynomial2D));
    173173    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial2DFree);
    174174    newPoly->nX = nX;
     
    194194}
    195195
    196 psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ)
     196psPolynomial3D* psPolynomial3DAlloc(int nX, int nY, int nZ)
    197197{
    198198    int x = 0;
    199199    int y = 0;
    200200    int z = 0;
    201     psPolynomial3D *newPoly = NULL;
    202 
    203     newPoly = (psPolynomial3D *) psAlloc(sizeof(psPolynomial3D));
     201    psPolynomial3D* newPoly = NULL;
     202
     203    newPoly = (psPolynomial3D* ) psAlloc(sizeof(psPolynomial3D));
    204204    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial3DFree);
    205205    newPoly->nX = nX;
     
    233233}
    234234
    235 psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ)
     235psPolynomial4D* psPolynomial4DAlloc(int nW, int nX, int nY, int nZ)
    236236{
    237237    int w = 0;
     
    239239    int y = 0;
    240240    int z = 0;
    241     psPolynomial4D *newPoly = NULL;
    242 
    243     newPoly = (psPolynomial4D *) psAlloc(sizeof(psPolynomial4D));
     241    psPolynomial4D* newPoly = NULL;
     242
     243    newPoly = (psPolynomial4D* ) psAlloc(sizeof(psPolynomial4D));
    244244    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial4DFree);
    245245    newPoly->nW = nW;
     
    281281}
    282282
    283 static void polynomial1DFree(psPolynomial1D * myPoly)
     283static void polynomial1DFree(psPolynomial1D* myPoly)
    284284{
    285285    psFree(myPoly->coeff);
     
    288288}
    289289
    290 static void polynomial2DFree(psPolynomial2D * myPoly)
     290static void polynomial2DFree(psPolynomial2D* myPoly)
    291291{
    292292    int x = 0;
     
    302302}
    303303
    304 static void polynomial3DFree(psPolynomial3D * myPoly)
     304static void polynomial3DFree(psPolynomial3D* myPoly)
    305305{
    306306    int x = 0;
     
    323323}
    324324
    325 static void polynomial4DFree(psPolynomial4D * myPoly)
     325static void polynomial4DFree(psPolynomial4D* myPoly)
    326326{
    327327    int w = 0;
     
    353353    Polynomial coefficients will be accessed in [w][x][y][z] fashion.
    354354 *****************************************************************************/
    355 float psPolynomial1DEval(float x, const psPolynomial1D * myPoly)
     355float psPolynomial1DEval(float x, const psPolynomial1D* myPoly)
    356356{
    357357    int loop_x = 0;
     
    380380}
    381381
    382 float psPolynomial2DEval(float x, float y, const psPolynomial2D * myPoly)
     382float psPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly)
    383383{
    384384    int loop_x = 0;
     
    400400}
    401401
    402 float psPolynomial3DEval(float x, float y, float z, const psPolynomial3D * myPoly)
     402float psPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly)
    403403{
    404404    int loop_x = 0;
     
    426426}
    427427
    428 float psPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D * myPoly)
     428float psPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly)
    429429{
    430430    int loop_w = 0;
     
    458458}
    459459
    460 psDPolynomial1D *psDPolynomial1DAlloc(int n)
     460psDPolynomial1D* psDPolynomial1DAlloc(int n)
    461461{
    462462    int i = 0;
    463     psDPolynomial1D *newPoly = NULL;
    464 
    465     newPoly = (psDPolynomial1D *) psAlloc(sizeof(psDPolynomial1D));
     463    psDPolynomial1D* newPoly = NULL;
     464
     465    newPoly = (psDPolynomial1D* ) psAlloc(sizeof(psDPolynomial1D));
    466466    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial1DFree);
    467467    newPoly->n = n;
     
    478478}
    479479
    480 psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY)
    481 {
    482     int x = 0;
    483     int y = 0;
    484     psDPolynomial2D *newPoly = NULL;
    485 
    486     newPoly = (psDPolynomial2D *) psAlloc(sizeof(psDPolynomial2D));
     480psDPolynomial2D* psDPolynomial2DAlloc(int nX, int nY)
     481{
     482    int x = 0;
     483    int y = 0;
     484    psDPolynomial2D* newPoly = NULL;
     485
     486    newPoly = (psDPolynomial2D* ) psAlloc(sizeof(psDPolynomial2D));
    487487    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial2DFree);
    488488    newPoly->nX = nX;
     
    508508}
    509509
    510 psDPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ)
     510psDPolynomial3D* psDPolynomial3DAlloc(int nX, int nY, int nZ)
    511511{
    512512    int x = 0;
    513513    int y = 0;
    514514    int z = 0;
    515     psDPolynomial3D *newPoly = NULL;
    516 
    517     newPoly = (psDPolynomial3D *) psAlloc(sizeof(psDPolynomial3D));
     515    psDPolynomial3D* newPoly = NULL;
     516
     517    newPoly = (psDPolynomial3D* ) psAlloc(sizeof(psDPolynomial3D));
    518518    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial3DFree);
    519519    newPoly->nX = nX;
     
    547547}
    548548
    549 psDPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ)
     549psDPolynomial4D* psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ)
    550550{
    551551    int w = 0;
     
    553553    int y = 0;
    554554    int z = 0;
    555     psDPolynomial4D *newPoly = NULL;
    556 
    557     newPoly = (psDPolynomial4D *) psAlloc(sizeof(psDPolynomial4D));
     555    psDPolynomial4D* newPoly = NULL;
     556
     557    newPoly = (psDPolynomial4D* ) psAlloc(sizeof(psDPolynomial4D));
    558558    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial4DFree);
    559559    newPoly->nW = nW;
     
    595595}
    596596
    597 static void dPolynomial1DFree(psDPolynomial1D * myPoly)
     597static void dPolynomial1DFree(psDPolynomial1D* myPoly)
    598598{
    599599    psFree(myPoly->coeff);
     
    602602}
    603603
    604 static void dPolynomial2DFree(psDPolynomial2D * myPoly)
     604static void dPolynomial2DFree(psDPolynomial2D* myPoly)
    605605{
    606606    int x = 0;
     
    616616}
    617617
    618 static void dPolynomial3DFree(psDPolynomial3D * myPoly)
     618static void dPolynomial3DFree(psDPolynomial3D* myPoly)
    619619{
    620620    int x = 0;
     
    637637}
    638638
    639 static void dPolynomial4DFree(psDPolynomial4D * myPoly)
     639static void dPolynomial4DFree(psDPolynomial4D* myPoly)
    640640{
    641641    int w = 0;
     
    667667    Polynomial coefficients will be accessed in [w][x][y][z] fashion.
    668668 *****************************************************************************/
    669 double psDPolynomial1DEval(double x, const psDPolynomial1D * myPoly)
     669double psDPolynomial1DEval(double x, const psDPolynomial1D* myPoly)
    670670{
    671671    int loop_x = 0;
     
    686686}
    687687
    688 double psDPolynomial2DEval(double x, double y, const psDPolynomial2D * myPoly)
     688double psDPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly)
    689689{
    690690    int loop_x = 0;
     
    706706}
    707707
    708 double psDPolynomial3DEval(double x, double y, double z, const psDPolynomial3D * myPoly)
     708double psDPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly)
    709709{
    710710    int loop_x = 0;
     
    732732}
    733733
    734 double psDPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D * myPoly)
     734double psDPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly)
    735735{
    736736    int loop_w = 0;
  • trunk/psLib/src/dataManip/psFunctions.h

    r1426 r1440  
    1313*  @author George Gusciora, MHPCC
    1414*
    15 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    16 *  @date $Date: 2004-08-09 22:44:25 $
     15*  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     16*  @date $Date: 2004-08-09 23:34:57 $
    1717*
    1818*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4242/** Produce a vector of random numbers from a Gaussian distribution with
    4343    the specified mean and sigma */
    44 psVector *psGaussianDev(float mean,     ///< The mean of the Gaussian
     44psVector* psGaussianDev(float mean,     ///< The mean of the Gaussian
    4545                        float sigma,    ///< The sigma of the Gaussian
    4646                        int Npts);      ///< The size of the vector
     
    9595
    9696/** Constructor */
    97 psPolynomial1D *psPolynomial1DAlloc(int n       ///< Number of terms
    98                                    );
    99 
    100 /** Constructor */
    101 psPolynomial2D *psPolynomial2DAlloc(int nX, int nY      ///< Number of terms in x and y
    102                                    );
    103 
    104 /** Constructor */
    105 psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ      ///< Number of terms in x, y and z
    106                                    );
    107 
    108 /** Constructor */
    109 psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ      ///< Number of terms in w, x, y and
     97psPolynomial1D* psPolynomial1DAlloc(int n       ///< Number of terms
     98                                   );
     99
     100/** Constructor */
     101psPolynomial2D* psPolynomial2DAlloc(int nX, int nY      ///< Number of terms in x and y
     102                                   );
     103
     104/** Constructor */
     105psPolynomial3D* psPolynomial3DAlloc(int nX, int nY, int nZ      ///< Number of terms in x, y and z
     106                                   );
     107
     108/** Constructor */
     109psPolynomial4D* psPolynomial4DAlloc(int nW, int nX, int nY, int nZ      ///< Number of terms in w, x, y and
    110110                                    // z
    111111                                   );
     
    113113/** Evaluate 1D polynomial */
    114114float psPolynomial1DEval(float x,       ///< Value at which to evaluate
    115                          const psPolynomial1D * myPoly  ///< Coefficients for the polynomial
     115                         const psPolynomial1D* myPoly  ///< Coefficients for the polynomial
    116116                        );
    117117
     
    119119float psPolynomial2DEval(float x,       ///< Value x at which to evaluate
    120120                         float y,       ///< Value y at which to evaluate
    121                          const psPolynomial2D * myPoly  ///< Coefficients for the polynomial
     121                         const psPolynomial2D* myPoly  ///< Coefficients for the polynomial
    122122                        );
    123123
     
    126126                         float y,       ///< Value y at which to evaluate
    127127                         float z,       ///< Value z at which to evaluate
    128                          const psPolynomial3D * myPoly  ///< Coefficients for the polynomial
     128                         const psPolynomial3D* myPoly  ///< Coefficients for the polynomial
    129129                        );
    130130
     
    134134                         float y,       ///< Value y at which to evaluate
    135135                         float z,       ///< Value z at which to evaluate
    136                          const psPolynomial4D * myPoly  ///< Coefficients for the polynomial
     136                         const psPolynomial4D* myPoly  ///< Coefficients for the polynomial
    137137                        );
    138138
     
    188188
    189189/** Constructor */
    190 psDPolynomial1D *psDPolynomial1DAlloc(int n     ///< Number of terms
    191                                      );
    192 
    193 /** Constructor */
    194 psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY    ///< Number of terms in x and y
    195                                      );
    196 
    197 /** Constructor */
    198 psDPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ    ///< Number of terms in x, y and z
    199                                      );
    200 
    201 /** Constructor */
    202 psDPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ    ///< Number of terms in w, x, y and
     190psDPolynomial1D* psDPolynomial1DAlloc(int n     ///< Number of terms
     191                                     );
     192
     193/** Constructor */
     194psDPolynomial2D* psDPolynomial2DAlloc(int nX, int nY    ///< Number of terms in x and y
     195                                     );
     196
     197/** Constructor */
     198psDPolynomial3D* psDPolynomial3DAlloc(int nX, int nY, int nZ    ///< Number of terms in x, y and z
     199                                     );
     200
     201/** Constructor */
     202psDPolynomial4D* psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ    ///< Number of terms in w, x, y and
    203203                                      // z
    204204                                     );
     
    206206/** Evaluate 1D polynomial (double precision) */
    207207double psDPolynomial1DEval(double x,    ///< Value at which to evaluate
    208                            const psDPolynomial1D * myPoly       ///< Coefficients for the polynomial
     208                           const psDPolynomial1D* myPoly       ///< Coefficients for the polynomial
    209209                          );
    210210
     
    212212double psDPolynomial2DEval(double x,    ///< Value x at which to evaluate
    213213                           double y,    ///< Value y at which to evaluate
    214                            const psDPolynomial2D * myPoly       ///< Coefficients for the polynomial
     214                           const psDPolynomial2D* myPoly       ///< Coefficients for the polynomial
    215215                          );
    216216
     
    219219                           double y,    ///< Value y at which to evaluate
    220220                           double z,    ///< Value z at which to evaluate
    221                            const psDPolynomial3D * myPoly       ///< Coefficients for the polynomial
     221                           const psDPolynomial3D* myPoly       ///< Coefficients for the polynomial
    222222                          );
    223223
     
    227227                           double y,    ///< Value y at which to evaluate
    228228                           double z,    ///< Value z at which to evaluate
    229                            const psDPolynomial4D * myPoly       ///< Coefficients for the polynomial
     229                           const psDPolynomial4D* myPoly       ///< Coefficients for the polynomial
    230230                          );
    231231
  • trunk/psLib/src/dataManip/psMatrix.c

    r1407 r1440  
    2121 *  @author Ross Harman, MHPCC
    2222 *   
    23  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    24  *  @date $Date: 2004-08-07 00:06:06 $
     23 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     24 *  @date $Date: 2004-08-09 23:34:57 $
    2525 *
    2626 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    160160/*****************************************************************************/
    161161
    162 psImage *psMatrixLUD(psImage * outImage, psVector * outPerm, psImage * inImage)
     162psImage* psMatrixLUD(psImage* outImage, psVector* outPerm, psImage* inImage)
    163163{
    164164    int signum = 0;
     
    205205}
    206206
    207 psVector *psMatrixLUSolve(psVector * outVector, const psImage * inImage, const psVector * inVector, const
    208                           psVector * inPerm)
     207psVector* psMatrixLUSolve(psVector* outVector, const psImage* inImage, const psVector* inVector, const
     208                          psVector* inPerm)
    209209{
    210210    int arraySize = 0;
     
    258258}
    259259
    260 psImage *psMatrixInvert(psImage * outImage, const psImage * inImage, float *restrict det)
     260psImage* psMatrixInvert(psImage* outImage, const psImage* inImage, float *restrict det)
    261261{
    262262    int signum = 0;
     
    312312}
    313313
    314 float *psMatrixDeterminant(const psImage * restrict inImage)
     314float *psMatrixDeterminant(const psImage* restrict inImage)
    315315{
    316316    int signum = 0;
     
    354354}
    355355
    356 psImage *psMatrixMultiply(psImage * outImage, psImage * inImage1, psImage * inImage2)
     356psImage* psMatrixMultiply(psImage* outImage, psImage* inImage1, psImage* inImage2)
    357357{
    358358    int arraySize = 0;
     
    396396}
    397397
    398 psImage *psMatrixTranspose(psImage * outImage, const psImage * inImage)
     398psImage* psMatrixTranspose(psImage* outImage, const psImage* inImage)
    399399{
    400400    int arraySize = 0;
     
    433433}
    434434
    435 psImage *psMatrixEigenvectors(psImage * outImage, psImage * inImage)
     435psImage* psMatrixEigenvectors(psImage* outImage, psImage* inImage)
    436436{
    437437    int numRows = 0;
     
    477477}
    478478
    479 psVector *psMatrixToVector(psVector * outVector, psImage * inImage)
     479psVector* psMatrixToVector(psVector* outVector, psImage* inImage)
    480480{
    481481    int size = 0;
     
    536536}
    537537
    538 psImage *psVectorToMatrix(psImage * outImage, psVector * inVector)
     538psImage* psVectorToMatrix(psImage* outImage, psVector* inVector)
    539539{
    540540    int size = 0;
  • trunk/psLib/src/dataManip/psMatrix.h

    r1426 r1440  
    2222 *  @author Ross Harman, MHPCC
    2323 *
    24  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    25  *  @date $Date: 2004-08-09 22:44:25 $
     24 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     25 *  @date $Date: 2004-08-09 23:34:57 $
    2626 *
    2727 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4141 *  the same. GSL indexes the top row as the zero row, not the bottom. 
    4242 *
    43  *  @return  psImage*: Pointer to LU decomposed psImage.
     43 *  @return  psImage* : Pointer to LU decomposed psImage.
    4444 */
    45 psImage *psMatrixLUD(psImage * outImage,        ///< Image to return, or NULL.
    46                      psVector * outPerm,        ///< Output permutation vector used by psMatrixLUSolve.
    47                      psImage * inImage  ///< Image to decompose.
     45psImage* psMatrixLUD(psImage* outImage,        ///< Image to return, or NULL.
     46                     psVector* outPerm,        ///< Output permutation vector used by psMatrixLUSolve.
     47                     psImage* inImage  ///< Image to decompose.
    4848                    );
    4949
     
    5555 *  the top row as the zero row, not the bottom. 
    5656 *
    57  *  @return  psVector*: Pointer to psVector solution of matrix equation.
     57 *  @return  psVector* : Pointer to psVector solution of matrix equation.
    5858 */
    59 psVector *psMatrixLUSolve(psVector * outVector, ///< Vector to return, or NULL.
    60                           const psImage * luImage,      ///< LU-decomposed matrix.
    61                           const psVector * inVector,    ///< Vector right-hand-side of equation.
    62                           const psVector * inPerm       ///< Permutation vector resulting from psMatrixLUD
     59psVector* psMatrixLUSolve(psVector* outVector, ///< Vector to return, or NULL.
     60                          const psImage* luImage,      ///< LU-decomposed matrix.
     61                          const psVector* inVector,    ///< Vector right-hand-side of equation.
     62                          const psVector* inPerm       ///< Permutation vector resulting from psMatrixLUD
    6363                          // function.
    6464                         );
     
    7171 *  the same. GSL indexes the top row as the zero row, not the bottom. 
    7272 *
    73  *  @return  psImage*: Pointer to inverted psImage.
     73 *  @return  psImage* : Pointer to inverted psImage.
    7474 */
    75 psImage *psMatrixInvert(psImage * outImage,     ///< Image to return, or NULL for in-place substitution.
    76                         const psImage * inImage,        ///< Image to be inverted
     75psImage* psMatrixInvert(psImage* outImage,     ///< Image to return, or NULL for in-place substitution.
     76                        const psImage* inImage,        ///< Image to be inverted
    7777                        float *restrict det     ///< Determinant to return, or NULL
    7878                       );
     
    8686 *  @return  float: Determinant from psImage.
    8787 */
    88 float *psMatrixDeterminant(const psImage * restrict inMatrix    ///< Image used to calculate determinant.
     88float *psMatrixDeterminant(const psImage* restrict inMatrix    ///< Image used to calculate determinant.
    8989                          );
    9090
     
    9696 *  zero row, not the bottom. 
    9797 *
    98  *  @return  psImage*: Pointer to resulting psImage.
     98 *  @return  psImage* : Pointer to resulting psImage.
    9999 */
    100 psImage *psMatrixMultiply(psImage * outImage,   ///< Matrix to return, or NULL.
    101                           psImage * inImage1,   ///< First input image.
    102                           psImage * inImage2    ///< Second input image.
     100psImage* psMatrixMultiply(psImage* outImage,   ///< Matrix to return, or NULL.
     101                          psImage* inImage1,   ///< First input image.
     102                          psImage* inImage2    ///< Second input image.
    103103                         );
    104104
     
    110110 *  row, not the bottom. 
    111111 *
    112  *  @return  psImage*: Pointer to transposed psImage.
     112 *  @return  psImage* : Pointer to transposed psImage.
    113113 */
    114 psImage *psMatrixTranspose(psImage * outImage,  ///< Image to return, or NULL
    115                            const psImage * inImage      ///< Image to transpose
     114psImage* psMatrixTranspose(psImage* outImage,  ///< Image to return, or NULL
     115                           const psImage* inImage      ///< Image to transpose
    116116                          );
    117117
     
    122122 *  only with the psF64 data type. GSL indexes the top row as the zero row, not the bottom. 
    123123 *
    124  *  @return  psImage*: Pointer to matrix of Eigenvectors.
     124 *  @return  psImage* : Pointer to matrix of Eigenvectors.
    125125 */
    126 psImage *psMatrixEigenvectors(psImage * outImage,       ///< Eigenvectors to return, or NULL.
    127                               psImage * inImage ///< Input image.
     126psImage* psMatrixEigenvectors(psImage* outImage,       ///< Eigenvectors to return, or NULL.
     127                              psImage* inImage ///< Input image.
    128128                             );
    129129
     
    135135 *  input matrix must be 1. This function operates only  with the psF64 data type.
    136136 *
    137  *  @return  psVector*: Pointer to psVector.
     137 *  @return  psVector* : Pointer to psVector.
    138138 */
    139 psVector *psMatrixToVector(psVector * outVector,        ///< Vector to return, or NULL.
    140                            psImage * inImage    ///< Image to convert.
     139psVector* psMatrixToVector(psVector* outVector,        ///< Vector to return, or NULL.
     140                           psImage* inImage    ///< Image to convert.
    141141                          );
    142142
     
    148148 *  automatically be created. This function operates only with the psF64 data type. 
    149149 *
    150  *  @return  psVector*: Pointer to psIamge.
     150 *  @return  psVector* : Pointer to psIamge.
    151151 */
    152 psImage *psVectorToMatrix(psImage * outImage,   ///< Matrix to return, or NULL.
    153                           psVector * inVector   ///< Vector to convert.
     152psImage* psVectorToMatrix(psImage* outImage,   ///< Matrix to return, or NULL.
     153                          psVector* inVector   ///< Vector to convert.
    154154                         );
    155155
  • trunk/psLib/src/dataManip/psMatrixVectorArithmetic.c

    r1407 r1440  
    3030 *  @author Ross Harman, MHPCC
    3131 *
    32  *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    33  *  @date $Date: 2004-08-07 00:06:06 $
     32 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     33 *  @date $Date: 2004-08-09 23:34:57 $
    3434 *
    3535 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    114114    ps##TYPE *i1 = NULL;                                                                                     \
    115115    ps##TYPE *i2 = NULL;                                                                                     \
    116     o  = &((psScalar*)OUT)->data.TYPE;                                                                       \
    117     i1 = &((psScalar*)IN1)->data.TYPE;                                                                       \
    118     i2 = &((psScalar*)IN2)->data.TYPE;                                                                       \
     116    o  = &((psScalar* )OUT)->data.TYPE;                                                                       \
     117    i1 = &((psScalar* )IN1)->data.TYPE;                                                                       \
     118    i2 = &((psScalar* )IN2)->data.TYPE;                                                                       \
    119119    *o = OP;                                                                                                 \
    120120}
     
    127127    ps##TYPE *i1 = NULL;                                                                                     \
    128128    ps##TYPE *i2 = NULL;                                                                                     \
    129     npt  = ((psVector*)IN1)->n;                                                                              \
    130     o  = ((psVector*)OUT)->data.TYPE;                                                                        \
    131     i1 = &((psScalar*)IN1)->data.TYPE;                                                                       \
    132     i2 = ((psVector*)IN2)->data.TYPE;                                                                        \
     129    npt  = ((psVector* )IN1)->n;                                                                              \
     130    o  = ((psVector* )OUT)->data.TYPE;                                                                        \
     131    i1 = &((psScalar* )IN1)->data.TYPE;                                                                       \
     132    i2 = ((psVector* )IN2)->data.TYPE;                                                                        \
    133133    for (i=0; i < npt; i++, o++, i2++) {                                                                     \
    134134        *o = OP;                                                                                             \
     
    145145    ps##TYPE *i1 = NULL;                                                                                     \
    146146    ps##TYPE *i2 = NULL;                                                                                     \
    147     numRows = ((psImage*)IN1)->numRows;                                                                      \
    148     numCols = ((psImage*)IN1)->numCols;                                                                      \
     147    numRows = ((psImage* )IN1)->numRows;                                                                      \
     148    numCols = ((psImage* )IN1)->numCols;                                                                      \
    149149    for(j = 0; j < numCols; j++) {                                                                           \
    150         o  = ((psImage*)OUT)->data.TYPE[j];                                                                  \
    151         i1 = &((psScalar*)IN1)->data.TYPE;                                                                   \
    152         i2 = ((psImage*)IN2)->data.TYPE[j];                                                                  \
     150        o  = ((psImage* )OUT)->data.TYPE[j];                                                                  \
     151        i1 = &((psScalar* )IN1)->data.TYPE;                                                                   \
     152        i2 = ((psImage* )IN2)->data.TYPE[j];                                                                  \
    153153        for(i = 0; i < numRows; i++, o++, i2++) {                                                            \
    154154            *o = OP;                                                                                         \
     
    165165    ps##TYPE *i1 = NULL;                                                                                     \
    166166    ps##TYPE *i2 = NULL;                                                                                     \
    167     n1  = ((psVector*)IN1)->n;                                                                               \
    168     o  = ((psVector*)OUT)->data.TYPE;                                                                        \
    169     i1 = ((psVector*)IN1)->data.TYPE;                                                                        \
    170     i2 = &((psScalar*)IN2)->data.TYPE;                                                                       \
     167    n1  = ((psVector* )IN1)->n;                                                                               \
     168    o  = ((psVector* )OUT)->data.TYPE;                                                                        \
     169    i1 = ((psVector* )IN1)->data.TYPE;                                                                        \
     170    i2 = &((psScalar* )IN2)->data.TYPE;                                                                       \
    171171    for (i=0; i < n1; i++, o++, i1++) {                                                                      \
    172172        *o = OP;                                                                                             \
     
    182182    ps##TYPE *i1 = NULL;                                                                                     \
    183183    ps##TYPE *i2 = NULL;                                                                                     \
    184     n1  = ((psVector*)IN1)->n;                                                                               \
    185     n2  = ((psVector*)IN2)->n;                                                                               \
     184    n1  = ((psVector* )IN1)->n;                                                                               \
     185    n2  = ((psVector* )IN2)->n;                                                                               \
    186186    if(n1 != n2) {                                                                                           \
    187187        psError(__func__, ": Inconsistent element count: %d vs %d", n1, n2);                                 \
    188188        return OUT;                                                                                          \
    189189    }                                                                                                        \
    190     o  = ((psVector*)OUT)->data.TYPE;                                                                        \
    191     i1 = ((psVector*)IN1)->data.TYPE;                                                                        \
    192     i2 = ((psVector*)IN2)->data.TYPE;                                                                        \
     190    o  = ((psVector* )OUT)->data.TYPE;                                                                        \
     191    i1 = ((psVector* )IN1)->data.TYPE;                                                                        \
     192    i2 = ((psVector* )IN2)->data.TYPE;                                                                        \
    193193    for (i=0; i < n1; i++, o++, i1++, i2++) {                                                                \
    194194        *o = OP;                                                                                             \
     
    207207    ps##TYPE *i1 = NULL;                                                                                     \
    208208    ps##TYPE *i2 = NULL;                                                                                     \
    209     n1  = ((psVector*)IN1)->n;                                                                               \
    210     dim1 = ((psVector*)IN1)->type.dimen;                                                                     \
    211     numRows2 = ((psImage*)IN2)->numRows;                                                                     \
    212     numCols2 = ((psImage*)IN2)->numCols;                                                                     \
     209    n1  = ((psVector* )IN1)->n;                                                                               \
     210    dim1 = ((psVector* )IN1)->type.dimen;                                                                     \
     211    numRows2 = ((psImage* )IN2)->numRows;                                                                     \
     212    numCols2 = ((psImage* )IN2)->numCols;                                                                     \
    213213    \
    214214    if(dim1 == PS_DIMEN_VECTOR) { /* Regular vectors */                                                      \
     
    218218        }                                                                                                    \
    219219        \
    220         i1 = ((psVector*)IN1)->data.TYPE;                                                                    \
     220        i1 = ((psVector* )IN1)->data.TYPE;                                                                    \
    221221        for(j = 0; j < numRows2; j++, i1++) {                                                                \
    222             o  = ((psImage*)OUT)->data.TYPE[j];                                                              \
    223             i2 = ((psImage*)IN2)->data.TYPE[j];                                                              \
     222            o  = ((psImage* )OUT)->data.TYPE[j];                                                              \
     223            i2 = ((psImage* )IN2)->data.TYPE[j];                                                              \
    224224            for(i = 0; i < numCols2; i++, o++, i2++) {                                                       \
    225225                *o = OP;                                                                                     \
     
    233233        \
    234234        for(j = 0; j < numRows2; j++) {                                                                      \
    235             o  = ((psImage*)OUT)->data.TYPE[j];                                                              \
    236             i1 = ((psVector*)IN1)->data.TYPE;                                                                \
    237             i2 = ((psImage*)IN2)->data.TYPE[j];                                                              \
     235            o  = ((psImage* )OUT)->data.TYPE[j];                                                              \
     236            i1 = ((psVector* )IN1)->data.TYPE;                                                                \
     237            i2 = ((psImage* )IN2)->data.TYPE[j];                                                              \
    238238            for(i = 0; i < numCols2; i++, o++, i1++, i2++) {                                                 \
    239239                *o = OP;                                                                                     \
     
    253253    ps##TYPE *i1 = NULL;                                                                                     \
    254254    ps##TYPE *i2 = NULL;                                                                                     \
    255     numRows = ((psImage*)IN1)->numRows;                                                                      \
    256     numCols = ((psImage*)IN1)->numCols;                                                                      \
     255    numRows = ((psImage* )IN1)->numRows;                                                                      \
     256    numCols = ((psImage* )IN1)->numCols;                                                                      \
    257257    for(j = 0; j < numRows; j++) {                                                                           \
    258         o  = ((psImage*)OUT)->data.TYPE[j];                                                                  \
    259         i1 = ((psImage*)IN1)->data.TYPE[j];                                                                  \
    260         i2 = &((psScalar*)IN2)->data.TYPE;                                                                   \
     258        o  = ((psImage* )OUT)->data.TYPE[j];                                                                  \
     259        i1 = ((psImage* )IN1)->data.TYPE[j];                                                                  \
     260        i2 = &((psScalar* )IN2)->data.TYPE;                                                                   \
    261261        for(i = 0; i < numCols; i++, o++, i1++) {                                                            \
    262262            *o = OP;                                                                                         \
     
    276276    ps##TYPE *i1 = NULL;                                                                                     \
    277277    ps##TYPE *i2 = NULL;                                                                                     \
    278     n2  = ((psVector*)IN2)->n;                                                                               \
    279     dim2 = ((psVector*)IN2)->type.dimen;                                                                     \
    280     numRows1 = ((psImage*)IN1)->numRows;                                                                     \
    281     numCols1 = ((psImage*)IN1)->numCols;                                                                     \
     278    n2  = ((psVector* )IN2)->n;                                                                               \
     279    dim2 = ((psVector* )IN2)->type.dimen;                                                                     \
     280    numRows1 = ((psImage* )IN1)->numRows;                                                                     \
     281    numCols1 = ((psImage* )IN1)->numCols;                                                                     \
    282282    \
    283283    if(dim2 == PS_DIMEN_VECTOR) { /* Regular vectors */                                                      \
     
    287287        }                                                                                                    \
    288288        \
    289         i2 = ((psVector*)IN2)->data.TYPE;                                                                    \
     289        i2 = ((psVector* )IN2)->data.TYPE;                                                                    \
    290290        for(j = 0; j < numRows1; j++, i1++) {                                                                \
    291             o  = ((psImage*)OUT)->data.TYPE[j];                                                              \
    292             i1 = ((psImage*)IN1)->data.TYPE[j];                                                              \
     291            o  = ((psImage* )OUT)->data.TYPE[j];                                                              \
     292            i1 = ((psImage* )IN1)->data.TYPE[j];                                                              \
    293293            for(i = 0; i < numCols1; i++, o++, i1++) {                                                       \
    294294                *o = OP;                                                                                     \
     
    302302        \
    303303        for(j = 0; j < numRows1; j++) {                                                                      \
    304             o  = ((psImage*)OUT)->data.TYPE[j];                                                              \
    305             i1 = ((psVector*)IN2)->data.TYPE;                                                                \
    306             i2 = ((psImage*)IN1)->data.TYPE[j];                                                              \
     304            o  = ((psImage* )OUT)->data.TYPE[j];                                                              \
     305            i1 = ((psVector* )IN2)->data.TYPE;                                                                \
     306            i2 = ((psImage* )IN1)->data.TYPE[j];                                                              \
    307307            for(i = 0; i < numCols1; i++, o++, i2++, i1++) {                                                 \
    308308                *o = OP;                                                                                     \
     
    323323    ps##TYPE *i1 = NULL;                                                                                     \
    324324    ps##TYPE *i2 = NULL;                                                                                     \
    325     numRows1 = ((psImage*)IN1)->numRows;                                                                     \
    326     numCols1 = ((psImage*)IN1)->numCols;                                                                     \
    327     numRows2 = ((psImage*)IN2)->numRows;                                                                     \
    328     numCols2 = ((psImage*)IN2)->numCols;                                                                     \
     325    numRows1 = ((psImage* )IN1)->numRows;                                                                     \
     326    numCols1 = ((psImage* )IN1)->numCols;                                                                     \
     327    numRows2 = ((psImage* )IN2)->numRows;                                                                     \
     328    numCols2 = ((psImage* )IN2)->numCols;                                                                     \
    329329    if(numRows1!=numRows2 || numCols1!=numCols2) {                                                           \
    330330        psError(__func__, ": Inconsistent element count: numRows: %d vs %d numCols: %d vs %d", numRows1,     \
     
    333333    }                                                                                                        \
    334334    for(j = 0; j < numRows1; j++) {                                                                          \
    335         o  = ((psImage*)OUT)->data.TYPE[j];                                                                  \
    336         i1 = ((psImage*)IN1)->data.TYPE[j];                                                                  \
    337         i2 = ((psImage*)IN2)->data.TYPE[j];                                                                  \
     335        o  = ((psImage* )OUT)->data.TYPE[j];                                                                  \
     336        i1 = ((psImage* )IN1)->data.TYPE[j];                                                                  \
     337        i2 = ((psImage* )IN2)->data.TYPE[j];                                                                  \
    338338        for(i = 0; i < numCols1; i++, o++, i1++, i2++) {                                                     \
    339339            *o = OP;                                                                                         \
     
    409409    psElemType elType2 = 0;
    410410    psElemType elTypeOut = 0;
    411     psType *psType1 = NULL;
    412     psType *psType2 = NULL;
    413     psType *psTypeOut = NULL;
    414 
    415     psTypeOut = (psType *) out;
     411    psType* psType1 = NULL;
     412    psType* psType2 = NULL;
     413    psType* psTypeOut = NULL;
     414
     415    psTypeOut = (psType* ) out;
    416416    if (psTypeOut == NULL) {
    417417        psError(__func__, ": Line %d - Null out argument", __LINE__);
     
    419419    }
    420420
    421     psType1 = (psType *) in1;
     421    psType1 = (psType* ) in1;
    422422    if (psType1 == NULL) {
    423423        psError(__func__, ": Line %d - Null in1 argument", __LINE__);
     
    425425    }
    426426
    427     psType2 = (psType *) in2;
     427    psType2 = (psType* ) in2;
    428428    if (psType2 == NULL) {
    429429        psError(__func__, ": Line %d - Null in2 argument", __LINE__);
     
    456456
    457457    if (dim1 == PS_DIMEN_VECTOR) {
    458         if (((psVector *) in1)->n == 0) {
     458        if (((psVector* ) in1)->n == 0) {
    459459            psError(__func__, ": Line %d - Vector contains zero elements");
    460460        }
    461461    } else if (dim1 == PS_DIMEN_IMAGE) {
    462         if (((psImage *) in1)->numCols == 0 || ((psImage *) in1)->numRows == 0) {
     462        if (((psImage* ) in1)->numCols == 0 || ((psImage* ) in1)->numRows == 0) {
    463463            psError(__func__, ": Line %d - Image contains zero length row or cols");
    464464        }
     
    466466
    467467    if (dim2 == PS_DIMEN_VECTOR) {
    468         if (((psVector *) in2)->n == 0) {
     468        if (((psVector* ) in2)->n == 0) {
    469469            psError(__func__, ": Line %d - Vector contains zero elements");
    470470        }
    471471    } else if (dim2 == PS_DIMEN_IMAGE) {
    472         if (((psImage *) in2)->numCols == 0 || ((psImage *) in2)->numRows == 0) {
     472        if (((psImage* ) in2)->numCols == 0 || ((psImage* ) in2)->numRows == 0) {
    473473            psError(__func__, ": Line %d - Image contains zero length row or cols");
    474474        }
     
    517517    ps##TYPE *o = NULL;                                                                                      \
    518518    ps##TYPE *i1 = NULL;                                                                                     \
    519     o  = &((psScalar*)OUT)->data.TYPE;                                                                       \
    520     i1 = &((psScalar*)IN)->data.TYPE;                                                                        \
     519    o  = &((psScalar* )OUT)->data.TYPE;                                                                       \
     520    i1 = &((psScalar* )IN)->data.TYPE;                                                                        \
    521521    *o = OP;                                                                                                 \
    522522}
     
    530530    ps##TYPE *o = NULL;                                                                                      \
    531531    ps##TYPE *i1 = NULL;                                                                                     \
    532     nIn = ((psVector*)IN)->n;                                                                                \
    533     nOut = ((psVector*)OUT)->n;                                                                              \
     532    nIn = ((psVector* )IN)->n;                                                                                \
     533    nOut = ((psVector* )OUT)->n;                                                                              \
    534534    if(nIn != nOut) {                                                                                        \
    535535        psError(__func__, ": Inconsistent element count: %d vs %d", nIn, nOut);                              \
    536536        return OUT;                                                                                          \
    537537    }                                                                                                        \
    538     o  = ((psVector*)OUT)->data.TYPE;                                                                        \
    539     i1 = ((psVector*)IN)->data.TYPE;                                                                         \
     538    o  = ((psVector* )OUT)->data.TYPE;                                                                        \
     539    i1 = ((psVector* )IN)->data.TYPE;                                                                         \
    540540    for(i = 0; i < nIn; i++, o++, i1++) {                                                                    \
    541541        *o = OP;                                                                                             \
     
    554554    ps##TYPE *o = NULL;                                                                                      \
    555555    ps##TYPE *i1 = NULL;                                                                                     \
    556     numRowsIn = ((psImage*)IN)->numRows;                                                                     \
    557     numColsIn = ((psImage*)IN)->numCols;                                                                     \
    558     numRowsOut = ((psImage*)OUT)->numRows;                                                                   \
    559     numColsOut = ((psImage*)OUT)->numCols;                                                                   \
     556    numRowsIn = ((psImage* )IN)->numRows;                                                                     \
     557    numColsIn = ((psImage* )IN)->numCols;                                                                     \
     558    numRowsOut = ((psImage* )OUT)->numRows;                                                                   \
     559    numColsOut = ((psImage* )OUT)->numCols;                                                                   \
    560560    if(numRowsIn!=numRowsOut || numColsIn!=numColsOut) {                                                     \
    561561        psError(__func__, ": Inconsistent element count: numRows: %d vs %d numCols: %d vs %d", numRowsIn,    \
     
    564564    }                                                                                                        \
    565565    for(j = 0; j < numRowsIn; j++) {                                                                         \
    566         o  = ((psImage*)OUT)->data.TYPE[j];                                                                  \
    567         i1 = ((psImage*)IN)->data.TYPE[j];                                                                   \
     566        o  = ((psImage* )OUT)->data.TYPE[j];                                                                  \
     567        i1 = ((psImage* )IN)->data.TYPE[j];                                                                   \
    568568        for(i = 0; i < numColsIn; i++, o++, i1++) {                                                          \
    569569            *o = OP;                                                                                         \
     
    713713    psElemType elTypeIn = 0;
    714714    psElemType elTypeOut = 0;
    715     psType *psTypeIn = NULL;
    716     psType *psTypeOut = NULL;
    717 
    718     psTypeOut = (psType *) out;
     715    psType* psTypeIn = NULL;
     716    psType* psTypeOut = NULL;
     717
     718    psTypeOut = (psType* ) out;
    719719    if (psTypeOut == NULL) {
    720720        psError(__func__, ": Line %d - Null out argument", __LINE__);
     
    722722    }
    723723
    724     psTypeIn = (psType *) in;
     724    psTypeIn = (psType* ) in;
    725725    if (psTypeIn == NULL) {
    726726        psError(__func__, ": Line %d - Null in argument", __LINE__);
     
    757757
    758758    if (dimIn == PS_DIMEN_VECTOR) {
    759         if (((psVector *) in)->n == 0) {
     759        if (((psVector* ) in)->n == 0) {
    760760            psError(__func__, ": Line %d - Vector contains zero elements");
    761761        }
    762762    } else if (dimIn == PS_DIMEN_IMAGE) {
    763         if (((psImage *) in)->numCols == 0 || ((psImage *) in)->numRows == 0) {
     763        if (((psImage* ) in)->numCols == 0 || ((psImage* ) in)->numRows == 0) {
    764764            psError(__func__, ": Line %d - Image contains zero length row or cols");
    765765        }
     
    767767
    768768    if (dimOut == PS_DIMEN_VECTOR) {
    769         if (((psVector *) out)->n == 0) {
     769        if (((psVector* ) out)->n == 0) {
    770770            psError(__func__, ": Line %d - Vector contains zero elements");
    771771        }
    772772    } else if (dimOut == PS_DIMEN_IMAGE) {
    773         if (((psImage *) out)->numCols == 0 || ((psImage *) out)->numRows == 0) {
     773        if (((psImage* ) out)->numCols == 0 || ((psImage* ) out)->numRows == 0) {
    774774            psError(__func__, ": Line %d - Image contains zero length row or cols");
    775775        }
  • trunk/psLib/src/dataManip/psMatrixVectorArithmetic.h

    r1407 r1440  
    3030 *  @author Ross Harman, MHPCC
    3131 *
    32  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    33  *  @date $Date: 2004-08-07 00:06:06 $
     32 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     33 *  @date $Date: 2004-08-09 23:34:57 $
    3434 *
    3535 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5353 *  This function only supports vector-vector or image-image opertions.
    5454 *
    55  *  @return  psType*: Pointer to either psImage or psVector.
     55 *  @return  psType* : Pointer to either psImage or psVector.
    5656 */
    57 psType *psBinaryOp(void *out,   // / Output type, either psImage or psVector.
     57psType* psBinaryOp(void *out,   // / Output type, either psImage or psVector.
    5858                   void *in1,   // / First input, either psImage or psVector.
    5959                   char *op,    // / Operator.
     
    7575 *  This function only supports vector-vector or image-image opertions.
    7676 *
    77  *  @return  psType*: Pointer to either psImage or psVector.
     77 *  @return  psType* : Pointer to either psImage or psVector.
    7878 */
    79 psType *psUnaryOp(void *out,    // / Output type, either psImage or psVector.
     79psType* psUnaryOp(void *out,    // / Output type, either psImage or psVector.
    8080                  void *in,     // / Input, either psImage or psVector.
    8181                  char *op      // / Operator.
  • trunk/psLib/src/dataManip/psMinimize.c

    r1407 r1440  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-07 00:06:06 $
     12 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-08-09 23:34:57 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9999    size_t n;                   // Number of data points points in domain.
    100100    int paramCount;             // Number of non-masked parameters.
    101     psVector *restrict initialGuess;
    102     const psImage *restrict domain;
    103     const psVector *restrict data;
    104     const psVector *restrict errors;
    105     const psVector *restrict paramMask;
    106     float (*evalModel) (const psVector *, const psVector *);
    107     float (*d_evalModel) (const psVector *, const psVector *, int);
     101    psVector* restrict initialGuess;
     102    const psImage* restrict domain;
     103    const psVector* restrict data;
     104    const psVector* restrict errors;
     105    const psVector* restrict paramMask;
     106    float (*evalModel) (const psVector* , const psVector* );
     107    float (*d_evalModel) (const psVector* , const psVector* , int);
    108108}
    109109psMinChi2Data;
     
    112112{
    113113    int paramCount;             // Number of non-masked parameters.
    114     psVector *restrict initialGuess;
    115     const psVector *restrict coord;
    116     const psVector *restrict paramMask;
    117     float (*evalModel) (const psVector *, const psVector *);
    118     float (*d_evalModel) (const psVector *, const psVector *, int);
     114    psVector* restrict initialGuess;
     115    const psVector* restrict coord;
     116    const psVector* restrict paramMask;
     117    float (*evalModel) (const psVector* , const psVector* );
     118    float (*d_evalModel) (const psVector* , const psVector* , int);
    119119}
    120120psMinimizeData;
     
    162162    int j;                      // Loop index variable.
    163163    float tmpf;                 // Temporary floating point variable.
    164     const psVector *restrict coord = ((psMinimizeData *) funcData)->coord;
    165     const psVector *restrict mask = ((psMinimizeData *) funcData)->paramMask;
    166     psVector *restrict initialGuess = ((psMinimizeData *) funcData)->initialGuess;
    167     float (*evalModel) (const psVector *, const psVector *) = ((psMinimizeData *) funcData)->evalModel;
    168     psVector *inputParameterList = NULL;
     164    const psVector* restrict coord = ((psMinimizeData* ) funcData)->coord;
     165    const psVector* restrict mask = ((psMinimizeData* ) funcData)->paramMask;
     166    psVector* restrict initialGuess = ((psMinimizeData* ) funcData)->initialGuess;
     167    float (*evalModel) (const psVector* , const psVector* ) = ((psMinimizeData* ) funcData)->evalModel;
     168    psVector* inputParameterList = NULL;
    169169
    170170    // The GSL routines will call this function with the masked parameters
     
    216216    int j;                      // Loop index variable.
    217217    float tmpf;                 // Temporary floating point variable.
    218     const psVector *restrict coord = ((psMinimizeData *) funcData)->coord;
    219     const psVector *restrict mask = ((psMinimizeData *) funcData)->paramMask;
    220     psVector *restrict initialGuess = ((psMinimizeData *) funcData)->initialGuess;
    221     float (*d_evalModel) (const psVector *, const psVector *, int) =
    222         ((psMinimizeData *) funcData)->d_evalModel;
    223     psVector *inputParameterList = NULL;
     218    const psVector* restrict coord = ((psMinimizeData* ) funcData)->coord;
     219    const psVector* restrict mask = ((psMinimizeData* ) funcData)->paramMask;
     220    psVector* restrict initialGuess = ((psMinimizeData* ) funcData)->initialGuess;
     221    float (*d_evalModel) (const psVector* , const psVector* , int) =
     222        ((psMinimizeData* ) funcData)->d_evalModel;
     223    psVector* inputParameterList = NULL;
    224224
    225225    // The GSL routines will call this function with the masked parameters
     
    293293    int j;                      // Loop index variable.
    294294    float tmpf;                 // Temporary floating point variable.
    295     const psImage *restrict domain = ((psMinChi2Data *) funcData)->domain;
    296     const psVector *restrict data = ((psMinChi2Data *) funcData)->data;
    297     const psVector *restrict errors = ((psMinChi2Data *) funcData)->errors;
    298     const psVector *restrict mask = ((psMinChi2Data *) funcData)->paramMask;
    299     psVector *restrict initialGuess = ((psMinChi2Data *) funcData)->initialGuess;
    300     float (*evalModel) (const psVector *, const psVector *) = ((psMinChi2Data *) funcData)->evalModel;
    301     psVector *inputParameterList = NULL;
    302     psVector *tmpVecPtr = NULL;
     295    const psImage* restrict domain = ((psMinChi2Data* ) funcData)->domain;
     296    const psVector* restrict data = ((psMinChi2Data* ) funcData)->data;
     297    const psVector* restrict errors = ((psMinChi2Data* ) funcData)->errors;
     298    const psVector* restrict mask = ((psMinChi2Data* ) funcData)->paramMask;
     299    psVector* restrict initialGuess = ((psMinChi2Data* ) funcData)->initialGuess;
     300    float (*evalModel) (const psVector* , const psVector* ) = ((psMinChi2Data* ) funcData)->evalModel;
     301    psVector* inputParameterList = NULL;
     302    psVector* tmpVecPtr = NULL;
    303303
    304304    tmpVecPtr = psVectorAlloc(domain->numCols, PS_TYPE_F32);
     
    360360int p_psMinChi2FuncDeriv(const gsl_vector * params, void *funcData, gsl_matrix * J)
    361361{
    362     const psImage *restrict domain = ((psMinChi2Data *) funcData)->domain;
    363     const psVector *restrict errors = ((psMinChi2Data *) funcData)->errors;
    364     const psVector *restrict mask = ((psMinChi2Data *) funcData)->paramMask;
    365     psVector *restrict initialGuess = ((psMinChi2Data *) funcData)->initialGuess;
    366     psVector *inputParameterList = NULL;
    367     psVector *tmpVecPtr = NULL;
    368     float (*d_evalModel) (const psVector *, const psVector *, int) =
    369         ((psMinChi2Data *) funcData)->d_evalModel;
     362    const psImage* restrict domain = ((psMinChi2Data* ) funcData)->domain;
     363    const psVector* restrict errors = ((psMinChi2Data* ) funcData)->errors;
     364    const psVector* restrict mask = ((psMinChi2Data* ) funcData)->paramMask;
     365    psVector* restrict initialGuess = ((psMinChi2Data* ) funcData)->initialGuess;
     366    psVector* inputParameterList = NULL;
     367    psVector* tmpVecPtr = NULL;
     368    float (*d_evalModel) (const psVector* , const psVector* , int) =
     369        ((psMinChi2Data* ) funcData)->d_evalModel;
    370370
    371371    size_t i;
     
    426426returned as a psVector sums.
    427427 *****************************************************************************/
    428 void p_psBuildSums1D(double x, int polyOrder, psVector * sums)
     428void p_psBuildSums1D(double x, int polyOrder, psVector* sums)
    429429{
    430430    int i = 0;
     
    442442values of the vector will be scaled uniformly between -1.0 and 1.0.
    443443 *****************************************************************************/
    444 psVector *psBuildImageScalingFactors(int x)
     444psVector* psBuildImageScalingFactors(int x)
    445445{
    446446    int i = 0;                  // loop index variable.
    447     psVector *imageScalingFactors = NULL;
     447    psVector* imageScalingFactors = NULL;
    448448
    449449    imageScalingFactors = psVectorAlloc(x, PS_TYPE_F32);
     
    556556parameters of that function such that the ...
    557557 *****************************************************************************/
    558 psVector *psMinimize(psVector * restrict initialGuess,
    559                      float (*myFunction) (const psVector * restrict, const psVector * restrict),
    560                      float (*myFunctionDeriv) (const psVector * restrict, const psVector * restrict, int),
    561                      const psVector * restrict coord, const psVector * restrict paramMask)
     558psVector* psMinimize(psVector* restrict initialGuess,
     559                     float (*myFunction) (const psVector* restrict, const psVector* restrict),
     560                     float (*myFunctionDeriv) (const psVector* restrict, const psVector* restrict, int),
     561                     const psVector* restrict coord, const psVector* restrict paramMask)
    562562{
    563563    int status;
     
    664664    such that they best fit the supplied data points.
    665665 *****************************************************************************/
    666 psVector *psMinimizeChi2(float (*evalModel) (const psVector * restrict, const psVector * restrict),
    667                          float (*DevalModel) (const psVector * restrict, const psVector * restrict, int),
    668                          const psImage * restrict domain,
    669                          const psVector * restrict data,
    670                          const psVector * restrict errors,
    671                          psVector * restrict initialGuess, const psVector * restrict paramMask, float *chiSq)
     666psVector* psMinimizeChi2(float (*evalModel) (const psVector* restrict, const psVector* restrict),
     667                         float (*DevalModel) (const psVector* restrict, const psVector* restrict, int),
     668                         const psImage* restrict domain,
     669                         const psVector* restrict data,
     670                         const psVector* restrict errors,
     671                         psVector* restrict initialGuess, const psVector* restrict paramMask, float *chiSq)
    672672{
    673673    int numData = domain->numRows;      // Number of data points
     
    847847NOTE: yErr is currently ignored.
    848848 *****************************************************************************/
    849 psPolynomial1D *psVectorFitPolynomial1D(psPolynomial1D * myPoly,
    850                                         const psVector * restrict x,
    851                                         const psVector * restrict y, const psVector * restrict yErr)
     849psPolynomial1D* psVectorFitPolynomial1D(psPolynomial1D* myPoly,
     850                                        const psVector* restrict x,
     851                                        const psVector* restrict y, const psVector* restrict yErr)
    852852{
    853853    int polyOrder = myPoly->n;
    854     psImage *A = NULL;
    855     psImage *ALUD = NULL;
    856     psVector *B = NULL;
    857     psVector *outPerm = NULL;
    858     psVector *X = NULL;         // NOTE: do we need this?
    859     psVector *coeffs = NULL;
     854    psImage* A = NULL;
     855    psImage* ALUD = NULL;
     856    psVector* B = NULL;
     857    psVector* outPerm = NULL;
     858    psVector* X = NULL;         // NOTE: do we need this?
     859    psVector* coeffs = NULL;
    860860    int i = 0;
    861861    int j = 0;
    862862    int k = 0;
    863     psVector *xSums = NULL;
     863    psVector* xSums = NULL;
    864864
    865865    // printf("psVectorFitPolynomial1D()\n");
  • trunk/psLib/src/dataManip/psMinimize.h

    r1426 r1440  
    1616
    1717/** This routine must minimize a non-linear function */
    18 psVector *psMinimize(psVector * restrict initialGuess,
    19                      float (*myFunction) (const psVector * restrict, const psVector * restrict),
    20                      float (*myFunctionDeriv) (const psVector * restrict, const psVector * restrict, int),
    21                      const psVector * restrict coord, const psVector * restrict paramMask);
     18psVector* psMinimize(psVector* restrict initialGuess,
     19                     float (*myFunction) (const psVector* restrict, const psVector* restrict),
     20                     float (*myFunctionDeriv) (const psVector* restrict, const psVector* restrict, int),
     21                     const psVector* restrict coord, const psVector* restrict paramMask);
    2222
    2323/** Minimize chi^2 for input data */
    24 psVector *psMinimizeChi2(float (*evalModel) (const psVector * restrict, const psVector * restrict),     ///<
     24psVector* psMinimizeChi2(float (*evalModel) (const psVector* restrict, const psVector* restrict),     ///<
    2525                         // Model
    2626                         // to
     
    2929                         // and
    3030                         // params)
    31                          float (*DevalModel) (const psVector * restrict, const psVector * restrict, int),       ///<
     31                         float (*DevalModel) (const psVector* restrict, const psVector* restrict, int),       ///<
    3232                         // Derivative
    3333                         // of
     
    3838                         // and
    3939                         // params)
    40                          const psImage * restrict domain,       ///< The domain values for the corresponding
     40                         const psImage* restrict domain,       ///< The domain values for the corresponding
    4141                         // measurements
    42                          const psVector * restrict data,        ///< Data to fit
    43                          const psVector * restrict errors,      ///< Errors in the data
    44                          psVector * restrict initialGuess,      ///< Initial guess
    45                          const psVector * restrict paramMask,   ///< 1 = fit for parameter, 0 = hold
     42                         const psVector* restrict data,        ///< Data to fit
     43                         const psVector* restrict errors,      ///< Errors in the data
     44                         psVector* restrict initialGuess,      ///< Initial guess
     45                         const psVector* restrict paramMask,   ///< 1 = fit for parameter, 0 = hold
    4646                         // parameter constant
    4747                         float *chiSq);
    4848
    4949/** Derive a polynomial fit by chi^2 minimisation (analytically) */
    50 psPolynomial1D *psVectorFitPolynomial1D(psPolynomial1D * myPoly,        ///< Polynomial to fit
    51                                         const psVector * restrict x,    ///< Ordinates (or NULL to just use
     50psPolynomial1D* psVectorFitPolynomial1D(psPolynomial1D* myPoly,        ///< Polynomial to fit
     51                                        const psVector* restrict x,    ///< Ordinates (or NULL to just use
    5252                                        // the indices)
    53                                         const psVector * restrict y,    ///< Coordinates
    54                                         const psVector * restrict yErr  ///< Errors in coordinates, or NULL
     53                                        const psVector* restrict y,    ///< Coordinates
     54                                        const psVector* restrict yErr  ///< Errors in coordinates, or NULL
    5555                                       );
    5656
  • trunk/psLib/src/dataManip/psStats.c

    r1407 r1440  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-07 00:06:06 $
     12 *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-08-09 23:34:57 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5454#define MAX_ITERATIONS 10
    5555
    56 void p_psVectorRobustStats(const psVector * restrict myVector,
    57                            const psVector * restrict maskVector, unsigned int maskVal, psStats * stats);
     56void p_psVectorRobustStats(const psVector* restrict myVector,
     57                           const psVector* restrict maskVector, unsigned int maskVal, psStats* stats);
    5858
    5959/** Preprocessor macro to generate error on an incorrect type */
     
    116116/*****************************************************************************/
    117117
    118 bool p_psGetStatValue(const psStats * stats, double *value)
     118bool p_psGetStatValue(const psStats* stats, double *value)
    119119{
    120120
     
    175175 *****************************************************************************/
    176176
    177 void p_psVectorPrint(psVector * myVector, psVector * maskVector, unsigned int maskVal, psStats * stats)
     177void p_psVectorPrint(psVector* myVector, psVector* maskVector, unsigned int maskVal, psStats* stats)
    178178{
    179179    int i = 0;                  // Loop index variable.
     
    218218 *****************************************************************************/
    219219
    220 void p_psVectorSampleMean(const psVector * restrict myVector,
    221                           const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
     220void p_psVectorSampleMean(const psVector* restrict myVector,
     221                          const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    222222{
    223223    int i = 0;                  // Loop index variable
     
    282282    NULL
    283283 *****************************************************************************/
    284 void p_psVectorMax(const psVector * restrict myVector,
    285                    const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
     284void p_psVectorMax(const psVector* restrict myVector,
     285                   const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    286286{
    287287    int i = 0;                  // Loop index variable
     
    343343    NULL
    344344 *****************************************************************************/
    345 void p_psVectorMin(const psVector * restrict myVector,
    346                    const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
     345void p_psVectorMin(const psVector* restrict myVector,
     346                   const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    347347{
    348348    int i = 0;                  // Loop index variable
     
    404404    NULL
    405405 *****************************************************************************/
    406 int p_psVectorNValues(const psVector * restrict myVector,
    407                       const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
     406int p_psVectorNValues(const psVector* restrict myVector,
     407                      const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    408408{
    409409    int i = 0;                  // Loop index variable
     
    456456    NULL
    457457 *****************************************************************************/
    458 void p_psVectorSampleMedian(const psVector * restrict myVector,
    459                             const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
    460 {
    461     psVector *unsortedVector = NULL;    // Temporary vector
    462     psVector *sortedVector = NULL;      // Temporary vector
     458void p_psVectorSampleMedian(const psVector* restrict myVector,
     459                            const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
     460{
     461    psVector* unsortedVector = NULL;    // Temporary vector
     462    psVector* sortedVector = NULL;      // Temporary vector
    463463    int i = 0;                  // Loop index variable
    464464    int count = 0;              // # of points in this mean?
     
    565565    XXX: use a static variable for gaussianCoefs[] and compute them once.
    566566 *****************************************************************************/
    567 psVector *p_psVectorsmoothHistGaussian(psHistogram * robustHistogram, float sigma)
     567psVector* p_psVectorsmoothHistGaussian(psHistogram* robustHistogram, float sigma)
    568568{
    569569    int i = 0;                  // Loop index variable
     
    572572    float expo = 0.0;           // Temporary variable
    573573    float gaussianCoefs[1 + (2 * GAUSS_WIDTH)]; // The Gaussian Coefficients
    574     psVector *smooth = psVectorAlloc(robustHistogram->nums->n, PS_TYPE_F32);
     574    psVector* smooth = psVectorAlloc(robustHistogram->nums->n, PS_TYPE_F32);
    575575
    576576    for (i = 0; i < (1 + (2 * GAUSS_WIDTH)); i++) {
     
    628628    NULL
    629629 *****************************************************************************/
    630 void p_psVectorSampleQuartiles(const psVector * restrict myVector,
    631                                const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
    632 {
    633     psVector *unsortedVector = NULL;    // Temporary vector
    634     psVector *sortedVector = NULL;      // Temporary vector
     630void p_psVectorSampleQuartiles(const psVector* restrict myVector,
     631                               const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
     632{
     633    psVector* unsortedVector = NULL;    // Temporary vector
     634    psVector* sortedVector = NULL;      // Temporary vector
    635635    int i = 0;                  // Loop index variable
    636636    int count = 0;              // # of points in this mean?
     
    710710 
    711711 *****************************************************************************/
    712 void p_psVectorSampleStdev(const psVector * restrict myVector,
    713                            const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
     712void p_psVectorSampleStdev(const psVector* restrict myVector,
     713                           const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    714714{
    715715    int i = 0;                  // Loop index variable
     
    795795    NULL
    796796 *****************************************************************************/
    797 void p_psVectorClippedStats(const psVector * restrict myVector,
    798                             const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
     797void p_psVectorClippedStats(const psVector* restrict myVector,
     798                            const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    799799{
    800800    int i = 0;                  // Loop index variable
     
    804804    float oldStanMean = 0.0;    // Temporary variable
    805805    float oldStanStdev = 0.0;   // Temporary variable
    806     psVector *tmpMask = NULL;   // Temporary vector
     806    psVector* tmpMask = NULL;   // Temporary vector
    807807
    808808    // Endure that stats->clipIter is within the proper range.
     
    884884elements of a vector to a range between 0.0 and 1.0.
    885885 *****************************************************************************/
    886 void p_psNormalizeVector(psVector * myData)
     886void p_psNormalizeVector(psVector* myData)
    887887{
    888888    float min = (float)HUGE;
     
    911911specified data point.
    912912 *****************************************************************************/
    913 float p_psGaussian(const psVector * restrict myData, const psVector * restrict myParams)
     913float p_psGaussian(const psVector* restrict myData, const psVector* restrict myParams)
    914914{
    915915    float x = myData->data.F32[0];
     
    928928calculates the specified partial derivative of the above Gaussian function.
    929929 *****************************************************************************/
    930 float p_psGaussianDeriv(const psVector * restrict myData, const psVector * restrict myParams, int whichParam)
     930float p_psGaussianDeriv(const psVector* restrict myData, const psVector* restrict myParams, int whichParam)
    931931{
    932932    float x = myData->data.F32[0];
     
    954954specified data point.
    955955 *****************************************************************************/
    956 float p_psQuadratic(const psVector * restrict myParams, const psVector * restrict myCoords)
     956float p_psQuadratic(const psVector* restrict myParams, const psVector* restrict myCoords)
    957957{
    958958    float x = myCoords->data.F32[0];
     
    970970calculates the specified partial derivative of the above quadratic function.
    971971 *****************************************************************************/
    972 float p_psQuadraticDeriv(const psVector * restrict myParams,
    973                          const psVector * restrict myCoords, int whichParamDeriv)
     972float p_psQuadraticDeriv(const psVector* restrict myParams,
     973                         const psVector* restrict myCoords, int whichParamDeriv)
    974974{
    975975    float x = myCoords->data.F32[0];
     
    996996decreasing within that range.
    997997 *****************************************************************************/
    998 float p_ps1DPolyMedian(psPolynomial1D * myPoly, float rangeLow, float rangeHigh, float getThisValue)
     998float p_ps1DPolyMedian(psPolynomial1D* myPoly, float rangeLow, float rangeHigh, float getThisValue)
    999999{
    10001000    int numIterations = 0;
     
    10361036XXX: This function is currently not being used.
    10371037 *****************************************************************************/
    1038 float p_psFitQuadratic(psHistogram * histogram, psVector * cumulativeSums, int binNum, float fitFloat)
    1039 {
    1040     psVector *x = psVectorAlloc(3, PS_TYPE_F64);
    1041     psVector *y = psVectorAlloc(3, PS_TYPE_F64);
    1042     psVector *yErr = psVectorAlloc(3, PS_TYPE_F64);
    1043     psPolynomial1D *myPoly = psPolynomial1DAlloc(2);
     1038float p_psFitQuadratic(psHistogram* histogram, psVector* cumulativeSums, int binNum, float fitFloat)
     1039{
     1040    psVector* x = psVectorAlloc(3, PS_TYPE_F64);
     1041    psVector* y = psVectorAlloc(3, PS_TYPE_F64);
     1042    psVector* yErr = psVectorAlloc(3, PS_TYPE_F64);
     1043    psPolynomial1D* myPoly = psPolynomial1DAlloc(2);
    10441044
    10451045    if ((binNum > 0) && (binNum < (histogram->nums->n + 1))) {
     
    11001100    NULL
    11011101*****************************************************************************/
    1102 void p_psVectorRobustStats(const psVector * restrict myVector,
    1103                            const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
    1104 {
    1105     psHistogram *robustHistogram = NULL;
    1106     psVector *robustHistogramVector = NULL;
     1102void p_psVectorRobustStats(const psVector* restrict myVector,
     1103                           const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
     1104{
     1105    psHistogram* robustHistogram = NULL;
     1106    psVector* robustHistogramVector = NULL;
    11071107    float binSize = 0.0;        // Size of the histogram bins
    11081108    int LQBinNum = -1;          // Bin num for lower quartile
     
    11131113    float dL = 0.0;
    11141114    int numBins = 0;
    1115     psStats *tmpStats = psStatsAlloc(PS_STAT_CLIPPED_STDEV | PS_STAT_CLIPPED_MEAN);
    1116 
    1117     // psImage *domain;
    1118     // psVector *errors;
    1119     // psVector *data;
    1120     // psVector *initialGuess;
    1121     // psVector *theParams;
     1115    psStats* tmpStats = psStatsAlloc(PS_STAT_CLIPPED_STDEV | PS_STAT_CLIPPED_MEAN);
     1116
     1117    // psImage* domain;
     1118    // psVector* errors;
     1119    // psVector* data;
     1120    // psVector* initialGuess;
     1121    // psVector* theParams;
    11221122    // float chiSq=0.0;
    11231123    // float max = -HUGE;
     
    11291129    float sumSquares = 0.0;
    11301130    float sumDiffs = 0.0;
    1131     psVector *x = psVectorAlloc(3, PS_TYPE_F64);
    1132     psVector *y = psVectorAlloc(3, PS_TYPE_F64);
    1133     psVector *yErr = psVectorAlloc(3, PS_TYPE_F64);
    1134     psPolynomial1D *myPoly = psPolynomial1DAlloc(2);
    1135     psVector *cumulativeRobustSumsFullRange = NULL;
    1136     psVector *cumulativeRobustSumsDlRange = NULL;
     1131    psVector* x = psVectorAlloc(3, PS_TYPE_F64);
     1132    psVector* y = psVectorAlloc(3, PS_TYPE_F64);
     1133    psVector* yErr = psVectorAlloc(3, PS_TYPE_F64);
     1134    psPolynomial1D* myPoly = psPolynomial1DAlloc(2);
     1135    psVector* cumulativeRobustSumsFullRange = NULL;
     1136    psVector* cumulativeRobustSumsDlRange = NULL;
    11371137    float sumRobust = 0.0;
    11381138    float sumN50 = 0.0;
     
    15001500/*****************************************************************************/
    15011501
    1502 static void histogramFree(psHistogram * myHist);
     1502static void histogramFree(psHistogram* myHist);
    15031503
    15041504/******************************************************************************
    15051505    psStatsAlloc(): This routine must create a new psStats data structure.
    15061506 *****************************************************************************/
    1507 psStats *psStatsAlloc(psStatsOptions options)
    1508 {
    1509     psStats *newStruct = NULL;
    1510 
    1511     newStruct = (psStats *) psAlloc(sizeof(psStats));
     1507psStats* psStatsAlloc(psStatsOptions options)
     1508{
     1509    psStats* newStruct = NULL;
     1510
     1511    newStruct = (psStats* ) psAlloc(sizeof(psStats));
    15121512    newStruct->sampleMean = NAN;
    15131513    newStruct->sampleMedian = NAN;
     
    15481548    The histogram structure
    15491549 *****************************************************************************/
    1550 psHistogram *psHistogramAlloc(float lower, float upper, int n)
     1550psHistogram* psHistogramAlloc(float lower, float upper, int n)
    15511551{
    15521552    int i = 0;                  // Loop index variable
    1553     psHistogram *newHist = NULL;        // The new histogram structure
     1553    psHistogram* newHist = NULL;        // The new histogram structure
    15541554    float binSize = 0.0;        // The histogram bin size
    15551555
     
    15671567    // Allocate memory for the new histogram structure.  If there are N
    15681568    // bins, then there are N+1 bounds to those bins.
    1569     newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
     1569    newHist = (psHistogram* ) psAlloc(sizeof(psHistogram));
    15701570    p_psMemSetDeallocator(newHist, (psFreeFcn) histogramFree);
    15711571    newHist->bounds = psVectorAlloc(n + 1, PS_TYPE_F32);
     
    16051605    The histogram structure
    16061606 *****************************************************************************/
    1607 psHistogram *psHistogramAllocGeneric(const psVector * restrict bounds)
    1608 {
    1609     psHistogram *newHist = NULL;        // The new histogram structure
     1607psHistogram* psHistogramAllocGeneric(const psVector* restrict bounds)
     1608{
     1609    psHistogram* newHist = NULL;        // The new histogram structure
    16101610    int i;                      // Loop index variable
    16111611
     
    16261626    }
    16271627    // Allocate memory for the new histogram structure.
    1628     newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
     1628    newHist = (psHistogram* ) psAlloc(sizeof(psHistogram));
    16291629    p_psMemSetDeallocator(newHist, (psFreeFcn) histogramFree);
    16301630    newHist->bounds = psVectorAlloc(bounds->n, PS_TYPE_F32);
     
    16501650}
    16511651
    1652 static void histogramFree(psHistogram * myHist)
     1652static void histogramFree(psHistogram* myHist)
    16531653{
    16541654    psFree(myHist->bounds);
     
    16701670    The histogram structure "out".
    16711671 *****************************************************************************/
    1672 psHistogram *psVectorHistogram(psHistogram * out,
    1673                                const psVector * restrict in,
    1674                                const psVector * restrict mask, unsigned int maskVal)
     1672psHistogram* psVectorHistogram(psHistogram* out,
     1673                               const psVector* restrict in,
     1674                               const psVector* restrict mask, unsigned int maskVal)
    16751675{
    16761676    int i = 0;                  // Loop index variable
     
    17671767the various stat functions.
    17681768 *****************************************************************************/
    1769 psVector *p_psConvertToF32(psStats * stats, psVector * in, psVector * mask, unsigned int maskVal)
     1769psVector* p_psConvertToF32(psStats* stats, psVector* in, psVector* mask, unsigned int maskVal)
    17701770{
    17711771    int i = 0;
    1772     psVector *tmp = NULL;
     1772    psVector* tmp = NULL;
    17731773
    17741774    if (in->type.type == PS_TYPE_S32) {
     
    18121812macro-ize everything and add PS_TYPE_U16 and PS_TYPE_F64.
    18131813 *****************************************************************************/
    1814 psStats *psVectorStats(psStats * stats, psVector * in, psVector * mask, unsigned int maskVal)
    1815 {
    1816     psVector *inF32;
     1814psStats* psVectorStats(psStats* stats, psVector* in, psVector* mask, unsigned int maskVal)
     1815{
     1816    psVector* inF32;
    18171817    int mustFreeTmp = 1;
    18181818
  • trunk/psLib/src/dataManip/psStats.h

    r1426 r1440  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-09 22:44:25 $
     12 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-08-09 23:34:57 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7777
    7878/** Do Statistics on an array.  Returns a status value. \ingroup MathGroup */
    79 psStats *psVectorStats(psStats * stats, ///< stats structure defines stats to be calculated and how
    80                        psVector * in,   ///< Vector to be analysed: must be F32
    81                        psVector * mask, ///< Ignore elements where (maskVector & maskVal) != 0: must be INT
     79psStats* psVectorStats(psStats* stats, ///< stats structure defines stats to be calculated and how
     80                       psVector* in,   ///< Vector to be analysed: must be F32
     81                       psVector* mask, ///< Ignore elements where (maskVector & maskVal) != 0: must be INT
    8282                       // or NULL
    8383                       unsigned int maskVal     ///< Only mask elements with one of these bits set in
     
    8686
    8787/** A constructor for the stats structure.*/
    88 psStats *psStatsAlloc(psStatsOptions options);  ///< Statistics to measure
     88psStats* psStatsAlloc(psStatsOptions options);  ///< Statistics to measure
    8989
    9090/******************************************************************************
     
    9595typedef struct
    9696{
    97     psVector *bounds;           ///< Bounds for the bins (type F32)
    98     psVector *nums;             ///< Number in each of the bins (INT)
     97    psVector* bounds;           ///< Bounds for the bins (type F32)
     98    psVector* nums;             ///< Number in each of the bins (INT)
    9999    int minNum;                 ///< Number below the minimum
    100100    int maxNum;                 ///< Number above the maximum
     
    104104
    105105/** Constructor \ingroup MathGroup */
    106 psHistogram *psHistogramAlloc(float lower,      ///< Lower limit for the bins
     106psHistogram* psHistogramAlloc(float lower,      ///< Lower limit for the bins
    107107                              float upper,      ///< Upper limit for the bins
    108108                              int n);   ///< Number of bins
    109109
    110110/** Generic constructor \ingroup MathGroup */
    111 psHistogram *psHistogramAllocGeneric(const psVector * restrict bounds); ///< Bounds for the bins
     111psHistogram* psHistogramAllocGeneric(const psVector* restrict bounds); ///< Bounds for the bins
    112112
    113113/** Calculate a histogram \ingroup MathGroup **/
    114 psHistogram *psVectorHistogram(psHistogram * out,       ///< Histogram data
    115                                const psVector * restrict in,    ///< Vector to analyse
    116                                const psVector * restrict mask,  ///< Mask dat for input vector
     114psHistogram* psVectorHistogram(psHistogram* out,       ///< Histogram data
     115                               const psVector* restrict in,    ///< Vector to analyse
     116                               const psVector* restrict mask,  ///< Mask dat for input vector
    117117                               unsigned int maskVal);   ///< Mask value
    118118
    119 bool p_psGetStatValue(const psStats * stats, double *value);
     119bool p_psGetStatValue(const psStats* stats, double *value);
    120120
    121121/// @}
  • trunk/psLib/src/dataManip/psVectorFFT.c

    r1407 r1440  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2004-08-07 00:06:06 $
     8*  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2004-08-09 23:34:57 $
    1010*
    1111*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2828static bool p_fftwWisdomImported = false;
    2929
    30 psImage *psImageFFT(psImage * out, const psImage * in, psFftDirection direction)
     30psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction)
    3131{
    3232    unsigned int numCols;
     
    9393}
    9494
    95 psImage *psImageReal(psImage * out, const psImage * in)
     95psImage* psImageReal(psImage* out, const psImage* in)
    9696{
    9797    psElemType type;
     
    117117
    118118    if (type == PS_TYPE_C32) {
    119         psF32 *outRow;
    120         psC32 *inRow;
     119        psF32* outRow;
     120        psC32* inRow;
    121121
    122122        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
     
    130130        }
    131131    } else if (type == PS_TYPE_C64) {
    132         psF64 *outRow;
    133         psC64 *inRow;
     132        psF64* outRow;
     133        psC64* inRow;
    134134
    135135        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
     
    151151}
    152152
    153 psImage *psImageImaginary(psImage * out, const psImage * in)
     153psImage* psImageImaginary(psImage* out, const psImage* in)
    154154{
    155155    psElemType type;
     
    177177
    178178    if (type == PS_TYPE_C32) {
    179         psF32 *outRow;
    180         psC32 *inRow;
     179        psF32* outRow;
     180        psC32* inRow;
    181181
    182182        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
     
    190190        }
    191191    } else if (type == PS_TYPE_C64) {
    192         psF64 *outRow;
    193         psC64 *inRow;
     192        psF64* outRow;
     193        psC64* inRow;
    194194
    195195        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
     
    211211}
    212212
    213 psImage *psImageComplex(psImage * out, psImage * real, const psImage * imag)
     213psImage* psImageComplex(psImage* out, psImage* real, const psImage* imag)
    214214{
    215215    psElemType type;
     
    251251
    252252    if (type == PS_TYPE_F32) {
    253         psC32 *outRow;
    254         psF32 *realRow;
    255         psF32 *imagRow;
     253        psC32* outRow;
     254        psF32* realRow;
     255        psF32* imagRow;
    256256
    257257        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
     
    267267        }
    268268    } else if (type == PS_TYPE_F64) {
    269         psC64 *outRow;
    270         psF64 *realRow;
    271         psF64 *imagRow;
     269        psC64* outRow;
     270        psF64* realRow;
     271        psF64* imagRow;
    272272
    273273        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
     
    290290}
    291291
    292 psImage *psImageConjugate(psImage * out, const psImage * in)
     292psImage* psImageConjugate(psImage* out, const psImage* in)
    293293{
    294294    psElemType type;
     
    314314
    315315    if (type == PS_TYPE_C32) {
    316         psC32 *outRow;
    317         psC32 *inRow;
     316        psC32* outRow;
     317        psC32* inRow;
    318318
    319319        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
     
    327327        }
    328328    } else if (type == PS_TYPE_C64) {
    329         psC64 *outRow;
    330         psC64 *inRow;
     329        psC64* outRow;
     330        psC64* inRow;
    331331
    332332        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
     
    348348}
    349349
    350 psImage *psImagePowerSpectrum(psImage * out, const psImage * in)
     350psImage* psImagePowerSpectrum(psImage* out, const psImage* in)
    351351{
    352352    psElemType type;
     
    373373
    374374    if (type == PS_TYPE_C32) {
    375         psF32 *outRow;
    376         psC32 *inRow;
     375        psF32* outRow;
     376        psC32* inRow;
    377377        psF32 real;
    378378        psF32 imag;
     
    390390        }
    391391    } else if (type == PS_TYPE_C64) {
    392         psF64 *outRow;
    393         psC64 *inRow;
     392        psF64* outRow;
     393        psC64* inRow;
    394394        psF64 real;
    395395        psF64 imag;
     
    418418/************************************** Vector Functions ***************************************/
    419419
    420 psVector *psVectorFFT(psVector * out, const psVector * in, psFftDirection direction)
     420psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction)
    421421{
    422422    unsigned int numElements;
     
    464464    if (type == PS_TYPE_F32) {
    465465        // need to convert to complex
    466         psC32 *outVec = out->data.C32;
    467         psF32 *inVec = in->data.F32;
     466        psC32* outVec = out->data.C32;
     467        psF32* inVec = in->data.F32;
    468468
    469469        for (unsigned int i = 0; i < numElements; i++) {
     
    471471        }
    472472    } else {
    473         psC32 *outVec = out->data.C32;
    474         psC32 *inVec = in->data.C32;
     473        psC32* outVec = out->data.C32;
     474        psC32* inVec = in->data.C32;
    475475
    476476        for (unsigned int i = 0; i < numElements; i++) {
     
    498498}
    499499
    500 psVector *psVectorReal(psVector * out, const psVector * in)
     500psVector* psVectorReal(psVector* out, const psVector* in)
    501501{
    502502    psElemType type;
     
    523523
    524524    if (type == PS_TYPE_C32) {
    525         psF32 *outVec;
    526         psC32 *inVec = in->data.C32;
     525        psF32* outVec;
     526        psC32* inVec = in->data.C32;
    527527
    528528        out = psVectorRecycle(out, numElements, PS_TYPE_F32);
     
    542542}
    543543
    544 psVector *psVectorImaginary(psVector * out, const psVector * in)
     544psVector* psVectorImaginary(psVector* out, const psVector* in)
    545545{
    546546    psElemType type;
     
    567567
    568568    if (type == PS_TYPE_C32) {
    569         psF32 *outVec;
    570         psC32 *inVec = in->data.C32;
     569        psF32* outVec;
     570        psC32* inVec = in->data.C32;
    571571
    572572        out = psVectorRecycle(out, numElements, PS_TYPE_F32);
     
    586586}
    587587
    588 psVector *psVectorComplex(psVector * out, psVector * real, const psVector * imag)
     588psVector* psVectorComplex(psVector* out, psVector* real, const psVector* imag)
    589589{
    590590    psElemType type;
     
    616616
    617617    if (type == PS_TYPE_F32) {
    618         psC32 *outVec;
    619         psF32 *realVec = real->data.F32;
    620         psF32 *imagVec = imag->data.F32;
     618        psC32* outVec;
     619        psF32* realVec = real->data.F32;
     620        psF32* imagVec = imag->data.F32;
    621621
    622622        out = psVectorRecycle(out, numElements, PS_TYPE_C32);
     
    636636}
    637637
    638 psVector *psVectorConjugate(psVector * out, const psVector * in)
     638psVector* psVectorConjugate(psVector* out, const psVector* in)
    639639{
    640640    psElemType type;
     
    662662
    663663    if (type == PS_TYPE_C32) {
    664         psC32 *outVec;
    665         psC32 *inVec = in->data.C32;
     664        psC32* outVec;
     665        psC32* inVec = in->data.C32;
    666666
    667667        out = psVectorRecycle(out, numElements, PS_TYPE_C32);
     
    681681}
    682682
    683 psVector *psVectorPowerSpectrum(psVector * out, const psVector * in)
     683psVector* psVectorPowerSpectrum(psVector* out, const psVector* in)
    684684{
    685685    psElemType type;
     
    708708
    709709    if (type == PS_TYPE_C32) {
    710         psF32 *outVec;
    711         psC32 *inVec = in->data.C32;
     710        psF32* outVec;
     711        psC32* inVec = in->data.C32;
    712712        psF32 inAbs1;
    713713        psF32 inAbs2;
  • trunk/psLib/src/dataManip/psVectorFFT.h

    r1426 r1440  
    88 *  @author Robert DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-08-09 22:44:25 $
     10 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-08-09 23:34:57 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3333} psFftDirection;
    3434
    35 psImage *psImageFFT(psImage * out, const psImage * in, psFftDirection direction);
    36 psImage *psImageReal(psImage * out, const psImage * in);
    37 psImage *psImageImaginary(psImage * out, const psImage * in);
    38 psImage *psImageComplex(psImage * out, psImage * real, const psImage * imag);
    39 psImage *psImageConjugate(psImage * out, const psImage * in);
    40 psImage *psImagePowerSpectrum(psImage * out, const psImage * in);
     35psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction);
     36psImage* psImageReal(psImage* out, const psImage* in);
     37psImage* psImageImaginary(psImage* out, const psImage* in);
     38psImage* psImageComplex(psImage* out, psImage* real, const psImage* imag);
     39psImage* psImageConjugate(psImage* out, const psImage* in);
     40psImage* psImagePowerSpectrum(psImage* out, const psImage* in);
    4141
    42 psVector *psVectorFFT(psVector * out, const psVector * in, psFftDirection direction);
    43 psVector *psVectorReal(psVector * out, const psVector * in);
    44 psVector *psVectorImaginary(psVector * out, const psVector * in);
    45 psVector *psVectorComplex(psVector * out, psVector * real, const psVector * imag);
    46 psVector *psVectorConjugate(psVector * out, const psVector * in);
    47 psVector *psVectorPowerSpectrum(psVector * out, const psVector * in);
     42psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction);
     43psVector* psVectorReal(psVector* out, const psVector* in);
     44psVector* psVectorImaginary(psVector* out, const psVector* in);
     45psVector* psVectorComplex(psVector* out, psVector* real, const psVector* imag);
     46psVector* psVectorConjugate(psVector* out, const psVector* in);
     47psVector* psVectorPowerSpectrum(psVector* out, const psVector* in);
    4848
    4949/// @}
  • trunk/psLib/src/fft/psVectorFFT.c

    r1407 r1440  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2004-08-07 00:06:06 $
     8*  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2004-08-09 23:34:57 $
    1010*
    1111*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2828static bool p_fftwWisdomImported = false;
    2929
    30 psImage *psImageFFT(psImage * out, const psImage * in, psFftDirection direction)
     30psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction)
    3131{
    3232    unsigned int numCols;
     
    9393}
    9494
    95 psImage *psImageReal(psImage * out, const psImage * in)
     95psImage* psImageReal(psImage* out, const psImage* in)
    9696{
    9797    psElemType type;
     
    117117
    118118    if (type == PS_TYPE_C32) {
    119         psF32 *outRow;
    120         psC32 *inRow;
     119        psF32* outRow;
     120        psC32* inRow;
    121121
    122122        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
     
    130130        }
    131131    } else if (type == PS_TYPE_C64) {
    132         psF64 *outRow;
    133         psC64 *inRow;
     132        psF64* outRow;
     133        psC64* inRow;
    134134
    135135        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
     
    151151}
    152152
    153 psImage *psImageImaginary(psImage * out, const psImage * in)
     153psImage* psImageImaginary(psImage* out, const psImage* in)
    154154{
    155155    psElemType type;
     
    177177
    178178    if (type == PS_TYPE_C32) {
    179         psF32 *outRow;
    180         psC32 *inRow;
     179        psF32* outRow;
     180        psC32* inRow;
    181181
    182182        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
     
    190190        }
    191191    } else if (type == PS_TYPE_C64) {
    192         psF64 *outRow;
    193         psC64 *inRow;
     192        psF64* outRow;
     193        psC64* inRow;
    194194
    195195        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
     
    211211}
    212212
    213 psImage *psImageComplex(psImage * out, psImage * real, const psImage * imag)
     213psImage* psImageComplex(psImage* out, psImage* real, const psImage* imag)
    214214{
    215215    psElemType type;
     
    251251
    252252    if (type == PS_TYPE_F32) {
    253         psC32 *outRow;
    254         psF32 *realRow;
    255         psF32 *imagRow;
     253        psC32* outRow;
     254        psF32* realRow;
     255        psF32* imagRow;
    256256
    257257        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
     
    267267        }
    268268    } else if (type == PS_TYPE_F64) {
    269         psC64 *outRow;
    270         psF64 *realRow;
    271         psF64 *imagRow;
     269        psC64* outRow;
     270        psF64* realRow;
     271        psF64* imagRow;
    272272
    273273        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
     
    290290}
    291291
    292 psImage *psImageConjugate(psImage * out, const psImage * in)
     292psImage* psImageConjugate(psImage* out, const psImage* in)
    293293{
    294294    psElemType type;
     
    314314
    315315    if (type == PS_TYPE_C32) {
    316         psC32 *outRow;
    317         psC32 *inRow;
     316        psC32* outRow;
     317        psC32* inRow;
    318318
    319319        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
     
    327327        }
    328328    } else if (type == PS_TYPE_C64) {
    329         psC64 *outRow;
    330         psC64 *inRow;
     329        psC64* outRow;
     330        psC64* inRow;
    331331
    332332        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
     
    348348}
    349349
    350 psImage *psImagePowerSpectrum(psImage * out, const psImage * in)
     350psImage* psImagePowerSpectrum(psImage* out, const psImage* in)
    351351{
    352352    psElemType type;
     
    373373
    374374    if (type == PS_TYPE_C32) {
    375         psF32 *outRow;
    376         psC32 *inRow;
     375        psF32* outRow;
     376        psC32* inRow;
    377377        psF32 real;
    378378        psF32 imag;
     
    390390        }
    391391    } else if (type == PS_TYPE_C64) {
    392         psF64 *outRow;
    393         psC64 *inRow;
     392        psF64* outRow;
     393        psC64* inRow;
    394394        psF64 real;
    395395        psF64 imag;
     
    418418/************************************** Vector Functions ***************************************/
    419419
    420 psVector *psVectorFFT(psVector * out, const psVector * in, psFftDirection direction)
     420psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction)
    421421{
    422422    unsigned int numElements;
     
    464464    if (type == PS_TYPE_F32) {
    465465        // need to convert to complex
    466         psC32 *outVec = out->data.C32;
    467         psF32 *inVec = in->data.F32;
     466        psC32* outVec = out->data.C32;
     467        psF32* inVec = in->data.F32;
    468468
    469469        for (unsigned int i = 0; i < numElements; i++) {
     
    471471        }
    472472    } else {
    473         psC32 *outVec = out->data.C32;
    474         psC32 *inVec = in->data.C32;
     473        psC32* outVec = out->data.C32;
     474        psC32* inVec = in->data.C32;
    475475
    476476        for (unsigned int i = 0; i < numElements; i++) {
     
    498498}
    499499
    500 psVector *psVectorReal(psVector * out, const psVector * in)
     500psVector* psVectorReal(psVector* out, const psVector* in)
    501501{
    502502    psElemType type;
     
    523523
    524524    if (type == PS_TYPE_C32) {
    525         psF32 *outVec;
    526         psC32 *inVec = in->data.C32;
     525        psF32* outVec;
     526        psC32* inVec = in->data.C32;
    527527
    528528        out = psVectorRecycle(out, numElements, PS_TYPE_F32);
     
    542542}
    543543
    544 psVector *psVectorImaginary(psVector * out, const psVector * in)
     544psVector* psVectorImaginary(psVector* out, const psVector* in)
    545545{
    546546    psElemType type;
     
    567567
    568568    if (type == PS_TYPE_C32) {
    569         psF32 *outVec;
    570         psC32 *inVec = in->data.C32;
     569        psF32* outVec;
     570        psC32* inVec = in->data.C32;
    571571
    572572        out = psVectorRecycle(out, numElements, PS_TYPE_F32);
     
    586586}
    587587
    588 psVector *psVectorComplex(psVector * out, psVector * real, const psVector * imag)
     588psVector* psVectorComplex(psVector* out, psVector* real, const psVector* imag)
    589589{
    590590    psElemType type;
     
    616616
    617617    if (type == PS_TYPE_F32) {
    618         psC32 *outVec;
    619         psF32 *realVec = real->data.F32;
    620         psF32 *imagVec = imag->data.F32;
     618        psC32* outVec;
     619        psF32* realVec = real->data.F32;
     620        psF32* imagVec = imag->data.F32;
    621621
    622622        out = psVectorRecycle(out, numElements, PS_TYPE_C32);
     
    636636}
    637637
    638 psVector *psVectorConjugate(psVector * out, const psVector * in)
     638psVector* psVectorConjugate(psVector* out, const psVector* in)
    639639{
    640640    psElemType type;
     
    662662
    663663    if (type == PS_TYPE_C32) {
    664         psC32 *outVec;
    665         psC32 *inVec = in->data.C32;
     664        psC32* outVec;
     665        psC32* inVec = in->data.C32;
    666666
    667667        out = psVectorRecycle(out, numElements, PS_TYPE_C32);
     
    681681}
    682682
    683 psVector *psVectorPowerSpectrum(psVector * out, const psVector * in)
     683psVector* psVectorPowerSpectrum(psVector* out, const psVector* in)
    684684{
    685685    psElemType type;
     
    708708
    709709    if (type == PS_TYPE_C32) {
    710         psF32 *outVec;
    711         psC32 *inVec = in->data.C32;
     710        psF32* outVec;
     711        psC32* inVec = in->data.C32;
    712712        psF32 inAbs1;
    713713        psF32 inAbs2;
  • trunk/psLib/src/fft/psVectorFFT.h

    r1426 r1440  
    88 *  @author Robert DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-08-09 22:44:25 $
     10 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-08-09 23:34:57 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3333} psFftDirection;
    3434
    35 psImage *psImageFFT(psImage * out, const psImage * in, psFftDirection direction);
    36 psImage *psImageReal(psImage * out, const psImage * in);
    37 psImage *psImageImaginary(psImage * out, const psImage * in);
    38 psImage *psImageComplex(psImage * out, psImage * real, const psImage * imag);
    39 psImage *psImageConjugate(psImage * out, const psImage * in);
    40 psImage *psImagePowerSpectrum(psImage * out, const psImage * in);
     35psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction);
     36psImage* psImageReal(psImage* out, const psImage* in);
     37psImage* psImageImaginary(psImage* out, const psImage* in);
     38psImage* psImageComplex(psImage* out, psImage* real, const psImage* imag);
     39psImage* psImageConjugate(psImage* out, const psImage* in);
     40psImage* psImagePowerSpectrum(psImage* out, const psImage* in);
    4141
    42 psVector *psVectorFFT(psVector * out, const psVector * in, psFftDirection direction);
    43 psVector *psVectorReal(psVector * out, const psVector * in);
    44 psVector *psVectorImaginary(psVector * out, const psVector * in);
    45 psVector *psVectorComplex(psVector * out, psVector * real, const psVector * imag);
    46 psVector *psVectorConjugate(psVector * out, const psVector * in);
    47 psVector *psVectorPowerSpectrum(psVector * out, const psVector * in);
     42psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction);
     43psVector* psVectorReal(psVector* out, const psVector* in);
     44psVector* psVectorImaginary(psVector* out, const psVector* in);
     45psVector* psVectorComplex(psVector* out, psVector* real, const psVector* imag);
     46psVector* psVectorConjugate(psVector* out, const psVector* in);
     47psVector* psVectorPowerSpectrum(psVector* out, const psVector* in);
    4848
    4949/// @}
  • trunk/psLib/src/image/psImage.c

    r1407 r1440  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-07 00:06:06 $
     12 *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-08-09 23:34:58 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3232#include "psImage.h"
    3333
    34 static void imageFree(psImage * image);
     34static void imageFree(psImage* image);
    3535
    3636/*****************************************************************************/
     
    4040/*****************************************************************************/
    4141
    42 psImage *psImageAlloc(unsigned int numCols, unsigned int numRows, const psElemType type)
     42psImage* psImageAlloc(unsigned int numCols, unsigned int numRows, const psElemType type)
    4343{
    4444    int area = 0;
     
    6161    }
    6262
    63     psImage *image = (psImage *) psAlloc(sizeof(psImage));
     63    psImage* image = (psImage* ) psAlloc(sizeof(psImage));
    6464
    6565    if (image == NULL) {
     
    8787    *(unsigned int *)&image->numCols = numCols;
    8888    *(unsigned int *)&image->numRows = numRows;
    89     *(psDimen *) & image->type.dimen = PS_DIMEN_IMAGE;
    90     *(psElemType *) & image->type.type = type;
     89    *(psDimen* ) & image->type.dimen = PS_DIMEN_IMAGE;
     90    *(psElemType* ) & image->type.type = type;
    9191    image->parent = NULL;
    9292    image->nChildren = 0;
     
    9696}
    9797
    98 static void imageFree(psImage * image)
     98static void imageFree(psImage* image)
    9999{
    100100    if (image == NULL) {
     
    107107        unsigned int oldNumRows = image->numRows;
    108108        unsigned int oldNumCols = image->numCols;
    109         psPTR *rowPtr;
     109        psPTR* rowPtr;
    110110
    111111        for (unsigned int row = 0; row < oldNumRows; row++) {
     
    124124}
    125125
    126 psImage *psImageRecycle(psImage * old, unsigned int numCols, unsigned int numRows, const psElemType type)
     126psImage* psImageRecycle(psImage* old, unsigned int numCols, unsigned int numRows, const psElemType type)
    127127{
    128128    int elementSize = PSELEMTYPE_SIZEOF(type);  // element
     
    151151        unsigned int oldNumRows = old->numRows;
    152152        unsigned int oldNumCols = old->numCols;
    153         psPTR *rowPtr;
     153        psPTR* rowPtr;
    154154
    155155        for (unsigned int row = 0; row < oldNumRows; row++) {
     
    177177    *(unsigned int *)&old->numCols = numCols;
    178178    *(unsigned int *)&old->numRows = numRows;
    179     *(psElemType *) & old->type.type = type;
     179    *(psElemType* ) & old->type.type = type;
    180180
    181181    return old;
    182182}
    183183
    184 int psImageFreeChildren(psImage * image)
     184int psImageFreeChildren(psImage* image)
    185185{
    186186    int i = 0;
    187187    int nChildren = 0;
    188     psImage **children = NULL;
     188    psImage* *children = NULL;
    189189    int numFreed = 0;
    190190
     
    216216linear interpolation is performed on the image.
    217217 *****************************************************************************/
    218 psF32 psImagePixelInterpolate(const psImage * input,
     218psF32 psImagePixelInterpolate(const psImage* input,
    219219                              float x, float y, psF32 unexposedValue, psImageInterpolateMode mode)
    220220{
     
    259259
    260260#define PSIMAGE_PIXEL_INTERPOLATE_FLAT(TYPE) \
    261 inline psF64 p_psImagePixelInterpolateFLAT_##TYPE(const psImage *input, \
     261inline psF64 p_psImagePixelInterpolateFLAT_##TYPE(const psImage* input, \
    262262        float x, \
    263263        float y, \
     
    280280
    281281#define PSIMAGE_PIXEL_INTERPOLATE_FLAT_COMPLEX(TYPE) \
    282 inline psC64 p_psImagePixelInterpolateFLAT_##TYPE(const psImage *input, \
     282inline psC64 p_psImagePixelInterpolateFLAT_##TYPE(const psImage* input, \
    283283        float x, \
    284284        float y, \
     
    313313PSIMAGE_PIXEL_INTERPOLATE_FLAT_COMPLEX(C64)
    314314#define PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(TYPE) \
    315 inline psF64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage *input, \
     315inline psF64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage* input, \
    316316        float x, \
    317317        float y, \
     
    368368}
    369369#define PSIMAGE_PIXEL_INTERPOLATE_BILINEAR_COMPLEX(TYPE) \
    370 inline psC64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage *input, \
     370inline psC64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage* input, \
    371371        float x, \
    372372        float y, \
  • trunk/psLib/src/image/psImage.h

    r1426 r1440  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-08-09 22:44:25 $
     14 *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-08-09 23:34:58 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050
    5151    union {
    52         psU8 **U8;              ///< Unsigned 8-bit integer data.
    53         psU16 **U16;            ///< Unsigned 16-bit integer data.
    54         psU32 **U32;            ///< Unsigned 32-bit integer data.
    55         psU64 **U64;            ///< Unsigned 64-bit integer data.
    56         psS8 **S8;              ///< Signed 8-bit integer data.
    57         psS16 **S16;            ///< Signed 16-bit integer data.
    58         psS32 **S32;            ///< Signed 32-bit integer data.
    59         psS64 **S64;            ///< Signed 64-bit integer data.
    60         psF32 **F32;            ///< Single-precision float data.
    61         psF64 **F64;            ///< Double-precision float data.
    62         psC32 **C32;            ///< Single-precision complex data.
    63         psC64 **C64;            ///< Double-precision complex data.
    64         psPTR **PTR;            ///< Void pointers.
    65         psPTR *V;               ///< Pointer to data.
     52        psU8* *U8;              ///< Unsigned 8-bit integer data.
     53        psU16* *U16;            ///< Unsigned 16-bit integer data.
     54        psU32* *U32;            ///< Unsigned 32-bit integer data.
     55        psU64* *U64;            ///< Unsigned 64-bit integer data.
     56        psS8* *S8;              ///< Signed 8-bit integer data.
     57        psS16* *S16;            ///< Signed 16-bit integer data.
     58        psS32* *S32;            ///< Signed 32-bit integer data.
     59        psS64* *S64;            ///< Signed 64-bit integer data.
     60        psF32* *F32;            ///< Single-precision float data.
     61        psF64* *F64;            ///< Double-precision float data.
     62        psC32* *C32;            ///< Single-precision complex data.
     63        psC64* *C64;            ///< Double-precision complex data.
     64        psPTR* *PTR;            ///< Void pointers.
     65        psPTR* V;               ///< Pointer to data.
    6666    } data;                     ///< Union for data types.
    67     const struct psImage *parent;       ///< Parent, if a subimage.
     67    const struct psImage* parent;       ///< Parent, if a subimage.
    6868    int nChildren;              ///< Number of subimages.
    69     struct psImage **children;  ///< Children of this region.
     69    struct psImage* *children;  ///< Children of this region.
    7070}
    7171psImage;
     
    8282 * specified size and type.
    8383 *
    84  * @return psImage*: Pointer to psImage.
     84 * @return psImage* : Pointer to psImage.
    8585 *
    8686 */
    87 psImage *psImageAlloc(unsigned int numCols,     ///< Number of rows in image.
     87psImage* psImageAlloc(unsigned int numCols,     ///< Number of rows in image.
    8888                      unsigned int numRows,     ///< Number of columns in image.
    8989                      const psElemType type     ///< Type of data for image.
     
    9595 *
    9696 */
    97 psImage *psImageRecycle(psImage * old,  ///< the psImage to recycle by resizing image buffer
     97psImage* psImageRecycle(psImage* old,  ///< the psImage to recycle by resizing image buffer
    9898                        unsigned int numCols,   ///< the desired number of columns in image
    9999                        unsigned int numRows,   ///< the desired number of rows in image
     
    106106 *
    107107 */
    108 int psImageFreeChildren(psImage * image
     108int psImageFreeChildren(psImage* image
    109109
    110110                        /**< psImage in which all children shall be deallocated */
    111111                       );
    112112
    113 psF32 psImagePixelInterpolate(const psImage * input,
     113psF32 psImagePixelInterpolate(const psImage* input,
    114114                              float x, float y, psF32 unexposedValue, psImageInterpolateMode mode);
    115115
    116116#    define p_psImagePixelInterpolateFcns(TYPE) \
    117117inline psF64 p_psImagePixelInterpolateFLAT_##TYPE( \
    118         const psImage *input, \
     118        const psImage* input, \
    119119        float x, \
    120120        float y, \
     
    122122                                                 ); \
    123123inline psF64 p_psImagePixelInterpolateBILINEAR_##TYPE( \
    124         const psImage *input, \
     124        const psImage* input, \
    125125        float x, \
    126126        float y, \
     
    130130#    define p_psImagePixelInterpolateComplexFcns(TYPE) \
    131131inline psC64 p_psImagePixelInterpolateFLAT_##TYPE( \
    132         const psImage *input, \
     132        const psImage* input, \
    133133        float x, \
    134134        float y, \
     
    136136                                                 ); \
    137137inline psC64 p_psImagePixelInterpolateBILINEAR_##TYPE( \
    138         const psImage *input, \
     138        const psImage* input, \
    139139        float x, \
    140140        float y, \
  • trunk/psLib/src/image/psImageExtraction.c

    r1407 r1440  
    1010*  @author Robert DeSonia, MHPCC
    1111*
    12 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-08-07 00:06:06 $
     12*  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-09 23:34:58 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2323#include "psError.h"
    2424
    25 psImage *psImageSubset(psImage * out,
    26                        psImage * image,
     25psImage* psImageSubset(psImage* out,
     26                       psImage* image,
    2727                       unsigned int numCols, unsigned int numRows, unsigned int col0, unsigned int row0)
    2828{
     
    8383    *(int *)&out->row0 = row0;
    8484    *(int *)&out->col0 = col0;
    85     *(psImage **) & out->parent = (psImage *) image;
     85    *(psImage* *) & out->parent = (psImage* ) image;
    8686
    8787    // add output image as a child of the input
    8888    // image.
    8989    image->nChildren++;
    90     image->children = (psImage **) psRealloc(image->children, image->nChildren * sizeof(psImage *));
     90    image->children = (psImage* *) psRealloc(image->children, image->nChildren * sizeof(psImage* ));
    9191    image->children[image->nChildren - 1] = out;
    9292
     
    101101}
    102102
    103 psImage *psImageCopy(psImage * restrict output, const psImage * input, psElemType type)
     103psImage* psImageCopy(psImage* restrict output, const psImage* input, psElemType type)
    104104{
    105105    psElemType inDatatype;
     
    242242}
    243243
    244 psVector *psImageSlice(psVector * out,
    245                        psVector * slicePositions,
    246                        const psImage * restrict in,
    247                        const psImage * restrict mask,
     244psVector* psImageSlice(psVector* out,
     245                       psVector* slicePositions,
     246                       const psImage* restrict in,
     247                       const psImage* restrict mask,
    248248                       unsigned int maskVal,
    249249                       unsigned int col,
    250250                       unsigned int row,
    251251                       unsigned int numCols,
    252                        unsigned int numRows, psImageCutDirection direction, const psStats * stats)
     252                       unsigned int numRows, psImageCutDirection direction, const psStats* stats)
    253253{
    254254    double statVal;
    255     psStats *myStats;
     255    psStats* myStats;
    256256    psElemType type;
    257257    int inRows;
    258258    int inCols;
    259259    int delta = 1;
    260     psF64 *outData;
     260    psF64* outData;
    261261
    262262    if (in == NULL || in->data.V == NULL) {
     
    328328
    329329    if (direction == PS_CUT_X_POS || direction == PS_CUT_X_NEG) {
    330         psVector *imgVec = psVectorAlloc(numRows, type);
    331         psVector *maskVec = NULL;
    332         psMaskType *maskData = NULL;
    333         psU32 *outPosition = NULL;
     330        psVector* imgVec = psVectorAlloc(numRows, type);
     331        psVector* maskVec = NULL;
     332        psMaskType* maskData = NULL;
     333        psU32* outPosition = NULL;
    334334
    335335        // recycle output to make a proper
     
    362362                if (maskVec != NULL) { \
    363363                    maskVecData = maskVec->data.V; \
    364                     maskData = (psMaskType*)(mask->data.V[row]) + col + c; \
     364                    maskData = (psMaskType* )(mask->data.V[row]) + col + c; \
    365365                } \
    366366                for (int r=0;r<numRows;r++) { \
     
    417417        // Y
    418418        // direction
    419         psVector *imgVec = NULL;
    420         psVector *maskVec = NULL;
     419        psVector* imgVec = NULL;
     420        psVector* maskVec = NULL;
    421421        int elementSize = PSELEMTYPE_SIZEOF(type);
    422         psU32 *outPosition = NULL;
     422        psU32* outPosition = NULL;
    423423
    424424        // fill in psVectors to fake out the
  • trunk/psLib/src/image/psImageExtraction.h

    r1426 r1440  
    1010*  @author Robert DeSonia, MHPCC
    1111*
    12 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-08-09 22:44:25 $
     12*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-09 23:34:58 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4040 * one.
    4141 *
    42  * @return psImage*: Pointer to psImage.
     42 * @return psImage* : Pointer to psImage.
    4343 *
    4444 */
     
    5454/** Makes a copy of a psImage
    5555 *
    56  * @return psImage*  Copy of the input psImage.  This may not be equal to the
     56 * @return psImage* Copy of the input psImage.  This may not be equal to the
    5757 * output parameter
    5858 *
     
    7878 * @return psVector    the resulting vector
    7979 */
    80 psVector *psImageSlice(
     80psVector* psImageSlice(
    8181    psVector* out,                     ///< psVector to recycle, or NULL.
    8282    psVector* slicePositions,
     
    111111 *  @return psVector    resulting vector
    112112 */
    113 psVector *psImageCut(
     113psVector* psImageCut(
    114114    psVector* out,                     ///< psVector to recycle, or NULL.
    115115    const psImage* input,              ///< the input image in which to perform the cut
  • trunk/psLib/src/image/psImageIO.c

    r1407 r1440  
    88 *  @author Robert DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-08-07 00:06:06 $
     10 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-08-09 23:34:58 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2222#include "psMemory.h"
    2323
    24 psImage *psImageReadSection(psImage * output,
     24psImage* psImageReadSection(psImage* output,
    2525                            int col,
    2626                            int row,
     
    199199}
    200200
    201 bool psImageWriteSection(psImage * input, int col0, int row0, int z, char *extname, int extnum,
     201bool psImageWriteSection(psImage* input, int col0, int row0, int z, char *extname, int extnum,
    202202                         char *filename)
    203203{
  • trunk/psLib/src/image/psImageIO.h

    r1407 r1440  
    1010 *  @author Robert DeSonia, MHPCC
    1111 *
    12  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-07 00:06:06 $
     12 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-08-09 23:34:58 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2727/** Read an image or subimage from a FITS file specified by a filename.
    2828 *
    29  *  return psImage*         The image read from the specified file.  NULL
     29 *  return psImage* The image read from the specified file.  NULL
    3030 *                          signifies that a problem had occured.
    3131 */
    32 psImage *psImageReadSection(psImage * output,
     32psImage* psImageReadSection(psImage* output,
    3333
    3434                            /**< the output psImage to recycle, or NULL if new psImage desired */
     
    6767 *  return bool         TRUE is successful, otherwise FALSE.
    6868 */
    69 bool psImageWriteSection(psImage * input,
     69bool psImageWriteSection(psImage* input,
    7070
    7171                         /**< the psImage to write */
  • trunk/psLib/src/image/psImageManip.c

    r1407 r1440  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-08-07 00:06:06 $
     13 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-08-09 23:34:58 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3131#include "psImageExtraction.h"
    3232
    33 int psImageClip(psImage * input, psF64 min, psF64 vmin, psF64 max, psF64 vmax)
     33int psImageClip(psImage* input, psF64 min, psF64 vmin, psF64 max, psF64 vmax)
    3434{
    3535    int numClipped = 0;
     
    125125}
    126126
    127 int psImageClipNaN(psImage * input, psF64 value)
     127int psImageClipNaN(psImage* input, psF64 value)
    128128{
    129129    int numClipped = 0;
     
    164164}
    165165
    166 int psImageOverlaySection(psImage * image, const psImage * overlay, int col0, int row0, const char *op)
     166int psImageOverlaySection(psImage* image, const psImage* overlay, int col0, int row0, const char *op)
    167167{
    168168    unsigned int imageNumRows;
     
    267267}
    268268
    269 int psImageClipComplexRegion(psImage * input, psC64 min, psC64 vmin, psC64 max, psC64 vmax)
     269int psImageClipComplexRegion(psImage* input, psC64 min, psC64 vmin, psC64 max, psC64 vmax)
    270270{
    271271    int numClipped = 0;
     
    340340}
    341341
    342 psImage *psImageRebin(psImage * out, const psImage * in, unsigned int scale, const psStats * stats)
     342psImage* psImageRebin(psImage* out, const psImage* in, unsigned int scale, const psStats* stats)
    343343{
    344344    int inRows;
     
    346346    int outRows;
    347347    int outCols;
    348     psVector *vec;              // vector to hold
     348    psVector* vec;              // vector to hold
    349349
    350350    // the values of
    351351    // a single bin.
    352     psStats *myStats;
     352    psStats* myStats;
    353353    double statVal;
    354354
     
    444444}
    445445
    446 psImage *psImageResample(psImage * out, const psImage * in, int scale, psImageInterpolateMode mode)
     446psImage* psImageResample(psImage* out, const psImage* in, int scale, psImageInterpolateMode mode)
    447447{
    448448    int outRows;
     
    496496}
    497497
    498 psImage *psImageRoll(psImage * out, const psImage * in, int dx, int dy)
     498psImage* psImageRoll(psImage* out, const psImage* in, int dx, int dy)
    499499{
    500500    int outRows;
     
    534534            inRowNumber -= outRows;
    535535        }
    536         psU8 *inRow = in->data.U8[inRowNumber]; // to
     536        psU8* inRow = in->data.U8[inRowNumber]; // to
    537537
    538538        // allow
     
    542542
    543543        // but for all types
    544         psU8 *outRow = out->data.U8[row];
     544        psU8* outRow = out->data.U8[row];
    545545
    546546        memcpy(outRow, inRow + segment2Size, segment1Size);
     
    551551}
    552552
    553 psImage *psImageRotate(psImage * out,
    554                        const psImage * in, float angle, float unexposedValue, psImageInterpolateMode mode)
     553psImage* psImageRotate(psImage* out,
     554                       const psImage* in, float angle, float unexposedValue, psImageInterpolateMode mode)
    555555{
    556556    if (in == NULL) {
     
    803803}
    804804
    805 psImage *psImageShift(psImage * out,
    806                       const psImage * in,
     805psImage* psImageShift(psImage* out,
     806                      const psImage* in,
    807807                      float dx, float dy, psF64 unexposedValue, psImageInterpolateMode mode)
    808808{
  • trunk/psLib/src/image/psImageManip.h

    r1426 r1440  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-08-09 22:44:25 $
     13 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-08-09 23:34:58 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3232 *  @return int     The number of clipped pixels
    3333 */
    34 int psImageClip(psImage * input,        ///< the image to clip
     34int psImageClip(psImage* input,        ///< the image to clip
    3535                psF64 min,      ///< the minimum image value allowed
    3636                psF64 vmin,     ///< the value pixels < min are set to
     
    4848 *  @return int     The number of clipped pixels
    4949 */
    50 int psImageClipComplexRegion(psImage * input,   ///< the image to clip
     50int psImageClipComplexRegion(psImage* input,   ///< the image to clip
    5151                             psC64 min, ///< the minimum image value allowed
    5252                             psC64 vmin,        ///< the value pixels < min are set to
     
    6262 *  @return int     The number of clipped pixels
    6363 */
    64 int psImageClipNaN(psImage * input,     ///< the image to clip
     64int psImageClipNaN(psImage* input,     ///< the image to clip
    6565                   psF64 value  ///< the value to set all NaN/Inf values to
    6666                  );
     
    7777 *  @return int         0 if success, non-zero if failed.
    7878 */
    79 int psImageOverlaySection(psImage * image,      ///< target image
    80                           const psImage * overlay,      ///< the overlay image
     79int psImageOverlaySection(psImage* image,      ///< target image
     80                          const psImage* overlay,      ///< the overlay image
    8181                          int col0,     ///< the column to start overlay
    8282                          int row0,     ///< the row to start overlay
     
    9494 *  @return psImage    new image formed by rebinning input image.
    9595 */
    96 psImage *psImageRebin(psImage * out,    ///< an psImage to recycle.  If NULL, a new image is created
    97                       const psImage * in,       ///< input image
     96psImage* psImageRebin(psImage* out,    ///< an psImage to recycle.  If NULL, a new image is created
     97                      const psImage* in,       ///< input image
    9898                      unsigned int scale,       ///< the scale to rebin for each dimension
    99                       const psStats * stats     ///< the statistic to perform when rebinning.  Only one
     99                      const psStats* stats     ///< the statistic to perform when rebinning.  Only one
    100100                      // method should be set.
    101101                     );
    102102
    103 psImage *psImageResample(psImage * out, ///< an psImage to recycle.  If NULL, a new image is created
    104                          const psImage * in,    ///< input image
     103psImage* psImageResample(psImage* out, ///< an psImage to recycle.  If NULL, a new image is created
     104                         const psImage* in,    ///< input image
    105105                         int scale, psImageInterpolateMode mode);
    106106
    107 psImage *psImageRotate(psImage * out,   ///< an psImage to recycle.  If NULL, a new image is created
    108                        const psImage * in,      ///< input image
     107psImage* psImageRotate(psImage* out,   ///< an psImage to recycle.  If NULL, a new image is created
     108                       const psImage* in,      ///< input image
    109109                       float angle, float unexposedValue, psImageInterpolateMode mode);
    110110
    111 psImage *psImageShift(psImage * out,    ///< an psImage to recycle.  If NULL, a new image is created
    112                       const psImage * in,       ///< input image
     111psImage* psImageShift(psImage* out,    ///< an psImage to recycle.  If NULL, a new image is created
     112                      const psImage* in,       ///< input image
    113113                      float dx, float dy, float unexposedValue, psImageInterpolateMode mode);
    114114
     
    119119 *  defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64.
    120120 *
    121  *  @return psImage*    the rolled version of the input image.
     121 *  @return psImage* the rolled version of the input image.
    122122 */
    123 psImage *psImageRoll(psImage * out,     ///< an psImage to recycle.  If NULL, a new image is created
    124                      const psImage * in,        ///< input image
     123psImage* psImageRoll(psImage* out,     ///< an psImage to recycle.  If NULL, a new image is created
     124                     const psImage* in,        ///< input image
    125125                     int dx,    ///< number of pixels to roll in the x-dimension
    126126                     int dy     ///< number of pixels to roll in the y-dimension
  • trunk/psLib/src/image/psImageStats.c

    r1407 r1440  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-08-07 00:06:06 $
     12*  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-09 23:34:58 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3737    NOTE: verify that image/mask have the correct types, and sizes.
    3838 *****************************************************************************/
    39 psStats *psImageStats(psStats * stats, psImage * in, psImage * mask, int maskVal)
    40 {
    41     psVector *junkData = NULL;
    42     psVector *junkMask = NULL;
     39psStats* psImageStats(psStats* stats, psImage* in, psImage* mask, int maskVal)
     40{
     41    psVector* junkData = NULL;
     42    psVector* junkMask = NULL;
    4343
    4444    if (stats == NULL) {
     
    9595    NOTE: verify that image/mask have the, correct types and  sizes.
    9696 *****************************************************************************/
    97 psHistogram *psImageHistogram(psHistogram * out, psImage * in, psImage * mask, unsigned int maskVal)
    98 {
    99     psVector *junkData = NULL;
    100     psVector *junkMask = NULL;
     97psHistogram* psImageHistogram(psHistogram* out, psImage* in, psImage* mask, unsigned int maskVal)
     98{
     99    psVector* junkData = NULL;
     100    psVector* junkMask = NULL;
    101101
    102102    // NOTE: Verify this action.
     
    183183}
    184184
    185 psPolynomial1D **p_psCreateChebyshevPolys(int maxChebyPoly)
    186 {
    187     psPolynomial1D **chebPolys = NULL;
     185psPolynomial1D* *p_psCreateChebyshevPolys(int maxChebyPoly)
     186{
     187    psPolynomial1D* *chebPolys = NULL;
    188188    int i = 0;
    189189    int j = 0;
    190190
    191     chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *));
     191    chebPolys = (psPolynomial1D* *) psAlloc(maxChebyPoly * sizeof(psPolynomial1D* ));
    192192    for (i = 0; i < maxChebyPoly; i++) {
    193193        chebPolys[i] = psPolynomial1DAlloc(i + 1);
     
    224224        over all pixels (x,y) in the image.
    225225 *****************************************************************************/
    226 psPolynomial2D *psImageFitPolynomial(const psImage * input, psPolynomial2D * coeffs)
     226psPolynomial2D* psImageFitPolynomial(const psImage* input, psPolynomial2D* coeffs)
    227227{
    228228    int x = 0;
     
    231231    int j = 0;
    232232    float **sums = NULL;
    233     psPolynomial1D **chebPolys = NULL;
     233    psPolynomial1D* *chebPolys = NULL;
    234234    int maxChebyPoly = 0;
    235235    float *cScalingFactors = NULL;
     
    327327 
    328328 *****************************************************************************/
    329 int psImageEvalPolynomial(const psImage * input, const psPolynomial2D * coeffs)
     329int psImageEvalPolynomial(const psImage* input, const psPolynomial2D* coeffs)
    330330{
    331331    int x = 0;
     
    334334    int j = 0;
    335335    float **sums = NULL;
    336     psPolynomial1D **chebPolys = NULL;
     336    psPolynomial1D* *chebPolys = NULL;
    337337    int maxChebyPoly = 0;
    338338    float *cScalingFactors = NULL;
  • trunk/psLib/src/image/psImageStats.h

    r1426 r1440  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-08-09 22:44:25 $
     12*  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-09 23:34:58 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2828
    2929/// This routine must determine the various statistics for the image.
    30 psStats *psImageStats(psStats * stats,  ///< defines statistics to be calculated
    31                       psImage * in,     ///< image (or subimage) to calculate stats
    32                       psImage * mask,   ///< mask data for image (NULL ok)
     30psStats* psImageStats(psStats* stats,  ///< defines statistics to be calculated
     31                      psImage* in,     ///< image (or subimage) to calculate stats
     32                      psImage* mask,   ///< mask data for image (NULL ok)
    3333                      int maskVal);     ///< mask Mask for mask
    3434
    35 psHistogram *psImageHistogram(psHistogram * out,        ///< input histogram description & target
    36                               psImage * in,     ///< Image data to be histogramed.
    37                               psImage * mask,   ///< mask data for image (NULL ok)
     35psHistogram* psImageHistogram(psHistogram* out,        ///< input histogram description & target
     36                              psImage* in,     ///< Image data to be histogramed.
     37                              psImage* mask,   ///< mask data for image (NULL ok)
    3838                              unsigned int maskVal);    ///< mask Mask for mask
    3939
    4040/// Fit a 2-D polynomial surface to an image.
    41 psPolynomial2D *psImageFitPolynomial(const psImage * input,     ///< image to fit
    42                                      psPolynomial2D * coeffs    ///< coefficient structure carries in
     41psPolynomial2D* psImageFitPolynomial(const psImage* input,     ///< image to fit
     42                                     psPolynomial2D* coeffs    ///< coefficient structure carries in
    4343                                     // desired terms & target
    4444                                    );
    4545
    4646/// Evaluate a 2-D polynomial surface to image pixels.
    47 int psImageEvalPolynomial(const psImage * input,        ///< image to fit
    48                           const psPolynomial2D * coeffs ///< coefficient structure carries in desired terms
     47int psImageEvalPolynomial(const psImage* input,        ///< image to fit
     48                          const psPolynomial2D* coeffs ///< coefficient structure carries in desired terms
    4949                         );
    5050
  • trunk/psLib/src/imageops/psImageStats.c

    r1407 r1440  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-08-07 00:06:06 $
     12*  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-09 23:34:58 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3737    NOTE: verify that image/mask have the correct types, and sizes.
    3838 *****************************************************************************/
    39 psStats *psImageStats(psStats * stats, psImage * in, psImage * mask, int maskVal)
    40 {
    41     psVector *junkData = NULL;
    42     psVector *junkMask = NULL;
     39psStats* psImageStats(psStats* stats, psImage* in, psImage* mask, int maskVal)
     40{
     41    psVector* junkData = NULL;
     42    psVector* junkMask = NULL;
    4343
    4444    if (stats == NULL) {
     
    9595    NOTE: verify that image/mask have the, correct types and  sizes.
    9696 *****************************************************************************/
    97 psHistogram *psImageHistogram(psHistogram * out, psImage * in, psImage * mask, unsigned int maskVal)
    98 {
    99     psVector *junkData = NULL;
    100     psVector *junkMask = NULL;
     97psHistogram* psImageHistogram(psHistogram* out, psImage* in, psImage* mask, unsigned int maskVal)
     98{
     99    psVector* junkData = NULL;
     100    psVector* junkMask = NULL;
    101101
    102102    // NOTE: Verify this action.
     
    183183}
    184184
    185 psPolynomial1D **p_psCreateChebyshevPolys(int maxChebyPoly)
    186 {
    187     psPolynomial1D **chebPolys = NULL;
     185psPolynomial1D* *p_psCreateChebyshevPolys(int maxChebyPoly)
     186{
     187    psPolynomial1D* *chebPolys = NULL;
    188188    int i = 0;
    189189    int j = 0;
    190190
    191     chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *));
     191    chebPolys = (psPolynomial1D* *) psAlloc(maxChebyPoly * sizeof(psPolynomial1D* ));
    192192    for (i = 0; i < maxChebyPoly; i++) {
    193193        chebPolys[i] = psPolynomial1DAlloc(i + 1);
     
    224224        over all pixels (x,y) in the image.
    225225 *****************************************************************************/
    226 psPolynomial2D *psImageFitPolynomial(const psImage * input, psPolynomial2D * coeffs)
     226psPolynomial2D* psImageFitPolynomial(const psImage* input, psPolynomial2D* coeffs)
    227227{
    228228    int x = 0;
     
    231231    int j = 0;
    232232    float **sums = NULL;
    233     psPolynomial1D **chebPolys = NULL;
     233    psPolynomial1D* *chebPolys = NULL;
    234234    int maxChebyPoly = 0;
    235235    float *cScalingFactors = NULL;
     
    327327 
    328328 *****************************************************************************/
    329 int psImageEvalPolynomial(const psImage * input, const psPolynomial2D * coeffs)
     329int psImageEvalPolynomial(const psImage* input, const psPolynomial2D* coeffs)
    330330{
    331331    int x = 0;
     
    334334    int j = 0;
    335335    float **sums = NULL;
    336     psPolynomial1D **chebPolys = NULL;
     336    psPolynomial1D* *chebPolys = NULL;
    337337    int maxChebyPoly = 0;
    338338    float *cScalingFactors = NULL;
  • trunk/psLib/src/imageops/psImageStats.h

    r1426 r1440  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-08-09 22:44:25 $
     12*  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-09 23:34:58 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2828
    2929/// This routine must determine the various statistics for the image.
    30 psStats *psImageStats(psStats * stats,  ///< defines statistics to be calculated
    31                       psImage * in,     ///< image (or subimage) to calculate stats
    32                       psImage * mask,   ///< mask data for image (NULL ok)
     30psStats* psImageStats(psStats* stats,  ///< defines statistics to be calculated
     31                      psImage* in,     ///< image (or subimage) to calculate stats
     32                      psImage* mask,   ///< mask data for image (NULL ok)
    3333                      int maskVal);     ///< mask Mask for mask
    3434
    35 psHistogram *psImageHistogram(psHistogram * out,        ///< input histogram description & target
    36                               psImage * in,     ///< Image data to be histogramed.
    37                               psImage * mask,   ///< mask data for image (NULL ok)
     35psHistogram* psImageHistogram(psHistogram* out,        ///< input histogram description & target
     36                              psImage* in,     ///< Image data to be histogramed.
     37                              psImage* mask,   ///< mask data for image (NULL ok)
    3838                              unsigned int maskVal);    ///< mask Mask for mask
    3939
    4040/// Fit a 2-D polynomial surface to an image.
    41 psPolynomial2D *psImageFitPolynomial(const psImage * input,     ///< image to fit
    42                                      psPolynomial2D * coeffs    ///< coefficient structure carries in
     41psPolynomial2D* psImageFitPolynomial(const psImage* input,     ///< image to fit
     42                                     psPolynomial2D* coeffs    ///< coefficient structure carries in
    4343                                     // desired terms & target
    4444                                    );
    4545
    4646/// Evaluate a 2-D polynomial surface to image pixels.
    47 int psImageEvalPolynomial(const psImage * input,        ///< image to fit
    48                           const psPolynomial2D * coeffs ///< coefficient structure carries in desired terms
     47int psImageEvalPolynomial(const psImage* input,        ///< image to fit
     48                          const psPolynomial2D* coeffs ///< coefficient structure carries in desired terms
    4949                         );
    5050
  • trunk/psLib/src/math/psMatrix.c

    r1407 r1440  
    2121 *  @author Ross Harman, MHPCC
    2222 *   
    23  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    24  *  @date $Date: 2004-08-07 00:06:06 $
     23 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     24 *  @date $Date: 2004-08-09 23:34:57 $
    2525 *
    2626 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    160160/*****************************************************************************/
    161161
    162 psImage *psMatrixLUD(psImage * outImage, psVector * outPerm, psImage * inImage)
     162psImage* psMatrixLUD(psImage* outImage, psVector* outPerm, psImage* inImage)
    163163{
    164164    int signum = 0;
     
    205205}
    206206
    207 psVector *psMatrixLUSolve(psVector * outVector, const psImage * inImage, const psVector * inVector, const
    208                           psVector * inPerm)
     207psVector* psMatrixLUSolve(psVector* outVector, const psImage* inImage, const psVector* inVector, const
     208                          psVector* inPerm)
    209209{
    210210    int arraySize = 0;
     
    258258}
    259259
    260 psImage *psMatrixInvert(psImage * outImage, const psImage * inImage, float *restrict det)
     260psImage* psMatrixInvert(psImage* outImage, const psImage* inImage, float *restrict det)
    261261{
    262262    int signum = 0;
     
    312312}
    313313
    314 float *psMatrixDeterminant(const psImage * restrict inImage)
     314float *psMatrixDeterminant(const psImage* restrict inImage)
    315315{
    316316    int signum = 0;
     
    354354}
    355355
    356 psImage *psMatrixMultiply(psImage * outImage, psImage * inImage1, psImage * inImage2)
     356psImage* psMatrixMultiply(psImage* outImage, psImage* inImage1, psImage* inImage2)
    357357{
    358358    int arraySize = 0;
     
    396396}
    397397
    398 psImage *psMatrixTranspose(psImage * outImage, const psImage * inImage)
     398psImage* psMatrixTranspose(psImage* outImage, const psImage* inImage)
    399399{
    400400    int arraySize = 0;
     
    433433}
    434434
    435 psImage *psMatrixEigenvectors(psImage * outImage, psImage * inImage)
     435psImage* psMatrixEigenvectors(psImage* outImage, psImage* inImage)
    436436{
    437437    int numRows = 0;
     
    477477}
    478478
    479 psVector *psMatrixToVector(psVector * outVector, psImage * inImage)
     479psVector* psMatrixToVector(psVector* outVector, psImage* inImage)
    480480{
    481481    int size = 0;
     
    536536}
    537537
    538 psImage *psVectorToMatrix(psImage * outImage, psVector * inVector)
     538psImage* psVectorToMatrix(psImage* outImage, psVector* inVector)
    539539{
    540540    int size = 0;
  • trunk/psLib/src/math/psMatrix.h

    r1426 r1440  
    2222 *  @author Ross Harman, MHPCC
    2323 *
    24  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    25  *  @date $Date: 2004-08-09 22:44:25 $
     24 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     25 *  @date $Date: 2004-08-09 23:34:57 $
    2626 *
    2727 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4141 *  the same. GSL indexes the top row as the zero row, not the bottom. 
    4242 *
    43  *  @return  psImage*: Pointer to LU decomposed psImage.
     43 *  @return  psImage* : Pointer to LU decomposed psImage.
    4444 */
    45 psImage *psMatrixLUD(psImage * outImage,        ///< Image to return, or NULL.
    46                      psVector * outPerm,        ///< Output permutation vector used by psMatrixLUSolve.
    47                      psImage * inImage  ///< Image to decompose.
     45psImage* psMatrixLUD(psImage* outImage,        ///< Image to return, or NULL.
     46                     psVector* outPerm,        ///< Output permutation vector used by psMatrixLUSolve.
     47                     psImage* inImage  ///< Image to decompose.
    4848                    );
    4949
     
    5555 *  the top row as the zero row, not the bottom. 
    5656 *
    57  *  @return  psVector*: Pointer to psVector solution of matrix equation.
     57 *  @return  psVector* : Pointer to psVector solution of matrix equation.
    5858 */
    59 psVector *psMatrixLUSolve(psVector * outVector, ///< Vector to return, or NULL.
    60                           const psImage * luImage,      ///< LU-decomposed matrix.
    61                           const psVector * inVector,    ///< Vector right-hand-side of equation.
    62                           const psVector * inPerm       ///< Permutation vector resulting from psMatrixLUD
     59psVector* psMatrixLUSolve(psVector* outVector, ///< Vector to return, or NULL.
     60                          const psImage* luImage,      ///< LU-decomposed matrix.
     61                          const psVector* inVector,    ///< Vector right-hand-side of equation.
     62                          const psVector* inPerm       ///< Permutation vector resulting from psMatrixLUD
    6363                          // function.
    6464                         );
     
    7171 *  the same. GSL indexes the top row as the zero row, not the bottom. 
    7272 *
    73  *  @return  psImage*: Pointer to inverted psImage.
     73 *  @return  psImage* : Pointer to inverted psImage.
    7474 */
    75 psImage *psMatrixInvert(psImage * outImage,     ///< Image to return, or NULL for in-place substitution.
    76                         const psImage * inImage,        ///< Image to be inverted
     75psImage* psMatrixInvert(psImage* outImage,     ///< Image to return, or NULL for in-place substitution.
     76                        const psImage* inImage,        ///< Image to be inverted
    7777                        float *restrict det     ///< Determinant to return, or NULL
    7878                       );
     
    8686 *  @return  float: Determinant from psImage.
    8787 */
    88 float *psMatrixDeterminant(const psImage * restrict inMatrix    ///< Image used to calculate determinant.
     88float *psMatrixDeterminant(const psImage* restrict inMatrix    ///< Image used to calculate determinant.
    8989                          );
    9090
     
    9696 *  zero row, not the bottom. 
    9797 *
    98  *  @return  psImage*: Pointer to resulting psImage.
     98 *  @return  psImage* : Pointer to resulting psImage.
    9999 */
    100 psImage *psMatrixMultiply(psImage * outImage,   ///< Matrix to return, or NULL.
    101                           psImage * inImage1,   ///< First input image.
    102                           psImage * inImage2    ///< Second input image.
     100psImage* psMatrixMultiply(psImage* outImage,   ///< Matrix to return, or NULL.
     101                          psImage* inImage1,   ///< First input image.
     102                          psImage* inImage2    ///< Second input image.
    103103                         );
    104104
     
    110110 *  row, not the bottom. 
    111111 *
    112  *  @return  psImage*: Pointer to transposed psImage.
     112 *  @return  psImage* : Pointer to transposed psImage.
    113113 */
    114 psImage *psMatrixTranspose(psImage * outImage,  ///< Image to return, or NULL
    115                            const psImage * inImage      ///< Image to transpose
     114psImage* psMatrixTranspose(psImage* outImage,  ///< Image to return, or NULL
     115                           const psImage* inImage      ///< Image to transpose
    116116                          );
    117117
     
    122122 *  only with the psF64 data type. GSL indexes the top row as the zero row, not the bottom. 
    123123 *
    124  *  @return  psImage*: Pointer to matrix of Eigenvectors.
     124 *  @return  psImage* : Pointer to matrix of Eigenvectors.
    125125 */
    126 psImage *psMatrixEigenvectors(psImage * outImage,       ///< Eigenvectors to return, or NULL.
    127                               psImage * inImage ///< Input image.
     126psImage* psMatrixEigenvectors(psImage* outImage,       ///< Eigenvectors to return, or NULL.
     127                              psImage* inImage ///< Input image.
    128128                             );
    129129
     
    135135 *  input matrix must be 1. This function operates only  with the psF64 data type.
    136136 *
    137  *  @return  psVector*: Pointer to psVector.
     137 *  @return  psVector* : Pointer to psVector.
    138138 */
    139 psVector *psMatrixToVector(psVector * outVector,        ///< Vector to return, or NULL.
    140                            psImage * inImage    ///< Image to convert.
     139psVector* psMatrixToVector(psVector* outVector,        ///< Vector to return, or NULL.
     140                           psImage* inImage    ///< Image to convert.
    141141                          );
    142142
     
    148148 *  automatically be created. This function operates only with the psF64 data type. 
    149149 *
    150  *  @return  psVector*: Pointer to psIamge.
     150 *  @return  psVector* : Pointer to psIamge.
    151151 */
    152 psImage *psVectorToMatrix(psImage * outImage,   ///< Matrix to return, or NULL.
    153                           psVector * inVector   ///< Vector to convert.
     152psImage* psVectorToMatrix(psImage* outImage,   ///< Matrix to return, or NULL.
     153                          psVector* inVector   ///< Vector to convert.
    154154                         );
    155155
  • trunk/psLib/src/math/psMinimize.c

    r1407 r1440  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-07 00:06:06 $
     12 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-08-09 23:34:57 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9999    size_t n;                   // Number of data points points in domain.
    100100    int paramCount;             // Number of non-masked parameters.
    101     psVector *restrict initialGuess;
    102     const psImage *restrict domain;
    103     const psVector *restrict data;
    104     const psVector *restrict errors;
    105     const psVector *restrict paramMask;
    106     float (*evalModel) (const psVector *, const psVector *);
    107     float (*d_evalModel) (const psVector *, const psVector *, int);
     101    psVector* restrict initialGuess;
     102    const psImage* restrict domain;
     103    const psVector* restrict data;
     104    const psVector* restrict errors;
     105    const psVector* restrict paramMask;
     106    float (*evalModel) (const psVector* , const psVector* );
     107    float (*d_evalModel) (const psVector* , const psVector* , int);
    108108}
    109109psMinChi2Data;
     
    112112{
    113113    int paramCount;             // Number of non-masked parameters.
    114     psVector *restrict initialGuess;
    115     const psVector *restrict coord;
    116     const psVector *restrict paramMask;
    117     float (*evalModel) (const psVector *, const psVector *);
    118     float (*d_evalModel) (const psVector *, const psVector *, int);
     114    psVector* restrict initialGuess;
     115    const psVector* restrict coord;
     116    const psVector* restrict paramMask;
     117    float (*evalModel) (const psVector* , const psVector* );
     118    float (*d_evalModel) (const psVector* , const psVector* , int);
    119119}
    120120psMinimizeData;
     
    162162    int j;                      // Loop index variable.
    163163    float tmpf;                 // Temporary floating point variable.
    164     const psVector *restrict coord = ((psMinimizeData *) funcData)->coord;
    165     const psVector *restrict mask = ((psMinimizeData *) funcData)->paramMask;
    166     psVector *restrict initialGuess = ((psMinimizeData *) funcData)->initialGuess;
    167     float (*evalModel) (const psVector *, const psVector *) = ((psMinimizeData *) funcData)->evalModel;
    168     psVector *inputParameterList = NULL;
     164    const psVector* restrict coord = ((psMinimizeData* ) funcData)->coord;
     165    const psVector* restrict mask = ((psMinimizeData* ) funcData)->paramMask;
     166    psVector* restrict initialGuess = ((psMinimizeData* ) funcData)->initialGuess;
     167    float (*evalModel) (const psVector* , const psVector* ) = ((psMinimizeData* ) funcData)->evalModel;
     168    psVector* inputParameterList = NULL;
    169169
    170170    // The GSL routines will call this function with the masked parameters
     
    216216    int j;                      // Loop index variable.
    217217    float tmpf;                 // Temporary floating point variable.
    218     const psVector *restrict coord = ((psMinimizeData *) funcData)->coord;
    219     const psVector *restrict mask = ((psMinimizeData *) funcData)->paramMask;
    220     psVector *restrict initialGuess = ((psMinimizeData *) funcData)->initialGuess;
    221     float (*d_evalModel) (const psVector *, const psVector *, int) =
    222         ((psMinimizeData *) funcData)->d_evalModel;
    223     psVector *inputParameterList = NULL;
     218    const psVector* restrict coord = ((psMinimizeData* ) funcData)->coord;
     219    const psVector* restrict mask = ((psMinimizeData* ) funcData)->paramMask;
     220    psVector* restrict initialGuess = ((psMinimizeData* ) funcData)->initialGuess;
     221    float (*d_evalModel) (const psVector* , const psVector* , int) =
     222        ((psMinimizeData* ) funcData)->d_evalModel;
     223    psVector* inputParameterList = NULL;
    224224
    225225    // The GSL routines will call this function with the masked parameters
     
    293293    int j;                      // Loop index variable.
    294294    float tmpf;                 // Temporary floating point variable.
    295     const psImage *restrict domain = ((psMinChi2Data *) funcData)->domain;
    296     const psVector *restrict data = ((psMinChi2Data *) funcData)->data;
    297     const psVector *restrict errors = ((psMinChi2Data *) funcData)->errors;
    298     const psVector *restrict mask = ((psMinChi2Data *) funcData)->paramMask;
    299     psVector *restrict initialGuess = ((psMinChi2Data *) funcData)->initialGuess;
    300     float (*evalModel) (const psVector *, const psVector *) = ((psMinChi2Data *) funcData)->evalModel;
    301     psVector *inputParameterList = NULL;
    302     psVector *tmpVecPtr = NULL;
     295    const psImage* restrict domain = ((psMinChi2Data* ) funcData)->domain;
     296    const psVector* restrict data = ((psMinChi2Data* ) funcData)->data;
     297    const psVector* restrict errors = ((psMinChi2Data* ) funcData)->errors;
     298    const psVector* restrict mask = ((psMinChi2Data* ) funcData)->paramMask;
     299    psVector* restrict initialGuess = ((psMinChi2Data* ) funcData)->initialGuess;
     300    float (*evalModel) (const psVector* , const psVector* ) = ((psMinChi2Data* ) funcData)->evalModel;
     301    psVector* inputParameterList = NULL;
     302    psVector* tmpVecPtr = NULL;
    303303
    304304    tmpVecPtr = psVectorAlloc(domain->numCols, PS_TYPE_F32);
     
    360360int p_psMinChi2FuncDeriv(const gsl_vector * params, void *funcData, gsl_matrix * J)
    361361{
    362     const psImage *restrict domain = ((psMinChi2Data *) funcData)->domain;
    363     const psVector *restrict errors = ((psMinChi2Data *) funcData)->errors;
    364     const psVector *restrict mask = ((psMinChi2Data *) funcData)->paramMask;
    365     psVector *restrict initialGuess = ((psMinChi2Data *) funcData)->initialGuess;
    366     psVector *inputParameterList = NULL;
    367     psVector *tmpVecPtr = NULL;
    368     float (*d_evalModel) (const psVector *, const psVector *, int) =
    369         ((psMinChi2Data *) funcData)->d_evalModel;
     362    const psImage* restrict domain = ((psMinChi2Data* ) funcData)->domain;
     363    const psVector* restrict errors = ((psMinChi2Data* ) funcData)->errors;
     364    const psVector* restrict mask = ((psMinChi2Data* ) funcData)->paramMask;
     365    psVector* restrict initialGuess = ((psMinChi2Data* ) funcData)->initialGuess;
     366    psVector* inputParameterList = NULL;
     367    psVector* tmpVecPtr = NULL;
     368    float (*d_evalModel) (const psVector* , const psVector* , int) =
     369        ((psMinChi2Data* ) funcData)->d_evalModel;
    370370
    371371    size_t i;
     
    426426returned as a psVector sums.
    427427 *****************************************************************************/
    428 void p_psBuildSums1D(double x, int polyOrder, psVector * sums)
     428void p_psBuildSums1D(double x, int polyOrder, psVector* sums)
    429429{
    430430    int i = 0;
     
    442442values of the vector will be scaled uniformly between -1.0 and 1.0.
    443443 *****************************************************************************/
    444 psVector *psBuildImageScalingFactors(int x)
     444psVector* psBuildImageScalingFactors(int x)
    445445{
    446446    int i = 0;                  // loop index variable.
    447     psVector *imageScalingFactors = NULL;
     447    psVector* imageScalingFactors = NULL;
    448448
    449449    imageScalingFactors = psVectorAlloc(x, PS_TYPE_F32);
     
    556556parameters of that function such that the ...
    557557 *****************************************************************************/
    558 psVector *psMinimize(psVector * restrict initialGuess,
    559                      float (*myFunction) (const psVector * restrict, const psVector * restrict),
    560                      float (*myFunctionDeriv) (const psVector * restrict, const psVector * restrict, int),
    561                      const psVector * restrict coord, const psVector * restrict paramMask)
     558psVector* psMinimize(psVector* restrict initialGuess,
     559                     float (*myFunction) (const psVector* restrict, const psVector* restrict),
     560                     float (*myFunctionDeriv) (const psVector* restrict, const psVector* restrict, int),
     561                     const psVector* restrict coord, const psVector* restrict paramMask)
    562562{
    563563    int status;
     
    664664    such that they best fit the supplied data points.
    665665 *****************************************************************************/
    666 psVector *psMinimizeChi2(float (*evalModel) (const psVector * restrict, const psVector * restrict),
    667                          float (*DevalModel) (const psVector * restrict, const psVector * restrict, int),
    668                          const psImage * restrict domain,
    669                          const psVector * restrict data,
    670                          const psVector * restrict errors,
    671                          psVector * restrict initialGuess, const psVector * restrict paramMask, float *chiSq)
     666psVector* psMinimizeChi2(float (*evalModel) (const psVector* restrict, const psVector* restrict),
     667                         float (*DevalModel) (const psVector* restrict, const psVector* restrict, int),
     668                         const psImage* restrict domain,
     669                         const psVector* restrict data,
     670                         const psVector* restrict errors,
     671                         psVector* restrict initialGuess, const psVector* restrict paramMask, float *chiSq)
    672672{
    673673    int numData = domain->numRows;      // Number of data points
     
    847847NOTE: yErr is currently ignored.
    848848 *****************************************************************************/
    849 psPolynomial1D *psVectorFitPolynomial1D(psPolynomial1D * myPoly,
    850                                         const psVector * restrict x,
    851                                         const psVector * restrict y, const psVector * restrict yErr)
     849psPolynomial1D* psVectorFitPolynomial1D(psPolynomial1D* myPoly,
     850                                        const psVector* restrict x,
     851                                        const psVector* restrict y, const psVector* restrict yErr)
    852852{
    853853    int polyOrder = myPoly->n;
    854     psImage *A = NULL;
    855     psImage *ALUD = NULL;
    856     psVector *B = NULL;
    857     psVector *outPerm = NULL;
    858     psVector *X = NULL;         // NOTE: do we need this?
    859     psVector *coeffs = NULL;
     854    psImage* A = NULL;
     855    psImage* ALUD = NULL;
     856    psVector* B = NULL;
     857    psVector* outPerm = NULL;
     858    psVector* X = NULL;         // NOTE: do we need this?
     859    psVector* coeffs = NULL;
    860860    int i = 0;
    861861    int j = 0;
    862862    int k = 0;
    863     psVector *xSums = NULL;
     863    psVector* xSums = NULL;
    864864
    865865    // printf("psVectorFitPolynomial1D()\n");
  • trunk/psLib/src/math/psMinimize.h

    r1426 r1440  
    1616
    1717/** This routine must minimize a non-linear function */
    18 psVector *psMinimize(psVector * restrict initialGuess,
    19                      float (*myFunction) (const psVector * restrict, const psVector * restrict),
    20                      float (*myFunctionDeriv) (const psVector * restrict, const psVector * restrict, int),
    21                      const psVector * restrict coord, const psVector * restrict paramMask);
     18psVector* psMinimize(psVector* restrict initialGuess,
     19                     float (*myFunction) (const psVector* restrict, const psVector* restrict),
     20                     float (*myFunctionDeriv) (const psVector* restrict, const psVector* restrict, int),
     21                     const psVector* restrict coord, const psVector* restrict paramMask);
    2222
    2323/** Minimize chi^2 for input data */
    24 psVector *psMinimizeChi2(float (*evalModel) (const psVector * restrict, const psVector * restrict),     ///<
     24psVector* psMinimizeChi2(float (*evalModel) (const psVector* restrict, const psVector* restrict),     ///<
    2525                         // Model
    2626                         // to
     
    2929                         // and
    3030                         // params)
    31                          float (*DevalModel) (const psVector * restrict, const psVector * restrict, int),       ///<
     31                         float (*DevalModel) (const psVector* restrict, const psVector* restrict, int),       ///<
    3232                         // Derivative
    3333                         // of
     
    3838                         // and
    3939                         // params)
    40                          const psImage * restrict domain,       ///< The domain values for the corresponding
     40                         const psImage* restrict domain,       ///< The domain values for the corresponding
    4141                         // measurements
    42                          const psVector * restrict data,        ///< Data to fit
    43                          const psVector * restrict errors,      ///< Errors in the data
    44                          psVector * restrict initialGuess,      ///< Initial guess
    45                          const psVector * restrict paramMask,   ///< 1 = fit for parameter, 0 = hold
     42                         const psVector* restrict data,        ///< Data to fit
     43                         const psVector* restrict errors,      ///< Errors in the data
     44                         psVector* restrict initialGuess,      ///< Initial guess
     45                         const psVector* restrict paramMask,   ///< 1 = fit for parameter, 0 = hold
    4646                         // parameter constant
    4747                         float *chiSq);
    4848
    4949/** Derive a polynomial fit by chi^2 minimisation (analytically) */
    50 psPolynomial1D *psVectorFitPolynomial1D(psPolynomial1D * myPoly,        ///< Polynomial to fit
    51                                         const psVector * restrict x,    ///< Ordinates (or NULL to just use
     50psPolynomial1D* psVectorFitPolynomial1D(psPolynomial1D* myPoly,        ///< Polynomial to fit
     51                                        const psVector* restrict x,    ///< Ordinates (or NULL to just use
    5252                                        // the indices)
    53                                         const psVector * restrict y,    ///< Coordinates
    54                                         const psVector * restrict yErr  ///< Errors in coordinates, or NULL
     53                                        const psVector* restrict y,    ///< Coordinates
     54                                        const psVector* restrict yErr  ///< Errors in coordinates, or NULL
    5555                                       );
    5656
  • trunk/psLib/src/math/psPolynomial.c

    r1407 r1440  
    88 *  polynomials.  It also contains a Gaussian functions.
    99 *
    10  *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-08-07 00:06:06 $
     10 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-08-09 23:34:57 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4949
    5050/*****************************************************************************/
    51 static void polynomial1DFree(psPolynomial1D * myPoly);
    52 static void polynomial2DFree(psPolynomial2D * myPoly);
    53 static void polynomial3DFree(psPolynomial3D * myPoly);
    54 static void polynomial4DFree(psPolynomial4D * myPoly);
    55 static void dPolynomial1DFree(psDPolynomial1D * myPoly);
    56 static void dPolynomial2DFree(psDPolynomial2D * myPoly);
    57 static void dPolynomial3DFree(psDPolynomial3D * myPoly);
    58 static void dPolynomial4DFree(psDPolynomial4D * myPoly);
     51static void polynomial1DFree(psPolynomial1D* myPoly);
     52static void polynomial2DFree(psPolynomial2D* myPoly);
     53static void polynomial3DFree(psPolynomial3D* myPoly);
     54static void polynomial4DFree(psPolynomial4D* myPoly);
     55static void dPolynomial1DFree(psDPolynomial1D* myPoly);
     56static void dPolynomial2DFree(psDPolynomial2D* myPoly);
     57static void dPolynomial3DFree(psDPolynomial3D* myPoly);
     58static void dPolynomial4DFree(psDPolynomial4D* myPoly);
    5959
    6060/*****************************************************************************/
     
    120120 NOTE: There is no way to seed the random generator.
    121121 *****************************************************************************/
    122 psVector *psGaussianDev(float mean, float sigma, int Npts)
    123 {
    124     psVector *gauss = NULL;
     122psVector* psGaussianDev(float mean, float sigma, int Npts)
     123{
     124    psVector* gauss = NULL;
    125125    const gsl_rng_type *T = NULL;
    126126    gsl_rng *r = NULL;
     
    144144    This routine must allocate memory for the polynomial structures.
    145145 *****************************************************************************/
    146 psPolynomial1D *psPolynomial1DAlloc(int n)
     146psPolynomial1D* psPolynomial1DAlloc(int n)
    147147{
    148148    int i = 0;
    149     psPolynomial1D *newPoly = NULL;
    150 
    151     newPoly = (psPolynomial1D *) psAlloc(sizeof(psPolynomial1D));
     149    psPolynomial1D* newPoly = NULL;
     150
     151    newPoly = (psPolynomial1D* ) psAlloc(sizeof(psPolynomial1D));
    152152    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial1DFree);
    153153    newPoly->n = n;
     
    164164}
    165165
    166 psPolynomial2D *psPolynomial2DAlloc(int nX, int nY)
    167 {
    168     int x = 0;
    169     int y = 0;
    170     psPolynomial2D *newPoly = NULL;
    171 
    172     newPoly = (psPolynomial2D *) psAlloc(sizeof(psPolynomial2D));
     166psPolynomial2D* psPolynomial2DAlloc(int nX, int nY)
     167{
     168    int x = 0;
     169    int y = 0;
     170    psPolynomial2D* newPoly = NULL;
     171
     172    newPoly = (psPolynomial2D* ) psAlloc(sizeof(psPolynomial2D));
    173173    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial2DFree);
    174174    newPoly->nX = nX;
     
    194194}
    195195
    196 psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ)
     196psPolynomial3D* psPolynomial3DAlloc(int nX, int nY, int nZ)
    197197{
    198198    int x = 0;
    199199    int y = 0;
    200200    int z = 0;
    201     psPolynomial3D *newPoly = NULL;
    202 
    203     newPoly = (psPolynomial3D *) psAlloc(sizeof(psPolynomial3D));
     201    psPolynomial3D* newPoly = NULL;
     202
     203    newPoly = (psPolynomial3D* ) psAlloc(sizeof(psPolynomial3D));
    204204    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial3DFree);
    205205    newPoly->nX = nX;
     
    233233}
    234234
    235 psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ)
     235psPolynomial4D* psPolynomial4DAlloc(int nW, int nX, int nY, int nZ)
    236236{
    237237    int w = 0;
     
    239239    int y = 0;
    240240    int z = 0;
    241     psPolynomial4D *newPoly = NULL;
    242 
    243     newPoly = (psPolynomial4D *) psAlloc(sizeof(psPolynomial4D));
     241    psPolynomial4D* newPoly = NULL;
     242
     243    newPoly = (psPolynomial4D* ) psAlloc(sizeof(psPolynomial4D));
    244244    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial4DFree);
    245245    newPoly->nW = nW;
     
    281281}
    282282
    283 static void polynomial1DFree(psPolynomial1D * myPoly)
     283static void polynomial1DFree(psPolynomial1D* myPoly)
    284284{
    285285    psFree(myPoly->coeff);
     
    288288}
    289289
    290 static void polynomial2DFree(psPolynomial2D * myPoly)
     290static void polynomial2DFree(psPolynomial2D* myPoly)
    291291{
    292292    int x = 0;
     
    302302}
    303303
    304 static void polynomial3DFree(psPolynomial3D * myPoly)
     304static void polynomial3DFree(psPolynomial3D* myPoly)
    305305{
    306306    int x = 0;
     
    323323}
    324324
    325 static void polynomial4DFree(psPolynomial4D * myPoly)
     325static void polynomial4DFree(psPolynomial4D* myPoly)
    326326{
    327327    int w = 0;
     
    353353    Polynomial coefficients will be accessed in [w][x][y][z] fashion.
    354354 *****************************************************************************/
    355 float psPolynomial1DEval(float x, const psPolynomial1D * myPoly)
     355float psPolynomial1DEval(float x, const psPolynomial1D* myPoly)
    356356{
    357357    int loop_x = 0;
     
    380380}
    381381
    382 float psPolynomial2DEval(float x, float y, const psPolynomial2D * myPoly)
     382float psPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly)
    383383{
    384384    int loop_x = 0;
     
    400400}
    401401
    402 float psPolynomial3DEval(float x, float y, float z, const psPolynomial3D * myPoly)
     402float psPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly)
    403403{
    404404    int loop_x = 0;
     
    426426}
    427427
    428 float psPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D * myPoly)
     428float psPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly)
    429429{
    430430    int loop_w = 0;
     
    458458}
    459459
    460 psDPolynomial1D *psDPolynomial1DAlloc(int n)
     460psDPolynomial1D* psDPolynomial1DAlloc(int n)
    461461{
    462462    int i = 0;
    463     psDPolynomial1D *newPoly = NULL;
    464 
    465     newPoly = (psDPolynomial1D *) psAlloc(sizeof(psDPolynomial1D));
     463    psDPolynomial1D* newPoly = NULL;
     464
     465    newPoly = (psDPolynomial1D* ) psAlloc(sizeof(psDPolynomial1D));
    466466    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial1DFree);
    467467    newPoly->n = n;
     
    478478}
    479479
    480 psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY)
    481 {
    482     int x = 0;
    483     int y = 0;
    484     psDPolynomial2D *newPoly = NULL;
    485 
    486     newPoly = (psDPolynomial2D *) psAlloc(sizeof(psDPolynomial2D));
     480psDPolynomial2D* psDPolynomial2DAlloc(int nX, int nY)
     481{
     482    int x = 0;
     483    int y = 0;
     484    psDPolynomial2D* newPoly = NULL;
     485
     486    newPoly = (psDPolynomial2D* ) psAlloc(sizeof(psDPolynomial2D));
    487487    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial2DFree);
    488488    newPoly->nX = nX;
     
    508508}
    509509
    510 psDPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ)
     510psDPolynomial3D* psDPolynomial3DAlloc(int nX, int nY, int nZ)
    511511{
    512512    int x = 0;
    513513    int y = 0;
    514514    int z = 0;
    515     psDPolynomial3D *newPoly = NULL;
    516 
    517     newPoly = (psDPolynomial3D *) psAlloc(sizeof(psDPolynomial3D));
     515    psDPolynomial3D* newPoly = NULL;
     516
     517    newPoly = (psDPolynomial3D* ) psAlloc(sizeof(psDPolynomial3D));
    518518    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial3DFree);
    519519    newPoly->nX = nX;
     
    547547}
    548548
    549 psDPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ)
     549psDPolynomial4D* psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ)
    550550{
    551551    int w = 0;
     
    553553    int y = 0;
    554554    int z = 0;
    555     psDPolynomial4D *newPoly = NULL;
    556 
    557     newPoly = (psDPolynomial4D *) psAlloc(sizeof(psDPolynomial4D));
     555    psDPolynomial4D* newPoly = NULL;
     556
     557    newPoly = (psDPolynomial4D* ) psAlloc(sizeof(psDPolynomial4D));
    558558    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial4DFree);
    559559    newPoly->nW = nW;
     
    595595}
    596596
    597 static void dPolynomial1DFree(psDPolynomial1D * myPoly)
     597static void dPolynomial1DFree(psDPolynomial1D* myPoly)
    598598{
    599599    psFree(myPoly->coeff);
     
    602602}
    603603
    604 static void dPolynomial2DFree(psDPolynomial2D * myPoly)
     604static void dPolynomial2DFree(psDPolynomial2D* myPoly)
    605605{
    606606    int x = 0;
     
    616616}
    617617
    618 static void dPolynomial3DFree(psDPolynomial3D * myPoly)
     618static void dPolynomial3DFree(psDPolynomial3D* myPoly)
    619619{
    620620    int x = 0;
     
    637637}
    638638
    639 static void dPolynomial4DFree(psDPolynomial4D * myPoly)
     639static void dPolynomial4DFree(psDPolynomial4D* myPoly)
    640640{
    641641    int w = 0;
     
    667667    Polynomial coefficients will be accessed in [w][x][y][z] fashion.
    668668 *****************************************************************************/
    669 double psDPolynomial1DEval(double x, const psDPolynomial1D * myPoly)
     669double psDPolynomial1DEval(double x, const psDPolynomial1D* myPoly)
    670670{
    671671    int loop_x = 0;
     
    686686}
    687687
    688 double psDPolynomial2DEval(double x, double y, const psDPolynomial2D * myPoly)
     688double psDPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly)
    689689{
    690690    int loop_x = 0;
     
    706706}
    707707
    708 double psDPolynomial3DEval(double x, double y, double z, const psDPolynomial3D * myPoly)
     708double psDPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly)
    709709{
    710710    int loop_x = 0;
     
    732732}
    733733
    734 double psDPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D * myPoly)
     734double psDPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly)
    735735{
    736736    int loop_w = 0;
  • trunk/psLib/src/math/psPolynomial.h

    r1426 r1440  
    1313*  @author George Gusciora, MHPCC
    1414*
    15 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    16 *  @date $Date: 2004-08-09 22:44:25 $
     15*  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     16*  @date $Date: 2004-08-09 23:34:57 $
    1717*
    1818*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4242/** Produce a vector of random numbers from a Gaussian distribution with
    4343    the specified mean and sigma */
    44 psVector *psGaussianDev(float mean,     ///< The mean of the Gaussian
     44psVector* psGaussianDev(float mean,     ///< The mean of the Gaussian
    4545                        float sigma,    ///< The sigma of the Gaussian
    4646                        int Npts);      ///< The size of the vector
     
    9595
    9696/** Constructor */
    97 psPolynomial1D *psPolynomial1DAlloc(int n       ///< Number of terms
    98                                    );
    99 
    100 /** Constructor */
    101 psPolynomial2D *psPolynomial2DAlloc(int nX, int nY      ///< Number of terms in x and y
    102                                    );
    103 
    104 /** Constructor */
    105 psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ      ///< Number of terms in x, y and z
    106                                    );
    107 
    108 /** Constructor */
    109 psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ      ///< Number of terms in w, x, y and
     97psPolynomial1D* psPolynomial1DAlloc(int n       ///< Number of terms
     98                                   );
     99
     100/** Constructor */
     101psPolynomial2D* psPolynomial2DAlloc(int nX, int nY      ///< Number of terms in x and y
     102                                   );
     103
     104/** Constructor */
     105psPolynomial3D* psPolynomial3DAlloc(int nX, int nY, int nZ      ///< Number of terms in x, y and z
     106                                   );
     107
     108/** Constructor */
     109psPolynomial4D* psPolynomial4DAlloc(int nW, int nX, int nY, int nZ      ///< Number of terms in w, x, y and
    110110                                    // z
    111111                                   );
     
    113113/** Evaluate 1D polynomial */
    114114float psPolynomial1DEval(float x,       ///< Value at which to evaluate
    115                          const psPolynomial1D * myPoly  ///< Coefficients for the polynomial
     115                         const psPolynomial1D* myPoly  ///< Coefficients for the polynomial
    116116                        );
    117117
     
    119119float psPolynomial2DEval(float x,       ///< Value x at which to evaluate
    120120                         float y,       ///< Value y at which to evaluate
    121                          const psPolynomial2D * myPoly  ///< Coefficients for the polynomial
     121                         const psPolynomial2D* myPoly  ///< Coefficients for the polynomial
    122122                        );
    123123
     
    126126                         float y,       ///< Value y at which to evaluate
    127127                         float z,       ///< Value z at which to evaluate
    128                          const psPolynomial3D * myPoly  ///< Coefficients for the polynomial
     128                         const psPolynomial3D* myPoly  ///< Coefficients for the polynomial
    129129                        );
    130130
     
    134134                         float y,       ///< Value y at which to evaluate
    135135                         float z,       ///< Value z at which to evaluate
    136                          const psPolynomial4D * myPoly  ///< Coefficients for the polynomial
     136                         const psPolynomial4D* myPoly  ///< Coefficients for the polynomial
    137137                        );
    138138
     
    188188
    189189/** Constructor */
    190 psDPolynomial1D *psDPolynomial1DAlloc(int n     ///< Number of terms
    191                                      );
    192 
    193 /** Constructor */
    194 psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY    ///< Number of terms in x and y
    195                                      );
    196 
    197 /** Constructor */
    198 psDPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ    ///< Number of terms in x, y and z
    199                                      );
    200 
    201 /** Constructor */
    202 psDPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ    ///< Number of terms in w, x, y and
     190psDPolynomial1D* psDPolynomial1DAlloc(int n     ///< Number of terms
     191                                     );
     192
     193/** Constructor */
     194psDPolynomial2D* psDPolynomial2DAlloc(int nX, int nY    ///< Number of terms in x and y
     195                                     );
     196
     197/** Constructor */
     198psDPolynomial3D* psDPolynomial3DAlloc(int nX, int nY, int nZ    ///< Number of terms in x, y and z
     199                                     );
     200
     201/** Constructor */
     202psDPolynomial4D* psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ    ///< Number of terms in w, x, y and
    203203                                      // z
    204204                                     );
     
    206206/** Evaluate 1D polynomial (double precision) */
    207207double psDPolynomial1DEval(double x,    ///< Value at which to evaluate
    208                            const psDPolynomial1D * myPoly       ///< Coefficients for the polynomial
     208                           const psDPolynomial1D* myPoly       ///< Coefficients for the polynomial
    209209                          );
    210210
     
    212212double psDPolynomial2DEval(double x,    ///< Value x at which to evaluate
    213213                           double y,    ///< Value y at which to evaluate
    214                            const psDPolynomial2D * myPoly       ///< Coefficients for the polynomial
     214                           const psDPolynomial2D* myPoly       ///< Coefficients for the polynomial
    215215                          );
    216216
     
    219219                           double y,    ///< Value y at which to evaluate
    220220                           double z,    ///< Value z at which to evaluate
    221                            const psDPolynomial3D * myPoly       ///< Coefficients for the polynomial
     221                           const psDPolynomial3D* myPoly       ///< Coefficients for the polynomial
    222222                          );
    223223
     
    227227                           double y,    ///< Value y at which to evaluate
    228228                           double z,    ///< Value z at which to evaluate
    229                            const psDPolynomial4D * myPoly       ///< Coefficients for the polynomial
     229                           const psDPolynomial4D* myPoly       ///< Coefficients for the polynomial
    230230                          );
    231231
  • trunk/psLib/src/math/psSpline.c

    r1407 r1440  
    88 *  polynomials.  It also contains a Gaussian functions.
    99 *
    10  *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-08-07 00:06:06 $
     10 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-08-09 23:34:57 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4949
    5050/*****************************************************************************/
    51 static void polynomial1DFree(psPolynomial1D * myPoly);
    52 static void polynomial2DFree(psPolynomial2D * myPoly);
    53 static void polynomial3DFree(psPolynomial3D * myPoly);
    54 static void polynomial4DFree(psPolynomial4D * myPoly);
    55 static void dPolynomial1DFree(psDPolynomial1D * myPoly);
    56 static void dPolynomial2DFree(psDPolynomial2D * myPoly);
    57 static void dPolynomial3DFree(psDPolynomial3D * myPoly);
    58 static void dPolynomial4DFree(psDPolynomial4D * myPoly);
     51static void polynomial1DFree(psPolynomial1D* myPoly);
     52static void polynomial2DFree(psPolynomial2D* myPoly);
     53static void polynomial3DFree(psPolynomial3D* myPoly);
     54static void polynomial4DFree(psPolynomial4D* myPoly);
     55static void dPolynomial1DFree(psDPolynomial1D* myPoly);
     56static void dPolynomial2DFree(psDPolynomial2D* myPoly);
     57static void dPolynomial3DFree(psDPolynomial3D* myPoly);
     58static void dPolynomial4DFree(psDPolynomial4D* myPoly);
    5959
    6060/*****************************************************************************/
     
    120120 NOTE: There is no way to seed the random generator.
    121121 *****************************************************************************/
    122 psVector *psGaussianDev(float mean, float sigma, int Npts)
    123 {
    124     psVector *gauss = NULL;
     122psVector* psGaussianDev(float mean, float sigma, int Npts)
     123{
     124    psVector* gauss = NULL;
    125125    const gsl_rng_type *T = NULL;
    126126    gsl_rng *r = NULL;
     
    144144    This routine must allocate memory for the polynomial structures.
    145145 *****************************************************************************/
    146 psPolynomial1D *psPolynomial1DAlloc(int n)
     146psPolynomial1D* psPolynomial1DAlloc(int n)
    147147{
    148148    int i = 0;
    149     psPolynomial1D *newPoly = NULL;
    150 
    151     newPoly = (psPolynomial1D *) psAlloc(sizeof(psPolynomial1D));
     149    psPolynomial1D* newPoly = NULL;
     150
     151    newPoly = (psPolynomial1D* ) psAlloc(sizeof(psPolynomial1D));
    152152    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial1DFree);
    153153    newPoly->n = n;
     
    164164}
    165165
    166 psPolynomial2D *psPolynomial2DAlloc(int nX, int nY)
    167 {
    168     int x = 0;
    169     int y = 0;
    170     psPolynomial2D *newPoly = NULL;
    171 
    172     newPoly = (psPolynomial2D *) psAlloc(sizeof(psPolynomial2D));
     166psPolynomial2D* psPolynomial2DAlloc(int nX, int nY)
     167{
     168    int x = 0;
     169    int y = 0;
     170    psPolynomial2D* newPoly = NULL;
     171
     172    newPoly = (psPolynomial2D* ) psAlloc(sizeof(psPolynomial2D));
    173173    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial2DFree);
    174174    newPoly->nX = nX;
     
    194194}
    195195
    196 psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ)
     196psPolynomial3D* psPolynomial3DAlloc(int nX, int nY, int nZ)
    197197{
    198198    int x = 0;
    199199    int y = 0;
    200200    int z = 0;
    201     psPolynomial3D *newPoly = NULL;
    202 
    203     newPoly = (psPolynomial3D *) psAlloc(sizeof(psPolynomial3D));
     201    psPolynomial3D* newPoly = NULL;
     202
     203    newPoly = (psPolynomial3D* ) psAlloc(sizeof(psPolynomial3D));
    204204    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial3DFree);
    205205    newPoly->nX = nX;
     
    233233}
    234234
    235 psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ)
     235psPolynomial4D* psPolynomial4DAlloc(int nW, int nX, int nY, int nZ)
    236236{
    237237    int w = 0;
     
    239239    int y = 0;
    240240    int z = 0;
    241     psPolynomial4D *newPoly = NULL;
    242 
    243     newPoly = (psPolynomial4D *) psAlloc(sizeof(psPolynomial4D));
     241    psPolynomial4D* newPoly = NULL;
     242
     243    newPoly = (psPolynomial4D* ) psAlloc(sizeof(psPolynomial4D));
    244244    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial4DFree);
    245245    newPoly->nW = nW;
     
    281281}
    282282
    283 static void polynomial1DFree(psPolynomial1D * myPoly)
     283static void polynomial1DFree(psPolynomial1D* myPoly)
    284284{
    285285    psFree(myPoly->coeff);
     
    288288}
    289289
    290 static void polynomial2DFree(psPolynomial2D * myPoly)
     290static void polynomial2DFree(psPolynomial2D* myPoly)
    291291{
    292292    int x = 0;
     
    302302}
    303303
    304 static void polynomial3DFree(psPolynomial3D * myPoly)
     304static void polynomial3DFree(psPolynomial3D* myPoly)
    305305{
    306306    int x = 0;
     
    323323}
    324324
    325 static void polynomial4DFree(psPolynomial4D * myPoly)
     325static void polynomial4DFree(psPolynomial4D* myPoly)
    326326{
    327327    int w = 0;
     
    353353    Polynomial coefficients will be accessed in [w][x][y][z] fashion.
    354354 *****************************************************************************/
    355 float psPolynomial1DEval(float x, const psPolynomial1D * myPoly)
     355float psPolynomial1DEval(float x, const psPolynomial1D* myPoly)
    356356{
    357357    int loop_x = 0;
     
    380380}
    381381
    382 float psPolynomial2DEval(float x, float y, const psPolynomial2D * myPoly)
     382float psPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly)
    383383{
    384384    int loop_x = 0;
     
    400400}
    401401
    402 float psPolynomial3DEval(float x, float y, float z, const psPolynomial3D * myPoly)
     402float psPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly)
    403403{
    404404    int loop_x = 0;
     
    426426}
    427427
    428 float psPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D * myPoly)
     428float psPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly)
    429429{
    430430    int loop_w = 0;
     
    458458}
    459459
    460 psDPolynomial1D *psDPolynomial1DAlloc(int n)
     460psDPolynomial1D* psDPolynomial1DAlloc(int n)
    461461{
    462462    int i = 0;
    463     psDPolynomial1D *newPoly = NULL;
    464 
    465     newPoly = (psDPolynomial1D *) psAlloc(sizeof(psDPolynomial1D));
     463    psDPolynomial1D* newPoly = NULL;
     464
     465    newPoly = (psDPolynomial1D* ) psAlloc(sizeof(psDPolynomial1D));
    466466    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial1DFree);
    467467    newPoly->n = n;
     
    478478}
    479479
    480 psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY)
    481 {
    482     int x = 0;
    483     int y = 0;
    484     psDPolynomial2D *newPoly = NULL;
    485 
    486     newPoly = (psDPolynomial2D *) psAlloc(sizeof(psDPolynomial2D));
     480psDPolynomial2D* psDPolynomial2DAlloc(int nX, int nY)
     481{
     482    int x = 0;
     483    int y = 0;
     484    psDPolynomial2D* newPoly = NULL;
     485
     486    newPoly = (psDPolynomial2D* ) psAlloc(sizeof(psDPolynomial2D));
    487487    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial2DFree);
    488488    newPoly->nX = nX;
     
    508508}
    509509
    510 psDPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ)
     510psDPolynomial3D* psDPolynomial3DAlloc(int nX, int nY, int nZ)
    511511{
    512512    int x = 0;
    513513    int y = 0;
    514514    int z = 0;
    515     psDPolynomial3D *newPoly = NULL;
    516 
    517     newPoly = (psDPolynomial3D *) psAlloc(sizeof(psDPolynomial3D));
     515    psDPolynomial3D* newPoly = NULL;
     516
     517    newPoly = (psDPolynomial3D* ) psAlloc(sizeof(psDPolynomial3D));
    518518    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial3DFree);
    519519    newPoly->nX = nX;
     
    547547}
    548548
    549 psDPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ)
     549psDPolynomial4D* psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ)
    550550{
    551551    int w = 0;
     
    553553    int y = 0;
    554554    int z = 0;
    555     psDPolynomial4D *newPoly = NULL;
    556 
    557     newPoly = (psDPolynomial4D *) psAlloc(sizeof(psDPolynomial4D));
     555    psDPolynomial4D* newPoly = NULL;
     556
     557    newPoly = (psDPolynomial4D* ) psAlloc(sizeof(psDPolynomial4D));
    558558    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial4DFree);
    559559    newPoly->nW = nW;
     
    595595}
    596596
    597 static void dPolynomial1DFree(psDPolynomial1D * myPoly)
     597static void dPolynomial1DFree(psDPolynomial1D* myPoly)
    598598{
    599599    psFree(myPoly->coeff);
     
    602602}
    603603
    604 static void dPolynomial2DFree(psDPolynomial2D * myPoly)
     604static void dPolynomial2DFree(psDPolynomial2D* myPoly)
    605605{
    606606    int x = 0;
     
    616616}
    617617
    618 static void dPolynomial3DFree(psDPolynomial3D * myPoly)
     618static void dPolynomial3DFree(psDPolynomial3D* myPoly)
    619619{
    620620    int x = 0;
     
    637637}
    638638
    639 static void dPolynomial4DFree(psDPolynomial4D * myPoly)
     639static void dPolynomial4DFree(psDPolynomial4D* myPoly)
    640640{
    641641    int w = 0;
     
    667667    Polynomial coefficients will be accessed in [w][x][y][z] fashion.
    668668 *****************************************************************************/
    669 double psDPolynomial1DEval(double x, const psDPolynomial1D * myPoly)
     669double psDPolynomial1DEval(double x, const psDPolynomial1D* myPoly)
    670670{
    671671    int loop_x = 0;
     
    686686}
    687687
    688 double psDPolynomial2DEval(double x, double y, const psDPolynomial2D * myPoly)
     688double psDPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly)
    689689{
    690690    int loop_x = 0;
     
    706706}
    707707
    708 double psDPolynomial3DEval(double x, double y, double z, const psDPolynomial3D * myPoly)
     708double psDPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly)
    709709{
    710710    int loop_x = 0;
     
    732732}
    733733
    734 double psDPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D * myPoly)
     734double psDPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly)
    735735{
    736736    int loop_w = 0;
  • trunk/psLib/src/math/psSpline.h

    r1426 r1440  
    1313*  @author George Gusciora, MHPCC
    1414*
    15 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    16 *  @date $Date: 2004-08-09 22:44:25 $
     15*  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     16*  @date $Date: 2004-08-09 23:34:57 $
    1717*
    1818*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4242/** Produce a vector of random numbers from a Gaussian distribution with
    4343    the specified mean and sigma */
    44 psVector *psGaussianDev(float mean,     ///< The mean of the Gaussian
     44psVector* psGaussianDev(float mean,     ///< The mean of the Gaussian
    4545                        float sigma,    ///< The sigma of the Gaussian
    4646                        int Npts);      ///< The size of the vector
     
    9595
    9696/** Constructor */
    97 psPolynomial1D *psPolynomial1DAlloc(int n       ///< Number of terms
    98                                    );
    99 
    100 /** Constructor */
    101 psPolynomial2D *psPolynomial2DAlloc(int nX, int nY      ///< Number of terms in x and y
    102                                    );
    103 
    104 /** Constructor */
    105 psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ      ///< Number of terms in x, y and z
    106                                    );
    107 
    108 /** Constructor */
    109 psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ      ///< Number of terms in w, x, y and
     97psPolynomial1D* psPolynomial1DAlloc(int n       ///< Number of terms
     98                                   );
     99
     100/** Constructor */
     101psPolynomial2D* psPolynomial2DAlloc(int nX, int nY      ///< Number of terms in x and y
     102                                   );
     103
     104/** Constructor */
     105psPolynomial3D* psPolynomial3DAlloc(int nX, int nY, int nZ      ///< Number of terms in x, y and z
     106                                   );
     107
     108/** Constructor */
     109psPolynomial4D* psPolynomial4DAlloc(int nW, int nX, int nY, int nZ      ///< Number of terms in w, x, y and
    110110                                    // z
    111111                                   );
     
    113113/** Evaluate 1D polynomial */
    114114float psPolynomial1DEval(float x,       ///< Value at which to evaluate
    115                          const psPolynomial1D * myPoly  ///< Coefficients for the polynomial
     115                         const psPolynomial1D* myPoly  ///< Coefficients for the polynomial
    116116                        );
    117117
     
    119119float psPolynomial2DEval(float x,       ///< Value x at which to evaluate
    120120                         float y,       ///< Value y at which to evaluate
    121                          const psPolynomial2D * myPoly  ///< Coefficients for the polynomial
     121                         const psPolynomial2D* myPoly  ///< Coefficients for the polynomial
    122122                        );
    123123
     
    126126                         float y,       ///< Value y at which to evaluate
    127127                         float z,       ///< Value z at which to evaluate
    128                          const psPolynomial3D * myPoly  ///< Coefficients for the polynomial
     128                         const psPolynomial3D* myPoly  ///< Coefficients for the polynomial
    129129                        );
    130130
     
    134134                         float y,       ///< Value y at which to evaluate
    135135                         float z,       ///< Value z at which to evaluate
    136                          const psPolynomial4D * myPoly  ///< Coefficients for the polynomial
     136                         const psPolynomial4D* myPoly  ///< Coefficients for the polynomial
    137137                        );
    138138
     
    188188
    189189/** Constructor */
    190 psDPolynomial1D *psDPolynomial1DAlloc(int n     ///< Number of terms
    191                                      );
    192 
    193 /** Constructor */
    194 psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY    ///< Number of terms in x and y
    195                                      );
    196 
    197 /** Constructor */
    198 psDPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ    ///< Number of terms in x, y and z
    199                                      );
    200 
    201 /** Constructor */
    202 psDPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ    ///< Number of terms in w, x, y and
     190psDPolynomial1D* psDPolynomial1DAlloc(int n     ///< Number of terms
     191                                     );
     192
     193/** Constructor */
     194psDPolynomial2D* psDPolynomial2DAlloc(int nX, int nY    ///< Number of terms in x and y
     195                                     );
     196
     197/** Constructor */
     198psDPolynomial3D* psDPolynomial3DAlloc(int nX, int nY, int nZ    ///< Number of terms in x, y and z
     199                                     );
     200
     201/** Constructor */
     202psDPolynomial4D* psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ    ///< Number of terms in w, x, y and
    203203                                      // z
    204204                                     );
     
    206206/** Evaluate 1D polynomial (double precision) */
    207207double psDPolynomial1DEval(double x,    ///< Value at which to evaluate
    208                            const psDPolynomial1D * myPoly       ///< Coefficients for the polynomial
     208                           const psDPolynomial1D* myPoly       ///< Coefficients for the polynomial
    209209                          );
    210210
     
    212212double psDPolynomial2DEval(double x,    ///< Value x at which to evaluate
    213213                           double y,    ///< Value y at which to evaluate
    214                            const psDPolynomial2D * myPoly       ///< Coefficients for the polynomial
     214                           const psDPolynomial2D* myPoly       ///< Coefficients for the polynomial
    215215                          );
    216216
     
    219219                           double y,    ///< Value y at which to evaluate
    220220                           double z,    ///< Value z at which to evaluate
    221                            const psDPolynomial3D * myPoly       ///< Coefficients for the polynomial
     221                           const psDPolynomial3D* myPoly       ///< Coefficients for the polynomial
    222222                          );
    223223
     
    227227                           double y,    ///< Value y at which to evaluate
    228228                           double z,    ///< Value z at which to evaluate
    229                            const psDPolynomial4D * myPoly       ///< Coefficients for the polynomial
     229                           const psDPolynomial4D* myPoly       ///< Coefficients for the polynomial
    230230                          );
    231231
  • trunk/psLib/src/math/psStats.c

    r1407 r1440  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-07 00:06:06 $
     12 *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-08-09 23:34:57 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5454#define MAX_ITERATIONS 10
    5555
    56 void p_psVectorRobustStats(const psVector * restrict myVector,
    57                            const psVector * restrict maskVector, unsigned int maskVal, psStats * stats);
     56void p_psVectorRobustStats(const psVector* restrict myVector,
     57                           const psVector* restrict maskVector, unsigned int maskVal, psStats* stats);
    5858
    5959/** Preprocessor macro to generate error on an incorrect type */
     
    116116/*****************************************************************************/
    117117
    118 bool p_psGetStatValue(const psStats * stats, double *value)
     118bool p_psGetStatValue(const psStats* stats, double *value)
    119119{
    120120
     
    175175 *****************************************************************************/
    176176
    177 void p_psVectorPrint(psVector * myVector, psVector * maskVector, unsigned int maskVal, psStats * stats)
     177void p_psVectorPrint(psVector* myVector, psVector* maskVector, unsigned int maskVal, psStats* stats)
    178178{
    179179    int i = 0;                  // Loop index variable.
     
    218218 *****************************************************************************/
    219219
    220 void p_psVectorSampleMean(const psVector * restrict myVector,
    221                           const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
     220void p_psVectorSampleMean(const psVector* restrict myVector,
     221                          const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    222222{
    223223    int i = 0;                  // Loop index variable
     
    282282    NULL
    283283 *****************************************************************************/
    284 void p_psVectorMax(const psVector * restrict myVector,
    285                    const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
     284void p_psVectorMax(const psVector* restrict myVector,
     285                   const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    286286{
    287287    int i = 0;                  // Loop index variable
     
    343343    NULL
    344344 *****************************************************************************/
    345 void p_psVectorMin(const psVector * restrict myVector,
    346                    const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
     345void p_psVectorMin(const psVector* restrict myVector,
     346                   const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    347347{
    348348    int i = 0;                  // Loop index variable
     
    404404    NULL
    405405 *****************************************************************************/
    406 int p_psVectorNValues(const psVector * restrict myVector,
    407                       const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
     406int p_psVectorNValues(const psVector* restrict myVector,
     407                      const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    408408{
    409409    int i = 0;                  // Loop index variable
     
    456456    NULL
    457457 *****************************************************************************/
    458 void p_psVectorSampleMedian(const psVector * restrict myVector,
    459                             const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
    460 {
    461     psVector *unsortedVector = NULL;    // Temporary vector
    462     psVector *sortedVector = NULL;      // Temporary vector
     458void p_psVectorSampleMedian(const psVector* restrict myVector,
     459                            const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
     460{
     461    psVector* unsortedVector = NULL;    // Temporary vector
     462    psVector* sortedVector = NULL;      // Temporary vector
    463463    int i = 0;                  // Loop index variable
    464464    int count = 0;              // # of points in this mean?
     
    565565    XXX: use a static variable for gaussianCoefs[] and compute them once.
    566566 *****************************************************************************/
    567 psVector *p_psVectorsmoothHistGaussian(psHistogram * robustHistogram, float sigma)
     567psVector* p_psVectorsmoothHistGaussian(psHistogram* robustHistogram, float sigma)
    568568{
    569569    int i = 0;                  // Loop index variable
     
    572572    float expo = 0.0;           // Temporary variable
    573573    float gaussianCoefs[1 + (2 * GAUSS_WIDTH)]; // The Gaussian Coefficients
    574     psVector *smooth = psVectorAlloc(robustHistogram->nums->n, PS_TYPE_F32);
     574    psVector* smooth = psVectorAlloc(robustHistogram->nums->n, PS_TYPE_F32);
    575575
    576576    for (i = 0; i < (1 + (2 * GAUSS_WIDTH)); i++) {
     
    628628    NULL
    629629 *****************************************************************************/
    630 void p_psVectorSampleQuartiles(const psVector * restrict myVector,
    631                                const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
    632 {
    633     psVector *unsortedVector = NULL;    // Temporary vector
    634     psVector *sortedVector = NULL;      // Temporary vector
     630void p_psVectorSampleQuartiles(const psVector* restrict myVector,
     631                               const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
     632{
     633    psVector* unsortedVector = NULL;    // Temporary vector
     634    psVector* sortedVector = NULL;      // Temporary vector
    635635    int i = 0;                  // Loop index variable
    636636    int count = 0;              // # of points in this mean?
     
    710710 
    711711 *****************************************************************************/
    712 void p_psVectorSampleStdev(const psVector * restrict myVector,
    713                            const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
     712void p_psVectorSampleStdev(const psVector* restrict myVector,
     713                           const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    714714{
    715715    int i = 0;                  // Loop index variable
     
    795795    NULL
    796796 *****************************************************************************/
    797 void p_psVectorClippedStats(const psVector * restrict myVector,
    798                             const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
     797void p_psVectorClippedStats(const psVector* restrict myVector,
     798                            const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    799799{
    800800    int i = 0;                  // Loop index variable
     
    804804    float oldStanMean = 0.0;    // Temporary variable
    805805    float oldStanStdev = 0.0;   // Temporary variable
    806     psVector *tmpMask = NULL;   // Temporary vector
     806    psVector* tmpMask = NULL;   // Temporary vector
    807807
    808808    // Endure that stats->clipIter is within the proper range.
     
    884884elements of a vector to a range between 0.0 and 1.0.
    885885 *****************************************************************************/
    886 void p_psNormalizeVector(psVector * myData)
     886void p_psNormalizeVector(psVector* myData)
    887887{
    888888    float min = (float)HUGE;
     
    911911specified data point.
    912912 *****************************************************************************/
    913 float p_psGaussian(const psVector * restrict myData, const psVector * restrict myParams)
     913float p_psGaussian(const psVector* restrict myData, const psVector* restrict myParams)
    914914{
    915915    float x = myData->data.F32[0];
     
    928928calculates the specified partial derivative of the above Gaussian function.
    929929 *****************************************************************************/
    930 float p_psGaussianDeriv(const psVector * restrict myData, const psVector * restrict myParams, int whichParam)
     930float p_psGaussianDeriv(const psVector* restrict myData, const psVector* restrict myParams, int whichParam)
    931931{
    932932    float x = myData->data.F32[0];
     
    954954specified data point.
    955955 *****************************************************************************/
    956 float p_psQuadratic(const psVector * restrict myParams, const psVector * restrict myCoords)
     956float p_psQuadratic(const psVector* restrict myParams, const psVector* restrict myCoords)
    957957{
    958958    float x = myCoords->data.F32[0];
     
    970970calculates the specified partial derivative of the above quadratic function.
    971971 *****************************************************************************/
    972 float p_psQuadraticDeriv(const psVector * restrict myParams,
    973                          const psVector * restrict myCoords, int whichParamDeriv)
     972float p_psQuadraticDeriv(const psVector* restrict myParams,
     973                         const psVector* restrict myCoords, int whichParamDeriv)
    974974{
    975975    float x = myCoords->data.F32[0];
     
    996996decreasing within that range.
    997997 *****************************************************************************/
    998 float p_ps1DPolyMedian(psPolynomial1D * myPoly, float rangeLow, float rangeHigh, float getThisValue)
     998float p_ps1DPolyMedian(psPolynomial1D* myPoly, float rangeLow, float rangeHigh, float getThisValue)
    999999{
    10001000    int numIterations = 0;
     
    10361036XXX: This function is currently not being used.
    10371037 *****************************************************************************/
    1038 float p_psFitQuadratic(psHistogram * histogram, psVector * cumulativeSums, int binNum, float fitFloat)
    1039 {
    1040     psVector *x = psVectorAlloc(3, PS_TYPE_F64);
    1041     psVector *y = psVectorAlloc(3, PS_TYPE_F64);
    1042     psVector *yErr = psVectorAlloc(3, PS_TYPE_F64);
    1043     psPolynomial1D *myPoly = psPolynomial1DAlloc(2);
     1038float p_psFitQuadratic(psHistogram* histogram, psVector* cumulativeSums, int binNum, float fitFloat)
     1039{
     1040    psVector* x = psVectorAlloc(3, PS_TYPE_F64);
     1041    psVector* y = psVectorAlloc(3, PS_TYPE_F64);
     1042    psVector* yErr = psVectorAlloc(3, PS_TYPE_F64);
     1043    psPolynomial1D* myPoly = psPolynomial1DAlloc(2);
    10441044
    10451045    if ((binNum > 0) && (binNum < (histogram->nums->n + 1))) {
     
    11001100    NULL
    11011101*****************************************************************************/
    1102 void p_psVectorRobustStats(const psVector * restrict myVector,
    1103                            const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
    1104 {
    1105     psHistogram *robustHistogram = NULL;
    1106     psVector *robustHistogramVector = NULL;
     1102void p_psVectorRobustStats(const psVector* restrict myVector,
     1103                           const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
     1104{
     1105    psHistogram* robustHistogram = NULL;
     1106    psVector* robustHistogramVector = NULL;
    11071107    float binSize = 0.0;        // Size of the histogram bins
    11081108    int LQBinNum = -1;          // Bin num for lower quartile
     
    11131113    float dL = 0.0;
    11141114    int numBins = 0;
    1115     psStats *tmpStats = psStatsAlloc(PS_STAT_CLIPPED_STDEV | PS_STAT_CLIPPED_MEAN);
    1116 
    1117     // psImage *domain;
    1118     // psVector *errors;
    1119     // psVector *data;
    1120     // psVector *initialGuess;
    1121     // psVector *theParams;
     1115    psStats* tmpStats = psStatsAlloc(PS_STAT_CLIPPED_STDEV | PS_STAT_CLIPPED_MEAN);
     1116
     1117    // psImage* domain;
     1118    // psVector* errors;
     1119    // psVector* data;
     1120    // psVector* initialGuess;
     1121    // psVector* theParams;
    11221122    // float chiSq=0.0;
    11231123    // float max = -HUGE;
     
    11291129    float sumSquares = 0.0;
    11301130    float sumDiffs = 0.0;
    1131     psVector *x = psVectorAlloc(3, PS_TYPE_F64);
    1132     psVector *y = psVectorAlloc(3, PS_TYPE_F64);
    1133     psVector *yErr = psVectorAlloc(3, PS_TYPE_F64);
    1134     psPolynomial1D *myPoly = psPolynomial1DAlloc(2);
    1135     psVector *cumulativeRobustSumsFullRange = NULL;
    1136     psVector *cumulativeRobustSumsDlRange = NULL;
     1131    psVector* x = psVectorAlloc(3, PS_TYPE_F64);
     1132    psVector* y = psVectorAlloc(3, PS_TYPE_F64);
     1133    psVector* yErr = psVectorAlloc(3, PS_TYPE_F64);
     1134    psPolynomial1D* myPoly = psPolynomial1DAlloc(2);
     1135    psVector* cumulativeRobustSumsFullRange = NULL;
     1136    psVector* cumulativeRobustSumsDlRange = NULL;
    11371137    float sumRobust = 0.0;
    11381138    float sumN50 = 0.0;
     
    15001500/*****************************************************************************/
    15011501
    1502 static void histogramFree(psHistogram * myHist);
     1502static void histogramFree(psHistogram* myHist);
    15031503
    15041504/******************************************************************************
    15051505    psStatsAlloc(): This routine must create a new psStats data structure.
    15061506 *****************************************************************************/
    1507 psStats *psStatsAlloc(psStatsOptions options)
    1508 {
    1509     psStats *newStruct = NULL;
    1510 
    1511     newStruct = (psStats *) psAlloc(sizeof(psStats));
     1507psStats* psStatsAlloc(psStatsOptions options)
     1508{
     1509    psStats* newStruct = NULL;
     1510
     1511    newStruct = (psStats* ) psAlloc(sizeof(psStats));
    15121512    newStruct->sampleMean = NAN;
    15131513    newStruct->sampleMedian = NAN;
     
    15481548    The histogram structure
    15491549 *****************************************************************************/
    1550 psHistogram *psHistogramAlloc(float lower, float upper, int n)
     1550psHistogram* psHistogramAlloc(float lower, float upper, int n)
    15511551{
    15521552    int i = 0;                  // Loop index variable
    1553     psHistogram *newHist = NULL;        // The new histogram structure
     1553    psHistogram* newHist = NULL;        // The new histogram structure
    15541554    float binSize = 0.0;        // The histogram bin size
    15551555
     
    15671567    // Allocate memory for the new histogram structure.  If there are N
    15681568    // bins, then there are N+1 bounds to those bins.
    1569     newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
     1569    newHist = (psHistogram* ) psAlloc(sizeof(psHistogram));
    15701570    p_psMemSetDeallocator(newHist, (psFreeFcn) histogramFree);
    15711571    newHist->bounds = psVectorAlloc(n + 1, PS_TYPE_F32);
     
    16051605    The histogram structure
    16061606 *****************************************************************************/
    1607 psHistogram *psHistogramAllocGeneric(const psVector * restrict bounds)
    1608 {
    1609     psHistogram *newHist = NULL;        // The new histogram structure
     1607psHistogram* psHistogramAllocGeneric(const psVector* restrict bounds)
     1608{
     1609    psHistogram* newHist = NULL;        // The new histogram structure
    16101610    int i;                      // Loop index variable
    16111611
     
    16261626    }
    16271627    // Allocate memory for the new histogram structure.
    1628     newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
     1628    newHist = (psHistogram* ) psAlloc(sizeof(psHistogram));
    16291629    p_psMemSetDeallocator(newHist, (psFreeFcn) histogramFree);
    16301630    newHist->bounds = psVectorAlloc(bounds->n, PS_TYPE_F32);
     
    16501650}
    16511651
    1652 static void histogramFree(psHistogram * myHist)
     1652static void histogramFree(psHistogram* myHist)
    16531653{
    16541654    psFree(myHist->bounds);
     
    16701670    The histogram structure "out".
    16711671 *****************************************************************************/
    1672 psHistogram *psVectorHistogram(psHistogram * out,
    1673                                const psVector * restrict in,
    1674                                const psVector * restrict mask, unsigned int maskVal)
     1672psHistogram* psVectorHistogram(psHistogram* out,
     1673                               const psVector* restrict in,
     1674                               const psVector* restrict mask, unsigned int maskVal)
    16751675{
    16761676    int i = 0;                  // Loop index variable
     
    17671767the various stat functions.
    17681768 *****************************************************************************/
    1769 psVector *p_psConvertToF32(psStats * stats, psVector * in, psVector * mask, unsigned int maskVal)
     1769psVector* p_psConvertToF32(psStats* stats, psVector* in, psVector* mask, unsigned int maskVal)
    17701770{
    17711771    int i = 0;
    1772     psVector *tmp = NULL;
     1772    psVector* tmp = NULL;
    17731773
    17741774    if (in->type.type == PS_TYPE_S32) {
     
    18121812macro-ize everything and add PS_TYPE_U16 and PS_TYPE_F64.
    18131813 *****************************************************************************/
    1814 psStats *psVectorStats(psStats * stats, psVector * in, psVector * mask, unsigned int maskVal)
    1815 {
    1816     psVector *inF32;
     1814psStats* psVectorStats(psStats* stats, psVector* in, psVector* mask, unsigned int maskVal)
     1815{
     1816    psVector* inF32;
    18171817    int mustFreeTmp = 1;
    18181818
  • trunk/psLib/src/math/psStats.h

    r1426 r1440  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-09 22:44:25 $
     12 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-08-09 23:34:57 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7777
    7878/** Do Statistics on an array.  Returns a status value. \ingroup MathGroup */
    79 psStats *psVectorStats(psStats * stats, ///< stats structure defines stats to be calculated and how
    80                        psVector * in,   ///< Vector to be analysed: must be F32
    81                        psVector * mask, ///< Ignore elements where (maskVector & maskVal) != 0: must be INT
     79psStats* psVectorStats(psStats* stats, ///< stats structure defines stats to be calculated and how
     80                       psVector* in,   ///< Vector to be analysed: must be F32
     81                       psVector* mask, ///< Ignore elements where (maskVector & maskVal) != 0: must be INT
    8282                       // or NULL
    8383                       unsigned int maskVal     ///< Only mask elements with one of these bits set in
     
    8686
    8787/** A constructor for the stats structure.*/
    88 psStats *psStatsAlloc(psStatsOptions options);  ///< Statistics to measure
     88psStats* psStatsAlloc(psStatsOptions options);  ///< Statistics to measure
    8989
    9090/******************************************************************************
     
    9595typedef struct
    9696{
    97     psVector *bounds;           ///< Bounds for the bins (type F32)
    98     psVector *nums;             ///< Number in each of the bins (INT)
     97    psVector* bounds;           ///< Bounds for the bins (type F32)
     98    psVector* nums;             ///< Number in each of the bins (INT)
    9999    int minNum;                 ///< Number below the minimum
    100100    int maxNum;                 ///< Number above the maximum
     
    104104
    105105/** Constructor \ingroup MathGroup */
    106 psHistogram *psHistogramAlloc(float lower,      ///< Lower limit for the bins
     106psHistogram* psHistogramAlloc(float lower,      ///< Lower limit for the bins
    107107                              float upper,      ///< Upper limit for the bins
    108108                              int n);   ///< Number of bins
    109109
    110110/** Generic constructor \ingroup MathGroup */
    111 psHistogram *psHistogramAllocGeneric(const psVector * restrict bounds); ///< Bounds for the bins
     111psHistogram* psHistogramAllocGeneric(const psVector* restrict bounds); ///< Bounds for the bins
    112112
    113113/** Calculate a histogram \ingroup MathGroup **/
    114 psHistogram *psVectorHistogram(psHistogram * out,       ///< Histogram data
    115                                const psVector * restrict in,    ///< Vector to analyse
    116                                const psVector * restrict mask,  ///< Mask dat for input vector
     114psHistogram* psVectorHistogram(psHistogram* out,       ///< Histogram data
     115                               const psVector* restrict in,    ///< Vector to analyse
     116                               const psVector* restrict mask,  ///< Mask dat for input vector
    117117                               unsigned int maskVal);   ///< Mask value
    118118
    119 bool p_psGetStatValue(const psStats * stats, double *value);
     119bool p_psGetStatValue(const psStats* stats, double *value);
    120120
    121121/// @}
  • trunk/psLib/src/mathtypes/psImage.c

    r1407 r1440  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-07 00:06:06 $
     12 *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-08-09 23:34:58 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3232#include "psImage.h"
    3333
    34 static void imageFree(psImage * image);
     34static void imageFree(psImage* image);
    3535
    3636/*****************************************************************************/
     
    4040/*****************************************************************************/
    4141
    42 psImage *psImageAlloc(unsigned int numCols, unsigned int numRows, const psElemType type)
     42psImage* psImageAlloc(unsigned int numCols, unsigned int numRows, const psElemType type)
    4343{
    4444    int area = 0;
     
    6161    }
    6262
    63     psImage *image = (psImage *) psAlloc(sizeof(psImage));
     63    psImage* image = (psImage* ) psAlloc(sizeof(psImage));
    6464
    6565    if (image == NULL) {
     
    8787    *(unsigned int *)&image->numCols = numCols;
    8888    *(unsigned int *)&image->numRows = numRows;
    89     *(psDimen *) & image->type.dimen = PS_DIMEN_IMAGE;
    90     *(psElemType *) & image->type.type = type;
     89    *(psDimen* ) & image->type.dimen = PS_DIMEN_IMAGE;
     90    *(psElemType* ) & image->type.type = type;
    9191    image->parent = NULL;
    9292    image->nChildren = 0;
     
    9696}
    9797
    98 static void imageFree(psImage * image)
     98static void imageFree(psImage* image)
    9999{
    100100    if (image == NULL) {
     
    107107        unsigned int oldNumRows = image->numRows;
    108108        unsigned int oldNumCols = image->numCols;
    109         psPTR *rowPtr;
     109        psPTR* rowPtr;
    110110
    111111        for (unsigned int row = 0; row < oldNumRows; row++) {
     
    124124}
    125125
    126 psImage *psImageRecycle(psImage * old, unsigned int numCols, unsigned int numRows, const psElemType type)
     126psImage* psImageRecycle(psImage* old, unsigned int numCols, unsigned int numRows, const psElemType type)
    127127{
    128128    int elementSize = PSELEMTYPE_SIZEOF(type);  // element
     
    151151        unsigned int oldNumRows = old->numRows;
    152152        unsigned int oldNumCols = old->numCols;
    153         psPTR *rowPtr;
     153        psPTR* rowPtr;
    154154
    155155        for (unsigned int row = 0; row < oldNumRows; row++) {
     
    177177    *(unsigned int *)&old->numCols = numCols;
    178178    *(unsigned int *)&old->numRows = numRows;
    179     *(psElemType *) & old->type.type = type;
     179    *(psElemType* ) & old->type.type = type;
    180180
    181181    return old;
    182182}
    183183
    184 int psImageFreeChildren(psImage * image)
     184int psImageFreeChildren(psImage* image)
    185185{
    186186    int i = 0;
    187187    int nChildren = 0;
    188     psImage **children = NULL;
     188    psImage* *children = NULL;
    189189    int numFreed = 0;
    190190
     
    216216linear interpolation is performed on the image.
    217217 *****************************************************************************/
    218 psF32 psImagePixelInterpolate(const psImage * input,
     218psF32 psImagePixelInterpolate(const psImage* input,
    219219                              float x, float y, psF32 unexposedValue, psImageInterpolateMode mode)
    220220{
     
    259259
    260260#define PSIMAGE_PIXEL_INTERPOLATE_FLAT(TYPE) \
    261 inline psF64 p_psImagePixelInterpolateFLAT_##TYPE(const psImage *input, \
     261inline psF64 p_psImagePixelInterpolateFLAT_##TYPE(const psImage* input, \
    262262        float x, \
    263263        float y, \
     
    280280
    281281#define PSIMAGE_PIXEL_INTERPOLATE_FLAT_COMPLEX(TYPE) \
    282 inline psC64 p_psImagePixelInterpolateFLAT_##TYPE(const psImage *input, \
     282inline psC64 p_psImagePixelInterpolateFLAT_##TYPE(const psImage* input, \
    283283        float x, \
    284284        float y, \
     
    313313PSIMAGE_PIXEL_INTERPOLATE_FLAT_COMPLEX(C64)
    314314#define PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(TYPE) \
    315 inline psF64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage *input, \
     315inline psF64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage* input, \
    316316        float x, \
    317317        float y, \
     
    368368}
    369369#define PSIMAGE_PIXEL_INTERPOLATE_BILINEAR_COMPLEX(TYPE) \
    370 inline psC64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage *input, \
     370inline psC64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage* input, \
    371371        float x, \
    372372        float y, \
  • trunk/psLib/src/mathtypes/psImage.h

    r1426 r1440  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-08-09 22:44:25 $
     14 *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-08-09 23:34:58 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050
    5151    union {
    52         psU8 **U8;              ///< Unsigned 8-bit integer data.
    53         psU16 **U16;            ///< Unsigned 16-bit integer data.
    54         psU32 **U32;            ///< Unsigned 32-bit integer data.
    55         psU64 **U64;            ///< Unsigned 64-bit integer data.
    56         psS8 **S8;              ///< Signed 8-bit integer data.
    57         psS16 **S16;            ///< Signed 16-bit integer data.
    58         psS32 **S32;            ///< Signed 32-bit integer data.
    59         psS64 **S64;            ///< Signed 64-bit integer data.
    60         psF32 **F32;            ///< Single-precision float data.
    61         psF64 **F64;            ///< Double-precision float data.
    62         psC32 **C32;            ///< Single-precision complex data.
    63         psC64 **C64;            ///< Double-precision complex data.
    64         psPTR **PTR;            ///< Void pointers.
    65         psPTR *V;               ///< Pointer to data.
     52        psU8* *U8;              ///< Unsigned 8-bit integer data.
     53        psU16* *U16;            ///< Unsigned 16-bit integer data.
     54        psU32* *U32;            ///< Unsigned 32-bit integer data.
     55        psU64* *U64;            ///< Unsigned 64-bit integer data.
     56        psS8* *S8;              ///< Signed 8-bit integer data.
     57        psS16* *S16;            ///< Signed 16-bit integer data.
     58        psS32* *S32;            ///< Signed 32-bit integer data.
     59        psS64* *S64;            ///< Signed 64-bit integer data.
     60        psF32* *F32;            ///< Single-precision float data.
     61        psF64* *F64;            ///< Double-precision float data.
     62        psC32* *C32;            ///< Single-precision complex data.
     63        psC64* *C64;            ///< Double-precision complex data.
     64        psPTR* *PTR;            ///< Void pointers.
     65        psPTR* V;               ///< Pointer to data.
    6666    } data;                     ///< Union for data types.
    67     const struct psImage *parent;       ///< Parent, if a subimage.
     67    const struct psImage* parent;       ///< Parent, if a subimage.
    6868    int nChildren;              ///< Number of subimages.
    69     struct psImage **children;  ///< Children of this region.
     69    struct psImage* *children;  ///< Children of this region.
    7070}
    7171psImage;
     
    8282 * specified size and type.
    8383 *
    84  * @return psImage*: Pointer to psImage.
     84 * @return psImage* : Pointer to psImage.
    8585 *
    8686 */
    87 psImage *psImageAlloc(unsigned int numCols,     ///< Number of rows in image.
     87psImage* psImageAlloc(unsigned int numCols,     ///< Number of rows in image.
    8888                      unsigned int numRows,     ///< Number of columns in image.
    8989                      const psElemType type     ///< Type of data for image.
     
    9595 *
    9696 */
    97 psImage *psImageRecycle(psImage * old,  ///< the psImage to recycle by resizing image buffer
     97psImage* psImageRecycle(psImage* old,  ///< the psImage to recycle by resizing image buffer
    9898                        unsigned int numCols,   ///< the desired number of columns in image
    9999                        unsigned int numRows,   ///< the desired number of rows in image
     
    106106 *
    107107 */
    108 int psImageFreeChildren(psImage * image
     108int psImageFreeChildren(psImage* image
    109109
    110110                        /**< psImage in which all children shall be deallocated */
    111111                       );
    112112
    113 psF32 psImagePixelInterpolate(const psImage * input,
     113psF32 psImagePixelInterpolate(const psImage* input,
    114114                              float x, float y, psF32 unexposedValue, psImageInterpolateMode mode);
    115115
    116116#    define p_psImagePixelInterpolateFcns(TYPE) \
    117117inline psF64 p_psImagePixelInterpolateFLAT_##TYPE( \
    118         const psImage *input, \
     118        const psImage* input, \
    119119        float x, \
    120120        float y, \
     
    122122                                                 ); \
    123123inline psF64 p_psImagePixelInterpolateBILINEAR_##TYPE( \
    124         const psImage *input, \
     124        const psImage* input, \
    125125        float x, \
    126126        float y, \
     
    130130#    define p_psImagePixelInterpolateComplexFcns(TYPE) \
    131131inline psC64 p_psImagePixelInterpolateFLAT_##TYPE( \
    132         const psImage *input, \
     132        const psImage* input, \
    133133        float x, \
    134134        float y, \
     
    136136                                                 ); \
    137137inline psC64 p_psImagePixelInterpolateBILINEAR_##TYPE( \
    138         const psImage *input, \
     138        const psImage* input, \
    139139        float x, \
    140140        float y, \
  • trunk/psLib/src/mathtypes/psScalar.c

    r1407 r1440  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-08-07 00:06:06 $
     11 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-08-09 23:34:57 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7171
    7272/*****************************************************************************/
    73 psScalar *psScalarAlloc(psC64 value, psElemType dataType)
     73psScalar* psScalarAlloc(psC64 value, psElemType dataType)
    7474{
    75     psScalar *scalar = NULL;
     75    psScalar* scalar = NULL;
    7676
    7777    // Create scalar
    78     scalar = (psScalar *) psAlloc(sizeof(psScalar));
     78    scalar = (psScalar* ) psAlloc(sizeof(psScalar));
    7979    if (scalar == NULL) {
    8080        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
     
    128128}
    129129
    130 void psScalarFree(psScalar * restrict scalar)
     130void psScalarFree(psScalar* restrict scalar)
    131131{
    132132    if (scalar == NULL) {
  • trunk/psLib/src/mathtypes/psScalar.h

    r1426 r1440  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-08-09 22:44:25 $
     13 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-08-09 23:34:57 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6262 * Accepts a complex 64 bit float for input value, as max size, but resizes according to
    6363 * correct type.
    64  * @return psScalar*: Pointer to psScalar.
     64 * @return psScalar* : Pointer to psScalar.
    6565 *
    6666 */
    67 psScalar *psScalarAlloc(psC64 value,    ///< Data to be put into psScalar.
     67psScalar* psScalarAlloc(psC64 value,    ///< Data to be put into psScalar.
    6868                        psElemType dataType     ///< Type of data to be held by psScalar.
    6969                       );
     
    7676 *
    7777 */
    78 void psScalarFree(psScalar * restrict scalar    ///< Scalar to free.
     78void psScalarFree(psScalar* restrict scalar    ///< Scalar to free.
    7979                 );
    8080
  • trunk/psLib/src/mathtypes/psVector.c

    r1407 r1440  
    99*  @author Ross Harman, MHPCC
    1010*
    11 *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-08-07 00:06:06 $
     11*  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-08-09 23:34:57 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6767
    6868/*****************************************************************************/
    69 static void vectorFree(psVector * restrict psVec);
     69static void vectorFree(psVector* restrict psVec);
    7070
    7171/*****************************************************************************/
     
    7474
    7575/*****************************************************************************/
    76 psVector *psVectorAlloc(unsigned int nalloc, psElemType elemType)
    77 {
    78     psVector *psVec = NULL;
     76psVector* psVectorAlloc(unsigned int nalloc, psElemType elemType)
     77{
     78    psVector* psVec = NULL;
    7979    int elementSize = 0;
    8080
     
    8888
    8989    // Create vector struct
    90     psVec = (psVector *) psAlloc(sizeof(psVector));
     90    psVec = (psVector* ) psAlloc(sizeof(psVector));
    9191    p_psMemSetDeallocator(psVec, (psFreeFcn) vectorFree);
    9292
     
    102102}
    103103
    104 psVector *psVectorRealloc(unsigned int nalloc, psVector * restrict in)
     104psVector* psVectorRealloc(unsigned int nalloc, psVector* restrict in)
    105105{
    106106    int elementSize = 0;
     
    130130}
    131131
    132 psVector *psVectorRecycle(psVector * restrict in, unsigned int nalloc, psElemType type)
     132psVector* psVectorRecycle(psVector* restrict in, unsigned int nalloc, psElemType type)
    133133{
    134134    psElemType elemType;
     
    160160}
    161161
    162 psVector *psVectorSort(psVector * restrict outVector, const psVector * restrict inVector)
     162psVector* psVectorSort(psVector* restrict outVector, const psVector* restrict inVector)
    163163{
    164164    int inN = 0;
     
    261261}
    262262
    263 psVector *psVectorSortIndex(psVector * restrict outVector, const psVector * restrict inVector)
     263psVector* psVectorSortIndex(psVector* restrict outVector, const psVector* restrict inVector)
    264264{
    265265    int inN = 0;
     
    270270    int *outVec = NULL;
    271271    double diff = 0.0f;
    272     psVector *tmpVector = NULL;
     272    psVector* tmpVector = NULL;
    273273    psElemType inType = 0;
    274274
     
    348348}
    349349
    350 static void vectorFree(psVector * restrict psVec)
     350static void vectorFree(psVector* restrict psVec)
    351351{
    352352    if (psVec == NULL) {
  • trunk/psLib/src/mathtypes/psVector.h

    r1426 r1440  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-08-09 22:44:25 $
     14 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-08-09 23:34:57 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3838
    3939    union {
    40         psU8 *U8;               ///< Unsigned 8-bit integer data.
    41         psU16 *U16;             ///< Unsigned 16-bit integer data.
    42         psU32 *U32;             ///< Unsigned 32-bit integer data.
    43         psU64 *U64;             ///< Unsigned 64-bit integer data.
    44         psS8 *S8;               ///< Signed 8-bit integer data.
    45         psS16 *S16;             ///< Signed 16-bit integer data.
    46         psS32 *S32;             ///< Signed 32-bit integer data.
    47         psS64 *S64;             ///< Signed 64-bit integer data.
    48         psF32 *F32;             ///< Single-precision float data.
    49         psF64 *F64;             ///< Double-precision float data.
    50         psC32 *C32;             ///< Single-precision complex data.
    51         psC64 *C64;             ///< Double-precision complex data.
     40        psU8* U8;               ///< Unsigned 8-bit integer data.
     41        psU16* U16;             ///< Unsigned 16-bit integer data.
     42        psU32* U32;             ///< Unsigned 32-bit integer data.
     43        psU64* U64;             ///< Unsigned 64-bit integer data.
     44        psS8* S8;               ///< Signed 8-bit integer data.
     45        psS16* S16;             ///< Signed 16-bit integer data.
     46        psS32* S32;             ///< Signed 32-bit integer data.
     47        psS64* S64;             ///< Signed 64-bit integer data.
     48        psF32* F32;             ///< Single-precision float data.
     49        psF64* F64;             ///< Double-precision float data.
     50        psC32* C32;             ///< Single-precision complex data.
     51        psC64* C64;             ///< Double-precision complex data.
    5252        psPTR V;                ///< Pointer to data.
    5353    } data;                     ///< Union for data types.
     
    6565 * Uses psLib memory allocation functions to create a vector collection of data as defined by the psType type.
    6666 *
    67  * @return psVector*: Pointer to psVector.
     67 * @return psVector* : Pointer to psVector.
    6868 *
    6969 */
    70 psVector *psVectorAlloc(unsigned int nalloc,    ///< Total number of elements to make available.
     70psVector* psVectorAlloc(unsigned int nalloc,    ///< Total number of elements to make available.
    7171                        psElemType dataType     ///< Type of data to be held by vector.
    7272                       );
     
    7777 * according to the psType type member contained within the vector.
    7878 *
    79  * @return psVector*: Pointer to psVector.
     79 * @return psVector* : Pointer to psVector.
    8080 *
    8181 */
    82 psVector *psVectorRealloc(unsigned int nalloc,  ///< Total number of elements to make available.
    83                           psVector * restrict psVec     ///< Vector to reallocate.
     82psVector* psVectorRealloc(unsigned int nalloc,  ///< Total number of elements to make available.
     83                          psVector* restrict psVec     ///< Vector to reallocate.
    8484                         );
    8585
     
    8989 * according to the psElemType type parameter.
    9090 *
    91  * @return psVector*: Pointer to psVector.
     91 * @return psVector* : Pointer to psVector.
    9292 *
    9393 */
    94 psVector *psVectorRecycle(psVector * restrict psVec,
     94psVector* psVectorRecycle(psVector* restrict psVec,
    9595                          ///< Vector to recycle.  If NULL, a new vector is created.  No effort taken to
    9696                          // preserve the values.
     
    104104 *  all non-complex data types.
    105105 *
    106  *  @return  psFloatArray*: Pointer to sorted psFloatArray.
     106 *  @return  psFloatArray* : Pointer to sorted psFloatArray.
    107107 */
    108108
    109 psVector *psVectorSort(psVector * restrict outVector,   ///< the output vector to recycle, or NULL if new
     109psVector* psVectorSort(psVector* restrict outVector,   ///< the output vector to recycle, or NULL if new
    110110                       // vector desired.
    111                        const psVector * restrict inVector       ///< the vector to sort.
     111                       const psVector* restrict inVector       ///< the vector to sort.
    112112                      );
    113113
     
    117117 *  sorted float values based on pre-sort index positions. 
    118118 *
    119  *  @return  psIntArray*: Pointer to psIntArray of sorted indices.
     119 *  @return  psIntArray* : Pointer to psIntArray of sorted indices.
    120120 */
    121121
    122 psVector *psVectorSortIndex(psVector * restrict outVector, const psVector * restrict inVector);
     122psVector* psVectorSortIndex(psVector* restrict outVector, const psVector* restrict inVector);
    123123
    124124/// @}
  • trunk/psLib/src/sys/psMemory.c

    r1407 r1440  
    99*  @author Robert Lupton, Princeton University
    1010*
    11 *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-08-07 00:06:06 $
     11*  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-08-09 23:34:58 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3131#define P_PS_LARGE_BLOCK_SIZE 65536        // size where under, we try to recycle
    3232
    33 static int checkMemBlock(const psMemBlock * m, const char *funcName);
    34 static psMemBlock *lastMemBlockAllocated = NULL;
     33static int checkMemBlock(const psMemBlock* m, const char *funcName);
     34static psMemBlock* lastMemBlockAllocated = NULL;
    3535static pthread_mutex_t memBlockListMutex = PTHREAD_MUTEX_INITIALIZER;
    3636static pthread_mutex_t memIdMutex = PTHREAD_MUTEX_INITIALIZER;
     
    4444
    4545// N.B. recycleBinSize should be terminated by P_PS_LARGE_BLOCK_SIZE (simplifies search loops)
    46 static psMemBlock *recycleMemBlockList[13] = {
     46static psMemBlock* recycleMemBlockList[13] = {
    4747            NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
    4848        };
    4949
    5050#ifdef PS_MEM_DEBUG
    51 static psMemBlock *deadBlockList;       // a place to put dead memBlocks in debug mode.
     51static psMemBlock* deadBlockList;       // a place to put dead memBlocks in debug mode.
    5252#endif
    5353
     
    6969    while (level >= 0 && ptr == NULL) {
    7070        while (recycleMemBlockList[level] != NULL && ptr == NULL) {
    71             psMemBlock *old = recycleMemBlockList[level];
     71            psMemBlock* old = recycleMemBlockList[level];
    7272
    7373            recycleMemBlockList[level] = recycleMemBlockList[level]->nextBlock;
     
    9797}
    9898
    99 static void memProblemCallbackDefault(const psMemBlock * ptr, const char *file, int lineno)
     99static void memProblemCallbackDefault(const psMemBlock* ptr, const char *file, int lineno)
    100100{
    101101    if (ptr->refCounter < 1) {
     
    156156 * isn't resignalled)
    157157 */
    158 static psMemoryId memAllocateCallbackDefault(const psMemBlock * ptr)
     158static psMemoryId memAllocateCallbackDefault(const psMemBlock* ptr)
    159159{
    160160    static psMemoryId incr = 0; // "p_psMemAllocateID += incr"
     
    163163}
    164164
    165 static psMemoryId memFreeCallbackDefault(const psMemBlock * ptr)
     165static psMemoryId memFreeCallbackDefault(const psMemBlock* ptr)
    166166{
    167167    static psMemoryId incr = 0; // "p_psMemFreeID += incr"
     
    222222 */
    223223
    224 static int checkMemBlock(const psMemBlock * m, const char *funcName)
     224static int checkMemBlock(const psMemBlock* m, const char *funcName)
    225225{
    226226    // n.b. since this is called by psMemCheckCorruption while the memblock list is mutex locked,
     
    257257    pthread_mutex_lock(&memBlockListMutex);
    258258
    259     for (psMemBlock * iter = lastMemBlockAllocated; iter != NULL; iter = iter->nextBlock) {
     259    for (psMemBlock* iter = lastMemBlockAllocated; iter != NULL; iter = iter->nextBlock) {
    260260        if (checkMemBlock(iter, __func__)) {
    261261            nbad++;
     
    280280{
    281281
    282     psMemBlock *ptr = NULL;
     282    psMemBlock* ptr = NULL;
    283283
    284284    // memory is of the size I want to bother recycling?
     
    327327    // increment the memory id safely.
    328328    pthread_mutex_lock(&memBlockListMutex);
    329     *(psMemoryId *) & ptr->id = ++memid;
     329    *(psMemoryId* ) & ptr->id = ++memid;
    330330    pthread_mutex_unlock(&memBlockListMutex);
    331331
     
    363363        return p_psAlloc(size, file, lineno);
    364364    } else {
    365         psMemBlock *ptr = ((psMemBlock *) vptr) - 1;
     365        psMemBlock* ptr = ((psMemBlock* ) vptr) - 1;
    366366        bool isBlockLast = false;
    367367
     
    376376        isBlockLast = (ptr == lastMemBlockAllocated);
    377377
    378         ptr = (psMemBlock *) realloc(ptr, sizeof(psMemBlock) + size + sizeof(void *));
     378        ptr = (psMemBlock* ) realloc(ptr, sizeof(psMemBlock) + size + sizeof(void *));
    379379
    380380        if (ptr == NULL) {
     
    415415 * Check for memory leaks.
    416416 */
    417 int psMemCheckLeaks(psMemoryId id0, psMemBlock *** arr, FILE * fd)
     417int psMemCheckLeaks(psMemoryId id0, psMemBlock* ** arr, FILE * fd)
    418418{
    419419    int nleak = 0;
    420420    int j = 0;
    421     psMemBlock *topBlock = lastMemBlockAllocated;
     421    psMemBlock* topBlock = lastMemBlockAllocated;
    422422
    423423    pthread_mutex_lock(&memBlockListMutex);
    424424
    425     for (psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock) {
     425    for (psMemBlock* iter = topBlock; iter != NULL; iter = iter->nextBlock) {
    426426        if ((psMemGetRefCounter(iter + 1) > 0) && (iter->id >= id0)) {
    427427            nleak++;
     
    446446    pthread_mutex_lock(&memBlockListMutex);
    447447
    448     for (psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock) {
     448    for (psMemBlock* iter = topBlock; iter != NULL; iter = iter->nextBlock) {
    449449        if ((psMemGetRefCounter(iter + 1) > 0) && (iter->id >= id0)) {
    450450            (*arr)[j++] = iter;
     
    466466psReferenceCount psMemGetRefCounter(void *vptr)
    467467{
    468     psMemBlock *ptr;
     468    psMemBlock* ptr;
    469469    unsigned int refCount;
    470470
     
    473473    }
    474474
    475     ptr = ((psMemBlock *) vptr) - 1;
     475    ptr = ((psMemBlock* ) vptr) - 1;
    476476
    477477    if (checkMemBlock(ptr, __func__) != 0) {
     
    489489void *p_psMemIncrRefCounter(void *vptr, const char *file, int lineno)
    490490{
    491     psMemBlock *ptr;
     491    psMemBlock* ptr;
    492492
    493493    if (vptr == NULL) {
     
    495495    }
    496496
    497     ptr = ((psMemBlock *) vptr) - 1;
     497    ptr = ((psMemBlock* ) vptr) - 1;
    498498
    499499    if (checkMemBlock(ptr, __func__)) {
     
    515515    }
    516516
    517     psMemBlock *ptr = ((psMemBlock *) vptr) - 1;
     517    psMemBlock* ptr = ((psMemBlock* ) vptr) - 1;
    518518
    519519    if (checkMemBlock(ptr, __func__) != 0) {
     
    607607    }
    608608
    609     psMemBlock *ptr = ((psMemBlock *) vptr) - 1;
     609    psMemBlock* ptr = ((psMemBlock* ) vptr) - 1;
    610610
    611611    if (checkMemBlock(ptr, __func__) != 0) {
     
    622622    }
    623623
    624     psMemBlock *ptr = ((psMemBlock *) vptr) - 1;
     624    psMemBlock* ptr = ((psMemBlock* ) vptr) - 1;
    625625
    626626    if (checkMemBlock(ptr, __func__) != 0) {
  • trunk/psLib/src/sys/psMemory.h

    r1426 r1440  
    1515 *  @ingroup MemoryManagement
    1616 *
    17  *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
    18  *  @date $Date: 2004-08-09 22:44:25 $
     17 *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
     18 *  @date $Date: 2004-08-09 23:34:58 $
    1919 *
    2020 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6464{
    6565    const void *startblock;     ///< initialised to p_psMEMMAGIC
    66     struct psMemBlock *previousBlock;   ///< previous block in allocation list
    67     struct psMemBlock *nextBlock;       ///< next block allocation list
     66    struct psMemBlock* previousBlock;   ///< previous block in allocation list
     67    struct psMemBlock* nextBlock;       ///< next block allocation list
    6868    psFreeFcn freeFcn;          ///< deallocator.  If NULL, use generic deallocation.
    6969    size_t userMemorySize;      ///< the size of the user-portion of the memory block
     
    8282 *  @ingroup memCallback
    8383 */
    84 typedef psMemoryId(*psMemAllocateCallback) (const psMemBlock * ptr      ///< the psMemBlock just allocated
     84typedef psMemoryId(*psMemAllocateCallback) (const psMemBlock* ptr      ///< the psMemBlock just allocated
    8585                                           );
    8686
     
    9090 *  @ingroup memCallback
    9191 */
    92 typedef psMemoryId(*psMemFreeCallback) (const psMemBlock * ptr  ///< the psMemBlock being freed
     92typedef psMemoryId(*psMemFreeCallback) (const psMemBlock* ptr  ///< the psMemBlock being freed
    9393                                       );
    9494
     
    100100 *  @ingroup memCallback
    101101 */
    102 typedef void (*psMemProblemCallback) (const psMemBlock * ptr,   ///< the pointer to the problematic memory
     102typedef void (*psMemProblemCallback) (const psMemBlock* ptr,   ///< the pointer to the problematic memory
    103103                                      // block.
    104104                                      const char *file, ///< the file in which the problem originated
     
    195195 */
    196196int psMemCheckLeaks(psMemoryId id0,     ///< don't list blocks with id < id0
    197                     psMemBlock *** arr, ///< pointer to array of pointers to leaked blocks, or NULL
     197                    psMemBlock* ** arr, ///< pointer to array of pointers to leaked blocks, or NULL
    198198                    FILE * fd   ///< print list of leaks to fd (or NULL)
    199199                   );
  • trunk/psLib/src/sys/psTrace.c

    r1407 r1440  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-07 00:06:06 $
     12 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-08-09 23:34:58 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4545#    include "psError.h"
    4646
    47 static p_psComponent *p_psCroot = NULL; // The root of the trace component
     47static p_psComponent* p_psCroot = NULL; // The root of the trace component
    4848static FILE *p_psTraceFP = NULL;        // File destination for messages.
    4949
    50 static void componentFree(p_psComponent * comp);
    51 static p_psComponent *componentAlloc(const char *name, int level);
     50static void componentFree(p_psComponent* comp);
     51static p_psComponent* componentAlloc(const char *name, int level);
    5252
    5353/*****************************************************************************
    5454componentAlloc(): allocate memory for a new node, and initialize members.
    5555 *****************************************************************************/
    56 static p_psComponent *componentAlloc(const char *name, int level)
    57 {
    58     p_psComponent *comp = psAlloc(sizeof(p_psComponent));
     56static p_psComponent* componentAlloc(const char *name, int level)
     57{
     58    p_psComponent* comp = psAlloc(sizeof(p_psComponent));
    5959
    6060    p_psMemSetDeallocator(comp, (psFreeFcn) componentFree);
     
    7070nodes as well.
    7171 *****************************************************************************/
    72 static void componentFree(p_psComponent * comp)
     72static void componentFree(p_psComponent* comp)
    7373{
    7474    if (comp == NULL) {
     
    9999Set all trace levels to zero.
    100100 *****************************************************************************/
    101 void p_psTraceReset(p_psComponent * currentNode)
     101void p_psTraceReset(p_psComponent* currentNode)
    102102{
    103103    int i = 0;
     
    147147    char *pname = name;
    148148    char *firstComponent = NULL;        // first component of name
    149     p_psComponent *currentNode = p_psCroot;
     149    p_psComponent* currentNode = p_psCroot;
    150150    int nodeExists = 0;
    151151
     
    182182        if (nodeExists == 0) {
    183183            currentNode->subcomp = psRealloc(currentNode->subcomp,
    184                                              (currentNode->n + 1) * sizeof(p_psComponent *));
     184                                             (currentNode->n + 1) * sizeof(p_psComponent* ));
    185185            currentNode->n = (currentNode->n) + 1;
    186186
     
    234234    char *pname = name;
    235235    char *firstComponent = NULL;        // first component of name
    236     p_psComponent *currentNode = p_psCroot;
     236    p_psComponent* currentNode = p_psCroot;
    237237    int i = 0;
    238238
     
    303303 null
    304304 *****************************************************************************/
    305 static void doPrintTraceLevels(const p_psComponent * comp, int depth)
     305static void doPrintTraceLevels(const p_psComponent* comp, int depth)
    306306{
    307307    int i = 0;
  • trunk/psLib/src/sys/psTrace.h

    r1426 r1440  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-09 22:44:25 $
     12 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-08-09 23:34:58 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5353            int level;                  // trace level for this component
    5454            int n;                      // number of subcomponents
    55             struct p_psComponent **subcomp;     // next level of subcomponents
     55            struct p_psComponent* *subcomp;     // next level of subcomponents
    5656        }
    5757p_psComponent;
  • trunk/psLib/src/sysUtils/psMemory.c

    r1407 r1440  
    99*  @author Robert Lupton, Princeton University
    1010*
    11 *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-08-07 00:06:06 $
     11*  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-08-09 23:34:58 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3131#define P_PS_LARGE_BLOCK_SIZE 65536        // size where under, we try to recycle
    3232
    33 static int checkMemBlock(const psMemBlock * m, const char *funcName);
    34 static psMemBlock *lastMemBlockAllocated = NULL;
     33static int checkMemBlock(const psMemBlock* m, const char *funcName);
     34static psMemBlock* lastMemBlockAllocated = NULL;
    3535static pthread_mutex_t memBlockListMutex = PTHREAD_MUTEX_INITIALIZER;
    3636static pthread_mutex_t memIdMutex = PTHREAD_MUTEX_INITIALIZER;
     
    4444
    4545// N.B. recycleBinSize should be terminated by P_PS_LARGE_BLOCK_SIZE (simplifies search loops)
    46 static psMemBlock *recycleMemBlockList[13] = {
     46static psMemBlock* recycleMemBlockList[13] = {
    4747            NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
    4848        };
    4949
    5050#ifdef PS_MEM_DEBUG
    51 static psMemBlock *deadBlockList;       // a place to put dead memBlocks in debug mode.
     51static psMemBlock* deadBlockList;       // a place to put dead memBlocks in debug mode.
    5252#endif
    5353
     
    6969    while (level >= 0 && ptr == NULL) {
    7070        while (recycleMemBlockList[level] != NULL && ptr == NULL) {
    71             psMemBlock *old = recycleMemBlockList[level];
     71            psMemBlock* old = recycleMemBlockList[level];
    7272
    7373            recycleMemBlockList[level] = recycleMemBlockList[level]->nextBlock;
     
    9797}
    9898
    99 static void memProblemCallbackDefault(const psMemBlock * ptr, const char *file, int lineno)
     99static void memProblemCallbackDefault(const psMemBlock* ptr, const char *file, int lineno)
    100100{
    101101    if (ptr->refCounter < 1) {
     
    156156 * isn't resignalled)
    157157 */
    158 static psMemoryId memAllocateCallbackDefault(const psMemBlock * ptr)
     158static psMemoryId memAllocateCallbackDefault(const psMemBlock* ptr)
    159159{
    160160    static psMemoryId incr = 0; // "p_psMemAllocateID += incr"
     
    163163}
    164164
    165 static psMemoryId memFreeCallbackDefault(const psMemBlock * ptr)
     165static psMemoryId memFreeCallbackDefault(const psMemBlock* ptr)
    166166{
    167167    static psMemoryId incr = 0; // "p_psMemFreeID += incr"
     
    222222 */
    223223
    224 static int checkMemBlock(const psMemBlock * m, const char *funcName)
     224static int checkMemBlock(const psMemBlock* m, const char *funcName)
    225225{
    226226    // n.b. since this is called by psMemCheckCorruption while the memblock list is mutex locked,
     
    257257    pthread_mutex_lock(&memBlockListMutex);
    258258
    259     for (psMemBlock * iter = lastMemBlockAllocated; iter != NULL; iter = iter->nextBlock) {
     259    for (psMemBlock* iter = lastMemBlockAllocated; iter != NULL; iter = iter->nextBlock) {
    260260        if (checkMemBlock(iter, __func__)) {
    261261            nbad++;
     
    280280{
    281281
    282     psMemBlock *ptr = NULL;
     282    psMemBlock* ptr = NULL;
    283283
    284284    // memory is of the size I want to bother recycling?
     
    327327    // increment the memory id safely.
    328328    pthread_mutex_lock(&memBlockListMutex);
    329     *(psMemoryId *) & ptr->id = ++memid;
     329    *(psMemoryId* ) & ptr->id = ++memid;
    330330    pthread_mutex_unlock(&memBlockListMutex);
    331331
     
    363363        return p_psAlloc(size, file, lineno);
    364364    } else {
    365         psMemBlock *ptr = ((psMemBlock *) vptr) - 1;
     365        psMemBlock* ptr = ((psMemBlock* ) vptr) - 1;
    366366        bool isBlockLast = false;
    367367
     
    376376        isBlockLast = (ptr == lastMemBlockAllocated);
    377377
    378         ptr = (psMemBlock *) realloc(ptr, sizeof(psMemBlock) + size + sizeof(void *));
     378        ptr = (psMemBlock* ) realloc(ptr, sizeof(psMemBlock) + size + sizeof(void *));
    379379
    380380        if (ptr == NULL) {
     
    415415 * Check for memory leaks.
    416416 */
    417 int psMemCheckLeaks(psMemoryId id0, psMemBlock *** arr, FILE * fd)
     417int psMemCheckLeaks(psMemoryId id0, psMemBlock* ** arr, FILE * fd)
    418418{
    419419    int nleak = 0;
    420420    int j = 0;
    421     psMemBlock *topBlock = lastMemBlockAllocated;
     421    psMemBlock* topBlock = lastMemBlockAllocated;
    422422
    423423    pthread_mutex_lock(&memBlockListMutex);
    424424
    425     for (psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock) {
     425    for (psMemBlock* iter = topBlock; iter != NULL; iter = iter->nextBlock) {
    426426        if ((psMemGetRefCounter(iter + 1) > 0) && (iter->id >= id0)) {
    427427            nleak++;
     
    446446    pthread_mutex_lock(&memBlockListMutex);
    447447
    448     for (psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock) {
     448    for (psMemBlock* iter = topBlock; iter != NULL; iter = iter->nextBlock) {
    449449        if ((psMemGetRefCounter(iter + 1) > 0) && (iter->id >= id0)) {
    450450            (*arr)[j++] = iter;
     
    466466psReferenceCount psMemGetRefCounter(void *vptr)
    467467{
    468     psMemBlock *ptr;
     468    psMemBlock* ptr;
    469469    unsigned int refCount;
    470470
     
    473473    }
    474474
    475     ptr = ((psMemBlock *) vptr) - 1;
     475    ptr = ((psMemBlock* ) vptr) - 1;
    476476
    477477    if (checkMemBlock(ptr, __func__) != 0) {
     
    489489void *p_psMemIncrRefCounter(void *vptr, const char *file, int lineno)
    490490{
    491     psMemBlock *ptr;
     491    psMemBlock* ptr;
    492492
    493493    if (vptr == NULL) {
     
    495495    }
    496496
    497     ptr = ((psMemBlock *) vptr) - 1;
     497    ptr = ((psMemBlock* ) vptr) - 1;
    498498
    499499    if (checkMemBlock(ptr, __func__)) {
     
    515515    }
    516516
    517     psMemBlock *ptr = ((psMemBlock *) vptr) - 1;
     517    psMemBlock* ptr = ((psMemBlock* ) vptr) - 1;
    518518
    519519    if (checkMemBlock(ptr, __func__) != 0) {
     
    607607    }
    608608
    609     psMemBlock *ptr = ((psMemBlock *) vptr) - 1;
     609    psMemBlock* ptr = ((psMemBlock* ) vptr) - 1;
    610610
    611611    if (checkMemBlock(ptr, __func__) != 0) {
     
    622622    }
    623623
    624     psMemBlock *ptr = ((psMemBlock *) vptr) - 1;
     624    psMemBlock* ptr = ((psMemBlock* ) vptr) - 1;
    625625
    626626    if (checkMemBlock(ptr, __func__) != 0) {
  • trunk/psLib/src/sysUtils/psMemory.h

    r1426 r1440  
    1515 *  @ingroup MemoryManagement
    1616 *
    17  *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
    18  *  @date $Date: 2004-08-09 22:44:25 $
     17 *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
     18 *  @date $Date: 2004-08-09 23:34:58 $
    1919 *
    2020 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6464{
    6565    const void *startblock;     ///< initialised to p_psMEMMAGIC
    66     struct psMemBlock *previousBlock;   ///< previous block in allocation list
    67     struct psMemBlock *nextBlock;       ///< next block allocation list
     66    struct psMemBlock* previousBlock;   ///< previous block in allocation list
     67    struct psMemBlock* nextBlock;       ///< next block allocation list
    6868    psFreeFcn freeFcn;          ///< deallocator.  If NULL, use generic deallocation.
    6969    size_t userMemorySize;      ///< the size of the user-portion of the memory block
     
    8282 *  @ingroup memCallback
    8383 */
    84 typedef psMemoryId(*psMemAllocateCallback) (const psMemBlock * ptr      ///< the psMemBlock just allocated
     84typedef psMemoryId(*psMemAllocateCallback) (const psMemBlock* ptr      ///< the psMemBlock just allocated
    8585                                           );
    8686
     
    9090 *  @ingroup memCallback
    9191 */
    92 typedef psMemoryId(*psMemFreeCallback) (const psMemBlock * ptr  ///< the psMemBlock being freed
     92typedef psMemoryId(*psMemFreeCallback) (const psMemBlock* ptr  ///< the psMemBlock being freed
    9393                                       );
    9494
     
    100100 *  @ingroup memCallback
    101101 */
    102 typedef void (*psMemProblemCallback) (const psMemBlock * ptr,   ///< the pointer to the problematic memory
     102typedef void (*psMemProblemCallback) (const psMemBlock* ptr,   ///< the pointer to the problematic memory
    103103                                      // block.
    104104                                      const char *file, ///< the file in which the problem originated
     
    195195 */
    196196int psMemCheckLeaks(psMemoryId id0,     ///< don't list blocks with id < id0
    197                     psMemBlock *** arr, ///< pointer to array of pointers to leaked blocks, or NULL
     197                    psMemBlock* ** arr, ///< pointer to array of pointers to leaked blocks, or NULL
    198198                    FILE * fd   ///< print list of leaks to fd (or NULL)
    199199                   );
  • trunk/psLib/src/sysUtils/psTrace.c

    r1407 r1440  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-07 00:06:06 $
     12 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-08-09 23:34:58 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4545#    include "psError.h"
    4646
    47 static p_psComponent *p_psCroot = NULL; // The root of the trace component
     47static p_psComponent* p_psCroot = NULL; // The root of the trace component
    4848static FILE *p_psTraceFP = NULL;        // File destination for messages.
    4949
    50 static void componentFree(p_psComponent * comp);
    51 static p_psComponent *componentAlloc(const char *name, int level);
     50static void componentFree(p_psComponent* comp);
     51static p_psComponent* componentAlloc(const char *name, int level);
    5252
    5353/*****************************************************************************
    5454componentAlloc(): allocate memory for a new node, and initialize members.
    5555 *****************************************************************************/
    56 static p_psComponent *componentAlloc(const char *name, int level)
    57 {
    58     p_psComponent *comp = psAlloc(sizeof(p_psComponent));
     56static p_psComponent* componentAlloc(const char *name, int level)
     57{
     58    p_psComponent* comp = psAlloc(sizeof(p_psComponent));
    5959
    6060    p_psMemSetDeallocator(comp, (psFreeFcn) componentFree);
     
    7070nodes as well.
    7171 *****************************************************************************/
    72 static void componentFree(p_psComponent * comp)
     72static void componentFree(p_psComponent* comp)
    7373{
    7474    if (comp == NULL) {
     
    9999Set all trace levels to zero.
    100100 *****************************************************************************/
    101 void p_psTraceReset(p_psComponent * currentNode)
     101void p_psTraceReset(p_psComponent* currentNode)
    102102{
    103103    int i = 0;
     
    147147    char *pname = name;
    148148    char *firstComponent = NULL;        // first component of name
    149     p_psComponent *currentNode = p_psCroot;
     149    p_psComponent* currentNode = p_psCroot;
    150150    int nodeExists = 0;
    151151
     
    182182        if (nodeExists == 0) {
    183183            currentNode->subcomp = psRealloc(currentNode->subcomp,
    184                                              (currentNode->n + 1) * sizeof(p_psComponent *));
     184                                             (currentNode->n + 1) * sizeof(p_psComponent* ));
    185185            currentNode->n = (currentNode->n) + 1;
    186186
     
    234234    char *pname = name;
    235235    char *firstComponent = NULL;        // first component of name
    236     p_psComponent *currentNode = p_psCroot;
     236    p_psComponent* currentNode = p_psCroot;
    237237    int i = 0;
    238238
     
    303303 null
    304304 *****************************************************************************/
    305 static void doPrintTraceLevels(const p_psComponent * comp, int depth)
     305static void doPrintTraceLevels(const p_psComponent* comp, int depth)
    306306{
    307307    int i = 0;
  • trunk/psLib/src/sysUtils/psTrace.h

    r1426 r1440  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-09 22:44:25 $
     12 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-08-09 23:34:58 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5353            int level;                  // trace level for this component
    5454            int n;                      // number of subcomponents
    55             struct p_psComponent **subcomp;     // next level of subcomponents
     55            struct p_psComponent* *subcomp;     // next level of subcomponents
    5656        }
    5757p_psComponent;
  • trunk/psLib/src/types/psArray.c

    r1407 r1440  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-08-07 00:06:06 $
     11 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-08-09 23:34:57 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3232
    3333/*****************************************************************************/
    34 static void arrayFree(psArray * restrict psArr);
     34static void arrayFree(psArray* restrict psArr);
    3535
    3636/*****************************************************************************/
     
    3939
    4040/*****************************************************************************/
    41 psArray *psArrayAlloc(unsigned int nalloc)
     41psArray* psArrayAlloc(unsigned int nalloc)
    4242{
    43     psArray *psArr = NULL;
     43    psArray* psArr = NULL;
    4444
    4545    // Invalid nalloc
     
    4949    }
    5050    // Create vector struct
    51     psArr = (psArray *) psAlloc(sizeof(psArray));
     51    psArr = (psArray* ) psAlloc(sizeof(psArray));
    5252    p_psMemSetDeallocator(psArr, (psFreeFcn) arrayFree);
    5353
     
    6161}
    6262
    63 psArray *psArrayRealloc(unsigned int nalloc, psArray * restrict in)
     63psArray* psArrayRealloc(unsigned int nalloc, psArray* restrict in)
    6464{
    6565    // Invalid nalloc
     
    8787}
    8888
    89 static void arrayFree(psArray * restrict psArr)
     89static void arrayFree(psArray* restrict psArr)
    9090{
    9191    if (psArr == NULL) {
     
    9898}
    9999
    100 void psArrayElementFree(psArray * restrict psArr)
     100void psArrayElementFree(psArray* restrict psArr)
    101101{
    102102
     
    111111}
    112112
    113 psArray *psArraySort(psArray * in, psComparePtrFcn compare)
     113psArray* psArraySort(psArray* in, psComparePtrFcn compare)
    114114{
    115115    if (in == NULL) {
  • trunk/psLib/src/types/psArray.h

    r1426 r1440  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-08-09 22:44:25 $
     14 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-08-09 23:34:57 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3636    unsigned int nalloc;        ///< Total number of elements available.
    3737    unsigned int n;             ///< Number of elements in use.
    38     psPTR *data;                ///< An Array of pointer elements
     38    psPTR* data;                ///< An Array of pointer elements
    3939}
    4040psArray;
     
    5151 * data
    5252 *
    53  * @return psArray*: Pointer to psArray.
     53 * @return psArray* : Pointer to psArray.
    5454 *
    5555 */
    56 psArray *psArrayAlloc(unsigned int nalloc       ///< Total number of elements to make available.
     56psArray* psArrayAlloc(unsigned int nalloc       ///< Total number of elements to make available.
    5757                     );
    5858
     
    6262 * of data.
    6363 *
    64  * @return psArray*: Pointer to psArray.
     64 * @return psArray* : Pointer to psArray.
    6565 *
    6666 */
    67 psArray *psArrayRealloc(unsigned int nalloc,    ///< Total number of elements to make available.
    68                         psArray * restrict psArr        ///< array to reallocate.
     67psArray* psArrayRealloc(unsigned int nalloc,    ///< Total number of elements to make available.
     68                        psArray* restrict psArr        ///< array to reallocate.
    6969                       );
    7070
     
    7676 *
    7777 */
    78 void psArrayElementFree(psArray * restrict psArr        ///< Void pointer array to destroy.
     78void psArrayElementFree(psArray* restrict psArr        ///< Void pointer array to destroy.
    7979                       );
    8080
     
    8484 *  to specify how the objects on the array should be sorted.
    8585 *
    86  *  @return psArray*       The sorted array.
     86 *  @return psArray* The sorted array.
    8787 */
    88 psArray *psArraySort(psArray * in, psComparePtrFcn compare);
     88psArray* psArraySort(psArray* in, psComparePtrFcn compare);
    8989
    9090/// @}
  • trunk/psLib/src/types/psBitSet.c

    r1407 r1440  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-08-07 00:06:06 $
     13 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-08-09 23:34:57 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7070
    7171/*****************************************************************************/
    72 static void psBitSetFree(psBitSet * restrict inBitSet);
     72static void psBitSetFree(psBitSet* restrict inBitSet);
    7373
    7474/** Private function to create a mask.
     
    9595
    9696/*****************************************************************************/
    97 psBitSet *psBitSetAlloc(int n)
     97psBitSet* psBitSetAlloc(int n)
    9898{
    9999    int numBytes = 0;
    100     psBitSet *newObj = NULL;
     100    psBitSet* newObj = NULL;
    101101
    102102    if (n <= 0) {
     
    125125}
    126126
    127 static void psBitSetFree(psBitSet * restrict inBitSet)
     127static void psBitSetFree(psBitSet* restrict inBitSet)
    128128{
    129129    if (inBitSet == NULL) {
     
    134134}
    135135
    136 psBitSet *psBitSetSet(psBitSet * inBitSet, int bit)
     136psBitSet* psBitSetSet(psBitSet* inBitSet, int bit)
    137137{
    138138    char *byte = NULL;
     
    155155}
    156156
    157 bool psBitSetTest(const psBitSet * inBitSet, int bit)
     157bool psBitSetTest(const psBitSet* inBitSet, int bit)
    158158{
    159159    char *byte = NULL;
     
    178178}
    179179
    180 psBitSet *psBitSetOp(psBitSet * outBitSet, const psBitSet * restrict inBitSet1, char *operator,
    181                      const psBitSet * restrict inBitSet2)
     180psBitSet* psBitSetOp(psBitSet* outBitSet, const psBitSet* restrict inBitSet1, char *operator,
     181                     const psBitSet* restrict inBitSet2)
    182182{
    183183    int i = 0;
     
    241241}
    242242
    243 psBitSet *psBitSetNot(psBitSet * outBitSet, const psBitSet * restrict inBitSet)
     243psBitSet* psBitSetNot(psBitSet* outBitSet, const psBitSet* restrict inBitSet)
    244244{
    245245    int i = 0;
     
    278278}
    279279
    280 char *psBitSetToString(const psBitSet * restrict inBitSet)
     280char *psBitSetToString(const psBitSet* restrict inBitSet)
    281281{
    282282    int i = 0;
  • trunk/psLib/src/types/psBitSet.h

    r1407 r1440  
    1313 *  @author Ross Harman, MHPCC
    1414 *
    15  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2004-08-07 00:06:06 $
     15 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2004-08-09 23:34:57 $
    1717 *
    1818 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5656 *  allocation.
    5757 *
    58  *  @return  psBitSet*: Pointer to struct containing array of bits and size of array.
     58 *  @return  psBitSet* : Pointer to struct containing array of bits and size of array.
    5959 */
    6060
    6161/*@null@*/
    6262
    63 psBitSet *psBitSetAlloc(int n
     63psBitSet* psBitSetAlloc(int n
    6464                        /**< Number of bits in psBitSet array */
    6565                       );
     
    7171 *  an array with two elements would result in an psBitSet that looks like 00000000 00001000.
    7272 *
    73  *  @return  psBitSet*: Pointer to struct containing psBitSet.
     73 *  @return  psBitSet* : Pointer to struct containing psBitSet.
    7474 */
    75 psBitSet *psBitSetSet(
     75psBitSet* psBitSetSet(
    7676
    77     /* @returned@ */ psBitSet * restrict inMask,
     77    /* @returned@ */ psBitSet* restrict inMask,
    7878    /**< Pointer to psBitSet to be set. */
    7979
     
    9191 */
    9292
    93 bool psBitSetTest(const psBitSet * restrict inMask,
     93bool psBitSetTest(const psBitSet* restrict inMask,
    9494                  /**< Pointer psBitSet to be tested. */
    9595
     
    102102 *  be performed and an error message will be logged.
    103103 *
    104  *  @return  psBitSet*: Pointer to struct containing result of binary operation.
     104 *  @return  psBitSet* : Pointer to struct containing result of binary operation.
    105105 */
    106 psBitSet *psBitSetOp(
     106psBitSet* psBitSetOp(
    107107
    108     /* @returned@ */ psBitSet * restrict outMask,
     108    /* @returned@ */ psBitSet* restrict outMask,
    109109    /**< Resulting psBitSet from binary operation */
    110110
    111     const psBitSet * restrict inMask1,
     111    const psBitSet* restrict inMask1,
    112112    /**< First psBitSet on which to operate */
    113113
    114114    char *operator,         /**< Bit operation */
    115115
    116     const psBitSet * restrict inMask2
     116    const psBitSet* restrict inMask2
    117117    /**< First psBitSet on which to operate */
    118118);
     
    122122 *  Toggles bits in a psBitset. All zero bits are set to one and all one bits are set to zero.
    123123 *
    124  *  @return  psBitSet*: Pointer to struct containing result of operation.
     124 *  @return  psBitSet* : Pointer to struct containing result of operation.
    125125 */
    126126
    127 psBitSet *psBitSetNot(psBitSet * outBitSet,
     127psBitSet* psBitSetNot(psBitSet* outBitSet,
    128128                      /**< Resulting psBitSet from operation */
    129129
    130                       const psBitSet * restrict inBitSet
     130                      const psBitSet* restrict inBitSet
    131131                      /**< Input psBitSet */
    132132                     );
     
    140140 */
    141141
    142 char *psBitSetToString(const psBitSet * restrict inMask
     142char *psBitSetToString(const psBitSet* restrict inMask
    143143                       /**< psBitSet to convert */
    144144                      );
  • trunk/psLib/src/types/psHash.c

    r1420 r1440  
    1111*  @author George Gusciora, MHPCC
    1212*
    13 *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-08-09 20:29:43 $
     13*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-08-09 23:34:57 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2626#include "psAbort.h"
    2727
    28 static psHashBucket *hashBucketAlloc(const char *key, void *data, psHashBucket * next);
    29 static void hashBucketFree(psHashBucket * bucket);
    30 static void *doHashWork(psHash * table, const char *key, void *data, bool remove
     28static psHashBucket* hashBucketAlloc(const char *key, void *data, psHashBucket* next);
     29static void hashBucketFree(psHashBucket* bucket);
     30static void *doHashWork(psHash* table, const char *key, void *data, bool remove
    3131                           );
    32 static void hashFree(psHash * table);
     32static void hashFree(psHash* table);
    3333
    3434/******************************************************************************
     
    4040    The linked list
    4141 *****************************************************************************/
    42 psList *psHashKeyList(psHash * table)
     42psList* psHashKeyList(psHash* table)
    4343{
    4444    int i = 0;                  // Loop index variable
    45     psList *myLinkList = NULL;  // The output data structure
    46     psHashBucket *ptr = NULL;   // Used to step thru linked list.
     45    psList* myLinkList = NULL;  // The output data structure
     46    psHashBucket* ptr = NULL;   // Used to step thru linked list.
    4747
    4848    if (table == NULL) {
     
    8181    the new hash bucket.
    8282 *****************************************************************************/
    83 static psHashBucket *hashBucketAlloc(const char *key, void *data, psHashBucket * next)
     83static psHashBucket* hashBucketAlloc(const char *key, void *data, psHashBucket* next)
    8484{
    8585    if (key == NULL) {
     
    8787    }
    8888    // Allocate memory for the new hash bucket.
    89     psHashBucket *bucket = psAlloc(sizeof(psHashBucket));
     89    psHashBucket* bucket = psAlloc(sizeof(psHashBucket));
    9090
    9191    p_psMemSetDeallocator(bucket, (psFreeFcn) hashBucketFree);
     
    114114    NONE
    115115 *****************************************************************************/
    116 static void hashBucketFree(psHashBucket * bucket)
     116static void hashBucketFree(psHashBucket* bucket)
    117117{
    118118    if (bucket == NULL) {
     
    133133    The new hash table.
    134134 *****************************************************************************/
    135 psHash *psHashAlloc(int nbucket)        // initial number of buckets
     135psHash* psHashAlloc(int nbucket)        // initial number of buckets
    136136{
    137137    int i = 0;                  // loop index variable
    138138
    139139    // Create the new hash table.
    140     psHash *table = psAlloc(sizeof(psHash));
     140    psHash* table = psAlloc(sizeof(psHash));
    141141
    142142    p_psMemSetDeallocator(table, (psFreeFcn) hashFree);
    143143
    144144    // Allocate memory for the buckets.
    145     table->buckets = psAlloc(nbucket * sizeof(psHashBucket *));
     145    table->buckets = psAlloc(nbucket * sizeof(psHashBucket* ));
    146146    table->nbucket = nbucket;
    147147
     
    168168    NONE
    169169 *****************************************************************************/
    170 static void hashFree(psHash * table)
     170static void hashFree(psHash* table)
    171171{
    172172    int i = 0;                  // Loop index variable.
     
    210210there is little common code between those functions.
    211211  *****************************************************************************/
    212 static void *doHashWork(psHash * table, const char *key, void *data, bool remove
     212static void *doHashWork(psHash* table, const char *key, void *data, bool remove
    213213                           )
    214214{
     
    217217    // "hashed" from the key.
    218218    char *tmpchar = NULL;       // Used in computing the hash function.
    219     psHashBucket *ptr = NULL;   // Used to retrieve the hash bucket.
    220     psHashBucket *optr = NULL;  // "original pointer": used to step
     219    psHashBucket* ptr = NULL;   // Used to retrieve the hash bucket.
     220    psHashBucket* optr = NULL;  // "original pointer": used to step
    221221
    222222    // thru the linked list for a bucket.
     
    338338    boolean value defining success or failure
    339339 *****************************************************************************/
    340 bool psHashAdd(psHash * table, const char *key, void *data)
     340bool psHashAdd(psHash* table, const char *key, void *data)
    341341{
    342342    if (table == NULL) {
     
    364364    The data associated with that key.
    365365 *****************************************************************************/
    366 void *psHashLookup(psHash * table,      // table to lookup key in
     366void *psHashLookup(psHash* table,      // table to lookup key in
    367367                   const char *key)     // key to lookup
    368368{
     
    387387    boolean value defining success or failure
    388388 *****************************************************************************/
    389 bool psHashRemove(psHash * table, const char *key)
     389bool psHashRemove(psHash* table, const char *key)
    390390{
    391391    void *data = NULL;
  • trunk/psLib/src/types/psHash.h

    r1426 r1440  
    1111 *  @author George Gusciora, MHPCC
    1212 *   
    13  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-08-09 22:44:25 $
     13 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-08-09 23:34:57 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3131    char *key;                  ///< key for this item of data
    3232    void *data;                 ///< the data itself
    33     struct psHashBucket *next;  ///< list of other possible keys
     33    struct psHashBucket* next;  ///< list of other possible keys
    3434}
    3535psHashBucket;
     
    4141{
    4242    int nbucket;                ///< Number of buckets in hash table.
    43     psHashBucket **buckets;     ///< The bucket data.
     43    psHashBucket* *buckets;     ///< The bucket data.
    4444}
    4545psHash;
    4646
    4747/// Allocate hash buckets in table.
    48 psHash *psHashAlloc(int nbucket ///< The number of buckets to allocate.
     48psHash* psHashAlloc(int nbucket ///< The number of buckets to allocate.
    4949                   );
    5050
    5151/// Insert entry into table.
    52 bool psHashAdd(psHash * table,  ///< table to insert in
     52bool psHashAdd(psHash* table,  ///< table to insert in
    5353               const char *key, ///< key to use
    5454               void *data       ///< data to insert
     
    5656
    5757/// Lookup key in table.
    58 void *psHashLookup(psHash * table,      ///< table to lookup key in
     58void *psHashLookup(psHash* table,      ///< table to lookup key in
    5959                   const char *key      ///< key to lookup
    6060                  );
    6161
    6262/// Remove key from table.
    63 bool psHashRemove(psHash * table,       ///< table to lookup key in
     63bool psHashRemove(psHash* table,       ///< table to lookup key in
    6464                  const char *key       ///< key to lookup
    6565                 );
    6666
    6767/// List all keys in table.
    68 psList *psHashKeyList(psHash * table    ///< table to list keys from.
     68psList* psHashKeyList(psHash* table    ///< table to list keys from.
    6969                     );
    7070
  • trunk/psLib/src/types/psList.c

    r1407 r1440  
    77 *  @author Robert Daniel DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-08-07 00:06:06 $
     9 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-08-09 23:34:57 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2929
    3030// private functions.
    31 static psListElem *listGetIterator(psList * list);
    32 static int listGetIteratorIndex(psList * list);
    33 static void listSetIterator(psList * list, int where, bool lockList);
    34 static void listFree(psList * list);
    35 
    36 psList *psListAlloc(void *data)
    37 {
    38     psList *list = psAlloc(sizeof(psList));
     31static psListElem* listGetIterator(psList* list);
     32static int listGetIteratorIndex(psList* list);
     33static void listSetIterator(psList* list, int where, bool lockList);
     34static void listFree(psList* list);
     35
     36psList* psListAlloc(void *data)
     37{
     38    psList* list = psAlloc(sizeof(psList));
    3939
    4040    p_psMemSetDeallocator(list, (psFreeFcn) listFree);
     
    5555}
    5656
    57 static void listFree(psList * list)
     57static void listFree(psList* list)
    5858{
    5959    if (list == NULL) {
     
    6464    ;
    6565
    66     for (psListElem * ptr = list->head; ptr != NULL;) {
    67         psListElem *next = ptr->next;
     66    for (psListElem* ptr = list->head; ptr != NULL;) {
     67        psListElem* next = ptr->next;
    6868
    6969        psFree(ptr->data);
     
    8181}
    8282
    83 bool psListAdd(psList * list, void *data, int where)
    84 {
    85     psListElem *position;
    86     psListElem *elem;
     83bool psListAdd(psList* list, void *data, int where)
     84{
     85    psListElem* position;
     86    psListElem* elem;
    8787    int cursorIndex = 0;
    8888
     
    168168 * Remove an element from a list
    169169 */
    170 bool psListRemove(psList * list, void *data, int which)
    171 {
    172     psListElem *elem = NULL;    // element to remove
     170bool psListRemove(psList* list, void *data, int which)
     171{
     172    psListElem* elem = NULL;    // element to remove
    173173    int cursorIndex = 0;
    174174
     
    186186        int i = 0;              // index
    187187
    188         for (psListElem * ptr = list->head; ptr != NULL; ptr = ptr->next) {
     188        for (psListElem* ptr = list->head; ptr != NULL; ptr = ptr->next) {
    189189            if (ptr->data == data) {
    190190                which = i;
     
    243243}
    244244
    245 void psListSetIterator(psList * list, int where)
     245void psListSetIterator(psList* list, int where)
    246246{
    247247    listSetIterator(list, where, true);
    248248}
    249249
    250 void listSetIterator(psList * list, int where, bool lockList)
    251 {
    252     psListElem *cursor;
     250void listSetIterator(psList* list, int where, bool lockList)
     251{
     252    psListElem* cursor;
    253253    int position;
    254254
     
    340340}
    341341
    342 psListElem *listGetIterator(psList * list)
     342psListElem* listGetIterator(psList* list)
    343343{
    344344    if (list == NULL) {
     
    355355}
    356356
    357 int listGetIteratorIndex(psList * list)
     357int listGetIteratorIndex(psList* list)
    358358{
    359359    if (list->iter == ITER_INIT_HEAD) {
     
    366366}
    367367
    368 void *psListGet(psList * list, int which)
    369 {
    370     psListElem *element;
     368void *psListGet(psList* list, int which)
     369{
     370    psListElem* element;
    371371
    372372    psListSetIterator(list, which);
     
    383383 * and now return the previous/next element of the list
    384384 */
    385 void *psListGetNext(psList * list)
     385void *psListGetNext(psList* list)
    386386{
    387387    return psListGet(list, PS_LIST_NEXT);
    388388}
    389389
    390 void *psListGetPrevious(psList * list)
     390void *psListGetPrevious(psList* list)
    391391{
    392392    return psListGet(list, PS_LIST_PREVIOUS);
    393393}
    394394
    395 void *psListGetCurrent(psList * list)
     395void *psListGetCurrent(psList* list)
    396396{
    397397    return psListGet(list, PS_LIST_CURRENT);
     
    401401 * Convert a psList to/from a psVoidPtrArray
    402402 */
    403 psArray *psListToArray(psList * restrict list)
    404 {
    405     psListElem *ptr;
     403psArray* psListToArray(psList* restrict list)
     404{
     405    psListElem* ptr;
    406406    unsigned int n;
    407     psArray *restrict arr;
     407    psArray* restrict arr;
    408408
    409409    if (list == NULL) {
     
    429429}
    430430
    431 psList *psArrayToList(psArray * arr)
     431psList* psArrayToList(psArray* arr)
    432432{
    433433    unsigned int n;
    434     psList *list;               // list of elements
     434    psList* list;               // list of elements
    435435
    436436    if (arr == NULL) {
     
    447447}
    448448
    449 psList *psListSort(psList * list, psComparePtrFcn compare)
    450 {
    451     psArray *arr;
     449psList* psListSort(psList* list, psComparePtrFcn compare)
     450{
     451    psArray* arr;
    452452
    453453    if (list == NULL) {
  • trunk/psLib/src/types/psList.h

    r1426 r1440  
    1010 *  @ingroup LinkedList
    1111 *
    12  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-09 22:44:25 $
     12 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-08-09 23:34:57 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4444typedef struct psListElem
    4545{
    46     struct psListElem *prev;    ///< previous link in list
    47     struct psListElem *next;    ///< next link in list
     46    struct psListElem* prev;    ///< previous link in list
     47    struct psListElem* next;    ///< next link in list
    4848    void *data;                 ///< real data item
    4949}
     
    5858{
    5959    unsigned int size;          ///< number of elements on list
    60     psListElem *head;           ///< first element on list (may be NULL)
    61     psListElem *tail;           ///< last element on list (may be NULL)
    62     psListElem *iter;           ///< iteration cursor
     60    psListElem* head;           ///< first element on list (may be NULL)
     61    psListElem* tail;           ///< last element on list (may be NULL)
     62    psListElem* iter;           ///< iteration cursor
    6363    unsigned int iterIndex;     ///< the numeric position of the iteration cursor in the list
    6464    pthread_mutex_t lock;       ///< mutex to lock a node during changes
     
    6868/** Creates a psList linked list object.
    6969 *
    70  *  @return psList*     A new psList object.
     70 *  @return psList* A new psList object.
    7171 */
    72 psList *psListAlloc(void *data
     72psList* psListAlloc(void *data
    7373                    ///< initial data item; may be NULL if no an empty psList is desired
    7474                   )
     
    7777/** Adds an element to a psList at position given.
    7878 *
    79  *  @return psList*     The psList with added data item.  If list parameter is
     79 *  @return psList* The psList with added data item.  If list parameter is
    8080 *                      NULL, the return value will also be NULL.
    8181 */
    82 bool psListAdd(psList * restrict list,  ///< list to add to (if NULL, nothing is done)
     82bool psListAdd(psList* restrict list,  ///< list to add to (if NULL, nothing is done)
    8383               void *data,      ///< data item to add.  If NULL, list is not modified.
    8484               int where        ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.
     
    8989 *  @return bool        TRUE if element is successfully removed, otherwise FALSE.
    9090 */
    91 bool psListRemove(psList * restrict list,
     91bool psListRemove(psList* restrict list,
    9292                  ///< list to remove element from
    9393                  void *data,
     
    104104 *                      NULL is returned.
    105105 */
    106 void *psListGet(psList * restrict list, ///< list to retrieve element from
     106void *psListGet(psList* restrict list, ///< list to retrieve element from
    107107                int which       ///< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN
    108108               );
     
    112112 *
    113113 */
    114 void psListSetIterator(psList * restrict list,  ///< list to retrieve element from
     114void psListSetIterator(psList* restrict list,  ///< list to retrieve element from
    115115                       int where        ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
    116116                      );
     
    123123 *                      parameter was NULL.
    124124 */
    125 void *psListGetNext(psList * restrict list      ///< list to retrieve element from
     125void *psListGetNext(psList* restrict list      ///< list to retrieve element from
    126126                   );
    127127
     
    133133 *                      iterator is not valid or list parameter was NULL.
    134134 */
    135 void *psListGetCurrent(psList * restrict list   ///< list to retrieve element from
     135void *psListGetCurrent(psList* restrict list   ///< list to retrieve element from
    136136                      );
    137137
     
    143143 *                      parameter was NULL.
    144144 */
    145 void *psListGetPrevious(psList * restrict list  ///< list to retrieve element from
     145void *psListGetPrevious(psList* restrict list  ///< list to retrieve element from
    146146                       );
    147147
    148148/** Convert a linked list to an array
    149149 *
    150  *  @return psArray*   A new psArray populated with elements from the list,
     150 *  @return psArray* A new psArray populated with elements from the list,
    151151 *                      or NULL if the given dlist parameter is NULL.
    152152 */
    153 psArray *psListToArray(psList * dlist   ///< List to convert
     153psArray* psListToArray(psList* dlist   ///< List to convert
    154154                      );
    155155
    156156/** Convert array to a doubly-linked list
    157157 *
    158  *  @return psList*     A new psList populated with elements formt the psArray,
     158 *  @return psList* A new psList populated with elements formt the psArray,
    159159 *                      or NULL is the given arr parameter is NULL.
    160160 */
    161 psList *psArrayToList(psArray * arr     ///< vector to convert
     161psList* psArrayToList(psArray* arr     ///< vector to convert
    162162                     );
    163163
    164 psList *psListSort(psList * list, psComparePtrFcn compare);
     164psList* psListSort(psList* list, psComparePtrFcn compare);
    165165
    166166/// @} End of DataGroup Functions
  • trunk/psLib/src/types/psMetadata.c

    r1432 r1440  
    1212*  @author Ross Harman, MHPCC
    1313*
    14 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2004-08-09 23:06:10 $
     14*  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2004-08-09 23:34:57 $
    1616*
    1717*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8888
    8989/*****************************************************************************/
    90 static void metadataItemFree(psMetadataItem * metadataItem)
     90static void metadataItemFree(psMetadataItem* metadataItem)
    9191{
    9292    psMetadataType type;
     
    109109}
    110110
    111 static void metadataFree(psMetadata * metadata)
     111static void metadataFree(psMetadata* metadata)
    112112{
    113113    if (metadata == NULL) {
     
    124124/*****************************************************************************/
    125125
    126 psMetadataItem *psMetadataItemAlloc(const char *name, psMetadataType type, const char *comment, ...)
     126psMetadataItem* psMetadataItemAlloc(const char *name, psMetadataType type, const char *comment, ...)
    127127{
    128128    va_list argPtr;
    129     psMetadataItem *metadataItem = NULL;
     129    psMetadataItem* metadataItem = NULL;
    130130
    131131    // Get the variable list parameters to pass to allocation function
     
    141141}
    142142
    143 psMetadataItem *psMetadataItemAllocV(const char *name, psMetadataType type, const char *comment,
     143psMetadataItem* psMetadataItemAllocV(const char *name, psMetadataType type, const char *comment,
    144144                                     va_list argPtr)
    145145{
    146     psMetadataItem *metadataItem = NULL;
     146    psMetadataItem* metadataItem = NULL;
    147147
    148148    if (name == NULL) {
     
    151151    }
    152152    // Allocate metadata item
    153     metadataItem = (psMetadataItem *) psAlloc(sizeof(psMetadataItem));
     153    metadataItem = (psMetadataItem* ) psAlloc(sizeof(psMetadataItem));
    154154    if (metadataItem == NULL) {
    155155        psAbort(__func__, "Failed to allocate memory");
     
    211211}
    212212
    213 psMetadata *psMetadataAlloc(void)
    214 {
    215     psList *list = NULL;
    216     psHash *table = NULL;
    217     psMetadata *metadata = NULL;
     213psMetadata* psMetadataAlloc(void)
     214{
     215    psList* list = NULL;
     216    psHash* table = NULL;
     217    psMetadata* metadata = NULL;
    218218
    219219    // Allocate metadata
    220     metadata = (psMetadata *) psAlloc(sizeof(psMetadata));
     220    metadata = (psMetadata* ) psAlloc(sizeof(psMetadata));
    221221    if (metadata == NULL) {
    222222        psAbort(__func__, "Failed to allocate metadata");
     
    226226
    227227    // Allocate metadata's internal containers
    228     list = (psList *) psListAlloc(NULL);
     228    list = (psList* ) psListAlloc(NULL);
    229229    if (list == NULL) {
    230230        psAbort(__func__, "Failed to allocate list");
    231231    }
    232232
    233     table = (psHash *) psHashAlloc(10);
     233    table = (psHash* ) psHashAlloc(10);
    234234    if (table == NULL) {
    235235        psAbort(__func__, "Failed to allocate table");
     
    242242}
    243243
    244 bool psMetadataAddItem(psMetadata * restrict md, int where, psMetadataItem * restrict metadataItem)
     244bool psMetadataAddItem(psMetadata* restrict md, int where, psMetadataItem* restrict metadataItem)
    245245{
    246246    char *key = NULL;
    247     psHash *mdTable = NULL;
    248     psList *mdList = NULL;
    249     psMetadataItem *value = NULL;
     247    psHash* mdTable = NULL;
     248    psList* mdList = NULL;
     249    psMetadataItem* value = NULL;
    250250    psMetadataType type = PS_META_ITEM_SET;
    251251
     
    280280    }
    281281    // Check if key is already in table
    282     value = (psMetadataItem *) psHashLookup(mdTable, key);
     282    value = (psMetadataItem* ) psHashLookup(mdTable, key);
    283283    if (value != NULL && type != PS_META_ITEM_SET) {
    284284
     
    316316}
    317317
    318 bool psMetadataAdd(psMetadata * restrict md, int where, const char *name, psMetadataType type,
     318bool psMetadataAdd(psMetadata* restrict md, int where, const char *name, psMetadataType type,
    319319                   const char *comment, ...)
    320320{
    321321    va_list argPtr;
    322     psMetadataItem *metadataItem = NULL;
     322    psMetadataItem* metadataItem = NULL;
    323323
    324324    va_start(argPtr, comment);
     
    339339}
    340340
    341 bool psMetadataRemove(psMetadata * restrict md, int where, const char *restrict key)
     341bool psMetadataRemove(psMetadata* restrict md, int where, const char *restrict key)
    342342{
    343343    int numChildren = 0;
    344     psList *mdList = NULL;
    345     psHash *mdTable = NULL;
    346     psMetadataItem *entry = NULL;
    347     psMetadataItem *entryChild = NULL;
     344    psList* mdList = NULL;
     345    psHash* mdTable = NULL;
     346    psMetadataItem* entry = NULL;
     347    psMetadataItem* entryChild = NULL;
    348348
    349349
     
    368368
    369369        // Remove by key name
    370         entry = (psMetadataItem *) psHashLookup(mdTable, key);
     370        entry = (psMetadataItem* ) psHashLookup(mdTable, key);
    371371        if (entry == NULL) {
    372372            psError(__func__, "Couldn't find metadata item. Name: %s", key);
     
    419419}
    420420
    421 psMetadataItem *psMetadataLookup(psMetadata * restrict md, const char *restrict key)
    422 {
    423     psHash *mdTable = NULL;
    424     psMetadataItem *entry = NULL;
     421psMetadataItem* psMetadataLookup(psMetadata* restrict md, const char *restrict key)
     422{
     423    psHash* mdTable = NULL;
     424    psMetadataItem* entry = NULL;
    425425
    426426
     
    441441    }
    442442
    443     entry = (psMetadataItem *) psHashLookup(mdTable, key);
     443    entry = (psMetadataItem* ) psHashLookup(mdTable, key);
    444444    if (entry == NULL) {
    445445        psError(__func__, "Could not find metadata item. Key: %s", key);
     
    450450}
    451451
    452 psMetadataItem *psMetadataGet(psMetadata * restrict md, int where)
    453 {
    454     psList *mdList = NULL;
    455     psMetadataItem *entry = NULL;
     452psMetadataItem* psMetadataGet(psMetadata* restrict md, int where)
     453{
     454    psList* mdList = NULL;
     455    psMetadataItem* entry = NULL;
    456456
    457457
     
    467467    }
    468468
    469     entry = (psMetadataItem *) psListGet(mdList, where);
     469    entry = (psMetadataItem* ) psListGet(mdList, where);
    470470    if (entry == NULL) {
    471471        psError(__func__, "Couldn't find metadata item with given index. Index: %d", where);
     
    476476}
    477477
    478 bool psMetadataSetIterator(psMetadata * restrict md, int where)
    479 {
    480     psList *mdList = NULL;
     478bool psMetadataSetIterator(psMetadata* restrict md, int where)
     479{
     480    psList* mdList = NULL;
    481481
    482482    if (md == NULL) {
     
    496496}
    497497
    498 psMetadataItem *psMetadataGetNext(psMetadata * restrict md, const char *restrict match, int which)
    499 {
    500     psList *mdList = NULL;
    501     psMetadataItem *entry = NULL;
     498psMetadataItem* psMetadataGetNext(psMetadata* restrict md, const char *restrict match, int which)
     499{
     500    psList* mdList = NULL;
     501    psMetadataItem* entry = NULL;
    502502
    503503    mdList = md->list;
     
    532532}
    533533
    534 psMetadataItem *psMetadataGetPrevious(psMetadata * restrict md, const char *restrict match, int which)
    535 {
    536     psList *mdList = NULL;
    537     psMetadataItem *entry = NULL;
     534psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, int which)
     535{
     536    psList* mdList = NULL;
     537    psMetadataItem* entry = NULL;
    538538
    539539    mdList = md->list;
     
    568568}
    569569
    570 void psMetadataItemPrint(FILE * fd, const char *format, const psMetadataItem * restrict metadataItem)
     570void psMetadataItemPrint(FILE * fd, const char *format, const psMetadataItem* restrict metadataItem)
    571571{
    572572    psMetadataType type;
     
    616616}
    617617
    618 psMetadata *psMetadataFReadHeader(psMetadata * output, char *extName, int extNum, fitsfile * fd)
     618psMetadata* psMetadataFReadHeader(psMetadata* output, char *extName, int extNum, fitsfile * fd)
    619619{
    620620    bool tempBool;
  • trunk/psLib/src/types/psMetadata.h

    r1426 r1440  
    1111*  @author Ross Harman, MHPCC
    1212*
    13 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-08-09 22:44:25 $
     13*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-08-09 23:34:57 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6666    } data;                     ///< Union for data types.
    6767    char *comment;              ///< Optional comment ("", not NULL).
    68     psList *restrict items;     ///< List of psMetadataItems with same name.
     68    psList* restrict items;     ///< List of psMetadataItems with same name.
    6969}
    7070psMetadataItem;
     
    7878typedef struct psMetadata
    7979{
    80     psList *restrict list;
    81     psHash *restrict table;
     80    psList* restrict list;
     81    psHash* restrict table;
    8282}
    8383psMetadata;
     
    100100 * specified size and type.
    101101 *
    102  * @return psMetadataItem*: Pointer metadata item.
    103  */
    104 psMetadataItem *psMetadataItemAlloc(const char *name,   ///< Name of metadata item.
     102 * @return psMetadataItem* : Pointer metadata item.
     103 */
     104psMetadataItem* psMetadataItemAlloc(const char *name,   ///< Name of metadata item.
    105105                                    psMetadataType type,        ///< Type of metadata item.
    106106                                    const char *comment,        ///< Comment for metadata item.
     
    119119 * specified size and type.
    120120 *
    121  * @return psMetadataItem*: Pointer metadata item.
    122  */
    123 psMetadataItem *psMetadataItemAllocV(const char *name,  ///< Name of metadata item.
     121 * @return psMetadataItem* : Pointer metadata item.
     122 */
     123psMetadataItem* psMetadataItemAllocV(const char *name,  ///< Name of metadata item.
    124124                                     psMetadataType type,       ///< Type of metadata item.
    125125                                     const char *comment,       ///< Comment for metadata item.
     
    132132 * Returns an empty metadata container with fully allocated internal metadata containers.
    133133 *
    134  * @return psMetadata*: Pointer metadata.
    135  */
    136 psMetadata *psMetadataAlloc(void        ///< Void.
     134 * @return psMetadata* : Pointer metadata.
     135 */
     136psMetadata* psMetadataAlloc(void        ///< Void.
    137137                           );
    138138
     
    143143 * @return bool: True for success, false for failure.
    144144 */
    145 bool psMetadataAddItem(psMetadata * restrict md,        ///< Metadata collection to insert metadat item.
     145bool psMetadataAddItem(psMetadata* restrict md,        ///< Metadata collection to insert metadat item.
    146146                       int where,       ///< Location to be added.
    147                        psMetadataItem * restrict item   ///< Metadata item to be added.
     147                       psMetadataItem* restrict item   ///< Metadata item to be added.
    148148                      );
    149149
     
    154154 * @return bool: True for success, false for failure.
    155155 */
    156 bool psMetadataAdd(psMetadata * restrict md,    ///< Metadata collection to insert metadat item.
     156bool psMetadataAdd(psMetadata* restrict md,    ///< Metadata collection to insert metadat item.
    157157                   int where,   ///< Location to be added.
    158158                   const char *name,    ///< Name of metadata item.
     
    171171 * @return bool: True for success, false for failure.
    172172 */
    173 bool psMetadataRemove(psMetadata * restrict md, ///< Metadata collection to insert metadat item.
     173bool psMetadataRemove(psMetadata* restrict md, ///< Metadata collection to insert metadat item.
    174174                      int where,        ///< Location to be removed.
    175175                      const char *restrict key  ///< Name of metadata key.
     
    181181 * returned. If the item is not found, null is returned.
    182182 *
    183  * @return psMetadataItem*: Pointer metadata item.
    184  */
    185 psMetadataItem *psMetadataLookup(psMetadata * restrict md,      ///< Metadata collection to insert metadat
     183 * @return psMetadataItem* : Pointer metadata item.
     184 */
     185psMetadataItem* psMetadataLookup(psMetadata* restrict md,      ///< Metadata collection to insert metadat
    186186                                 // item.
    187187                                 const char *restrict key       ///< Name of metadata key.
     
    192192 * Items may be found in the metadata by their entry position in the list container.
    193193 *
    194  * @return psMetadataItem*: Pointer metadata item.
    195  */
    196 psMetadataItem *psMetadataGet(psMetadata * restrict md, ///< Metadata collection to insert metadat item.
     194 * @return psMetadataItem* : Pointer metadata item.
     195 */
     196psMetadataItem* psMetadataGet(psMetadata* restrict md, ///< Metadata collection to insert metadat item.
    197197                              int where ///< Location to be retrieved.
    198198                             );
     
    204204 * @return void: void.
    205205 */
    206 bool psMetadataSetIterator(psMetadata * restrict md,    ///< Metadata collection to iterate.
     206bool psMetadataSetIterator(psMetadata* restrict md,    ///< Metadata collection to iterate.
    207207                           int where    ///< Location of iterator.
    208208                          );
     
    212212 * Get next metadata item in iterator list.
    213213 *
    214  * @return psMetadataItem*: Pointer metadata item.
    215  */
    216 psMetadataItem *psMetadataGetNext(psMetadata * restrict md,     ///< Metadata collection to iterate.
     214 * @return psMetadataItem* : Pointer metadata item.
     215 */
     216psMetadataItem* psMetadataGetNext(psMetadata* restrict md,     ///< Metadata collection to iterate.
    217217                                  const char *restrict match,   ///< Beginning of key name.
    218218                                  int which     ///< Iterator to be used.
     
    223223 * Get previous metadata item in iterator list.
    224224 *
    225  * @return psMetadataItem*: Pointer metadata item.
    226  */
    227 psMetadataItem *psMetadataGetPrevious(psMetadata * restrict md, ///< Metadata collection to iterate.
     225 * @return psMetadataItem* : Pointer metadata item.
     226 */
     227psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, ///< Metadata collection to iterate.
    228228                                      const char *restrict match,       ///< Beginning of key name.
    229229                                      int which ///< Iterator to be used.
     
    238238 * metadata type is any other data type, printing is not allowed.
    239239 *
    240  * @return psMetadataItem*: Pointer metadata item.
     240 * @return psMetadataItem* : Pointer metadata item.
    241241 */
    242242void psMetadataItemPrint(FILE * fd,     ///< Pointer to file to write metadata item.
    243243                         const char *format,    ///< Format to print metadata item.
    244                          const psMetadataItem * restrict metadataItem   ///< Metadata item to print.
     244                         const psMetadataItem* restrict metadataItem   ///< Metadata item to print.
    245245                        );
    246246
     
    250250 * unimplemented.
    251251 *
    252  * @return psMetadata*: Pointer metadata.
    253  */
    254 psMetadata *psMetadataReadHeader(psMetadata * output,   ///< Resulting metadata from read.
     252 * @return psMetadata* : Pointer metadata.
     253 */
     254psMetadata* psMetadataReadHeader(psMetadata* output,   ///< Resulting metadata from read.
    255255                                 char *extname, ///< File name extension string.
    256256                                 int extnum,    ///< File name extension number. Starts at 1.
     
    262262 * Read a metadata header from file. If the file is not found, an error is reported.
    263263 *
    264  * @return psMetadata*: Pointer metadata.
    265  */
    266 psMetadata *psMetadataFReadHeader(psMetadata * output,  ///< Resulting metadata from read.
     264 * @return psMetadata* : Pointer metadata.
     265 */
     266psMetadata* psMetadataFReadHeader(psMetadata* output,  ///< Resulting metadata from read.
    267267                                  char *extName,        ///< File name extension string.
    268268                                  int extNum,   ///< File name extension number.
Note: See TracChangeset for help on using the changeset viewer.