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 "
509 T* temp_el = (T*)NULL;
512 for (
long n = 0; n < q; n++) temp_el[n] = f[n];
523#ifdef DEBUG_DYNLINARR
524 mcout <<
"DynLinArr(const DynLinArr<T>& f) is working\n";
540 mcerr <<
"ERROR in template<class T> void DynLinArr<T>::put_qel(long "
542 mcerr <<
"fqel < 0, fqel=" << fqel <<
'\n';
543 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
550 if (qel > 0) el =
new T[fqel];
560 for (
long n = 0; n < fqel; ++n) {
561 if (n < qel) elh[n] = el[n];
582 mcerr <<
"ERROR in template<class T> void DynLinArr<T>::put_qel(long fqel, "
583 "const T* val, ArgInterp_SingleAdr):\n";
584 mcerr <<
"fqel < 0, fqel=" << fqel <<
'\n';
585 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
589 mcerr <<
sizeof(t) <<
"\n";
594 if (qel > 0) el =
new T[fqel];
596 for (
long n = 0; n < qel; ++n) el[n] = *val;
606 for (
long n = 0; n < fqel; ++n) {
609 else if (val != NULL)
629 mfunnamep(
"void DynLinArr<T>::sort(long q_to_sort = 0)");
632 if (q_to_sort <= 0) q_to_sort = qel;
633 if (q_to_sort <= 1)
return;
635 long n_possible_next = 1;
638 for (n = 0; n < q_to_sort - 1; n++) {
642 long nmin = n_possible_next;
644 int s_change_possible_next = 0;
647 for (m = n_possible_next + 1; m < q_to_sort; m++) {
650 if (el_min > el[m]) {
651 n_possible_next = nmin;
652 s_change_possible_next = 1;
658 if (s_change_possible_next == 0 || n_possible_next < n + 2) {
659 n_possible_next = n + 2;
669 if (el[n] > el_min) {
670 if (s_change_possible_next == 1) {
672 if (n_possible_next < q_to_sort && el[n] < el[n_possible_next]) {
673 n_possible_next = nmin;
691 "void DynLinArr<T>::sort(DynLinArr< long >& sort_ind, long "
692 "q_to_sort = 0) const");
695 if (q_to_sort <= 0) q_to_sort = qel;
701 for (n = 0; n < q_to_sort; n++) {
704 if (q_to_sort <= 1)
return;
706 long n_possible_next = 1;
708 for (n = 0; n < q_to_sort - 1; n++) {
710 long nmin = n_possible_next;
711 long ind_nmin = sort_ind.
acu(nmin);
712 int s_change_possible_next = 0;
715 for (m = n_possible_next + 1; m < q_to_sort; m++) {
716 if (el[ind_nmin] > el[sort_ind.
acu(m)])
719 n_possible_next = nmin;
720 s_change_possible_next = 1;
722 ind_nmin = sort_ind.
acu(nmin);
725 if (s_change_possible_next == 0 || n_possible_next < n + 2) {
726 n_possible_next = n + 2;
728 if (el[sort_ind.
acu(n)] > el[ind_nmin])
731 if (s_change_possible_next == 1) {
732 if (n_possible_next < q_to_sort &&
733 el[sort_ind.
acu(n)] < el[sort_ind.
acu(n_possible_next)]) {
734 n_possible_next = nmin;
738 sort_ind.
acu(nmin) = sort_ind.
acu(n);
739 sort_ind.
acu(n) = ind_nmin;
746 long q_to_sort)
const {
748 "void DynLinArr<T>::sort_select_increasing(DynLinArr< long >& "
749 "sort_ind, long q_to_sort = 0) const");
752 long s_last_noninc = 0;
753 if (q_to_sort <= 0) {
756 }
else if (q_to_sort == qel) {
764 for (n = 0; n < qel; n++) {
767 if (q_to_sort <= 1)
return;
769 long n_possible_next = 1;
771 for (n = 0; n < q_to_sort - s_last_noninc; n++) {
773 long nmin = n_possible_next;
774 long ind_nmin = sort_ind[nmin];
775 int s_change_possible_next = 0;
778 for (m = n_possible_next + 1; m < qel; m++) {
779 if (el[ind_nmin] > el[sort_ind[m]])
782 n_possible_next = nmin;
783 s_change_possible_next = 1;
785 ind_nmin = sort_ind[nmin];
788 if (s_change_possible_next == 0 || n_possible_next < n + 2) {
789 n_possible_next = n + 2;
791 if (el[sort_ind[n]] > el[ind_nmin])
794 if (s_change_possible_next == 1) {
795 if (n_possible_next < q_to_sort &&
796 el[sort_ind[n]] < el[sort_ind[n_possible_next]]) {
797 n_possible_next = nmin;
801 sort_ind[nmin] = sort_ind[n];
802 sort_ind[n] = ind_nmin;
810 long q_to_sort)
const {
812 "void DynLinArr<T>::sort_select_decreasing(DynLinArr< long >& "
813 "sort_ind, long q_to_sort = 0) const");
816 long s_last_noninc = 0;
817 if (q_to_sort <= 0) {
820 }
else if (q_to_sort == qel) {
829 for (n = 0; n < qel; n++) {
832 if (q_to_sort <= 1)
return;
834 long n_possible_next = 1;
836 for (n = 0; n < q_to_sort - s_last_noninc; n++) {
839 long nmax = n_possible_next;
841 long ind_nmax = sort_ind[nmax];
842 int s_change_possible_next = 0;
845 for (m = n_possible_next + 1; m < qel; m++) {
847 if (el[ind_nmax] < el[sort_ind[m]]) {
848 n_possible_next = nmax;
849 s_change_possible_next = 1;
852 ind_nmax = sort_ind[nmax];
855 if (s_change_possible_next == 0 || n_possible_next < n + 2) {
856 n_possible_next = n + 2;
859 if (el[sort_ind[n]] < el[ind_nmax]) {
860 if (s_change_possible_next == 1) {
861 if (n_possible_next < q_to_sort &&
862 el[sort_ind[n]] > el[sort_ind[n_possible_next]]) {
863 n_possible_next = nmax;
867 sort_ind[nmax] = sort_ind[n];
868 sort_ind[n] = ind_nmax;
952#ifndef BAN_DEFAULT_PAR_FUN_TEMPL
966 mcerr <<
"ERROR in long append(class DynLinArr& dla, ...): dla.get_qel() < "
968 <<
"dla.get_qel()=" << dla.
get_qel() <<
" qael=" << qael <<
'\n';
969 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
974 if (new_qel <= qael) new_qel = std::max(3 * qael,
long(3));
983#define append_to_DynLinArr(t, dla, qael, tempt, new_qel) \
985 if (dla.get_qel() < qael) { \
986 mcerr << "append(class DynLinArr& dla, ...): dla.get_qel() < qael, " \
987 << "dla.get_qel()=" << dla.get_qel() << " qael=" << qael << '\n'; \
991 if (dla.get_qel() == qael) { \
992 if (new_qel <= qael) nn = std::max(3 * qael, long(3)); \
993 dla.put_qel(nn, tempt); \
997#define append_to_DynLinArr_short(t, dla, qael) \
999 if (dla.get_qel() < qael) { \
1000 mcerr << "append(class DynLinArr& dla, ...): dla.get_qel() < qael, " \
1001 << "dla.get_qel()=" << dla.get_qel() << " qael=" << qael << '\n'; \
1005 if (dla.get_qel() == qael) { \
1006 nn = std::max(3 * qael, long(3)); \
1007 dla.put_qel(nn, NULL); \
1023 for (n = 0; n < f.
get_qel(); n++) {
1026 Ifile <<
"n=" << n <<
" el[n]=";
1028 std::ostringstream ost;
1043 "template<class T> istream& operator>>(istream& file, DynLinArr<T>& f)");
1055 for (fn = 0; fn < qel; fn++) {
1108 for (n = 0; n < f.
get_qel(); n++) {
1112 std::ostringstream ost;
1125 Ifile <<
"DynLinArr<T>: qel=" << f.
get_qel() <<
" q to print is " << q
1129 mcerr <<
"print_DynLinArr(...): q>f.get_qel(), q=" << q
1130 <<
" f.get_qel()=" << f.
get_qel() <<
'\n';
1131 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1137 for (n = 0; n < q; n++) {
1141 std::ostringstream ost;
1155 Ifile <<
"DynLinArr<T>: qel=" << f.
get_qel() <<
" q to print is " << q
1159 mcerr <<
"print_adr_DynLinArr(...): q>f.get_qel(), q=" << q
1160 <<
" f.get_qel()=" << f.
get_qel() <<
'\n';
1161 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1167 for (n = 0; n < q; n++) {
1171 std::ostringstream ost;
1172 f[n]->
print(ost, l);
1203#define Iprintdla_int(file, name) \
1204 file << indn << #name << "=" << noindent; \
1205 print_DynLinArr_int(file, name);
1206#define Iprintdla_long(file, name) \
1207 file << indn << #name << "=" << noindent; \
1208 print_DynLinArr_long(file, name);
1209#define Iprintdla_float(file, name) \
1210 file << indn << #name << "=" << noindent; \
1211 print_DynLinArr_float(file, name);
1212#define Iprintdla_double(file, name) \
1213 file << indn << #name << "=" << noindent; \
1214 print_DynLinArr_double(file, name);
1217template <
class T,
class X>
1219 mfunnamep(
"template<class T, class X> void copy_DynLinArr(const T& s, X& d)");
1222 long q = s.get_qel();
1225 for (n = 0; n < q; n++) {
1231template <
class T,
class X>
1233 long q = s.get_qel();
1236 for (n = 0; n < q; n++) {
1247 for (n = 0; n < q; n++) f[n].put_qel(fq);
1250template <
class T,
class T1>
1256 for (n = 0; n < q; n++) f[n].assignAll(ft);
1264 if (ncur < dar->get_qel() - 1)
1265 return &((*dar)[++ncur]);
1267 ncur = dar->get_qel();
1271 if (ncur >= 0 || ncur < dar->get_qel())
1272 return &((*dar)[ncur]);
1279 return &((*dar)[--ncur]);
1291int gconfirm_ind(
const DynLinArr<long>& qel,
const DynLinArr<long>& ind);
1292int gconfirm_ind_ext(
const DynLinArr<long>& qel,
const DynLinArr<long>& ind);
1319 for (n = 0; n < qfirst; n++) {
1321 if (!(fd1[n] == fd2[n]))
return 0;
1333 if (qfirst > fd1.
get_qel())
return 0;
1335 for (n = 0; n < qfirst; n++)
1336 if (!(fd1[n] == fd2[n]))
return 0;
1343 for (n = 0; n < qfirst; n++)
1344 if (!(fd1[n] == fd2[n]))
return 0;
1359 if (qfd1 + qfd2 == 0)
return ret;
1360 for (n = 0; n < qfd1; n++) {
1363 for (n = 0; n < qfd2; n++) {
1364 ret[qfd1 + n] = fd2[n];
1380 mcout <<
"explicit DynArr(long fqel, T* val=NULL) is called\n";
1391 mcout <<
"explicit DynArr(long fqel, T* val=NULL) is called\n";
1402 for (n = 0; n < fqel; n++) el.acu(n) = ar[n];
1411 for (
long n = 0; n < qel[0]; n++)
ac(n) = f[n];
1415 DynArr(
long fqel1,
long fqel2, T* val = NULL)
1420 mcout <<
"DynArr(long fqel1, long fqel2, T* val=NULL) is called\n";
1435 <<
"DynArr(long fqel1, long fqel2, T val, ArgInterp_Val t) is called\n";
1445 DynArr(
long fqel1,
long fqel2,
long fqel3, T* val = NULL)
1448 el(fqel1 * fqel2 * fqel3) {
1452 cum_qel[0] = fqel2 * fqel3;
1459 DynArr(
long fqel1,
long fqel2,
long fqel3,
long fqel4, T* val = NULL)
1462 el(fqel1 * fqel2 * fqel3 * fqel4) {
1467 cum_qel[0] = fqel2 * fqel3 * fqel4;
1468 cum_qel[1] = fqel3 * fqel4;
1481 if (qdim <= 0)
return;
1485 for (ndim = 1; ndim < qdim; ndim++) size *= qel[ndim];
1487 cum_qel[qdim - 1] = 1;
1488 for (ndim = qdim - 2; ndim >= 0; ndim--)
1489 cum_qel[ndim] = qel[ndim + 1] * cum_qel[ndim + 1];
1497 if (qdim <= 0)
return;
1501 for (ndim = 1; ndim < qdim; ndim++) size *= qel[ndim];
1503 cum_qel[qdim - 1] = 1;
1504 for (ndim = qdim - 2; ndim >= 0; ndim--)
1505 cum_qel[ndim] = qel[ndim + 1] * cum_qel[ndim + 1];
1511 mcout <<
"DynArr(const DynArr<T>& f) is working\n";
1518 mcout <<
"DynArr( DynArr<T>& f, Pilfer) is working\n";
1524 mcout <<
"DynArr::pilfer is called\n";
1529 mcerr <<
"ERROR in DynArr::pilfer(...):\n";
1530 mcerr <<
"Both the destination and source arrays are not empty\n";
1541 cum_qel.
pilfer(f.cum_qel);
1573 operator D&()
const {
1575 mcerr <<
"ERROR in IndexingProvider::operator D& (): q_deref_ind != "
1578 mcerr <<
"Type of T is (in internal notations) " <<
typeid(D).name()
1582#ifdef ALR_CHECK_BOUND
1590 mcerr <<
"ERROR in T& IndexingProvider::operator=(T& f): q_deref_ind "
1591 "!= arr.get_qel().get_qel()\n";
1593 mcerr <<
"Type of T is (in internal notations) " <<
typeid(D).name()
1597#ifdef ALR_CHECK_BOUND
1607 mcerr <<
"ERROR in DynArr::IndexingProvider& DynArr::operator[](long "
1608 "n): q_deref_ind >= arr.get_qel().get_qel()\n";
1610 mcerr <<
"Type of T is (in internal notations) " <<
typeid(D).name()
1614#ifdef ALR_CHECK_EACH_BOUND
1620#ifdef ALR_CHECK_EACH_BOUND
1622 mcerr <<
"Error in IndexingProvider<D>& "
1623 "IndexingProvider::operator[](long n): n < 0 || n >= "
1624 "qel.acu(q_deref_ind)\n";
1626 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1635 mcerr <<
"ERROR in DynArr::IndexingProvider& DynArr::operator[](long "
1636 "n): q_deref_ind >= arr.get_qel().get_qel()\n";
1638 mcerr <<
"Type of T is (in internal notations) " <<
typeid(D).name()
1642#ifdef ALR_CHECK_EACH_BOUND
1648#ifdef ALR_CHECK_EACH_BOUND
1650 mcerr <<
"Error in IndexingProvider<D>& "
1651 "IndexingProvider::operator[](long n): n < 0 || n >= "
1652 "qel.acu(q_deref_ind)\n";
1654 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1668 mcerr <<
"ERROR in DynArr::IndexingProvider DynArr::operator[](long n): "
1669 "qel.get_qel()< 1, qel.get_qel()=" << qel.
get_qel() <<
'\n';
1670 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1674#ifdef ALR_CHECK_EACH_BOUND
1675 if (n >= 0 && n < qel.
acu(0)) {
1678#ifdef ALR_CHECK_EACH_BOUND
1680 mcerr <<
"Error in IndexingProvider<T> DynArr::operator[](long n): n < 0 "
1681 "|| n >= qel.acu(0)\n";
1683 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1692 mcerr <<
"ERROR in DynArr::IndexingProvider DynArr::operator[](long n): "
1693 "qel.get_qel()< 1, qel.get_qel()=" << qel.
get_qel() <<
'\n';
1694 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1698#ifdef ALR_CHECK_EACH_BOUND
1699 if (n >= 0 && n < qel.
acu(0)) {
1705#ifdef ALR_CHECK_EACH_BOUND
1707 mcerr <<
"Error in IndexingProvider<T> DynArr::operator[](long n): n < 0 "
1708 "|| n >= qel.acu(0)\n";
1710 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1719 if (qel.
get_qel() == 1)
return el[i];
1720 mcerr <<
"ERROR in DynArr::ac(long i): qel.get_qel()!= 1, qel.get_qel()="
1722 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1727 const T&
ac(
long i)
const {
1729 if (qel.
get_qel() == 1)
return el[i];
1730 mcerr <<
"ERROR in DynArr::ac(long i): qel.get_qel()!= 1, qel.get_qel()="
1732 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1741 inline const T&
acu(
long i1)
const
1754 mcerr <<
"ERROR in DynArr::ac(const DynLinArr<long>& ind): "
1755 <<
"qel.get_qel()!= ind.get_qel()\n"
1756 <<
"qel.get_qel()=" << qel.
get_qel()
1757 <<
" ind.get_qel()=" << ind.
get_qel() <<
'\n';
1758 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1762#ifdef ALR_CHECK_EACH_BOUND
1765 return el[ind.
acu(0)];
1767 return el[calc_lin_ind(ind)];
1770 return el[ind.
acu(0)];
1772 return el.acu(calc_lin_ind(ind));
1776 return el[ind.
acu(0)];
1778 return el[calc_lin_ind(ind)];
1784 if ((q = qel.
get_qel()) != ind.get_qel()) {
1785 mcerr <<
"ERROR in DynArr::ac(const DynLinArr<long>& ind): "
1786 <<
"qel.get_qel()!= ind.get_qel()\n"
1787 <<
"qel.get_qel()=" << qel.
get_qel()
1788 <<
" ind.get_qel()=" << ind.get_qel() <<
'\n';
1789 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1806#ifdef ALR_CHECK_EACH_BOUND
1809 return el[ind.acu(0)];
1811 return el[calc_lin_ind(ind)];
1814 return el[ind.acu(0)];
1816 return el.acu(calc_lin_ind(ind));
1820 return el[ind.acu(0)];
1822 return el[calc_lin_ind(ind)];
1832 mcerr <<
"ERROR in DynArr::acp(const DynLinArr<long>& ind): "
1833 <<
"qel.get_qel()!= ind.get_qel()\n"
1834 <<
"qel.get_qel()=" << qel.
get_qel()
1835 <<
" ind.get_qel()=" << ind.
get_qel() <<
'\n';
1836 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1841#ifdef ALR_CHECK_EACH_BOUND
1844 return el[ind.
acu(0)];
1846 return el[calc_lin_ind(ind)];
1849 return el[ind.
acu(0)];
1851 return el.acu(calc_lin_ind(ind));
1855 return el[ind.
acu(0)];
1857 return el[calc_lin_ind(ind)];
1864 mcerr <<
"ERROR in DynArr::acp(const DynLinArr<long>& ind): "
1865 <<
"qel.get_qel()!= ind.get_qel()\n"
1866 <<
"qel.get_qel()=" << qel.
get_qel()
1867 <<
" ind.get_qel()=" << ind.
get_qel() <<
'\n';
1868 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1872#ifdef ALR_CHECK_EACH_BOUND
1875 return el[ind.
acu(0)];
1877 return el[calc_lin_ind(ind)];
1880 return el[ind.
acu(0)];
1882 return el.acu(calc_lin_ind(ind));
1886 return el[ind.
acu(0)];
1888 return el[calc_lin_ind(ind)];
1895 return el.acu(ind.
acu(0));
1897 return el.acu(calc_lin_ind(ind));
1902 return el.acu(ind.acu(0));
1904 return el.acu(calc_lin_ind(ind));
1910#ifdef ALR_CHECK_EACH_BOUND
1911 if (i1 >= 0 && i1 < qel.
acu(0)) {
1912 if (i2 >= 0 && i2 < qel.
acu(1)) {
1914 return el[i1 * cum_qel.
acu(0) + i2];
1916 return el.acu(i1 * cum_qel.
acu(0) + i2);
1919 mcerr <<
"Error in DynArr::ac(long i1, long i2): i2 < 0 || i2 >= "
1924 mcerr <<
"Error in DynArr::ac(long i1, long i2): i1 < 0 || i1 >= "
1929 mcerr <<
"ERROR in DynArr::ac(long i1, long i2): qel.get_qel()!= 2,"
1930 <<
" qel.get_qel()=" << qel.
get_qel() <<
'\n';
1932 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
1937 return el[i1 * cum_qel.
acu(0) + i2];
1974 const T&
ac(
long i1,
long i2)
const
1977#ifdef ALR_CHECK_EACH_BOUND
1978 if (i1 >= 0 && i1 < qel.
acu(0)) {
1979 if (i2 >= 0 && i2 < qel.
acu(1)) {
1981 return el[i1 * cum_qel.
acu(0) + i2];
1983 return el.acu(i1 * cum_qel.
acu(0) + i2);
1986 mcerr <<
"Error in DynArr::ac(long i1, long i2): i2 < 0 || i2 >= "
1991 mcerr <<
"Error in DynArr::ac(long i1, long i2): i1 < 0 || i1 >= "
1996 mcerr <<
"ERROR in DynArr::ac(long i1, long i2): qel.get_qel()!= 2,"
1997 <<
" qel.get_qel()=" << qel.
get_qel() <<
'\n';
1999 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
2004 return el[i1 * cum_qel.
acu(0) + i2];
2044 return el.acu(i1 * cum_qel.
acu(0) + i2);
2046 inline const T&
acu(
long i1,
long i2)
const
2048 return el.acu(i1 * cum_qel.
acu(0) + i2);
2051 T&
ac(
long i1,
long i2,
long i3)
2054 mcerr <<
"ERROR in DynArr::ac(long i1, long i2, long i3): "
2055 "qel.get_qel()!= 3,"
2056 <<
" qel.get_qel()=" << qel.
get_qel() <<
'\n';
2057 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
2061#ifdef ALR_CHECK_EACH_BOUND
2062 if (i1 < 0 || i1 >= qel.
acu(0)) {
2063 mcerr <<
"Error in DynArr::ac(long i1, long i2, long i3): i1 < 0 || i1 "
2068 if (i2 < 0 || i2 >= qel.
acu(1)) {
2069 mcerr <<
"Error in DynArr::ac(long i1, long i2, long i3): i2 < 0 || i2 "
2074 if (i3 < 0 || i3 >= qel.
acu(2)) {
2075 mcerr <<
"Error in DynArr::ac(long i1, long i2, long i3): i3 < 0 || i3 "
2081 return el.acu(i1 * cum_qel.
acu(0) + i2 * cum_qel.
acu(1) + i3);
2083 return el[i1 * cum_qel.
acu(0) + i2 * cum_qel[1] + i3];
2086 return el[i1 * cum_qel.acu(0) + i2 * cum_qel[1] + i3];
2091 const T&
ac(
long i1,
long i2,
long i3)
const
2094 mcerr <<
"ERROR in DynArr::ac(long i1, long i2, long i3): "
2095 "qel.get_qel()!= 3,"
2096 <<
" qel.get_qel()=" << qel.
get_qel() <<
'\n';
2097 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
2101#ifdef ALR_CHECK_EACH_BOUND
2102 if (i1 < 0 || i1 >= qel.
acu(0)) {
2103 mcerr <<
"Error in DynArr::ac(long i1, long i2, long i3): i1 < 0 || i1 "
2108 if (i2 < 0 || i2 >= qel.
acu(1)) {
2109 mcerr <<
"Error in DynArr::ac(long i1, long i2, long i3): i2 < 0 || i2 "
2114 if (i3 < 0 || i3 >= qel.
acu(2)) {
2115 mcerr <<
"Error in DynArr::ac(long i1, long i2, long i3): i3 < 0 || i3 "
2121 return el.acu(i1 * cum_qel.
acu(0) + i2 * cum_qel.
acu(1) + i3);
2123 return el[i1 * cum_qel.
acu(0) + i2 * cum_qel[1] + i3];
2126 return el[i1 * cum_qel.acu(0) + i2 * cum_qel[1] + i3];
2135 long qelln = el.get_qel();
2136#ifdef ALR_CHECK_BOUND
2137 if (n >= 0 && n < qelln)
return el[n];
2138 mcerr <<
"ERROR in T& DynArr::ac_lin(long n): "
2139 <<
"n is out of bounds, n=" << n <<
" qelln=" << qelln <<
'\n';
2140 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
2149 long qelln = el.get_qel();
2150#ifdef ALR_CHECK_BOUND
2151 if (n >= 0 && n < qelln)
return el[n];
2152 mcerr <<
"ERROR in T& DynArr::ac_lin(long n): "
2153 <<
"n is out of bounds, n=" << n <<
" qelln=" << qelln <<
'\n';
2154 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
2164 inline const T&
acu_lin(
long n)
const {
return el[n]; }
2205 template <
class P,
class X>
2207 void (*fun2)(X& f));
2216 if (q == 0)
return 0;
2218 for (n = 0; n < q; n++) {
2219 if (qel[n] <= 0)
return 0;
2242 long qdim1 = qel.
get_qel() - 1;
2256 for (n = 0; n < qdim1; n++) {
2257#ifdef ALR_CHECK_EACH_BOUND
2259 if (ind[n] < 0 || ind[n] >= qel[n]) {
2260 mcerr <<
"ERROR in long DynArr::calc_lin_ind(const DynLinArr<long>& "
2262 mcerr <<
"ind[n] < 0 || ind[n] >= qel[n]\n";
2268 if (ind.
acu(n) < 0 || ind.
acu(n) >= qel.
acu(n)) {
2269 mcerr <<
"ERROR in long DynArr::calc_lin_ind(const DynLinArr<long>& "
2271 mcerr <<
"ind.acu(n) < 0 || ind.acu(n) >= qel.acu(n)\n";
2278 i += ind[n] * cum_qel[n];
2280#ifdef ALR_CHECK_EACH_BOUND
2282 if (ind[qdim1] < 0 || ind[qdim1] >= qel[qdim1]) {
2283 mcerr <<
"ERROR in long DynArr::calc_lin_ind(const DynLinArr<long>& ind) "
2285 mcerr <<
"ind[qdim1] < 0 || ind[qdim1] >= qel[qdim1]\n";
2291 if (ind.
acu(qdim1) < 0 || ind.
acu(qdim1) >= qel.
acu(qdim1)) {
2292 mcerr <<
"ERROR in long DynArr::calc_lin_ind(const DynLinArr<long>& ind) "
2294 mcerr <<
"ind.acu(qdim1) < 0 || ind.acu(qdim1) >= qel.acu(qdim1)\n";
2310 mcout <<
"DynArr<T>& DynArr<T>::operator=(const DynArr<T>& f)\n";
2318 cum_qel = f.cum_qel;
2327#ifdef DEBUG_DYNLINARR
2328 mcout <<
"DynArr<T>& DynArr<T>::operator=(const DynArr<D>& f)\n";
2336 T* temp_el = (q > 0) ? (
new T[q]) : (T*)NULL;
2337 for (
long n = 0; n < q; n++) temp_el[n] = f.
acu_lin(n);
2338 pass(q, fqel, fcum_qel, temp_el);
2344 const long q = ar.el.get_qel();
2345 for (
long n = 0; n < q; n++) (*fun)(ar.el[n]);
2347template <
class T,
class X>
2349 void (*fun2)(X& f)) {
2350 const long q = ar.el.get_qel();
2351 for (
long n = 0; n < q; n++) (*fun1)(ar.el[n], fun2);
2354int find_next_comb(
const DynLinArr<long>& qel, DynLinArr<long>& f);
2355int find_prev_comb(
const DynLinArr<long>& qel, DynLinArr<long>& f);
2362 : ncur(fdar->get_qdim()), dar((
DynArr<T>*)fdar) {
2364 long qdim1 = ncur.
get_qel() - 1;
2366 for (n = 0; n < qdim1; n++) ncur[n] = 0;
2373 return &(dar->ac(ncur));
2382 if (qdim <= 0)
return NULL;
2383 for (n = 0; n < qdim; n++) {
2384 if (ncur[n] < 0 || ncur[n] >= dar->get_qel()[n])
return NULL;
2386 return &(dar->ac(ncur));
2393 return &(dar->ac(ncur));
2420 while ((at = iter.
more()) != NULL) {
2421 if (confirm_ind_ext(iter.
get_ncur()))
2432 for (n = 0; n < q; n++) {
2433 if (!(f1.
acu(n) == f2.
acu(n)))
return 0;
2438template <
class T,
class P>
2443 for (n = 0; n < q; n++) {
2464template <
class T,
class P>
2493template <
class T,
class X>
2496 "template<class T, class X> void copy_DynArr(const DynArr<T>& s, "
2503 while ((at = iter.
more()) != NULL) {
2510template <
class T,
class X>
2513 "template<class T, class X> void convert_DynArr(const DynArr<T>& "
2514 "s, DynArr<X>& d)");
2520 while ((at = iter.
more()) != NULL) {
2522 d.
ac(ncur) = X(*at);
2531 for (n = 0; n < qel; n++) {
2538 mfunnamep(
"template<class T> DynArr<T> DynArr<T>::top(void)");
2540 long qdim = get_qdim();
2544 for (n1 = 0; n1 < qel[0]; n1++) {
2545 for (n2 = 0; n2 < qel[1]; n2++) {
2546 r.
ac(n2, n1) = ac(n1, n2);
2558 mcerr <<
"ERROR in DynLinArr<T>::DynLinArr(const DynArr<T>& f):\n"
2559 <<
"f.get_qdim() != 1, f.get_qdim()=" << f.
get_qdim() <<
'\n';
2560 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
2569 for (
long n = 0; n < qel; n++) el[n] = f.
ac(n);
2583 mcerr <<
"ERROR in DynLinArr<T>::DynLinArr(const DynArr<T>& f, int "
2584 "n_of_dim,long roc_number):\n"
2585 <<
"f.get_qdim() != 2, f.get_qdim()=" << f.
get_qdim() <<
'\n';
2586 mcerr <<
"Type of T is (in internal notations) " <<
typeid(T).name()
2591 if (n_of_dim == 0) {
2600 if (n_of_dim == 0) {
2601 for (n = 0; n < qel; n++) el[n] = f.
ac(roc_number, n);
2603 for (n = 0; n < qel; n++) el[n] = f.
ac(n, roc_number);
2623 Ifile <<
"Content element by element:\n";
2624 Ifile <<
"(The first number is sequencial number, then there are "
2625 "indexes, the last is the element)\n";
2631 while ((at = iter_f.
more()) != NULL) {
2632 std::ostringstream ost;
2635 Ifile <<
"nseq=" << std::setw(5) << nseq <<
" ncur=";
2637 for (n = 0; n < iter_f.
get_ncur().get_qel(); n++) {
2638 file <<
' ' << std::setw(5) << iter_f.
get_ncur()[n];
2651 Ifile <<
"Content is empty.\n";
2689 "template<class T> istream& operator>>(istream& file, DynArr<T>& f)");
2709 file >> cum_qel_loc;
2715 long qseq = qel_loc[0];
2716 for (n = 1; n < qel_loc.
get_qel(); n++) {
2719 for (n = 0; n < qseq; n++) {
2726 for (m = 0; m < qel_loc.
get_qel(); m++) {
2795 Ifile <<
"Content element by element:\n";
2796 Ifile <<
"(The first number is sequencial number, then there are indexes, "
2797 "the last is the element)\n";
2802 while ((at = iter_f.
more()) != NULL) {
2804 Ifile <<
"nseq=" << std::setw(5) << nseq <<
" ncur=";
2806 for (n = 0; n < iter_f.
get_ncur().get_qel(); n++) {
2807 file <<
' ' << std::setw(5) << iter_f.
get_ncur()[n];
2812 std::ostringstream ost;
2834#define Iprintda_double(file, name) \
2835 file << indn << #name << "=" << noindent; \
2836 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)