Ice Sheet System Model  4.18
Code documentation
Observation.cpp
Go to the documentation of this file.
1 
5 #include <stdlib.h>
6 #include <cmath>
7 #include <utility>
8 #include "../classes.h"
9 
10 /*Observation constructors and destructor*/
12  return;
13 }
14 /*}}}*/
15 Observation::Observation(double x_in,double y_in,int xi_in,int yi_in,int index_in,double value_in){/*{{{*/
16 
17  this->x = x_in;
18  this->y = y_in;
19  this->xi = xi_in;
20  this->yi = yi_in;
21  this->index = index_in;
22  this->value = value_in;
23  this->weight = 1.;
24 
25 }
26 /*}}}*/
27 Observation::Observation(double x_in, double y_in,double value_in){
28  this->x = x_in;
29  this->y = y_in;
30  this->value = value_in;
31 
32  this->xi = 0;
33  this->yi = 0;
34  this->index = 0;
35  this->weight = 0.;
36 }
38  return;
39 }
40 /*}}}*/
41 
42 /*Object virtual functions definitions:*/
43 Object* Observation::copy(void){/*{{{*/
44 
45  Observation* observation = new Observation(this->x,this->y,this->xi,this->yi,this->index,this->value);
46 
47  observation->weight = this->weight;
48 
49  return (Object*) observation;
50 
51 }
52 /*}}}*/
53 void Observation::Echo(void){/*{{{*/
54 
55  _printf_("Observation\n");
56  _printf_(" index : " << this->index << "\n");
57  _printf_(" x : " << this->x << "\n");
58  _printf_(" y : " << this->y << "\n");
59  _printf_(" xi : \n"); printbinary(this->xi); _printf_("\n");
60  _printf_(" yi : \n"); printbinary(this->yi); _printf_("\n");
61  _printf_(" weight: " << this->weight << "\n");
62  _printf_(" value : " << this->value << "\n");
63 }
64 /*}}}*/
65 
66 /*Observations functions*/
67 void Observation::WriteXYObs(double* px,double* py,double* pobs){/*{{{*/
68  *px = this->x;
69  *py = this->y;
70  *pobs = this->value;
71 }
72 /*}}}*/
73 
74 /*Covertree*/
75 bool Observation::operator==(const Observation& ob) const{/*{{{*/
76  return (ob.x == this->x && ob.y == this->y && ob.value == this->value);
77 }/*}}}*/
78 double Observation::distance(const Observation& ob) const{/*{{{*/
79  return std::sqrt( (std::pow( (ob.x - this->x), 2 ) + std::pow((ob.y - this->y), 2) ));
80 }
81 /*}}}*/
82 void Observation::print(void) const{/*{{{*/
83 
84  _printf_("Observation\n");
85  _printf_(" x : " << this->x << "\n");
86  _printf_(" y : " << this->y << "\n");
87  _printf_(" value : " << this->value << "\n");
88 }
89 /*}}}*/
90 void Observation::WriteXYObs(const Observation& ob, double* px, double* py, double* pobs){/*{{{*/
91  *px = ob.x;
92  *py = ob.y;
93  *pobs = ob.value;
94 }/*}}}*/
Observation::distance
double distance(const Observation &ob) const
Definition: Observation.cpp:78
Observation::Echo
void Echo()
Definition: Observation.cpp:53
Observation::Observation
Observation()
Definition: Observation.cpp:11
Observation
Definition: Observation.h:10
Observation::x
double x
Definition: Observation.h:13
Observation::operator==
bool operator==(const Observation &ob) const
Definition: Observation.cpp:75
_printf_
#define _printf_(StreamArgs)
Definition: Print.h:22
printbinary
void printbinary(int n)
Definition: PrintArrays.cpp:76
Observation::yi
int yi
Definition: Observation.h:14
Observation::WriteXYObs
void WriteXYObs(const Observation &ob, double *px, double *py, double *pobs)
Definition: Observation.cpp:90
Object
Definition: Object.h:13
Observation::xi
int xi
Definition: Observation.h:14
Observation::y
double y
Definition: Observation.h:13
Observation::index
int index
Definition: Observation.h:15
Observation::weight
double weight
Definition: Observation.h:16
Observation::print
void print() const
Definition: Observation.cpp:82
Observation::value
double value
Definition: Observation.h:17
Observation::~Observation
~Observation()
Definition: Observation.cpp:37
Observation::copy
Object * copy()
Definition: Observation.cpp:43