casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ArrayModel.h
Go to the documentation of this file.
00001 //# ArrayModel.h: this defines ArrayModel
00002 //# Copyright (C) 1996,1997,1998,1999
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //#
00027 //# $Id$
00028 
00029 #ifndef SYNTHESIS_ARRAYMODEL_H
00030 #define SYNTHESIS_ARRAYMODEL_H
00031 
00032 
00033 #include <casa/aips.h>
00034 #include <synthesis/MeasurementEquations/LinearModel.h>
00035 #include <casa/Arrays/Array.h>
00036 
00037 namespace casa { //# NAMESPACE CASA - BEGIN
00038 
00039 // <summary> models with an internal & external representation 
00040 // as an array </summary>
00041 
00042 // <use visibility=export>
00043 
00044 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00045 // </reviewed>
00046 
00047 // <prerequisite>
00048 //   <li> <linkto module="Arrays">Arrays</linkto>
00049 //   <li> <linkto class="LinearModel">LinearModel</linkto>
00050 //   <li> LinearModel/LinearEquation paradigm
00051 // </prerequisite>
00052 //
00053 // <synopsis>
00054 // An ArrayModel is a base class for Models that can be
00055 // represented by arrays. It is expected that this class will be mainly used
00056 // as base classes for other classes which will then provide the solve()
00057 // functions necessary to update the model given an equation.
00058 // 
00059 // However this class does not contain any pure virtual functions and hence
00060 // can be used "as is". An example of this is given below. For an example of
00061 // how this class can be used by derived classes see the 
00062 // <linkto class=HogbomCleanModel>HogbomCleanModel</linkto> 
00063 // class.
00064 //
00065 // This class makes an internal copy of the Array supplied to it (either
00066 // when constructed or when using the setModel function). If this is found
00067 // to significantly affect performance (execution speed or memory
00068 // requirements) this may be changed to a reference, perhaps using a smart
00069 // pointer like the <linkto class=COWPtr>COWPtr</linkto>
00070 // </synopsis>
00071 //
00072 // <example>
00073 // <srcblock>
00074 // ArrayModel<Float> currentModel(); // Cannot use the model yet!
00075 // {
00076 //   Matrix<Float> bestGuess(32,32);
00077 //    ... put your best guess into the Matrix ...
00078 //   currentModel.setModel(bestGuess); // This does a real copy
00079 // }
00080 // ConvolutionEquation eqn(psf, dirty); // psf, and dirty are arrays defined
00081 //                                      // elsewhere.
00082 // eqn.evaluate(result, currentModel); // Here result is the convolution of
00083 //                                     // of the model with the psf.
00084 // </srcblock>
00085 // </example>
00086 //
00087 // <motivation>
00088 // All the different image plane based clean algorithms have a common
00089 // implementation in that they can use an array to store the current
00090 // model. This class provides a way to abstract this functionality.
00091 // </motivation>
00092 //
00093 // <templating arg=T>
00094 // While the template arguement for this class can be just about anything,
00095 // the use of this class with an equation class will significantly restrict
00096 // the possible templates. I have used this class (or derivations of it)
00097 // with the following data types.
00098 //    <li> Float
00099 //    <li> StokesVector
00100 // </templating>
00101 //
00102 // <thrown>
00103 // This class does not explicitly throw exceptions however the objects used
00104 // by this class may
00105 // </thrown>
00106 //
00107 // <todo asof="1996/05/14">
00108 //   <li> Decide whether to copy the input array by reference or stay with
00109 //   the current scheme.
00110 // </todo>
00111 
00112 template<class T> class ArrayModel: 
00113   public LinearModel<Array<T> > {
00114 public:
00115 
00116   ArrayModel();
00117   ArrayModel(const Array<T> & model);
00118   ArrayModel(Array<T> & model);
00119 
00120   virtual const Array<T> & getModel() const;
00121   virtual void getModel(Array<T>& model) const;
00122   virtual void setModel(const Array<T>& model);
00123   virtual void setModel(Array<T> & model);
00124 
00125 protected:
00126   Array<T> theModel;
00127 };
00128 
00129 
00130 } //# NAMESPACE CASA - END
00131 
00132 #ifndef AIPS_NO_TEMPLATE_SRC
00133 #include <synthesis/MeasurementEquations/ArrayModel.tcc>
00134 #endif //# AIPS_NO_TEMPLATE_SRC
00135 #endif