Changeset 18912 for issm/trunk-jpl/src/c/classes/kriging/Observation.cpp
- Timestamp:
- 12/03/14 11:37:24 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/kriging/Observation.cpp
r18237 r18912 4 4 5 5 #include <stdlib.h> 6 #include <cmath> 7 #include <utility> 6 8 #include "../classes.h" 7 9 … … 23 25 } 24 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 } 25 37 Observation::~Observation(){/*{{{*/ 26 38 return; … … 59 71 } 60 72 /*}}}*/ 73 74 /*Covertree*/ 75 void Observation::print(void) const{/*{{{*/ 76 77 _printf_("Observation\n"); 78 _printf_(" x : " << this->x << "\n"); 79 _printf_(" y : " << this->y << "\n"); 80 _printf_(" value : " << this->value << "\n"); 81 } 82 /*}}}*/ 83 double Observation::distance(const Observation& ob) const 84 { 85 return std::sqrt( (std::pow( (ob.getXY().first - this->x), 2 ) + std::pow((ob.getXY().second - this->y), 2) )); 86 } 87 88 const std::pair<double, double>& Observation::getXY() const 89 { 90 return std::make_pair(this->x, this->y); 91 } 92 bool Observation::operator==(const Observation& ob) const 93 { 94 return (ob.getXY().first == this->x && ob.getXY().second == this->y && ob.value == this->value); 95 } 96 97 void Observation::WriteXYObs(const Observation& ob, double* px, double* py, double* pobs){ 98 *px = ob.getXY().first; 99 *py = ob.getXY().second; 100 *pobs = ob.value; 101 }
Note:
See TracChangeset
for help on using the changeset viewer.