casacore
Loading...
Searching...
No Matches
ExtendSpecifier.h
Go to the documentation of this file.
1//# ExtendSpecifier.h: Specification of new and stretched lattice axes
2//# Copyright (C) 2001
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: casa-feedback@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#ifndef CASA_EXTENDSPECIFIER_2_H
27#define CASA_EXTENDSPECIFIER_2_H
28
29
30//# Includes
31#include "IPosition.h"
32
33namespace casacore { //# NAMESPACE CASACORE - BEGIN
34
35//# Forward Declarations
36class Slicer;
37
38// <summary>
39// Specification of new and stretched lattice axes
40// </summary>
41
42// <use visibility=local>
43
44// <reviewed reviewer="" date="yyyy/mm/dd" tests="tExtendSpecifier.cc" demos="">
45// </reviewed>
46
47// <prerequisite>
48// <li> <linkto class="IPosition">IPosition</linkto>
49// </prerequisite>
50
51// <synopsis>
52// ExtendSpecifier is a class internally used by casacore class
53// ExtendLattice.
54// It holds the information which axes are stretched and which axes
55// are new. Note that a stretched axis has to have length 1 in the
56// original shape.
57// <p>
58// The class only contains the functionality needed by ExtendLattice.
59// which are (mainly) 2 conversion functions. One function converts
60// a slicer from the extended lattice to the original lattice, so
61// ExtendLattice can read the correct data.
62// The other function converts a shape in the original lattice to the
63// shape in the extended lattice.
64// <br>Some data is precalculated for more efficient processing
65// of the conversion of slicers and shapes.
66// </synopsis>
67
68// <example>
69// <srcblock>
70// IPosition oldShape(4,10,1,3,1);
71// IPosition newShape(5,10,1,5,3,8);
72// ExtendSpecifier spec (oldShape, newShape, IPosition(1,2), IPosition(1,4));
73// </srcblock>
74// This example extends the old shape to the new shape.
75// <br>The 3rd argument tells that axes 2 is new. The newShape tells that
76// its length will be 5. Note that adding this axis means that axes 2
77// in the old shape will get axes 3 in the new shape.
78// <br>The 4th argument tells that axes 4 (in the new shape!!) is stretched
79// (to 8 according to newShape).
80// </example>
81
82//# <todo asof="yyyy/mm/dd">
83//# </todo>
84
86{
87public:
88 // Default constructor generates empty IPositions.
90
91 // Tell if no or all degenerate axes have to be removed.
93 const IPosition& newShape,
94 const IPosition& newAxes,
95 const IPosition& stretchAxes);
96
97 // Return the new shape.
98 const IPosition& newShape() const
99 { return itsNewShape; }
100
101 // Return the new axes.
102 const IPosition& newAxes() const
103 { return itsNewAxes; }
104
105 // Return the axes to be stretched.
106 const IPosition& stretchAxes() const
107 { return itsStretchAxes; }
108
109 // Return the old shape.
110 const IPosition& oldShape() const
111 { return itsOldShape; }
112
113 // Return the axes to be extended (i.e. new and stretch axes).
114 const IPosition& extendAxes() const
115 { return itsExtendAxes; }
116
117 // Return the old axes (i.e. axes new nor stretched) as in old shape.
118 const IPosition& oldOldAxes() const
119 { return itsOldOldAxes; }
120
121 // Return the old axes as in new shape.
122 const IPosition& oldNewAxes() const
123 { return itsOldNewAxes; }
124
125 // Convert the slicer to the specification for the old shape.
126 // It fills <src>shape</src> with the shape to reform the section
127 // length such that it contains the new axes.
128 Slicer convert (IPosition& shape, const Slicer& section) const;
129
130 // Convert a shape to the specification for the new shape.
132
133private:
134 // Fill the flags for the given axes.
135 // It throws an exception if the axis is invalid or multiply given.
136 void fill (bool* flags, size_t nrdim, const IPosition& axes) const;
137
145};
146
147} //# NAMESPACE CASACORE - END
148
149#endif
void fill(bool *flags, size_t nrdim, const IPosition &axes) const
Fill the flags for the given axes.
const IPosition & newAxes() const
Return the new axes.
Slicer convert(IPosition &shape, const Slicer &section) const
Convert the slicer to the specification for the old shape.
const IPosition & oldOldAxes() const
Return the old axes (i.e.
ExtendSpecifier(const IPosition &oldShape, const IPosition &newShape, const IPosition &newAxes, const IPosition &stretchAxes)
Tell if no or all degenerate axes have to be removed.
const IPosition & oldNewAxes() const
Return the old axes as in new shape.
const IPosition & oldShape() const
Return the old shape.
const IPosition & extendAxes() const
Return the axes to be extended (i.e.
const IPosition & newShape() const
Return the new shape.
const IPosition & stretchAxes() const
Return the axes to be stretched.
IPosition convertNew(const IPosition &oldShape) const
Convert a shape to the specification for the new shape.
ExtendSpecifier()
Default constructor generates empty IPositions.
this file contains all the compiler specific defines
Definition mainpage.dox:28
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape.
Definition ExprNode.h:1991