local_expansion.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00043 #ifndef LOCAL_EXPANSION
00044 #define LOCAL_EXPANSION
00045
00046 #include <climits>
00047
00048
00049 #include "fastlib/fastlib.h"
00050 #include "kernel_aux.h"
00051 #include "series_expansion_aux.h"
00052
00053 template<typename TKernelAux>
00054 class FarFieldExpansion;
00055
00059 template<typename TKernelAux>
00060 class LocalExpansion {
00061
00062 private:
00063
00065 Vector center_;
00066
00068 Vector coeffs_;
00069
00071 int order_;
00072
00074 const TKernelAux *ka_;
00075
00077 const typename TKernelAux::TKernel *kernel_;
00078
00080 const typename TKernelAux::TSeriesExpansionAux *sea_;
00081
00082 OT_DEF(LocalExpansion) {
00083 OT_MY_OBJECT(center_);
00084 OT_MY_OBJECT(coeffs_);
00085 OT_MY_OBJECT(order_);
00086 }
00087
00088 public:
00089
00090
00091
00093 double bandwidth_sq() const { return kernel_->bandwidth_sq(); }
00094
00096 Vector* get_center() { return ¢er_; }
00097
00098 const Vector* get_center() const { return ¢er_; }
00099
00101 const Vector& get_coeffs() const { return coeffs_; }
00102
00104 int get_order() const { return order_; }
00105
00107 int get_max_order() const { return sea_->get_max_order(); }
00108
00110 void set_order(int new_order) { order_ = new_order; }
00111
00112
00113
00118 void AccumulateCoeffs(const Matrix& data, const Vector& weights,
00119 int begin, int end, int order);
00120
00124 void RefineCoeffs(const Matrix& data, const Vector& weights,
00125 int begin, int end, int order) { }
00126
00130 double EvaluateField(const Matrix& data, int row_num) const;
00131 double EvaluateField(const double *x_q) const;
00132
00137 void Init(const Vector& center, const TKernelAux &ka);
00138 void Init(const TKernelAux &ka);
00139
00144 template<typename TBound>
00145 int OrderForEvaluating(const TBound &far_field_region,
00146 const TBound &local_field_region,
00147 double min_dist_sqd_regions,
00148 double max_dist_sqd_regions,
00149 double max_error, double *actual_error) const;
00150
00154 void PrintDebug(const char *name="", FILE *stream=stderr) const;
00155
00160 void TranslateFromFarField(const FarFieldExpansion<TKernelAux> &se);
00161
00166 void TranslateToLocal(LocalExpansion &se);
00167
00168 };
00169
00170 #define INSIDE_LOCAL_EXPANSION_H
00171 #include "local_expansion_impl.h"
00172 #undef INSIDE_LOCAL_EXPANSION_H
00173
00174 #endif