81 unsigned jr, dN =
N * (
N + 1) / 2;
82 rz_pow[0] =
new double[dN];
83 memset(
rz_pow[0], 0, dN *
sizeof(
double));
85 for (jr = 1, dN =
N; jr <
N; ++jr, --dN) {
97 for (jz = 1; jz <=
NPwr; ++jz)
99 for (jr = 1; jr <=
NPwr; ++jr) {
100 for (jz = 0; jz <= (
NPwr - jr); ++jz) {
109 std::set<poly2d_base *>::iterator it;
112 curp = (*it)->max_pwr;
128 out <<
"poly2d_base table size NTab = " <<
NTab <<
"\tmax. power NPwr = " <<
NPwr << std::endl;
131 std::streamsize old_prec =
out.precision(), wdt = prec + 7;
133 out <<
"Table content:" << std::endl;
135 for (jr = 0; jr <=
NPwr; ++jr) {
136 for (jz = 0; jz <= (
NPwr - jr); ++jz) {
137 out << std::setw(wdt) << std::left <<
rz_pow[jr][jz];
139 out <<
"|" << std::endl;
141 out.precision(old_prec);
143 out <<
"\tTable size is not adjusted." << std::endl;
146 out <<
"\tTable is not allocated." << std::endl;
157 }
else if ((r !=
rval) || (z !=
zval))
165 for (
unsigned j = 0;
j <
data.size(); ++
j)
175 unsigned j1, j2, rpow, zpow, noff = 0, jend =
data.size();
177 std::vector<bool>
mask(jend,
false);
180 for (j1 = 0; j1 < jend; ++j1) {
184 rpow =
data[j1].np[0];
185 zpow =
data[j1].np[1];
186 for (j2 = j1 + 1; j2 < jend; ++j2) {
189 if ((rpow ==
data[j2].
np[0]) && (zpow ==
data[j2].
np[1])) {
197 if ((rpow = rpow + zpow) >
max_pwr)
204 std::vector<poly2d_term> newdata;
205 newdata.reserve(jend - noff);
206 for (j1 = 0; j1 < jend; ++j1) {
208 newdata.push_back(
data[j1]);
216 out <<
"\"poly2d_base\" object contains no terms." << std::endl;
219 out <<
data.size() <<
" terms; max. degree = " <<
max_pwr <<
":" << std::endl;
220 std::streamsize old_prec =
out.precision();
223 for (
unsigned it = 1; it <
data.size(); ++it) {
227 out.precision(old_prec);
235 std::vector<poly2d_term> newdata;
236 newdata.reserve(
data.size());
237 unsigned cur_pwr = 0, maxp = 0, oldp =
max_pwr;
238 for (
unsigned it = 0; it <
data.size(); ++it) {
241 if (v3.
coeff != 0.) {
243 newdata.push_back(v3);
244 if ((cur_pwr = v3.
np[0] + v3.
np[1]) > maxp)
248 newdata.resize(newdata.size());
261 for (
unsigned it = 0; it <
data.size(); ++it) {
262 data[it].coeff /= ++
data[it].np[nvar];
273 for (
unsigned it = 0; it <
data.size(); ++it) {
287 std::vector<poly2d_term> newdata;
288 newdata.reserve(
data.size());
289 unsigned cur_pwr = 0, maxp = 0, oldp =
max_pwr;
290 for (
unsigned it = 0; it <
data.size(); ++it) {
292 if ((v3.
coeff != 0.) && (v3.
np[nvar] > 0)) {
294 newdata.push_back(v3);
295 if ((cur_pwr = v3.
np[0] + v3.
np[1]) > maxp)
299 newdata.resize(newdata.size());
311 for (
unsigned it = 0; it <
data.size(); ++it) {
void Print(std::ostream &out=std::cout, const std::streamsize prec=5)
std::vector< poly2d_term > data
static void SetTabSize(const unsigned N)
static std::set< poly2d_base * > poly2d_base_set
void Scale(const double C)
static void SetPoint(const double r, const double z)
void Print(std::ostream &out=std::cout, bool first_term=true)
static void FillTable(const double r, const double z)
static void PrintTab(std::ostream &out=std::cout, const std::streamsize prec=5)
static const double MIN_COEFF