mult_farfield_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 MULT_FARFIELD_EXPANSION
00044 #define MULT_FARFIELD_EXPANSION
00045
00046 #include <climits>
00047
00048
00049 #include "fastlib/fastlib.h"
00050 #include "kernel_aux.h"
00051 #include "mult_series_expansion_aux.h"
00052
00053 template<typename TKernelAux>
00054 class MultLocalExpansion;
00055
00059 template<typename TKernelAux>
00060 class MultFarFieldExpansion {
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(MultFarFieldExpansion) {
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
00111 double get_weight_sum() const { return coeffs_[0]; }
00112
00114 void set_order(int new_order) { order_ = new_order; }
00115
00120 void set_center(const Vector ¢er) {
00121
00122 for(index_t i = 0; i < center.length(); i++) {
00123 center_[i] = center[i];
00124 }
00125 }
00126
00127
00128
00133 void AccumulateCoeffs(const Matrix& data, const Vector& weights,
00134 int begin, int end, int order);
00135
00140 void RefineCoeffs(const Matrix& data, const Vector& weights,
00141 int begin, int end, int order);
00142
00146 double EvaluateField(const Matrix& data, int row_num, int order) const;
00147 double EvaluateField(const double *x_q, int order) const;
00148
00153 double MixField(const Matrix &data, int node1_begin, int node1_end,
00154 int node2_begin, int node2_end,
00155 const MultFarFieldExpansion &fe2,
00156 const MultFarFieldExpansion &fe3,
00157 int order2, int order3) const;
00158
00159 double ConvolveField(const MultFarFieldExpansion &fe, int order) const;
00160
00165 double ConvolveField(const MultFarFieldExpansion &fe2,
00166 const MultFarFieldExpansion &fe3,
00167 int order1, int order2, int order3) const;
00168
00173 void Init(const Vector& center, const TKernelAux &ka);
00174 void Init(const TKernelAux &ka);
00175
00180 template<typename TBound>
00181 int OrderForEvaluating(const TBound &far_field_region,
00182 const TBound &local_field_region,
00183 double min_dist_sqd_regions,
00184 double max_dist_sqd_regions,
00185 double max_error, double *actual_error) const;
00186
00196 template<typename TBound>
00197 int OrderForConvertingToLocal(const TBound &far_field_region,
00198 const TBound &local_field_region,
00199 double min_dist_sqd_regions,
00200 double max_dist_sqd_regions,
00201 double required_bound,
00202 double *actual_error) const;
00203
00207 void PrintDebug(const char *name="", FILE *stream=stderr) const;
00208
00213 void TranslateFromFarField(const MultFarFieldExpansion &se);
00214
00219 void TranslateToLocal(MultLocalExpansion<TKernelAux> &se,
00220 int truncation_order);
00221
00222 };
00223
00224 #define INSIDE_MULT_FARFIELD_EXPANSION_H
00225 #include "mult_farfield_expansion_impl.h"
00226 #undef INSIDE_MULT_FARFIELD_EXPANSION_H
00227
00228 #endif