Changeset 15562 for trunk/psModules/src/objects/pmSource.c
- Timestamp:
- Nov 9, 2007, 3:09:20 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmSource.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmSource.c
r15232 r15562 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1.4 0$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-1 0-06 02:29:47$8 * @version $Revision: 1.41 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-11-10 01:09:20 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 77 77 } 78 78 79 bool psMemCheckSource(psPtr ptr) 80 { 81 PS_ASSERT_PTR(ptr, false); 82 return ( psMemGetDeallocator(ptr) == (psFreeFunc) sourceFree); 83 } 84 79 85 /****************************************************************************** 80 86 pmSourceAlloc(): Allocate the pmSource structure and initialize its members 81 87 to NULL. 82 88 *****************************************************************************/ 89 83 90 pmSource *pmSourceAlloc() 84 91 { … … 132 139 pmSource *pmSourceCopy(pmSource *in) 133 140 { 141 if (in == NULL) { 142 return(NULL); 143 } 134 144 // this copy is used to allow multiple fit attempts on the 135 145 // same object. the pixels, weight, and mask arrays all point to … … 139 149 140 150 // this is actually the same peak as the original, is this the correct way to handle this? 141 source->peak = pmPeakAlloc (in->peak->x, in->peak->y, in->peak->value, in->peak->type); 142 source->peak->xf = in->peak->xf; 143 source->peak->yf = in->peak->yf; 144 source->peak->flux = in->peak->flux; 145 source->peak->SN = in->peak->SN; 151 if (in->peak != NULL) { 152 source->peak = pmPeakAlloc (in->peak->x, in->peak->y, in->peak->value, in->peak->type); 153 source->peak->xf = in->peak->xf; 154 source->peak->yf = in->peak->yf; 155 source->peak->flux = in->peak->flux; 156 source->peak->SN = in->peak->SN; 157 } 146 158 147 159 // copy the values in the moments structure 148 source->moments = pmMomentsAlloc(); 149 *source->moments = *in->moments; 160 if (in->moments != NULL) { 161 source->moments = pmMomentsAlloc(); 162 *source->moments = *in->moments; 163 } 150 164 151 165 // These images are all views to the parent. 152 166 // We want a new view, but pointing at the same pixels. 153 source->pixels = psImageCopyView (NULL, in->pixels);154 source->weight = psImageCopyView (NULL, in->weight);155 source->maskView = psImageCopyView (NULL, in->maskView);167 source->pixels = psImageCopyView(NULL, in->pixels); 168 source->weight = psImageCopyView(NULL, in->weight); 169 source->maskView = psImageCopyView(NULL, in->maskView); 156 170 157 171 // the maskObj is a unique mask array; create a new mask image … … 173 187 psF32 Radius) 174 188 { 189 PS_ASSERT_PTR_NON_NULL(mySource, false); 190 PS_ASSERT_PTR_NON_NULL(readout, false); 191 PS_ASSERT_PTR_NON_NULL(readout->image, false); 192 PS_ASSERT_INT_POSITIVE(Radius, false); 193 175 194 psRegion srcRegion; 176 195 … … 200 219 psF32 Radius) 201 220 { 221 PS_ASSERT_PTR_NON_NULL(mySource, false); 222 PS_ASSERT_PTR_NON_NULL(readout, false); 223 PS_ASSERT_PTR_NON_NULL(readout->image, false); 224 PS_ASSERT_INT_POSITIVE(Radius, false); 225 202 226 bool extend; 203 227 psRegion newRegion; 204 205 if (Radius == 0)206 return false;207 228 208 229 // check to see if new region is completely contained within old region … … 814 835 815 836 // should we call pmSourceCacheModel if it does not exist? 816 bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add, psMaskType maskVal, int dx, int dy) { 817 837 bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add, 838 psMaskType maskVal, int dx, int dy) 839 { 840 PS_ASSERT_PTR_NON_NULL(source, false); 818 841 bool status; 819 842 … … 904 927 pmModel *pmSourceGetModel (bool *isPSF, const pmSource *source) 905 928 { 929 PS_ASSERT_PTR_NON_NULL(source, NULL); 906 930 907 931 pmModel *model;
Note:
See TracChangeset
for help on using the changeset viewer.
