casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VisVector.h
Go to the documentation of this file.
1 //# VisVector.h: Definition of VisVector
2 //# Copyright (C) 1996,1997,2000,2001,2002,2003
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 adressed 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 
28 #ifndef SYNTHESIS_VISVECTOR_H
29 #define SYNTHESIS_VISVECTOR_H
30 
31 #include <casa/aips.h>
32 #include <casa/BasicSL/Complex.h>
33 #include <casa/Arrays/Cube.h>
34 #include <casa/iostream.h>
35 #include <casa/Exceptions/Error.h>
36 
37 namespace casa { //# NAMESPACE CASA - BEGIN
38 
39 class VisVector {
40 
41 public:
42 
43  enum VisType{One=1, Two=2, Four=4};
44 
45  // Construct from length
46  VisVector(const VisType& len, const casacore::Bool& owner=false);
47 
48  // Dtor
49  ~VisVector();
50 
51  // Assignment (data copy)
52  inline VisVector& operator=(const VisVector& vv) {
53  for (casacore::Int i=0;i<vistype_;i++) {
54  v_[i]=vv.v_[i];
55  if (f0_ && vv.f0_) f_[i]=vv.f_[i];
56  }
57  return *this;
58  };
59 
60  // Set type id:
61  void setType(const VisVector::VisType& type);
62 
63  // Return type id
64  inline VisType& type() { return vistype_; };
65 
66  // Reassign origin
67  inline void sync(casacore::Complex& vis) {
68  if (!owner_) {v0_=&vis; f0_=NULL; origin();}
69  else {throw(casacore::AipsError("Illegal VisVector sync")); }
70  };
71 
72  // Reassign origin
73  inline void sync(casacore::Complex& vis, casacore::Bool& flag) {
74  if (!owner_) {v0_=&vis; f0_=&flag; origin();}
75  else {throw(casacore::AipsError("Illegal VisVector sync")); }
76  };
77 
78 
79  // Go to origin
80  inline void origin() {v_=v0_;f_=f0_;};
81 
82  // Increment to next vector
83  // (use function pointers in ctor to handle owner_ case?)
84  inline void operator++() {
85  if (!owner_) {v_+=vistype_; if (f0_) f_+=vistype_;}
86  else throw(casacore::AipsError("Illegal VisVector ++"));
87  };
88  inline void operator++(int) {
89  if (!owner_) {v_+=vistype_; if (f0_) f_+=vistype_;}
90  else throw(casacore::AipsError("Illegal VisVector ++"));
91  };
92 
93  // Advance step vectors forward
94  inline void advance(const casacore::Int& step) {
95  if (!owner_) {v_+=(step*vistype_); if (f0_) f_+=(step*vistype_);}
96  else throw(casacore::AipsError("Illegal VisVector advance"));
97  };
98 
99  // Re-order elements
100  void polznMap();
101  void polznUnMap();
102 
103  inline void zero() {
104  for (casacore::Int i=0;i<vistype_;i++) {v_[i]=casacore::Complex(0.0);if (f0_) f_[i]=true;}
105  };
106 
107  // Print it out
108  friend std::ostream& operator<<(std::ostream& os, const VisVector& vec);
109 
110  // Give access to Mueller,Jones classes for application
111  friend class Mueller;
112  friend class MuellerDiag;
113  friend class MuellerDiag2;
114  friend class AddMuellerDiag;
115  friend class AddMuellerDiag2;
116  friend class MuellerScal;
117  friend class Jones;
118  friend class JonesGenLin;
119  friend class JonesDiag;
120  friend class JonesScal;
121 
122 
123 
124 private:
125 
126  // Default ctor private to avoid use
127  VisVector() {};
128 
129  // VisVector length (4, 2, or 1)
131 
132  // Does the VisVector own the storage, or are
133  // we pointing to something external
135 
136  // Pointer to origin
139 
140  // Moving pointer
143 
144 
145 };
146 
147 // Globals:
148 
149 // Return VisType according to length of data array corr axis
151 
152 
153 } //# NAMESPACE CASA - END
154 
155 #endif
156 
157 
158 
casacore::Complex * v0_
Pointer to origin.
Definition: VisVector.h:137
int Int
Definition: aipstype.h:50
VisVector()
Default ctor private to avoid use.
Definition: VisVector.h:127
VisType vistype_
VisVector length (4, 2, or 1)
Definition: VisVector.h:127
void sync(casacore::Complex &vis, casacore::Bool &flag)
Reassign origin.
Definition: VisVector.h:73
casacore::Complex * v_
Moving pointer.
Definition: VisVector.h:141
~VisVector()
Dtor.
casacore::Bool * f0_
Definition: VisVector.h:138
Parallel-hands only &quot;additive Mueller&quot;.
Definition: Mueller.h:268
void operator++()
Increment to next vector (use function pointers in ctor to handle owner_ case?)
Definition: VisVector.h:84
VisVector & operator=(const VisVector &vv)
Assignment (data copy)
Definition: VisVector.h:52
Full polarization &quot;additive Mueller&quot;.
Definition: Mueller.h:301
VisType & type()
Return type id.
Definition: VisVector.h:64
void advance(const casacore::Int &step)
Advance step vectors forward.
Definition: VisVector.h:94
casacore::Bool * f_
Definition: VisVector.h:142
void polznMap()
Re-order elements.
void setType(const VisVector::VisType &type)
Set type id:
VisVector::VisType visType(const casacore::Int &ncorr)
Globals:
friend std::ostream & operator<<(std::ostream &os, const VisVector &vec)
Print it out.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Base class for all Casacore library errors.
Definition: Error.h:134
casacore::Bool owner_
Does the VisVector own the storage, or are we pointing to something external.
Definition: VisVector.h:134
void sync(casacore::Complex &vis)
Reassign origin.
Definition: VisVector.h:67
void operator++(int)
Definition: VisVector.h:88
void origin()
Go to origin.
Definition: VisVector.h:80