casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
LatticeModel.h
Go to the documentation of this file.
00001 //# LatticeModel.h: this defines LatticeModel
00002 //# Copyright (C) 1996,1997,1999,2000
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_LATTICEMODEL_H
00030 #define SYNTHESIS_LATTICEMODEL_H
00031 
00032 #include <casa/aips.h>
00033 #include <synthesis/MeasurementEquations/LinearModel.h>
00034 #include <lattices/Lattices/Lattice.h>
00035 
00036 namespace casa { //# NAMESPACE CASA - BEGIN
00037 
00038 // <summary> models with an internal & external representation as an Lattice </summary>
00039 
00040 // <use visibility=export>
00041 
00042 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00043 // </reviewed>
00044 
00045 // <prerequisite>
00046 //   <li> <linkto module="Lattices">Lattices</linkto> module
00047 //   <li> <linkto class="LinearModel">LinearModel</linkto> class
00048 //   <li> LinearModel/LinearEquation paradigm
00049 // </prerequisite>
00050 //
00051 // <synopsis>
00052 // An LatticeModel is a base class for Models that can be
00053 // represented by Lattices. It is expected that this class will be mainly 
00054 // used as base classes for other classes which will then provide the solve()
00055 // functions necessary to update the model given an equation.
00056 // 
00057 // However this class does not contain any pure virtual functions and hence
00058 // can be used "as is". An example of this is given below. For an example of
00059 // how this class can be used by derived classes see the 
00060 // <linkto class=HogbomCleanModel>HogbomCleanModel</linkto> 
00061 // class.
00062 //
00063 // </synopsis>
00064 //
00065 // <example>
00066 // <srcblock>
00067 // LatticeModel<Float> currentModel(); // Cannot use the model yet!
00068 // {
00069 //   PagedImage<Float> bestGuess(Iposition(2,32,32));
00070 //    ... put your best guess into the Matrix ...
00071 //   currentModel.setModel(bestGuess); // This does a real copy
00072 // }
00073 // ConvolutionEquation eqn(psf, dirty); // psf, and dirty are PagedImages defined
00074 //                                      // elsewhere.
00075 // eqn.evaluate(result, currentModel); // Here result is the convolution of
00076 //                                     // of the model with the psf.
00077 // </srcblock>
00078 // </example>
00079 //
00080 // <motivation>
00081 // All the different image plane based clean algorithms have a common
00082 // implementation in that they can use an Lattice (ie, PagedImage)
00083 // to store the current
00084 // model. This class provides a way to abstract this functionality.
00085 // </motivation>
00086 //
00087 // <templating arg=T>
00088 // While the template arguement for this class can be just about anything,
00089 // the use of this class with an equation class will significantly restrict
00090 // the possible templates. I have used this class (or derivations of it)
00091 // with the following data types.
00092 //    <li> Float
00093 //    <li> StokesVector
00094 // </templating>
00095 //
00096 // <thrown>
00097 // This class does not explicitly throw exceptions however the objects used
00098 // by this class may
00099 // </thrown>
00100 //
00101 // <todo asof="1998/11/06">
00102 //   <li>  We don't have any "set" or "constructor" methods which
00103 //   take constants.  We work in terms of pointers now because of
00104 //   Lattice::operator= is protected, and Ger said it was the right thing.
00105 // </todo>
00106 
00107 class LatticeModel
00108   :public LinearModel<Lattice<Float> > {
00109 public:
00110 
00111   LatticeModel(Lattice<Float>& mod);
00112 
00113   // The destructor does nothing.
00114   virtual ~LatticeModel();
00115 
00116   // returns a reference to the model
00117   virtual const Lattice<Float> & getModel() const { return *itsModelPtr;}
00118 
00119   // Change the underlying Model to to the one specified. Reference semantics
00120   // are used so that no data is copied.
00121   virtual void setModel(const Lattice<Float> & model) { itsModelPtr = model.clone(); }
00122 
00123 private:
00124 
00125     Lattice<Float> * itsModelPtr;
00126 };
00127 
00128 
00129 } //# NAMESPACE CASA - END
00130 
00131 #endif