"Fossies" - the Fresh Open Source Software Archive

Member "gama-2.05/lib/gnu_gama/model.h" (10 May 2019, 2630 Bytes) of package /linux/privat/gama-2.05.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "model.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2     GNU Gama -- adjustment of geodetic networks
    3     Copyright (C) 2003  Ales Cepek <cepek@gnu.org>
    4 
    5     This file is part of the GNU Gama C++ library.
    6 
    7     This library is free software; you can redistribute it and/or modify
    8     it under the terms of the GNU General Public License as published by
    9     the Free Software Foundation; either version 3 of the License, or
   10     (at your option) any later version.
   11 
   12     This library is distributed in the hope that it will be useful,
   13     but WITHOUT ANY WARRANTY; without even the implied warranty of
   14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   15     GNU General Public License for more details.
   16 
   17     You should have received a copy of the GNU General Public License
   18     along with this library; if not, write to the Free Software
   19     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
   20 */
   21 
   22 #ifndef GNU_gama_mathematical_model_h_gnugamamodel_gnu_gama_gmodel_h
   23 #define GNU_gama_mathematical_model_h_gnugamamodel_gnu_gama_gmodel_h
   24 
   25 #include <gnu_gama/obsdata.h>
   26 #include <gnu_gama/visitor.h>
   27 
   28 namespace GNU_gama {
   29 
   30   // Three basic components of mathematical model (of geodetic
   31   // adjustment) are functional relations (class Model), unknown
   32   // parameters and constants (class Parameter) and observables (class
   33   // Observation).
   34 
   35   // Model, Parameter and Observation classes are logically
   36   // related. To brake the source code dependency we use the 'acyclic
   37   // visitor' pattern, where Model objects are visiting Observation
   38   // objects.
   39 
   40   // BaseVisitor is a completely degenerated class having only
   41   // the virtual destructor.
   42 
   43   /** Base observation class.
   44    */
   45 
   46   template <typename Cluster, typename Matrix, typename Index=std::size_t>
   47   class Observation
   48   {
   49   public:
   50 
   51     Cluster*        cluster;
   52     Index           cluster_index;
   53     typedef Matrix  CovarianceMatrix;
   54 
   55     Observation() : cluster(0), cluster_index(0), active_(true) {}
   56     virtual ~Observation() {}
   57 
   58     virtual int  dimension() const = 0;
   59     virtual void accept(BaseVisitor* visitor) = 0;
   60 
   61     bool active() const     { return  active_;      }
   62     bool set_active(bool b) { return (active_ = b); }
   63 
   64 
   65   private:
   66 
   67     bool active_;
   68   };
   69 
   70 
   71   /** Base template class Model (mathematical model of geodetic
   72    *  adjustment)
   73    */
   74 
   75   template <typename Observation>
   76   class Model
   77   {
   78   public:
   79     typedef typename
   80           ObservationData<Observation>::ClusterList   ClusterList;
   81     typedef Observation                               ObservationType;
   82     typedef ObservationData<Observation>              ObsData;
   83 
   84     ObsData  obsdata;
   85   };
   86 
   87 }
   88 
   89 #endif