25 int nChoosek(
int n,
int k)
28 Msg::Error(
"Wrong argument for combination. (%d, %d)", n, k);
32 if(k > n / 2) k = n - k;
37 for(
int i = 1; i <= k; i++, n--) (
c *= n) /= i;
43 int order,
int dimSimplex)
46 Msg::Error(
"Wrong sizes for bez2lag matrix generation %d %d -- %d %d",
52 int ndofs = exponent.
size1();
53 int dim = exponent.
size2();
56 for(
int i = 0; i < ndofs; i++) {
57 for(
int j = 0; j < ndofs; j++) {
60 double pointCompl = 1.;
61 int exponentCompl = order;
62 for(
int k = 0; k < dimSimplex; k++) {
63 dd *= nChoosek(exponentCompl, (
int)exponent(i, k)) *
64 pow(point(j, k), exponent(i, k));
65 pointCompl -= point(j, k);
66 exponentCompl -= (int)exponent(i, k);
68 dd *= pow(pointCompl, exponentCompl);
71 for(
int k = dimSimplex; k < dim; k++)
72 dd *= nChoosek(order, (
int)exponent(i, k)) *
73 pow(point(j, k), exponent(i, k)) *
74 pow(1. - point(j, k), order - exponent(i, k));
90 exponent.
size2() != 3) {
92 "Wrong sizes for pyramid's bez2lag matrix generation %d %d -- %d %d",
97 const int ndofs = exponent.
size1();
101 for(
int i = 0; i < ndofs; i++) {
102 for(
int j = 0; j < ndofs; j++) {
103 if(pyr) n01 = exponent(j, 2) + nij;
105 nChoosek(n01, exponent(j, 0)) * nChoosek(n01, exponent(j, 1)) *
106 nChoosek(nk, exponent(j, 2)) *
pow_int(point(i, 0), exponent(j, 0)) *
107 pow_int(point(i, 1), exponent(j, 1)) *
108 pow_int(point(i, 2), exponent(j, 2)) *
109 pow_int(1. - point(i, 0), n01 - exponent(j, 0)) *
110 pow_int(1. - point(i, 1), n01 - exponent(j, 1)) *
111 pow_int(1. - point(i, 2), nk - exponent(j, 2));
120 for(
int i = 0; i < matDouble.
size1(); ++i) {
121 for(
int j = 0; j < matDouble.
size2(); ++j) {
122 matInt(i, j) =
static_cast<int>(matDouble(i, j) + .5);
127 template <
typename D>
139 const int nColumns = lag.
size2();
141 for(
int i = start, n = 0; n <= order; i += inc, ++n) {
142 for(
int j = 0; j < nColumns; ++j) {
f(n, j) = lag(i, j); }
148 for(
int j = 0; j < nColumns; ++j) {
c(0, j) =
f(0, j); }
149 for(
int s = 1; s <= order; ++s) {
150 for(
int k = order; k >= s; --k) {
151 for(
int j = 0; j < nColumns; ++j) {
152 f(k, j) = (
f(k, j) -
f(k - 1, j)) / (x(k) - x(k - s));
155 for(
int k = s; k >= 1; --k) {
156 const D kk =
static_cast<D>(k);
158 kk / s * w(k - 1) * (1 - x(s - 1)) - (1 - kk / s) * w(k) * x(s - 1);
159 for(
int j = 0; j < nColumns; ++j) {
161 kk / s *
c(k - 1, j) + (1 - kk / s) *
c(k, j) +
f(s, j) * w(k);
164 w(0) = -w(0) * x(s - 1);
165 for(
int j = 0; j < nColumns; ++j) {
c(0, j) =
c(0, j) +
f(s, j) * w(0); }
167 for(
int i = start, n = 0; n <= order; i += inc, ++n) {
168 for(
int j = 0; j < nColumns; ++j) {
169 bez(i, j) =
static_cast<double>(
c(n, j));
176 int start = -1,
int inc = -1)
178 if(start < 0) start = 0;
180 convertLag2Bez<double>(lag, order, start, inc, x, bez);
186 : _funcSpaceData(data), _raiser(nullptr)
204 Msg::Error(
"This bezierBasis constructor is not for pyramids!");
240 Msg::Error(
"Unknown function space for parentType %d",
260 Msg::Error(
"This bezierBasis constructor is for pyramids!");
277 generateBez2LagMatrixPyramid(
_exponents, samplingPntsBezDom, pyr, nij, nk);
305 double2int(expD, exp);
308 int ncoeff = exp.
size1();
318 std::map<int, int> hashToInd2;
324 generateExponents(data, expD2);
325 double2int(expD2, exp2);
329 for(
int i = 0; i < exp2.
size1(); ++i) {
331 for(
int l = 0; l < dim; l++) {
332 hash +=
static_cast<int>(exp2(i, l) *
pow_int(2 * order + 1, l));
334 hashToInd2[hash] = i;
338 for(
int i = 0; i < ncoeff; i++) {
339 for(
int j = i; j < ncoeff; j++) {
340 double num = 1, den = 1;
344 int compltot = 2 * order;
345 for(
int l = 0; l < dimSimplex; l++) {
346 num *= nChoosek(compl1, exp(i, l)) * nChoosek(compl2, exp(j, l));
347 den *= nChoosek(compltot, exp(i, l) + exp(j, l));
350 compltot -= exp(i, l) + exp(j, l);
352 for(
int l = dimSimplex; l < dim; l++) {
353 num *= nChoosek(order, exp(i, l)) * nChoosek(order, exp(j, l));
354 den *= nChoosek(2 * order, exp(i, l) + exp(j, l));
362 for(
int l = 0; l < dim; l++) {
364 static_cast<int>((exp(i, l) + exp(j, l)) *
pow_int(2 * order + 1, l));
366 _raiser2[hashToInd2[hash]].push_back(
_data(num / den, i, j));
372 std::map<int, int> hashToInd3;
378 generateExponents(data, expD3);
379 double2int(expD3, exp3);
383 for(
int i = 0; i < exp3.
size1(); ++i) {
385 for(
int l = 0; l < dim; l++) {
386 hash +=
static_cast<int>(exp3(i, l) *
pow_int(3 * order + 1, l));
388 hashToInd3[hash] = i;
392 for(
int i = 0; i < ncoeff; i++) {
393 for(
int j = i; j < ncoeff; j++) {
394 for(
int k = j; k < ncoeff; ++k) {
395 double num = 1, den = 1;
400 int compltot = 3 * order;
401 for(
int l = 0; l < dimSimplex; l++) {
402 num *= nChoosek(compl1, exp(i, l)) * nChoosek(compl2, exp(j, l)) *
403 nChoosek(compl3, exp(k, l));
404 den *= nChoosek(compltot, exp(i, l) + exp(j, l) + exp(k, l));
408 compltot -= exp(i, l) + exp(j, l) + exp(k, l);
410 for(
int l = dimSimplex; l < dim; l++) {
411 num *= nChoosek(order, exp(i, l)) * nChoosek(order, exp(j, l)) *
412 nChoosek(order, exp(k, l));
413 den *= nChoosek(3 * order, exp(i, l) + exp(j, l) + exp(k, l));
420 else if(i < j || j < k)
424 for(
int l = 0; l < dim; l++) {
425 hash +=
static_cast<int>((exp(i, l) + exp(j, l) + exp(k, l)) *
428 _raiser3[hashToInd3[hash]].push_back(
_data(num / den, i, j, k));
446 Msg::Error(
"Bezier raiser not implemented for pyramidal space");
453 double2int(expD, exp);
455 int ncoeff = exp.
size1();
457 int orderHash = std::max(order[0], order[2]);
463 std::map<int, int> hashToInd2;
469 generateExponents(data, expD2);
470 double2int(expD2, exp2);
474 for(
int i = 0; i < exp2.
size1(); ++i) {
476 for(
int l = 0; l < 3; l++) {
477 hash +=
static_cast<int>(exp2(i, l) *
pow_int(2 * orderHash + 1, l));
479 hashToInd2[hash] = i;
483 for(
int i = 0; i < ncoeff; i++) {
484 for(
int j = i; j < ncoeff; j++) {
485 double num = 1, den = 1;
486 for(
int l = 0; l < 3; l++) {
487 num *= nChoosek(order[l], exp(i, l)) * nChoosek(order[l], exp(j, l));
488 den *= nChoosek(2 * order[l], exp(i, l) + exp(j, l));
495 for(
int l = 0; l < 3; l++) {
496 hash +=
static_cast<int>((exp(i, l) + exp(j, l)) *
497 pow_int(2 * orderHash + 1, l));
499 _raiser2[hashToInd2[hash]].push_back(
_data(num / den, i, j));
505 std::map<int, int> hashToInd3;
511 generateExponents(data, expD3);
512 double2int(expD3, exp3);
516 for(
int i = 0; i < exp3.
size1(); ++i) {
518 for(
int l = 0; l < 3; l++) {
519 hash +=
static_cast<int>(exp3(i, l) *
pow_int(3 * orderHash + 1, l));
521 hashToInd3[hash] = i;
525 for(
int i = 0; i < ncoeff; i++) {
526 for(
int j = i; j < ncoeff; j++) {
527 for(
int k = j; k < ncoeff; ++k) {
528 double num = 1, den = 1;
529 for(
int l = 0; l < 3; l++) {
530 num *= nChoosek(order[l], exp(i, l)) * nChoosek(order[l], exp(j, l)) *
531 nChoosek(order[l], exp(k, l));
532 den *= nChoosek(3 * order[l], exp(i, l) + exp(j, l) + exp(k, l));
538 else if(i < j || j < k)
542 for(
int l = 0; l < 3; l++) {
543 hash +=
static_cast<int>((exp(i, l) + exp(j, l) + exp(k, l)) *
544 pow_int(3 * orderHash + 1, l));
546 _raiser3[hashToInd3[hash]].push_back(
_data(num / den, i, j, k));
558 if(&coeffA == &coeffB) {
559 for(std::size_t ind = 0; ind <
_raiser2.size(); ++ind) {
560 for(std::size_t l = 0; l <
_raiser2[ind].size(); ++l) {
562 coeffSquare(ind) += d.
val * coeffA(d.
i) * coeffB(d.
j);
567 for(std::size_t ind = 0; ind <
_raiser2.size(); ++ind) {
568 for(std::size_t l = 0; l <
_raiser2[ind].size(); ++l) {
571 d.
val / 2 * (coeffA(d.
i) * coeffB(d.
j) + coeffA(d.
j) * coeffB(d.
i));
584 if(&coeffA == &coeffB && &coeffB == &coeffC) {
585 for(std::size_t ind = 0; ind <
_raiser3.size(); ++ind) {
586 for(std::size_t l = 0; l <
_raiser3[ind].size(); ++l) {
588 coeffCubic(ind) += d.
val * coeffA(d.
i) * coeffB(d.
j) * coeffC(d.
k);
592 else if(&coeffA != &coeffB && &coeffB != &coeffC) {
593 for(std::size_t ind = 0; ind <
_raiser3.size(); ++ind) {
594 for(std::size_t l = 0; l <
_raiser3[ind].size(); ++l) {
596 coeffCubic(ind) += d.
val / 6 *
597 (coeffA(d.
i) * coeffB(d.
j) * coeffC(d.
k) +
598 coeffA(d.
i) * coeffB(d.
k) * coeffC(d.
j) +
599 coeffA(d.
j) * coeffB(d.
i) * coeffC(d.
k) +
600 coeffA(d.
j) * coeffB(d.
k) * coeffC(d.
i) +
601 coeffA(d.
k) * coeffB(d.
i) * coeffC(d.
j) +
602 coeffA(d.
k) * coeffB(d.
j) * coeffC(d.
i));
608 "bezierBasisRaiser::computeCoeff not implemented for A == B != C "
618 : _numPool(num), _funcSpaceData(fsData),
624 Msg::Error(
"Call of Bezier expansion for Serendipity space.");
628 Msg::Error(
"Call of Bezier expansion with a wrong number of Lagrange "
629 "coefficients (%d vs %d).", orderedLagCoeff.
size1(),
646 else if(num == 1 &&
_pool1)
658 : _numPool(num), _funcSpaceData(fsData),
664 Msg::Error(
"Call of Bezier expansion for Serendipity space.");
668 Msg::Error(
"Call of Bezier expansion with a wrong number of Lagrange "
669 "coefficients (%d vs %d).", orderedLagCoeff.
size(),
681 _r = orderedLagCoeff.
size();
686 else if(num == 1 &&
_pool1)
734 Msg::Error(
"Not supposed to be here. destructor bezierCoeff");
744 const int npt = order + 1;
757 case TYPE_LIN: convertLag2Bez(lag, order, x, bez);
return;
759 for(
int i = 0; i < npt; ++i) convertLag2Bez(lag, order, x, bez, i, npt);
760 for(
int j = 0; j < npt; ++j) convertLag2Bez(bez, order, x, bez, j * npt, 1);
763 for(
int ij = 0; ij < npt * npt; ++ij) {
764 convertLag2Bez(lag, order, x, bez, ij, npt * npt);
766 for(
int i = 0; i < npt; ++i) {
767 for(
int k = 0; k < npt; ++k) {
768 convertLag2Bez(bez, order, x, bez, i + k * npt * npt, npt);
771 for(
int jk = 0; jk < npt * npt; ++jk) {
772 convertLag2Bez(bez, order, x, bez, jk * npt, 1);
782 for(
int ij = 0; ij < nbij * nbij; ++ij) {
783 convertLag2Bez(lag, nbk - 1, xk, bez, ij, nbij * nbij);
785 for(
int i = 0; i < nbij; ++i) {
786 for(
int k = 0; k < nbk; ++k) {
787 convertLag2Bez(bez, nbij - 1, xij, bez, i + k * nbij * nbij, nbij);
790 for(
int jk = 0; jk < nbij * nbk; ++jk) {
791 convertLag2Bez(bez, nbij - 1, xij, bez, jk * nbij, 1);
797 double *lagCoeffData =
const_cast<double *
>(lagCoeffDataConst);
799 const int nptTri = (order + 2) * (order + 1) / 2;
802 for(
int k = 0; k < npt; ++k) {
803 for(
int c = 0;
c <
_c; ++
c) {
804 const int inc =
c *
_r + k * nptTri;
805 proxLag.
setAsProxy(lagCoeffData + inc, nptTri);
810 for(
int ij = 0; ij < nptTri; ++ij) {
811 convertLag2Bez(bez, order, x, bez, ij, nptTri);
853 case 1:
return order;
854 case 2:
return _r - 1;
859 case 1:
return order;
860 case 2:
return _r - 1;
861 case 3:
return _r - 1 - order;
866 case 1:
return order;
867 case 2:
return (order + 2) * (order + 1) / 2 - 1;
868 case 3:
return _r - 1;
873 case 1:
return order;
874 case 2:
return (order + 1) * (order + 1) - 1;
875 case 3:
return (order + 1) * order;
876 case 4:
return (order + 1) * (order + 1) * order;
877 case 5:
return (order + 1) * (order + 1) * order + order;
878 case 6:
return _r - 1;
879 case 7:
return (order + 2) * (order + 1) * order;
884 case 1:
return order;
885 case 2:
return (order + 2) * (order + 1) / 2 - 1;
886 case 3:
return (order + 2) * (order + 1) / 2 * order;
887 case 4:
return (order + 2) * (order + 1) / 2 * order + order;
888 case 5:
return _r - 1;
894 case 1:
return order;
895 case 2:
return (order + 1) * (order + 1) - 1;
896 case 3:
return (order + 1) * order;
897 case 4:
return _r - 1;
906 case 2:
return (nij + 1) * (nij + 1) - 1;
907 case 3:
return (nij + 1) * nij;
908 case 4:
return (nij + 1) * (nij + 1) * nk;
909 case 5:
return (nij + 1) * (nij + 1) * nk + nij;
910 case 6:
return _r - 1;
911 case 7:
return (nij + 1) * (nij + 1) * nk + (nij + 1) * nij;
915 Msg::Error(
"type %d not implemented in getIdxCornerCoeff",
932 for(
int i = 0; i < n; ++i) {
934 for(
int j = 0; j <
_c; ++j) { m(i, j) =
_data[k +
_r * j]; }
940 if(subCoeff.size()) {
947 for(
int i = 0; i < 4; ++i) subCoeff.push_back(
new bezierCoeff(*
this));
951 for(
int i = 0; i < 4; ++i) subCoeff.push_back(
new bezierCoeff(*
this));
955 for(
int i = 0; i < 8; ++i) subCoeff.push_back(
new bezierCoeff(*
this));
959 for(
int i = 0; i < 8; ++i) subCoeff.push_back(
new bezierCoeff(*
this));
963 for(
int i = 0; i < 8; ++i) subCoeff.push_back(
new bezierCoeff(*
this));
967 for(
int i = 0; i < 8; ++i) subCoeff.push_back(
new bezierCoeff(*
this));
976 const int dim = coeff.
size2();
977 for(
int iter = 1; iter < npts; ++iter) {
978 for(
int I = start + iter; I < start + 2 * npts - iter; I += 2) {
979 for(
int K = 0; K < dim; ++K) {
980 coeff(I, K) = .5 * (coeff(I - 1, K) + coeff(I + 1, K));
990 const int dim = coeff.
size2();
991 for(
int iter = 1; iter < npts; ++iter) {
992 for(
int i = iter; i < 2 * npts - iter; i += 2) {
993 int I = start + i * inc;
994 for(
int K = 0; K < dim; ++K) {
995 coeff(I, K) = .5 * (coeff(I - inc, K) + coeff(I + inc, K));
1002 std::vector<bezierCoeff *> &vSubCoeff)
1005 const int dim = coeff.
_c;
1013 if(&coeff != &sub1)
_copy(coeff, start, (n + 1) * n / 2, sub1);
1017 for(
int iter = 1; iter < n; ++iter) {
1018 for(
int j = 0; j < n - iter; ++j) {
1019 for(
int i = n - 1 - j; i >= iter; --i) {
1020 const int I = start +
_ij2Index(i, j, n);
1021 const int Im = start +
_ij2Index(i - 1, j, n);
1022 for(
int K = 0; K < dim; ++K) {
1023 sub1(I, K) = .5 * (sub1(Im, K) + sub1(I, K));
1029 for(
int iter = 1; iter < n; ++iter) {
1030 for(
int j = n - 1; j >= iter; --j) {
1031 for(
int i = 0; i < n - j; ++i) {
1032 const int I = start +
_ij2Index(i, j, n);
1033 const int Im = start +
_ij2Index(i, j - 1, n);
1034 for(
int K = 0; K < dim; ++K) {
1035 sub1(I, K) = .5 * (sub1(Im, K) + sub1(I, K));
1041 _copy(sub1, start, (n + 1) * n / 2, sub2);
1044 for(
int iter = 1; iter < n; ++iter) {
1045 for(
int j = 0; j < n - iter; ++j) {
1046 for(
int i = 0; i < n - iter - j; ++i) {
1047 const int I = start +
_ij2Index(i, j, n);
1048 const int Ia = start +
_ij2Index(i + 1, j, n);
1049 const int Ib = start +
_ij2Index(i, j + 1, n);
1050 for(
int K = 0; K < dim; ++K) {
1051 sub2(I, K) = sub2(Ia, K) + sub2(Ib, K) - sub2(I, K);
1057 _copy(sub2, start, (n + 1) * n / 2, sub3);
1058 for(
int iter = 1; iter < n; ++iter) {
1059 for(
int j = 0; j < n - iter; ++j) {
1060 for(
int i = n - 1 - j; i >= iter; --i) {
1061 const int I = start +
_ij2Index(i, j, n);
1062 const int Ia = start +
_ij2Index(i - 1, j, n);
1063 const int Ib = start +
_ij2Index(i - 1, j + 1, n);
1064 for(
int K = 0; K < dim; ++K) {
1065 sub3(I, K) = sub3(Ia, K) + sub3(Ib, K) - sub3(I, K);
1071 _copy(sub2, start, (n + 1) * n / 2, sub4);
1072 for(
int iter = 1; iter < n; ++iter) {
1073 for(
int j = n - 1; j >= iter; --j) {
1074 for(
int i = 0; i < n - j; ++i) {
1075 const int I = start +
_ij2Index(i, j, n);
1076 const int Ia = start +
_ij2Index(i, j - 1, n);
1077 const int Ib = start +
_ij2Index(i + 1, j - 1, n);
1078 for(
int K = 0; K < dim; ++K) {
1079 sub4(I, K) = sub4(Ia, K) + sub4(Ib, K) - sub4(I, K);
1095 for(
int iter = 1; iter < n; ++iter) {
1096 for(
int k = 0; k < n - iter; ++k) {
1097 for(
int j = 0; j < n - iter - k; ++j) {
1098 for(
int i = n - 1 - j - k; i >= iter; --i) {
1101 for(
int K = 0; K < dim; ++K) {
1102 coeff(I, K) = .5 * (coeff(Im, K) + coeff(I, K));
1110 for(
int iter = 1; iter < n; ++iter) {
1111 for(
int k = 0; k < n - iter; ++k) {
1112 for(
int j = n - 1 - k; j >= iter; --j) {
1113 for(
int i = 0; i < n - j - k; ++i) {
1116 for(
int K = 0; K < dim; ++K) {
1117 coeff(I, K) = .5 * (coeff(Im, K) + coeff(I, K));
1125 for(
int iter = 1; iter < n; ++iter) {
1126 for(
int k = n - 1; k >= iter; --k) {
1127 for(
int j = 0; j < n - k; ++j) {
1128 for(
int i = 0; i < n - j - k; ++i) {
1131 for(
int K = 0; K < dim; ++K) {
1132 coeff(I, K) = .5 * (coeff(Im, K) + coeff(I, K));
1141 for(
int iter = 1; iter < n; ++iter) {
1142 for(
int k = 0; k < n - iter; ++k) {
1143 for(
int j = 0; j < n - iter - k; ++j) {
1144 for(
int i = 0; i < n - iter - j - k; ++i) {
1148 for(
int K = 0; K < dim; ++K) {
1149 coeff(I, K) = coeff(Ia, K) + coeff(Ib, K) - coeff(I, K);
1157 for(
int iter = 1; iter < n; ++iter) {
1158 for(
int k = n - 1; k >= iter; --k) {
1159 for(
int j = 0; j < n - k; ++j) {
1160 for(
int i = 0; i < n - j - k; ++i) {
1162 const int Ia =
_ijk2Index(i + 1, j, k - 1, n);
1163 const int Ib =
_ijk2Index(i, j + 1, k - 1, n);
1164 for(
int K = 0; K < dim; ++K) {
1165 coeff(I, K) = coeff(Ia, K) + coeff(Ib, K) - coeff(I, K);
1173 for(
int iter = 1; iter < n; ++iter) {
1174 for(
int k = 0; k < n - iter; ++k) {
1175 for(
int j = 0; j < n - iter - k; ++j) {
1176 for(
int i = n - 1 - j - k; i >= iter; --i) {
1179 const int Ib =
_ijk2Index(i - 1, j, k + 1, n);
1180 for(
int K = 0; K < dim; ++K) {
1181 coeff(I, K) = coeff(Ia, K) + coeff(Ib, K) - coeff(I, K);
1189 for(
int iter = 1; iter < n; ++iter) {
1190 for(
int k = 0; k < n - iter; ++k) {
1191 for(
int j = n - 1 - k; j >= iter; --j) {
1192 for(
int i = 0; i < n - j - k; ++i) {
1195 const int Ib =
_ijk2Index(i, j - 1, k + 1, n);
1196 for(
int K = 0; K < dim; ++K) {
1197 coeff(I, K) = coeff(Ia, K) + coeff(Ib, K) - coeff(I, K);
1207 std::vector<bezierCoeff *> &vSubCoeff)
1210 const int N = (n + 2) * (n + 1) * n / 6;
1222 _copy(coeff, 0, N, sub1);
1228 _copy(sub1, 0, N, sub2);
1231 _copy(sub2, 0, N, sub3);
1232 _copy(sub2, 0, N, sub4);
1236 _copy(sub4, 0, N, sub5);
1240 _copy(sub3, 0, N, sub6);
1241 _copy(sub4, 0, N, sub7);
1242 _copy(sub5, 0, N, sub8);
1250 std::vector<bezierCoeff *> &subCoeff)
1253 const int N = 2 * n - 1;
1254 const int dim = coeff.
_c;
1256 for(
int i = 0; i < n; ++i) {
1257 for(
int j = 0; j < n; ++j) {
1258 const int I1 = i + j * n;
1259 const int I2 = (2 * i) + (2 * j) * N;
1260 for(
int k = 0; k < dim; ++k) {
_sub(I2, k) = coeff(I1, k); }
1273 std::vector<bezierCoeff *> &subCoeff)
1276 const int N = 2 * n - 1;
1277 const int dim = coeff.
_c;
1279 for(
int i = 0; i < n; ++i) {
1280 for(
int j = 0; j < n; ++j) {
1281 for(
int k = 0; k < n; ++k) {
1282 const int I1 = i + j * n + k * n * n;
1283 const int I2 = (2 * i) + (2 * j) * N + (2 * k) * N * N;
1284 for(
int k = 0; k < dim; ++k) {
_sub(I2, k) = coeff(I1, k); }
1288 for(
int i = 0; i < N; i += 2) {
1289 for(
int j = 0; j < N; j += 2) {
_subdivide(
_sub, n, i + j * N, N * N); }
1291 for(
int i = 0; i < N; i += 2) {
1292 for(
int k = 0; k < N; ++k) {
_subdivide(
_sub, n, i + k * N * N, N); }
1294 for(
int j = 0; j < N; ++j) {
1295 for(
int k = 0; k < N; ++k) {
_subdivide(
_sub, n, j * N + k * N * N); }
1309 std::vector<bezierCoeff *> &subCoeff)
1312 const int ntri = (n + 1) * n / 2;
1313 const int N = 2 * n - 1;
1314 const int dim = coeff.
_c;
1318 for(
int k = 0; k < n; ++k) {
1319 for(
int i = 0; i < ntri; ++i) {
1320 const int I1 = i + k * ntri;
1321 const int I2 = i + (2 * k) * ntri;
1322 for(
int l = 0; l < dim; ++l) {
_sub(I2, l) = coeff(I1, l); }
1328 std::vector<bezierCoeff *> subCoeff2;
1329 subCoeff2.push_back(subCoeff[4]);
1330 subCoeff2.push_back(subCoeff[5]);
1331 subCoeff2.push_back(subCoeff[6]);
1332 subCoeff2.push_back(subCoeff[7]);
1337 for(
int k = 0; k < n; ++k) {
1345 std::vector<bezierCoeff *> &subCoeff)
1349 const int Nij = 2 * nij - 1;
1350 const int Nk = 2 * nk - 1;
1351 const int dim = coeff.
_c;
1354 for(
int i = 0; i < nij; ++i) {
1355 for(
int j = 0; j < nij; ++j) {
1356 for(
int k = 0; k < nk; ++k) {
1357 const int I1 = i + j * nij + k * nij * nij;
1358 const int I2 = (2 * i) + (2 * j) * Nij + (2 * k) * Nij * Nij;
1359 for(
int k = 0; k < dim; ++k) {
_sub(I2, k) = coeff(I1, k); }
1363 for(
int i = 0; i < Nij; i += 2) {
1364 for(
int j = 0; j < Nij; j += 2) {
1368 for(
int i = 0; i < Nij; i += 2) {
1369 for(
int k = 0; k < Nk; ++k) {
1373 for(
int j = 0; j < Nij; ++j) {
1374 for(
int k = 0; k < Nk; ++k) {
1381 _copyPyr(
_sub, nij, nk, nij - 1, nij - 1, 0, *subCoeff[3]);
1383 _copyPyr(
_sub, nij, nk, nij - 1, 0, nk - 1, *subCoeff[5]);
1384 _copyPyr(
_sub, nij, nk, 0, nij - 1, nk - 1, *subCoeff[6]);
1385 _copyPyr(
_sub, nij, nk, nij - 1, nij - 1, nk - 1, *subCoeff[7]);
1392 const int dim = from.
_c;
1393 for(
int i = start; i < start + num; ++i) {
1394 for(
int j = 0; j < dim; ++j) { to(i, j) = from(i, j); }
1401 const int dim = allSub.
size2();
1402 for(
int i = 0; i < n; ++i) {
1403 for(
int K = 0; K < dim; ++K) { sub(i, K) = allSub(start + i, K); }
1410 const int dim = allSub.
size2();
1411 const int N = 2 * n - 1;
1412 for(
int i = 0; i < n; ++i) {
1413 for(
int j = 0; j < n; ++j) {
1414 const int I1 = i + j * n;
1415 const int I2 = (starti + i) + (startj + j) * N;
1416 for(
int K = 0; K < dim; ++K) { sub(I1, K) = allSub(I2, K); }
1424 const int dim = allSub.
size2();
1425 const int N = 2 * n - 1;
1426 for(
int i = 0; i < n; ++i) {
1427 for(
int j = 0; j < n; ++j) {
1428 for(
int k = 0; k < n; ++k) {
1429 const int I1 = i + j * n + k * n * n;
1430 const int I2 = (starti + i) + (startj + j) * N + (startk + k) * N * N;
1431 for(
int K = 0; K < dim; ++K) { sub(I1, K) = allSub(I2, K); }
1438 int starti,
int startj,
int startk,
bezierCoeff &sub)
1440 const int dim = allSub.
size2();
1441 const int Nij = 2 * nij - 1;
1442 for(
int i = 0; i < nij; ++i) {
1443 for(
int j = 0; j < nij; ++j) {
1444 for(
int k = 0; k < nk; ++k) {
1445 const int I1 = i + j * nij + k * nij * nij;
1447 (starti + i) + (startj + j) * Nij + (startk + k) * Nij * Nij;
1448 for(
int K = 0; K < dim; ++K) { sub(I1, K) = allSub(I2, K); }
1465 Msg::Error(
"Cannot change size of blocks if %d blocks are still being "
1509 Msg::Error(
"Wrong state of bezierCoeffMemoryPool."
1510 "_bezierCoeff[i] not correct?");
1516 long diff = block - &
_memory.front();
1536 Msg::Error(
"I cannot free memory if some is still in use!");
1540 std::vector<double> dummy;
1548 double *pointer = &
_memory.front();
1551 if(pointer == &
_memory.front())
return;
1556 long diff = &
_memory.front() - pointer;