casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CCList.h
Go to the documentation of this file.
1 //# CCList.h:
2 //# Copyright (C) 1998,1999
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 //# $Id$
28 
29 #ifndef SYNTHESIS_CCLIST_H
30 #define SYNTHESIS_CCLIST_H
31 
32 
33 #include <casa/aips.h>
34 #include <casa/Containers/Block.h>
35 #include <casa/Arrays/IPosition.h>
36 #include <casa/Exceptions/Error.h>
37 #include <casa/Utilities/Assert.h>
38 #include <casa/Utilities/GenSort.h>
39 namespace casa { //# NAMESPACE CASA - BEGIN
40 
41 // <summary>
42 // </summary>
43 
44 // <use visibility=local> or <use visibility=export>
45 
46 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
47 // </reviewed>
48 
49 // <prerequisite>
50 // <li> SomeClass
51 // <li> SomeOtherClass
52 // <li> some concept
53 // </prerequisite>
54 //
55 // <etymology>
56 // </etymology>
57 //
58 // <synopsis>
59 // </synopsis>
60 //
61 // <example>
62 // </example>
63 //
64 // <motivation>
65 // </motivation>
66 //
67 // <templating arg=T>
68 // <li>
69 // <li>
70 // </templating>
71 //
72 // <thrown>
73 // <li>
74 // <li>
75 // </thrown>
76 //
77 // <todo asof="yyyy/mm/dd">
78 // <li> add this feature
79 // <li> fix this bug
80 // <li> start discussion of this possible extension
81 // </todo>
82 
83 class CCList
84 {
85 public:
86 
87  // vanilla constructor (npol=1, nComp=0)
88  CCList();
89 
90  // more controlling constructor:
91  // How many casacore::Stokes per flux casacore::Block?
92  // How many spatial dimensions per position?
93  // How many total components to allocate for?
95 
96  // copy constructor
97  CCList(const CCList & other);
98 
99  // destructor
100  ~CCList();
101 
102  // operator=
103  CCList & operator=(const CCList & other);
104 
105  // get pointer to the casacore::Block<casacore::Int> which holds the CC's positions in pixel
106  // coordinates. casacore::Block[nDim()*i] holds ith x, casacore::Block[nDim()*i+1] holds ith y
107  // <group>
109  const casacore::Int * positionPtr() const;
110  // </group>
111 
112  // get pointer to the whichCC'th component's position
113  casacore::Int * pixelPosition(const casacore::uInt whichCC);
114 
115  // Get a pointer into the Position casacore::Block for the next free
116  // clean component.
117  // <group>
119  const casacore::Int * freePositionPtr() const;
120  // </group>
121 
122  // get pointer to the casacore::Block<casacore::Float> which holds the CC's Flux.
123  // The flux itself is a casacore::Block, as it may be 1, 2, or 4 Stokes.
124  // casacore::Block[nPol()*i + iPol] holds the ith component's iPol Stokes.
125  // <group>
127  const casacore::Float * fluxPtr() const;
128  // </group>
129 
130  // get pointer to the whichCC'th component's flux
131  casacore::Float * pixelFlux(const casacore::uInt whichCC);
132 
133  // Get a pointer into the Flux casacore::Block for the next free
134  // clean component.
135  // <group>
137  const casacore::Float * freeFluxPtr() const;
138  // </group>
139 
140  // How many polarizations?
141  casacore::uInt nPol() const;
142 
143  // How many dimentions?
144  casacore::uInt nDim() const;
145 
146  // How many components have been filled into the list?
147  // <group>
148  casacore::uInt nComp() const;
149  casacore::uInt & nComp();
150  // </group>
151 
152  // How many components have been allocated for this list?
153  casacore::uInt maxComp() const;
154 
155  // We have free space for how many more components?
156  casacore::uInt freeComp() const;
157 
158  // Make the list bigger or smaller
159  void resize(const casacore::uInt nComp);
160 
161  // add a Component; if not enough space, resize the storage blocks
162  // to 2*maxComp()+1
163  void addComp(const casacore::Block<casacore::Float> & flux, const casacore::Block<casacore::Int> & position);
164 
165  // casacore::Sort components to be organized by tile number.
166  // If the position and Flux blocks have free space at the end, it gets cut off.
167  void tiledSort(const casacore::IPosition & tileShape);
168 
169  // ok() is called to check for an internally consistent state
170  // by most everything, often behind the scenes; sometimes,
171  // the internal state is in flux
172  // after a partial operation, and ok() fails; to turn off ok() checking,
173  // set itsSuspendOKCheck = true and remember to reset it to false
174  // when the state-changing operation is complete.
175  casacore::Bool ok() const;
176 private:
177 
178  // turn OFF error checking via "ok()"
179  void suspendOKCheck();
180 
181  // turn ON error checking vua "ok()"
182  void reactivateOKCheck();
183 
190 };
191 
192 
193 inline casacore::uInt CCList::nPol() const {
195  return itsPol;
196 };
197 
198 inline casacore::uInt CCList::nDim() const {
200  return itsDim;
201 };
202 
205  return itsComp;
206 };
207 
210  return itsComp;
211 };
212 
213 
214 
215 } //# NAMESPACE CASA - END
216 
217 #endif
218 
219 
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
int Int
Definition: aipstype.h:50
CCList()
vanilla constructor (npol=1, nComp=0)
void suspendOKCheck()
turn OFF error checking via &quot;ok()&quot;
casacore::uInt nComp() const
How many components have been filled into the list?
Definition: CCList.h:203
casacore::Float * freeFluxPtr()
Get a pointer into the Flux casacore::Block for the next free clean component.
casacore::Block< casacore::Int > itsPos
Definition: CCList.h:188
casacore::uInt nPol() const
How many polarizations?
Definition: CCList.h:193
void reactivateOKCheck()
turn ON error checking vua &quot;ok()&quot;
void tiledSort(const casacore::IPosition &tileShape)
casacore::Sort components to be organized by tile number.
casacore::Float * pixelFlux(const casacore::uInt whichCC)
get pointer to the whichCC&#39;th component&#39;s flux
casacore::uInt maxComp() const
How many components have been allocated for this list?
CCList & operator=(const CCList &other)
operator=
casacore::Int * pixelPosition(const casacore::uInt whichCC)
get pointer to the whichCC&#39;th component&#39;s position
casacore::Float * fluxPtr()
get pointer to the casacore::Block&lt;casacore::Float&gt; which holds the CC&#39;s Flux.
casacore::Int * freePositionPtr()
Get a pointer into the Position casacore::Block for the next free clean component.
void addComp(const casacore::Block< casacore::Float > &flux, const casacore::Block< casacore::Int > &position)
add a Component; if not enough space, resize the storage blocks to 2*maxComp()+1
casacore::uInt freeComp() const
We have free space for how many more components?
casacore::Int * positionPtr()
get pointer to the casacore::Block&lt;casacore::Int&gt; which holds the CC&#39;s positions in pixel coordinates...
#define DebugAssert(expr, exception)
Definition: Assert.h:185
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::uInt itsComp
Definition: CCList.h:186
~CCList()
destructor
casacore::Block< casacore::Float > itsFlux
Definition: CCList.h:187
float Float
Definition: aipstype.h:54
casacore::uInt nDim() const
How many dimentions?
Definition: CCList.h:198
Base class for all Casacore library errors.
Definition: Error.h:134
casacore::uInt itsPol
Definition: CCList.h:184
void resize(const casacore::uInt nComp)
Make the list bigger or smaller.
casacore::uInt itsDim
Definition: CCList.h:185
casacore::Bool ok() const
ok() is called to check for an internally consistent state by most everything, often behind the scene...
casacore::Bool itsSuspendOKCheck
Definition: CCList.h:189
unsigned int uInt
Definition: aipstype.h:51