76#ifndef ALR_CHECK_BOUND
77#define ALR_CHECK_BOUND
79#ifndef ALR_CHECK_EACH_BOUND
80#define ALR_CHECK_EACH_BOUND
108 mcerr <<
"ERROR in DynLinArr(long fqel):\n";
109 mcerr <<
"qel > max_qel_DynLinArr:\n";
111 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
116 mcerr <<
"ERROR in DynLinArr(long fqel):\n";
117 mcerr <<
"qel < 0:\n";
119 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
123 el = (fqel > 0) ? (
new T[fqel]) : (T*)NULL;
126 DynLinArr(
long fqel,
const T& val) : qel(fqel), el(NULL) {
128 mcerr <<
"ERROR in DynLinArr(long fqel, const T& val):\n";
129 mcerr <<
"qel > max_qel_DynLinArr:\n";
131 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
136 mcerr <<
"ERROR in DynLinArr(long fqel, const T& val):\n";
137 mcerr <<
"qel < 0:\n";
139 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
143 el = (fqel > 0) ? (
new T[fqel]) : (T*)NULL;
148 mcerr <<
"ERROR in DynLinArr(long fqel, const T* ar, ArgInterp_Arr):\n";
149 mcerr <<
"qel > max_qel_DynLinArr:\n";
151 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
156 mcerr <<
"ERROR in DynLinArr(long fqel, const T* ar, ArgInterp_Arr):\n";
157 mcerr <<
"qel < 0:\n";
159 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
163 el = (fqel > 0) ? (
new T[fqel]) : (T*)NULL;
164 for (
long n = 0; n < qel; n++) el[n] = ar[n];
193#ifdef DEBUG_DYNLINARR
194 mcout <<
"DynLinArr( DynLinArr<T>& f, Pilfer) is working\n";
209 for (
long n = 0; n < qel; n++) el[n] = f;
217 for (
long n = 0; n < qel; n++) el[n].
assignAll(f);
222#ifdef ALR_CHECK_BOUND
223 if (n >= 0 && n < qel)
return el[n];
224 mcerr <<
"ERROR in const T& DynLinArr::operator[](long n) const: "
225 <<
"n is out of bounds, n=" << n <<
" qel=" << qel <<
'\n';
226 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
235#ifdef ALR_CHECK_BOUND
236 if (n >= 0 && n < qel)
return el[n];
237 mcerr <<
"ERROR in const T& DynLinArr::operator[](long n) const: "
238 <<
"n is out of bounds, n=" << n <<
" qel=" << qel <<
'\n';
239 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
251 inline const T&
acu(
long n)
const {
256#ifdef ALR_CHECK_BOUND
257 if (qel > 0)
return el[qel - 1];
258 mcerr <<
"ERROR in const T& DynLinArr::last_el(void) const: qel <=0:"
259 <<
" qel" << qel <<
'\n';
260 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
270#ifdef ALR_CHECK_BOUND
271 if (qel > 0)
return el[qel - 1];
272 mcerr <<
"ERROR in const T& DynLinArr::last_el(void) const: qel <=0:"
273 <<
" qel" << qel <<
'\n';
274 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
316#ifdef DEBUG_DYNLINARR
317 mcout <<
"DynLinArr::pilfer is called\n";
322 mcerr <<
"ERROR in DynLinArr::pilfer(...):\n";
323 mcerr <<
"Both the destination and source arrays are not empty\n";
367 template <
class P,
class X>
400 long q_to_sort = 0)
const;
402 long q_to_sort = 0)
const;
423 for (
long n = 0; n < ar.qel; n++) (*fun)(ar.el[n]);
426template <
class T,
class X>
428 void (*fun2)(X& f)) {
429 for (
long n = 0; n < ar.qel; n++) (*fun1)(ar.el[n], fun2);
435 mcerr <<
"ERROR in template<class T> void DynLinArr<T>::check(void):\n";
436 mcerr <<
"qel < 0, qel=" << qel <<
'\n';
437 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
441 if (qel == 0 && el != NULL) {
442 mcerr <<
"ERROR in template<class T> void DynLinArr<T>::check(void):\n";
443 mcerr <<
"qel == 0 && el != NULL: el=" << el <<
'\n';
444 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
450 mcerr <<
"ERROR in template<class T> void DynLinArr<T>::check(void):\n";
451 mcerr <<
"qel > 0 && el == NULL: qel=" << qel <<
'\n';
452 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
457 mcerr <<
"ERROR in template<class T> void DynLinArr<T>::check(void):\n";
458 mcerr <<
"qel > max_qel_DynLinArr: \n";
460 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
469#ifdef DEBUG_DYNLINARR
470 mcout <<
"DynLinArr<T>& DynLinArr<T>::operator=(const DynLinArr<T>& f) is "
482 T* temp_el = (T*)NULL;
485 for (
long n = 0; n < q; n++) temp_el[n] = f.el[n];
495#ifdef DEBUG_DYNLINARR
496 mcout <<
"DynLinArr<T>& DynLinArr<T>::operator=(const DynLinArr<D>& f) is "
499 if (
this == &f)
return *
this;
506 T* temp_el = (T*)NULL;
509 for (
long n = 0; n < q; n++) temp_el[n] = f[n];
520#ifdef DEBUG_DYNLINARR
521 mcout <<
"DynLinArr(const DynLinArr<T>& f) is working\n";
537 mcerr <<
"ERROR in template<class T> void DynLinArr<T>::put_qel(long "
539 mcerr <<
"fqel < 0, fqel=" << fqel <<
'\n';
540 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
547 if (qel > 0) el =
new T[fqel];
557 for (
long n = 0; n < fqel; ++n) {
558 if (n < qel) elh[n] = el[n];
579 mcerr <<
"ERROR in template<class T> void DynLinArr<T>::put_qel(long fqel, "
580 "const T* val, ArgInterp_SingleAdr):\n";
581 mcerr <<
"fqel < 0, fqel=" << fqel <<
'\n';
582 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
586 mcerr <<
sizeof(t) <<
"\n";
591 if (qel > 0) el =
new T[fqel];
593 for (
long n = 0; n < qel; ++n) el[n] = *val;
603 for (
long n = 0; n < fqel; ++n) {
606 else if (val != NULL)
626 mfunnamep(
"void DynLinArr<T>::sort(long q_to_sort = 0)");
629 if (q_to_sort <= 0) q_to_sort = qel;
630 if (q_to_sort <= 1)
return;
632 long n_possible_next = 1;
635 for (n = 0; n < q_to_sort - 1; n++) {
639 long nmin = n_possible_next;
641 int s_change_possible_next = 0;
644 for (m = n_possible_next + 1; m < q_to_sort; m++) {
647 if (el_min > el[m]) {
648 n_possible_next = nmin;
649 s_change_possible_next = 1;
655 if (s_change_possible_next == 0 || n_possible_next < n + 2) {
656 n_possible_next = n + 2;
666 if (el[n] > el_min) {
667 if (s_change_possible_next == 1) {
669 if (n_possible_next < q_to_sort && el[n] < el[n_possible_next]) {
670 n_possible_next = nmin;
688 "void DynLinArr<T>::sort(DynLinArr< long >& sort_ind, long "
689 "q_to_sort = 0) const");
692 if (q_to_sort <= 0) q_to_sort = qel;
698 for (n = 0; n < q_to_sort; n++) {
701 if (q_to_sort <= 1)
return;
703 long n_possible_next = 1;
705 for (n = 0; n < q_to_sort - 1; n++) {
707 long nmin = n_possible_next;
708 long ind_nmin = sort_ind.
acu(nmin);
709 int s_change_possible_next = 0;
712 for (m = n_possible_next + 1; m < q_to_sort; m++) {
713 if (el[ind_nmin] > el[sort_ind.
acu(m)])
716 n_possible_next = nmin;
717 s_change_possible_next = 1;
719 ind_nmin = sort_ind.
acu(nmin);
722 if (s_change_possible_next == 0 || n_possible_next < n + 2) {
723 n_possible_next = n + 2;
725 if (el[sort_ind.
acu(n)] > el[ind_nmin])
728 if (s_change_possible_next == 1) {
729 if (n_possible_next < q_to_sort &&
730 el[sort_ind.
acu(n)] < el[sort_ind.
acu(n_possible_next)]) {
731 n_possible_next = nmin;
735 sort_ind.
acu(nmin) = sort_ind.
acu(n);
736 sort_ind.
acu(n) = ind_nmin;
743 long q_to_sort)
const {
745 "void DynLinArr<T>::sort_select_increasing(DynLinArr< long >& "
746 "sort_ind, long q_to_sort = 0) const");
749 long s_last_noninc = 0;
750 if (q_to_sort <= 0) {
753 }
else if (q_to_sort == qel) {
761 for (n = 0; n < qel; n++) {
764 if (q_to_sort <= 1)
return;
766 long n_possible_next = 1;
768 for (n = 0; n < q_to_sort - s_last_noninc; n++) {
770 long nmin = n_possible_next;
771 long ind_nmin = sort_ind[nmin];
772 int s_change_possible_next = 0;
775 for (m = n_possible_next + 1; m < qel; m++) {
776 if (el[ind_nmin] > el[sort_ind[m]])
779 n_possible_next = nmin;
780 s_change_possible_next = 1;
782 ind_nmin = sort_ind[nmin];
785 if (s_change_possible_next == 0 || n_possible_next < n + 2) {
786 n_possible_next = n + 2;
788 if (el[sort_ind[n]] > el[ind_nmin])
791 if (s_change_possible_next == 1) {
792 if (n_possible_next < q_to_sort &&
793 el[sort_ind[n]] < el[sort_ind[n_possible_next]]) {
794 n_possible_next = nmin;
798 sort_ind[nmin] = sort_ind[n];
799 sort_ind[n] = ind_nmin;
807 long q_to_sort)
const {
809 "void DynLinArr<T>::sort_select_decreasing(DynLinArr< long >& "
810 "sort_ind, long q_to_sort = 0) const");
813 long s_last_noninc = 0;
814 if (q_to_sort <= 0) {
817 }
else if (q_to_sort == qel) {
826 for (n = 0; n < qel; n++) {
829 if (q_to_sort <= 1)
return;
831 long n_possible_next = 1;
833 for (n = 0; n < q_to_sort - s_last_noninc; n++) {
836 long nmax = n_possible_next;
838 long ind_nmax = sort_ind[nmax];
839 int s_change_possible_next = 0;
842 for (m = n_possible_next + 1; m < qel; m++) {
844 if (el[ind_nmax] < el[sort_ind[m]]) {
845 n_possible_next = nmax;
846 s_change_possible_next = 1;
849 ind_nmax = sort_ind[nmax];
852 if (s_change_possible_next == 0 || n_possible_next < n + 2) {
853 n_possible_next = n + 2;
856 if (el[sort_ind[n]] < el[ind_nmax]) {
857 if (s_change_possible_next == 1) {
858 if (n_possible_next < q_to_sort &&
859 el[sort_ind[n]] > el[sort_ind[n_possible_next]]) {
860 n_possible_next = nmax;
864 sort_ind[nmax] = sort_ind[n];
865 sort_ind[n] = ind_nmax;
949#ifndef BAN_DEFAULT_PAR_FUN_TEMPL
963 mcerr <<
"ERROR in long append(class DynLinArr& dla, ...): dla.get_qel() < "
965 <<
"dla.get_qel()=" << dla.
get_qel() <<
" qael=" << qael <<
'\n';
966 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
971 if (new_qel <= qael) new_qel = std::max(3 * qael,
long(3));
980#define append_to_DynLinArr(t, dla, qael, tempt, new_qel) \
982 if (dla.get_qel() < qael) { \
983 mcerr << "append(class DynLinArr& dla, ...): dla.get_qel() < qael, " \
984 << "dla.get_qel()=" << dla.get_qel() << " qael=" << qael << '\n'; \
988 if (dla.get_qel() == qael) { \
989 if (new_qel <= qael) nn = std::max(3 * qael, long(3)); \
990 dla.put_qel(nn, tempt); \
994#define append_to_DynLinArr_short(t, dla, qael) \
996 if (dla.get_qel() < qael) { \
997 mcerr << "append(class DynLinArr& dla, ...): dla.get_qel() < qael, " \
998 << "dla.get_qel()=" << dla.get_qel() << " qael=" << qael << '\n'; \
1002 if (dla.get_qel() == qael) { \
1003 nn = std::max(3 * qael, long(3)); \
1004 dla.put_qel(nn, NULL); \
1020 for (n = 0; n < f.
get_qel(); n++) {
1023 Ifile <<
"n=" << n <<
" el[n]=";
1025 std::ostringstream ost;
1040 "template<class T> istream& operator>>(istream& file, DynLinArr<T>& f)");
1052 for (fn = 0; fn < qel; fn++) {
1105 for (n = 0; n < f.
get_qel(); n++) {
1109 std::ostringstream ost;
1122 Ifile <<
"DynLinArr<T>: qel=" << f.
get_qel() <<
" q to print is " << q
1126 mcerr <<
"print_DynLinArr(...): q>f.get_qel(), q=" << q
1127 <<
" f.get_qel()=" << f.
get_qel() <<
'\n';
1128 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1134 for (n = 0; n < q; n++) {
1138 std::ostringstream ost;
1152 Ifile <<
"DynLinArr<T>: qel=" << f.
get_qel() <<
" q to print is " << q
1156 mcerr <<
"print_adr_DynLinArr(...): q>f.get_qel(), q=" << q
1157 <<
" f.get_qel()=" << f.
get_qel() <<
'\n';
1158 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1164 for (n = 0; n < q; n++) {
1168 std::ostringstream ost;
1169 f[n]->
print(ost, l);
1200#define Iprintdla_int(file, name) \
1201 file << indn << #name << "=" << noindent; \
1202 print_DynLinArr_int(file, name);
1203#define Iprintdla_long(file, name) \
1204 file << indn << #name << "=" << noindent; \
1205 print_DynLinArr_long(file, name);
1206#define Iprintdla_float(file, name) \
1207 file << indn << #name << "=" << noindent; \
1208 print_DynLinArr_float(file, name);
1209#define Iprintdla_double(file, name) \
1210 file << indn << #name << "=" << noindent; \
1211 print_DynLinArr_double(file, name);
1214template <
class T,
class X>
1216 mfunnamep(
"template<class T, class X> void copy_DynLinArr(const T& s, X& d)");
1219 long q = s.get_qel();
1222 for (n = 0; n < q; n++) {
1228template <
class T,
class X>
1230 long q = s.get_qel();
1233 for (n = 0; n < q; n++) {
1244 for (n = 0; n < q; n++) f[n].put_qel(fq);
1247template <
class T,
class T1>
1253 for (n = 0; n < q; n++) f[n].assignAll(ft);
1261 if (ncur < dar->get_qel() - 1)
1262 return &((*dar)[++ncur]);
1264 ncur = dar->get_qel();
1268 if (ncur >= 0 || ncur < dar->get_qel())
1269 return &((*dar)[ncur]);
1276 return &((*dar)[--ncur]);
1288int gconfirm_ind(
const DynLinArr<long>& qel,
const DynLinArr<long>& ind);
1289int gconfirm_ind_ext(
const DynLinArr<long>& qel,
const DynLinArr<long>& ind);
1316 for (n = 0; n < qfirst; n++) {
1318 if (!(fd1[n] == fd2[n]))
return 0;
1330 if (qfirst > fd1.
get_qel())
return 0;
1332 for (n = 0; n < qfirst; n++)
1333 if (!(fd1[n] == fd2[n]))
return 0;
1340 for (n = 0; n < qfirst; n++)
1341 if (!(fd1[n] == fd2[n]))
return 0;
1356 if (qfd1 + qfd2 == 0)
return ret;
1357 for (n = 0; n < qfd1; n++) {
1360 for (n = 0; n < qfd2; n++) {
1361 ret[qfd1 + n] = fd2[n];
1377 mcout <<
"explicit DynArr(long fqel, T* val=NULL) is called\n";
1388 mcout <<
"explicit DynArr(long fqel, T* val=NULL) is called\n";
1399 for (n = 0; n < fqel; n++) el.acu(n) = ar[n];
1408 for (
long n = 0; n < qel[0]; n++)
ac(n) = f[n];
1412 DynArr(
long fqel1,
long fqel2, T* val = NULL)
1417 mcout <<
"DynArr(long fqel1, long fqel2, T* val=NULL) is called\n";
1432 <<
"DynArr(long fqel1, long fqel2, T val, ArgInterp_Val t) is called\n";
1442 DynArr(
long fqel1,
long fqel2,
long fqel3, T* val = NULL)
1445 el(fqel1 * fqel2 * fqel3) {
1449 cum_qel[0] = fqel2 * fqel3;
1456 DynArr(
long fqel1,
long fqel2,
long fqel3,
long fqel4, T* val = NULL)
1459 el(fqel1 * fqel2 * fqel3 * fqel4) {
1464 cum_qel[0] = fqel2 * fqel3 * fqel4;
1465 cum_qel[1] = fqel3 * fqel4;
1478 if (qdim <= 0)
return;
1482 for (ndim = 1; ndim < qdim; ndim++) size *= qel[ndim];
1484 cum_qel[qdim - 1] = 1;
1485 for (ndim = qdim - 2; ndim >= 0; ndim--)
1486 cum_qel[ndim] = qel[ndim + 1] * cum_qel[ndim + 1];
1494 if (qdim <= 0)
return;
1498 for (ndim = 1; ndim < qdim; ndim++) size *= qel[ndim];
1500 cum_qel[qdim - 1] = 1;
1501 for (ndim = qdim - 2; ndim >= 0; ndim--)
1502 cum_qel[ndim] = qel[ndim + 1] * cum_qel[ndim + 1];
1508 mcout <<
"DynArr(const DynArr<T>& f) is working\n";
1515 mcout <<
"DynArr( DynArr<T>& f, Pilfer) is working\n";
1521 mcout <<
"DynArr::pilfer is called\n";
1526 mcerr <<
"ERROR in DynArr::pilfer(...):\n";
1527 mcerr <<
"Both the destination and source arrays are not empty\n";
1538 cum_qel.
pilfer(f.cum_qel);
1570 operator D&()
const {
1572 mcerr <<
"ERROR in IndexingProvider::operator D& (): q_deref_ind != "
1575 mcerr <<
"Type of T is (in internal notations) " <<
typeid(D).name()
1579#ifdef ALR_CHECK_BOUND
1587 mcerr <<
"ERROR in T& IndexingProvider::operator=(T& f): q_deref_ind "
1588 "!= arr.get_qel().get_qel()\n";
1590 mcerr <<
"Type of T is (in internal notations) " <<
typeid(D).name()
1594#ifdef ALR_CHECK_BOUND
1604 mcerr <<
"ERROR in DynArr::IndexingProvider& DynArr::operator[](long "
1605 "n): q_deref_ind >= arr.get_qel().get_qel()\n";
1607 mcerr <<
"Type of T is (in internal notations) " <<
typeid(D).name()
1611#ifdef ALR_CHECK_EACH_BOUND
1613 mcerr <<
"Error in IndexingProvider<D>& "
1614 "IndexingProvider::operator[](long n): n < 0 || n >= "
1615 "qel.acu(q_deref_ind)\n";
1617 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1629 mcerr <<
"ERROR in DynArr::IndexingProvider& DynArr::operator[](long "
1630 "n): q_deref_ind >= arr.get_qel().get_qel()\n";
1632 mcerr <<
"Type of T is (in internal notations) " <<
typeid(D).name()
1636#ifdef ALR_CHECK_EACH_BOUND
1638 mcerr <<
"Error in IndexingProvider<D>& "
1639 "IndexingProvider::operator[](long n): n < 0 || n >= "
1640 "qel.acu(q_deref_ind)\n";
1642 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1659 mcerr <<
"ERROR in DynArr::IndexingProvider DynArr::operator[](long n): "
1660 "qel.get_qel()< 1, qel.get_qel()=" << qel.
get_qel() <<
'\n';
1661 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1665#ifdef ALR_CHECK_EACH_BOUND
1666 if (n < 0 || n >= qel.
acu(0)) {
1667 mcerr <<
"Error in IndexingProvider<T> DynArr::operator[](long n): n < 0 "
1668 "|| n >= qel.acu(0)\n";
1670 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1680 mcerr <<
"ERROR in DynArr::IndexingProvider DynArr::operator[](long n): "
1681 "qel.get_qel()< 1, qel.get_qel()=" << qel.
get_qel() <<
'\n';
1682 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1686#ifdef ALR_CHECK_EACH_BOUND
1687 if (n < 0 || n >= qel.
acu(0)) {
1688 mcerr <<
"Error in IndexingProvider<T> DynArr::operator[](long n): n < 0 "
1689 "|| n >= qel.acu(0)\n";
1691 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1702 if (qel.
get_qel() == 1)
return el[i];
1703 mcerr <<
"ERROR in DynArr::ac(long i): qel.get_qel()!= 1, qel.get_qel()="
1705 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1710 const T&
ac(
long i)
const {
1712 if (qel.
get_qel() == 1)
return el[i];
1713 mcerr <<
"ERROR in DynArr::ac(long i): qel.get_qel()!= 1, qel.get_qel()="
1715 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1724 inline const T&
acu(
long i1)
const
1737 mcerr <<
"ERROR in DynArr::ac(const DynLinArr<long>& ind): "
1738 <<
"qel.get_qel()!= ind.get_qel()\n"
1739 <<
"qel.get_qel()=" << qel.
get_qel()
1740 <<
" ind.get_qel()=" << ind.
get_qel() <<
'\n';
1741 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1745#ifdef ALR_CHECK_EACH_BOUND
1748 return el[ind.
acu(0)];
1750 return el[calc_lin_ind(ind)];
1753 return el[ind.
acu(0)];
1755 return el.acu(calc_lin_ind(ind));
1759 return el[ind.
acu(0)];
1761 return el[calc_lin_ind(ind)];
1767 if ((q = qel.
get_qel()) != ind.get_qel()) {
1768 mcerr <<
"ERROR in DynArr::ac(const DynLinArr<long>& ind): "
1769 <<
"qel.get_qel()!= ind.get_qel()\n"
1770 <<
"qel.get_qel()=" << qel.
get_qel()
1771 <<
" ind.get_qel()=" << ind.get_qel() <<
'\n';
1772 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1789#ifdef ALR_CHECK_EACH_BOUND
1792 return el[ind.acu(0)];
1794 return el[calc_lin_ind(ind)];
1797 return el[ind.acu(0)];
1799 return el.acu(calc_lin_ind(ind));
1803 return el[ind.acu(0)];
1805 return el[calc_lin_ind(ind)];
1815 mcerr <<
"ERROR in DynArr::acp(const DynLinArr<long>& ind): "
1816 <<
"qel.get_qel()!= ind.get_qel()\n"
1817 <<
"qel.get_qel()=" << qel.
get_qel()
1818 <<
" ind.get_qel()=" << ind.
get_qel() <<
'\n';
1819 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1824#ifdef ALR_CHECK_EACH_BOUND
1827 return el[ind.
acu(0)];
1829 return el[calc_lin_ind(ind)];
1832 return el[ind.
acu(0)];
1834 return el.acu(calc_lin_ind(ind));
1838 return el[ind.
acu(0)];
1840 return el[calc_lin_ind(ind)];
1847 mcerr <<
"ERROR in DynArr::acp(const DynLinArr<long>& ind): "
1848 <<
"qel.get_qel()!= ind.get_qel()\n"
1849 <<
"qel.get_qel()=" << qel.
get_qel()
1850 <<
" ind.get_qel()=" << ind.
get_qel() <<
'\n';
1851 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1855#ifdef ALR_CHECK_EACH_BOUND
1858 return el[ind.
acu(0)];
1860 return el[calc_lin_ind(ind)];
1863 return el[ind.
acu(0)];
1865 return el.acu(calc_lin_ind(ind));
1869 return el[ind.
acu(0)];
1871 return el[calc_lin_ind(ind)];
1878 return el.acu(ind.
acu(0));
1880 return el.acu(calc_lin_ind(ind));
1885 return el.acu(ind.acu(0));
1887 return el.acu(calc_lin_ind(ind));
1893#ifdef ALR_CHECK_EACH_BOUND
1894 if (i1 >= 0 && i1 < qel.
acu(0)) {
1895 if (i2 >= 0 && i2 < qel.
acu(1)) {
1897 return el[i1 * cum_qel.
acu(0) + i2];
1899 return el.acu(i1 * cum_qel.
acu(0) + i2);
1902 mcerr <<
"Error in DynArr::ac(long i1, long i2): i2 < 0 || i2 >= "
1907 mcerr <<
"Error in DynArr::ac(long i1, long i2): i1 < 0 || i1 >= "
1912 mcerr <<
"ERROR in DynArr::ac(long i1, long i2): qel.get_qel()!= 2,"
1913 <<
" qel.get_qel()=" << qel.
get_qel() <<
'\n';
1915 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1920 return el[i1 * cum_qel.
acu(0) + i2];
1957 const T&
ac(
long i1,
long i2)
const
1960#ifdef ALR_CHECK_EACH_BOUND
1961 if (i1 >= 0 && i1 < qel.
acu(0)) {
1962 if (i2 >= 0 && i2 < qel.
acu(1)) {
1964 return el[i1 * cum_qel.
acu(0) + i2];
1966 return el.acu(i1 * cum_qel.
acu(0) + i2);
1969 mcerr <<
"Error in DynArr::ac(long i1, long i2): i2 < 0 || i2 >= "
1974 mcerr <<
"Error in DynArr::ac(long i1, long i2): i1 < 0 || i1 >= "
1979 mcerr <<
"ERROR in DynArr::ac(long i1, long i2): qel.get_qel()!= 2,"
1980 <<
" qel.get_qel()=" << qel.
get_qel() <<
'\n';
1982 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1987 return el[i1 * cum_qel.
acu(0) + i2];
2027 return el.acu(i1 * cum_qel.
acu(0) + i2);
2029 inline const T&
acu(
long i1,
long i2)
const
2031 return el.acu(i1 * cum_qel.
acu(0) + i2);
2034 T&
ac(
long i1,
long i2,
long i3)
2037 mcerr <<
"ERROR in DynArr::ac(long i1, long i2, long i3): "
2038 "qel.get_qel()!= 3,"
2039 <<
" qel.get_qel()=" << qel.
get_qel() <<
'\n';
2040 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
2044#ifdef ALR_CHECK_EACH_BOUND
2045 if (i1 < 0 || i1 >= qel.
acu(0)) {
2046 mcerr <<
"Error in DynArr::ac(long i1, long i2, long i3): i1 < 0 || i1 "
2051 if (i2 < 0 || i2 >= qel.
acu(1)) {
2052 mcerr <<
"Error in DynArr::ac(long i1, long i2, long i3): i2 < 0 || i2 "
2057 if (i3 < 0 || i3 >= qel.
acu(2)) {
2058 mcerr <<
"Error in DynArr::ac(long i1, long i2, long i3): i3 < 0 || i3 "
2064 return el.acu(i1 * cum_qel.
acu(0) + i2 * cum_qel.
acu(1) + i3);
2066 return el[i1 * cum_qel.
acu(0) + i2 * cum_qel[1] + i3];
2069 return el[i1 * cum_qel.acu(0) + i2 * cum_qel[1] + i3];
2074 const T&
ac(
long i1,
long i2,
long i3)
const
2077 mcerr <<
"ERROR in DynArr::ac(long i1, long i2, long i3): "
2078 "qel.get_qel()!= 3,"
2079 <<
" qel.get_qel()=" << qel.
get_qel() <<
'\n';
2080 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
2084#ifdef ALR_CHECK_EACH_BOUND
2085 if (i1 < 0 || i1 >= qel.
acu(0)) {
2086 mcerr <<
"Error in DynArr::ac(long i1, long i2, long i3): i1 < 0 || i1 "
2091 if (i2 < 0 || i2 >= qel.
acu(1)) {
2092 mcerr <<
"Error in DynArr::ac(long i1, long i2, long i3): i2 < 0 || i2 "
2097 if (i3 < 0 || i3 >= qel.
acu(2)) {
2098 mcerr <<
"Error in DynArr::ac(long i1, long i2, long i3): i3 < 0 || i3 "
2104 return el.acu(i1 * cum_qel.
acu(0) + i2 * cum_qel.
acu(1) + i3);
2106 return el[i1 * cum_qel.
acu(0) + i2 * cum_qel[1] + i3];
2109 return el[i1 * cum_qel.acu(0) + i2 * cum_qel[1] + i3];
2118 long qelln = el.get_qel();
2119#ifdef ALR_CHECK_BOUND
2120 if (n >= 0 && n < qelln)
return el[n];
2121 mcerr <<
"ERROR in T& DynArr::ac_lin(long n): "
2122 <<
"n is out of bounds, n=" << n <<
" qelln=" << qelln <<
'\n';
2123 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
2132 long qelln = el.get_qel();
2133#ifdef ALR_CHECK_BOUND
2134 if (n >= 0 && n < qelln)
return el[n];
2135 mcerr <<
"ERROR in T& DynArr::ac_lin(long n): "
2136 <<
"n is out of bounds, n=" << n <<
" qelln=" << qelln <<
'\n';
2137 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
2147 inline const T&
acu_lin(
long n)
const {
return el[n]; }
2188 template <
class P,
class X>
2190 void (*fun2)(X& f));
2199 if (q == 0)
return 0;
2201 for (n = 0; n < q; n++) {
2202 if (qel[n] <= 0)
return 0;
2225 long qdim1 = qel.
get_qel() - 1;
2239 for (n = 0; n < qdim1; n++) {
2240#ifdef ALR_CHECK_EACH_BOUND
2242 if (ind[n] < 0 || ind[n] >= qel[n]) {
2243 mcerr <<
"ERROR in long DynArr::calc_lin_ind(const DynLinArr<long>& "
2245 mcerr <<
"ind[n] < 0 || ind[n] >= qel[n]\n";
2251 if (ind.
acu(n) < 0 || ind.
acu(n) >= qel.
acu(n)) {
2252 mcerr <<
"ERROR in long DynArr::calc_lin_ind(const DynLinArr<long>& "
2254 mcerr <<
"ind.acu(n) < 0 || ind.acu(n) >= qel.acu(n)\n";
2261 i += ind[n] * cum_qel[n];
2263#ifdef ALR_CHECK_EACH_BOUND
2265 if (ind[qdim1] < 0 || ind[qdim1] >= qel[qdim1]) {
2266 mcerr <<
"ERROR in long DynArr::calc_lin_ind(const DynLinArr<long>& ind) "
2268 mcerr <<
"ind[qdim1] < 0 || ind[qdim1] >= qel[qdim1]\n";
2274 if (ind.
acu(qdim1) < 0 || ind.
acu(qdim1) >= qel.
acu(qdim1)) {
2275 mcerr <<
"ERROR in long DynArr::calc_lin_ind(const DynLinArr<long>& ind) "
2277 mcerr <<
"ind.acu(qdim1) < 0 || ind.acu(qdim1) >= qel.acu(qdim1)\n";
2293 mcout <<
"DynArr<T>& DynArr<T>::operator=(const DynArr<T>& f)\n";
2301 cum_qel = f.cum_qel;
2310#ifdef DEBUG_DYNLINARR
2311 mcout <<
"DynArr<T>& DynArr<T>::operator=(const DynArr<D>& f)\n";
2313 if (
this == &f)
return *
this;
2320 T* temp_el = (q > 0) ? (
new T[q]) : (T*)NULL;
2321 for (
long n = 0; n < q; n++) temp_el[n] = f.
acu_lin(n);
2322 pass(q, fqel, fcum_qel, temp_el);
2328 const long q = ar.el.get_qel();
2329 for (
long n = 0; n < q; n++) (*fun)(ar.el[n]);
2331template <
class T,
class X>
2333 void (*fun2)(X& f)) {
2334 const long q = ar.el.get_qel();
2335 for (
long n = 0; n < q; n++) (*fun1)(ar.el[n], fun2);
2338int find_next_comb(
const DynLinArr<long>& qel, DynLinArr<long>& f);
2339int find_prev_comb(
const DynLinArr<long>& qel, DynLinArr<long>& f);
2346 : ncur(fdar->get_qdim()), dar((
DynArr<T>*)fdar) {
2348 long qdim1 = ncur.
get_qel() - 1;
2350 for (n = 0; n < qdim1; n++) ncur[n] = 0;
2357 return &(dar->ac(ncur));
2366 if (qdim <= 0)
return NULL;
2367 for (n = 0; n < qdim; n++) {
2368 if (ncur[n] < 0 || ncur[n] >= dar->get_qel()[n])
return NULL;
2370 return &(dar->ac(ncur));
2377 return &(dar->ac(ncur));
2404 while ((at = iter.
more()) != NULL) {
2405 if (confirm_ind_ext(iter.
get_ncur()))
2416 for (n = 0; n < q; n++) {
2417 if (!(f1.
acu(n) == f2.
acu(n)))
return 0;
2422template <
class T,
class P>
2427 for (n = 0; n < q; n++) {
2448template <
class T,
class P>
2477template <
class T,
class X>
2480 "template<class T, class X> void copy_DynArr(const DynArr<T>& s, "
2487 while ((at = iter.
more()) != NULL) {
2494template <
class T,
class X>
2497 "template<class T, class X> void convert_DynArr(const DynArr<T>& "
2498 "s, DynArr<X>& d)");
2504 while ((at = iter.
more()) != NULL) {
2506 d.
ac(ncur) = X(*at);
2515 for (n = 0; n < qel; n++) {
2522 mfunnamep(
"template<class T> DynArr<T> DynArr<T>::top(void)");
2524 long qdim = get_qdim();
2528 for (n1 = 0; n1 < qel[0]; n1++) {
2529 for (n2 = 0; n2 < qel[1]; n2++) {
2530 r.
ac(n2, n1) = ac(n1, n2);
2542 mcerr <<
"ERROR in DynLinArr<T>::DynLinArr(const DynArr<T>& f):\n"
2543 <<
"f.get_qdim() != 1, f.get_qdim()=" << f.
get_qdim() <<
'\n';
2544 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
2553 for (
long n = 0; n < qel; n++) el[n] = f.
ac(n);
2567 mcerr <<
"ERROR in DynLinArr<T>::DynLinArr(const DynArr<T>& f, int "
2568 "n_of_dim,long roc_number):\n"
2569 <<
"f.get_qdim() != 2, f.get_qdim()=" << f.
get_qdim() <<
'\n';
2570 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
2575 if (n_of_dim == 0) {
2584 if (n_of_dim == 0) {
2585 for (n = 0; n < qel; n++) el[n] = f.
ac(roc_number, n);
2587 for (n = 0; n < qel; n++) el[n] = f.
ac(n, roc_number);
2607 Ifile <<
"Content element by element:\n";
2608 Ifile <<
"(The first number is sequencial number, then there are "
2609 "indexes, the last is the element)\n";
2615 while ((at = iter_f.
more()) != NULL) {
2616 std::ostringstream ost;
2619 Ifile <<
"nseq=" << std::setw(5) << nseq <<
" ncur=";
2621 for (n = 0; n < iter_f.
get_ncur().get_qel(); n++) {
2622 file <<
' ' << std::setw(5) << iter_f.
get_ncur()[n];
2635 Ifile <<
"Content is empty.\n";
2673 "template<class T> istream& operator>>(istream& file, DynArr<T>& f)");
2693 file >> cum_qel_loc;
2699 long qseq = qel_loc[0];
2700 for (n = 1; n < qel_loc.
get_qel(); n++) {
2703 for (n = 0; n < qseq; n++) {
2710 for (m = 0; m < qel_loc.
get_qel(); m++) {
2779 Ifile <<
"Content element by element:\n";
2780 Ifile <<
"(The first number is sequencial number, then there are indexes, "
2781 "the last is the element)\n";
2786 while ((at = iter_f.
more()) != NULL) {
2788 Ifile <<
"nseq=" << std::setw(5) << nseq <<
" ncur=";
2790 for (n = 0; n < iter_f.
get_ncur().get_qel(); n++) {
2791 file <<
' ' << std::setw(5) << iter_f.
get_ncur()[n];
2796 std::ostringstream ost;
2818#define Iprintda_double(file, name) \
2819 file << indn << #name << "=" << noindent; \
2820 print_DynArr_double(file, name);
#define check_econd11(a, signb, stream)
#define mfunnamep(string)
#define check_econd12(a, sign, b, stream)
IndexingProvider(DynArr< D > &farr, long fq_deref_ind, long fcurrent_pos)
IndexingProvider< D > & operator[](long n)
const IndexingProvider< D > & operator[](long n) const
D & operator=(const D &f)
const T & ac(long i1, long i2, long i3) const
int confirm_ind(const DynLinArr< long > &ind)
DynArr(long fqel1, long fqel2, long fqel3, T *val=NULL)
const DynLinArr< T > & get_el(void) const
const T & acp(const DynLinArr< long > &ind) const
DynArr(const DynArr< T > &f)
DynArr(const DynLinArr< long > &fqel, T *val)
DynArr(long fqel, T val, ArgInterp_Val)
T & acu(long i1, long i2)
const T & ac(const DynLinArr< long > &ind) const
DynArr(long fqel, const T *ar, ArgInterp_Arr)
int confirm_ind_ext(const DynLinArr< long > &ind)
IndexingProvider< T > operator[](long n)
virtual DynArr * copy() const
const DynLinArr< long > & get_cum_qel(void) const
const T & ac(long i) const
DynArr(const DynArr< T > &f, Pilfer)
DynArr(long fqel1, long fqel2, long fqel3, long fqel4, T *val=NULL)
const T & acu(long i1) const
void pilfer(const DynArr< T > &f)
DynArr< T > & operator=(const DynArr< T > &f)
DynArr(long fqel1, long fqel2, T val, ArgInterp_Val)
long get_qel_lin(void) const
const IndexingProvider< T > operator[](long n) const
void assignAll(const T &val)
const T & acu(const DynLinArr< long > &ind) const
friend void apply2(DynArr< P > &ar, void(*fun1)(P &f, void(*fun21)(X &f)), void(*fun2)(X &f))
DynArr< T > & operator=(const DynArr< D > &f)
const T & acu(long i1, long i2) const
const T & ac(long i1, long i2) const
const DynLinArr< long > & get_qel(void) const
friend void apply1(DynArr< P > &ar, void(*fun)(P &f))
DynArr(long fqel, T *val=NULL)
DynArr(long fqel1, long fqel2, T *val=NULL)
DynArr(const DynLinArr< long > &fqel, T val, ArgInterp_Val)
void put_qel(T *val=NULL)
T & ac(long i1, long i2, long i3)
int get_s_non_emplty(void) const
long get_qdim(void) const
T & ac(const DynLinArr< long > &ind)
void pass(long q, DynLinArr< long > fqel, DynLinArr< long > fcum_qel, T *fel)
DynArr(const DynLinArr< T > &f)
const T & acu_lin(long n) const
T & acu(const DynLinArr< long > &ind)
const T & ac_lin(long n) const
T & acp(const DynLinArr< long > &ind)
const T & last_el(void) const
DynLinArr(const DynLinArr< T > &f, Pilfer)
virtual DynLinArr * copy() const
void sort_select_decreasing(DynLinArr< long > &sort_ind, long q_to_sort=0) const
DynLinArr(long fqel, const T *ar, ArgInterp_Arr)
DynLinArr< T > & operator=(const DynLinArr< D > &f)
void sort(DynLinArr< long > &sort_ind, long q_to_sort=0) const
const T & acu(long n) const
void put_qel(long fqel, const T *val, ArgInterp_SingleAdr t)
DynLinArr(long fqel, const T &val)
void pilfer(const DynLinArr< T > &f)
friend void apply1(DynLinArr< P > &ar, void(*fun)(P &f))
void pass(long fqel, T *fel)
DynLinArr(const DynArr< T > &f)
void increment(const T &val)
void sort(long q_to_sort=0)
void increment(const T *val=NULL)
DynLinArr(const DynArr< T > &f, int n_of_dim, long roc_number)
friend void apply2(DynLinArr< P > &ar, void(*fun1)(P &f, void(*fun21)(X &f)), void(*fun2)(X &f))
void put_qel(long fqel, const T &val)
DynLinArr & assignAll(const T &f)
DynLinArr< T > & operator=(const DynLinArr< T > &f)
void sort_select_increasing(DynLinArr< long > &sort_ind, long q_to_sort=0) const
const T & operator[](long n) const
DynLinArr< T > & assignAll1(const X &f)
DynLinArr(const DynLinArr< T > &f)
IterDynArr(const DynArr< T > *fdar)
const DynLinArr< long > & get_ncur(void) const
IterDynLinArr(DynLinArr< T > *fdar)
virtual void print(std::ostream &file, int l=1) const
void print_DynArr_double(std::ostream &file, const DynArr< double > &f)
void print_DynLinArr(std::ostream &file, const DynLinArr< T > &f, int l)
DynLinArr< T > merge(const DynLinArr< T > &fd1, long qfd1, const DynLinArr< T > &fd2, long qfd2)
void print_DynArr(std::ostream &file, const DynArr< T > &f, int l)
std::istream & operator>>(std::istream &file, EqualStepCoorMesh< T > &f)
std::ostream & noindent(std::ostream &f)
void apply2(DynLinArr< T > &ar, void(*fun1)(T &f, void(*fun21)(X &f)), void(*fun2)(X &f))
void print_DynArr_float(std::ostream &file, const DynArr< float > &f)
void print_DynLinArr_int_double3(std::ostream &file, const DynLinArr< int > &iar, const DynLinArr< double > &dar1, const DynLinArr< double > &dar2, const DynLinArr< double > &dar3)
int operator!=(manip_absvol_treeid &tid1, manip_absvol_treeid &tid2)
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
int ifequal(const DynLinArr< T > &fd1, const DynLinArr< T > &fd2, long qfirst=-1)
const int pq_arrelem_in_line
void print_DynLinArr_long(std::ostream &file, const DynLinArr< long > &f)
void print_DynLinArr_int_double(std::ostream &file, const DynLinArr< int > &iar, const DynLinArr< double > &dar)
int find_prev_comb(const DynLinArr< long > &qel, DynLinArr< long > &f)
void print_DynLinArr_double2(std::ostream &file, const DynLinArr< double > &f1, const DynLinArr< double > &f2)
int gconfirm_ind_ext(const DynLinArr< long > &qel, const DynLinArr< long > &ind)
void put_one_n(std::ostringstream &ost)
void print_DynLinArr_float(std::ostream &file, const DynLinArr< float > &f)
int operator==(const circumf &f1, const circumf &f2)
void apply1(DynLinArr< T > &ar, void(*fun)(T &f))
void copy_DynLinArr(const T &s, X &d)
long append(const T &t, DynLinArr< T > &dla, long &qael, T *tempt=NULL, long new_qel=0)
long set_position(const std::string &word, std::istream &istrm, int s_rewind, int s_req_sep)
int gconfirm_ind(const DynLinArr< long > &qel, const DynLinArr< long > &ind)
void print_DynLinArr_double(std::ostream &file, const DynLinArr< double > &f)
void print_DynArr_int_w(std::ostream &file, const DynArr< int > &f, int w)
void convert_DynLinArr(const T &s, X &d)
void print_adr_DynLinArr(std::ostream &file, const DynLinArr< T > &f, int l, long q)
int find_next_comb(const DynLinArr< long > &qel, DynLinArr< long > &f)
int find_next_comb_not_less(const DynLinArr< long > &qel, DynLinArr< long > &f)
void definp_any_par(T &inp, const std::string &word, const definp_endpar &dep, int fs_short=0)
void assignAll_1(DynLinArr< T > &f, const T1 &ft)
void convert_DynArr(const DynArr< T > &s, DynArr< X > &d)
int apeq_mant(const T &x1, const T &x2, T prec)
void copy_DynArr(const DynArr< T > &s, DynArr< X > &d)
void print_DynLinArr_int(std::ostream &file, const DynLinArr< int > &f)
std::ostream & yesindent(std::ostream &f)
DynLinArr< long > qel_communicat
void put_qel_1(DynLinArr< T > &f, long fq)
#define Iprint3n(file, name1, name2, name3)
#define Iprintn(file, name)
#define Iprint2n(file, name1, name2)