Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
AbsArr.h File Reference
#include <iostream>
#include <iomanip>
#include "wcpplib/stream/prstream.h"
#include "wcpplib/util/FunNameStack.h"
#include "wcpplib/util/emul_new_stand.h"
#include "wcpplib/util/String.h"
#include "wcpplib/safetl/AbsPtr.h"
#include "wcpplib/math/minmax.h"
#include "wcpplib/stream/definp.h"

Go to the source code of this file.

Classes

class  ArgInterp_Arr
 
class  ArgInterp_SingleAdr
 
class  ArgInterp_Val
 
class  DynLinArr< T >
 
class  IterDynLinArr< T >
 
class  DynArr< T >
 
class  DynArr< T >::IndexingProvider< D >
 
class  IterDynArr< T >
 

Macros

#define ALR_CHECK_BOUND
 
#define ALR_CHECK_EACH_BOUND
 
#define Iprintdla_int(file, name)
 
#define Iprintdla_long(file, name)
 
#define Iprintdla_float(file, name)
 
#define Iprintdla_double(file, name)
 
#define Iprintda_double(file, name)
 

Functions

template<class T >
 macro_copy_body (DynLinArr< T >) template< class T > void apply1(DynLinArr< T > &ar
 
template<class T , class X >
void apply2 (DynLinArr< T > &ar, void(*fun1)(T &f, void(*fun21)(X &f)), void(*fun2)(X &f))
 
template<class T >
long append (const T &t, DynLinArr< T > &dla, long &qael, T *tempt=NULL, long new_qel=0)
 
template<class T >
std::ostream & operator<< (std::ostream &file, const DynLinArr< T > &f)
 
template<class T >
std::istream & operator>> (std::istream &file, DynLinArr< T > &f)
 
template<class T >
void print_DynLinArr (std::ostream &file, const DynLinArr< T > &f, int l)
 
template<class T >
void print_DynLinArr (std::ostream &file, const DynLinArr< T > &f, int l, long q)
 
template<class T >
void print_adr_DynLinArr (std::ostream &file, const DynLinArr< T > &f, int l, long q)
 
void print_DynLinArr_int (std::ostream &file, const DynLinArr< int > &f)
 
void print_DynLinArr_long (std::ostream &file, const DynLinArr< long > &f)
 
void print_DynLinArr_float (std::ostream &file, const DynLinArr< float > &f)
 
void print_DynLinArr_double (std::ostream &file, const DynLinArr< double > &f)
 
void print_DynLinArr_double2 (std::ostream &file, const DynLinArr< double > &f1, const DynLinArr< double > &f2)
 
void print_DynLinArr_int_double (std::ostream &file, const DynLinArr< int > &iar, const DynLinArr< double > &dar)
 
void print_DynLinArr_int_double3 (std::ostream &file, const DynLinArr< int > &iar, const DynLinArr< double > &dar1, const DynLinArr< double > &dar2, const DynLinArr< double > &dar3)
 
template<class T , class X >
void copy_DynLinArr (const T &s, X &d)
 
template<class T , class X >
void convert_DynLinArr (const T &s, X &d)
 
template<class T >
void put_qel_1 (DynLinArr< T > &f, long fq)
 
template<class T , class T1 >
void assignAll_1 (DynLinArr< T > &f, const T1 &ft)
 
int gconfirm_ind (const DynLinArr< long > &qel, const DynLinArr< long > &ind)
 
int gconfirm_ind_ext (const DynLinArr< long > &qel, const DynLinArr< long > &ind)
 
template<class T >
int ifequal (const DynLinArr< T > &fd1, const DynLinArr< T > &fd2, long qfirst=-1)
 
template<class T >
int ifequal (const DynLinArr< T > &fd1, const T *fd2, long qfirst=-1)
 
template<class T >
int ifequal (T *fd1, T *fd2, long qfirst)
 
template<class T >
DynLinArr< T > merge (const DynLinArr< T > &fd1, long qfd1, const DynLinArr< T > &fd2, long qfd2)
 
String DynLinArr_char_we_to_String (DynLinArr< char > &ar)
 
template<class T >
void apply1 (DynArr< T > &ar, void(*fun)(T &f))
 
template<class T , class X >
void apply2 (DynArr< T > &ar, void(*fun1)(T &f, void(*fun21)(X &f)), void(*fun2)(X &f))
 
int find_next_comb (const DynLinArr< long > &qel, DynLinArr< long > &f)
 
int find_prev_comb (const DynLinArr< long > &qel, DynLinArr< long > &f)
 
int find_next_comb_not_less (const DynLinArr< long > &qel, DynLinArr< long > &f)
 
template<class T >
int operator== (const DynLinArr< T > &f1, const DynLinArr< T > &f2)
 
template<class T , class P >
int apeq_mant (const DynLinArr< T > &f1, const DynLinArr< T > &f2, P prec)
 
template<class T >
int operator!= (const DynLinArr< T > &f1, const DynLinArr< T > &f2)
 
template<class T >
int operator== (const DynArr< T > &f1, const DynArr< T > &f2)
 
template<class T , class P >
int apeq_mant (const DynArr< T > &f1, const DynArr< T > &f2, P prec)
 
template<class T >
int operator!= (const DynArr< T > &f1, const DynArr< T > &f2)
 
template<class T , class X >
void copy_DynArr (const DynArr< T > &s, DynArr< X > &d)
 
template<class T , class X >
void convert_DynArr (const DynArr< T > &s, DynArr< X > &d)
 
template<class T >
std::ostream & operator<< (std::ostream &file, const DynArr< T > &f)
 
template<class T >
std::istream & operator>> (std::istream &file, DynArr< T > &f)
 
template<class T >
void print_DynArr (std::ostream &file, const DynArr< T > &f, int l)
 
void print_DynArr_int_w (std::ostream &file, const DynArr< int > &f, int w)
 
void print_DynArr_float (std::ostream &file, const DynArr< float > &f)
 
void print_DynArr_double (std::ostream &file, const DynArr< double > &f)
 

Variables

long max_qel_DynLinArr
 
void(* fun )(T &f))
 
const int pq_arrelem_in_line = 5
 
DynLinArr< long > qel_communicat
 

Macro Definition Documentation

◆ ALR_CHECK_BOUND

#define ALR_CHECK_BOUND

Definition at line 76 of file AbsArr.h.

◆ ALR_CHECK_EACH_BOUND

#define ALR_CHECK_EACH_BOUND

Definition at line 79 of file AbsArr.h.

◆ Iprintda_double

#define Iprintda_double (   file,
  name 
)
Value:
file << indn << #name << "=" << noindent; \
print_DynArr_double(file, name);
indentation indn
Definition: prstream.cpp:13
std::ostream & noindent(std::ostream &f)
Definition: prstream.cpp:15

Definition at line 3248 of file AbsArr.h.

◆ Iprintdla_double

#define Iprintdla_double (   file,
  name 
)
Value:
file << indn << #name << "=" << noindent; \
print_DynLinArr_double(file, name);

Definition at line 1535 of file AbsArr.h.

◆ Iprintdla_float

#define Iprintdla_float (   file,
  name 
)
Value:
file << indn << #name << "=" << noindent; \
print_DynLinArr_float(file, name);

Definition at line 1532 of file AbsArr.h.

◆ Iprintdla_int

#define Iprintdla_int (   file,
  name 
)
Value:
file << indn << #name << "=" << noindent; \
print_DynLinArr_int(file, name);

Definition at line 1526 of file AbsArr.h.

◆ Iprintdla_long

#define Iprintdla_long (   file,
  name 
)
Value:
file << indn << #name << "=" << noindent; \
print_DynLinArr_long(file, name);

Definition at line 1529 of file AbsArr.h.

Function Documentation

◆ apeq_mant() [1/2]

template<class T , class P >
int apeq_mant ( const DynArr< T > &  f1,
const DynArr< T > &  f2,
prec 
)

Definition at line 2868 of file AbsArr.h.

2868 {
2869 if (f1.get_qel() != f2.get_qel()) return 0;
2870 if (!apeq_mant(f1.get_el(), f2.get_el(), prec)) return 0;
2871 return 1;
2872}
int apeq_mant(const DynLinArr< T > &f1, const DynLinArr< T > &f2, P prec)
Definition: AbsArr.h:2843
const DynLinArr< T > & get_el(void) const
Definition: AbsArr.h:2549
const DynLinArr< long > & get_qel(void) const
Definition: AbsArr.h:2548

◆ apeq_mant() [2/2]

template<class T , class P >
int apeq_mant ( const DynLinArr< T > &  f1,
const DynLinArr< T > &  f2,
prec 
)

Definition at line 2843 of file AbsArr.h.

2843 {
2844 if (f1.get_qel() != f2.get_qel()) return 0;
2845 long q = f1.get_qel();
2846 long n;
2847 for (n = 0; n < q; n++) {
2848 if (!apeq_mant(f1.acu(n), f2.acu(n), prec)) return 0;
2849 }
2850 return 1;
2851}
long get_qel(void) const
Definition: AbsArr.h:420
T & acu(long n)
Definition: AbsArr.h:372

Referenced by apeq_mant().

◆ append()

template<class T >
long append ( const T &  t,
DynLinArr< T > &  dla,
long &  qael,
T *  tempt = NULL,
long  new_qel = 0 
)

Definition at line 1247 of file AbsArr.h.

1257 {
1258 if (dla.get_qel() < qael) {
1259 mcerr << "ERROR in long append(class DynLinArr& dla, ...): dla.get_qel() < "
1260 "qael\n"
1261 << "dla.get_qel()=" << dla.get_qel() << " qael=" << qael << '\n';
1262 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
1263 << '\n';
1264 spexit(mcerr);
1265 }
1266 if (dla.get_qel() == qael) {
1267 if (new_qel <= qael) new_qel = find_max(3 * qael, long(3));
1268 dla.put_qel(new_qel, tempt, ArgInterp_SingleAdr());
1269 }
1270 dla[qael++] = t;
1271 return qael;
1272}
DoubleAc find_max(const DoubleAc &a, const DoubleAc &b)
Definition: DoubleAc.h:655
#define spexit(stream)
Definition: FunNameStack.h:536
void put_qel(long fqel)
Definition: AbsArr.h:774
#define mcerr
Definition: prstream.h:135

◆ apply1()

template<class T >
void apply1 ( DynArr< T > &  ar,
void(*)(T &f)  fun 
)

Definition at line 2743 of file AbsArr.h.

2743 {
2744 long q = ar.el.get_qel();
2745 long n;
2746 for (n = 0; n < q; n++)
2747 (*fun)(ar.el[n]);
2748}
void(* fun)(T &f))
Definition: AbsArr.h:591

◆ apply2() [1/2]

template<class T , class X >
void apply2 ( DynArr< T > &  ar,
void(*)(T &f, void(*fun21)(X &f))  fun1,
void(*)(X &f)  fun2 
)

Definition at line 2750 of file AbsArr.h.

2751 {
2752 long q = ar.el.get_qel();
2753 long n;
2754 for (n = 0; n < q; n++)
2755 (*fun1)(ar.el[n], fun2);
2756}

◆ apply2() [2/2]

template<class T , class X >
void apply2 ( DynLinArr< T > &  ar,
void(*)(T &f, void(*fun21)(X &f))  fun1,
void(*)(X &f)  fun2 
)

Definition at line 602 of file AbsArr.h.

603 {
604 long n;
605 for (n = 0; n < ar.qel; n++)
606 (*fun1)(ar.el[n], fun2);
607}

◆ assignAll_1()

template<class T , class T1 >
void assignAll_1 ( DynLinArr< T > &  f,
const T1 &  ft 
)

Definition at line 1573 of file AbsArr.h.

1575 {
1576 long q = f.get_qel();
1577 long n;
1578 for (n = 0; n < q; n++)
1579 f[n].assignAll(ft);
1580}

◆ convert_DynArr()

template<class T , class X >
void convert_DynArr ( const DynArr< T > &  s,
DynArr< X > &  d 
)

Definition at line 2910 of file AbsArr.h.

2910 {
2911 mfunnamep("template<class T, class X> void convert_DynArr(const DynArr<T>& "
2912 "s, DynArr<X>& d)");
2913 s.check();
2914 d.check();
2915 d = DynArr<X>(s.get_qel(), NULL);
2916 IterDynArr<T> iter(&s);
2917 T* at;
2918 while ((at = iter.more()) != NULL) {
2919 const DynLinArr<long>& ncur = iter.get_ncur();
2920 d.ac(ncur) = X(*at);
2921 }
2922}
#define mfunnamep(string)
Definition: FunNameStack.h:77
void check(void) const
Definition: AbsArr.h:2587
T & ac(long i)
Definition: AbsArr.h:2057

◆ convert_DynLinArr()

template<class T , class X >
void convert_DynLinArr ( const T &  s,
X &  d 
)

Definition at line 1553 of file AbsArr.h.

1553 {
1554 long q = s.get_qel();
1555 d.put_qel(q);
1556 long n;
1557 for (n = 0; n < q; n++) {
1558 d[n] = X(s[n]);
1559 }
1560}

◆ copy_DynArr()

template<class T , class X >
void copy_DynArr ( const DynArr< T > &  s,
DynArr< X > &  d 
)

Definition at line 2894 of file AbsArr.h.

2894 {
2895 mfunnamep("template<class T, class X> void copy_DynArr(const DynArr<T>& s, "
2896 "DynArr<X>& d)");
2897 s.check();
2898 d.check();
2899 d = DynArr<X>(s.get_qel(), NULL);
2900 IterDynArr<T> iter(&s);
2901 T* at;
2902 while ((at = iter.more()) != NULL) {
2903 const DynLinArr<long>& ncur = iter.get_ncur();
2904 d.ac(ncur) = *at;
2905 }
2906}

Referenced by inverse_DynArr().

◆ copy_DynLinArr()

template<class T , class X >
void copy_DynLinArr ( const T &  s,
X &  d 
)

Definition at line 1540 of file AbsArr.h.

1540 {
1541 mfunnamep("template<class T, class X> void copy_DynLinArr(const T& s, X& d)");
1542 s.check();
1543 d.check();
1544 long q = s.get_qel();
1545 d.put_qel(q);
1546 long n;
1547 for (n = 0; n < q; n++) {
1548 d[n] = s[n];
1549 }
1550}

◆ DynLinArr_char_we_to_String()

String DynLinArr_char_we_to_String ( DynLinArr< char > &  ar)

Definition at line 228 of file AbsArr.cpp.

228 {
229 DynLinArr<char> ar_ext(ar.get_qel() + 1);
230 long n;
231 long q = ar.get_qel();
232 for (n = 0; n < q; n++) {
233 ar_ext[n] = ar[n];
234 }
235 ar_ext[n] = '\0';
236 return String(&(ar_ext[0]));
237}
std::string String
Definition: String.h:75

◆ find_next_comb()

int find_next_comb ( const DynLinArr< long > &  qel,
DynLinArr< long > &  f 
)

Definition at line 465 of file AbsArr.cpp.

465 {
466 long n;
467 long qdim = qel.get_qel();
468 if (qdim <= 0) return 0;
469 if (qdim != f.get_qel()) return 0; //@@
470#ifdef DEBUG_DYNARR
471 for (n = qdim - 1; n >= 0; n--) {
472 if (f[n] < qel[n] - 1) {
473 f[n]++;
474 return 1;
475 } else {
476 f[n] = 0;
477 } // the first element
478
479 } // it was last combination
480 for (n = 0; n < qdim - 1; n++)
481 f[n] = qel[n] - 1; // the last element
482 f[qdim - 1] = qel[qdim - 1]; // next after last
483#else
484 for (n = qdim - 1; n >= 0; n--) {
485 if (f.acu(n) < qel.acu(n) - 1) {
486 f.acu(n)++;
487 return 1;
488 } else {
489 f.acu(n) = 0;
490 } // the first element
491
492 } // it was last combination
493 for (n = 0; n < qdim - 1; n++)
494 f.acu(n) = qel.acu(n) - 1; // the last element
495 f.acu(qdim - 1) = qel.acu(qdim - 1); // next after last
496#endif
497 return 0;
498}

Referenced by IterDynArr< T >::more().

◆ find_next_comb_not_less()

int find_next_comb_not_less ( const DynLinArr< long > &  qel,
DynLinArr< long > &  f 
)

Definition at line 500 of file AbsArr.cpp.

500 {
501 long n;
502 long qdim = qel.get_qel();
503 if (qdim <= 0) return 0;
504 if (qdim != f.get_qel()) return 0; //@@
505 for (n = qdim - 1; n >= 0; n--) {
506 if (f[n] < qel[n] - 1) {
507 f[n]++;
508 int n1;
509 for (n1 = n + 1; n1 < qdim; n1++)
510 f[n1] = f[n];
511 return 1;
512 }
513 } // it was last combination
514 for (n = 0; n < qdim - 1; n++)
515 f[n] = qel[n] - 1; // the last element
516 f[qdim - 1] = qel[qdim - 1]; // next after last
517 return 0;
518}

◆ find_prev_comb()

int find_prev_comb ( const DynLinArr< long > &  qel,
DynLinArr< long > &  f 
)

Definition at line 520 of file AbsArr.cpp.

520 {
521 long n;
522 long qdim = qel.get_qel();
523 if (qdim <= 0) return 0;
524 if (qdim != f.get_qel()) return 0; //@@
525 for (n = qdim - 1; n >= 0; n--) {
526 if (f[n] >= 1) {
527 f[n]--;
528 return 1;
529 } else {
530 f[n] = qel[n] - 1;
531 } // the last element
532 }
533 for (n = 0; n < qdim - 1; n++)
534 f[n] = 0; // the first element
535 f[qdim - 1] = -1;
536 return 0; // previous before first
537}

Referenced by IterDynArr< T >::less().

◆ gconfirm_ind()

int gconfirm_ind ( const DynLinArr< long > &  qel,
const DynLinArr< long > &  ind 
)

Definition at line 433 of file AbsArr.cpp.

433 {
434 if (qel.get_qel() != ind.get_qel()) {
435 mcerr << "gconfirm_ind(...): "
436 << "qel.get_qel()!= ind.get_qel()\n"
437 << "qel.get_qel()=" << qel.get_qel()
438 << "ind.get_qel()=" << ind.get_qel() << '\n';
439 spexit(mcerr);
440 }
441 long qd = qel.get_qel();
442 //if( ind.get_qel() < qd) qd=ind.get_qel();
443 long n;
444 for (n = 0; n < qd; n++)
445 if (ind[n] < 0 || ind[n] >= qel[n]) return 0;
446 return 1;
447}

Referenced by DynArr< T >::confirm_ind().

◆ gconfirm_ind_ext()

int gconfirm_ind_ext ( const DynLinArr< long > &  qel,
const DynLinArr< long > &  ind 
)

Definition at line 448 of file AbsArr.cpp.

448 {
449 if (qel.get_qel() > ind.get_qel()) {
450 mcerr << "gconfirm_ind_ext(...): "
451 << "qel.get_qel()> ind.get_qel()\n"
452 << "qel.get_qel()=" << qel.get_qel()
453 << " ind.get_qel()=" << ind.get_qel() << '\n';
454 spexit(mcerr);
455 }
456 long qd = qel.get_qel();
457 long n;
458 for (n = 0; n < qd; n++)
459 if (ind[n] < 0 || ind[n] >= qel[n]) return 0;
460 for (n = qd; n < ind.get_qel(); n++)
461 if (ind[n] != 0) return 0;
462 return 1;
463}

Referenced by DynArr< T >::confirm_ind_ext().

◆ ifequal() [1/3]

template<class T >
int ifequal ( const DynLinArr< T > &  fd1,
const DynLinArr< T > &  fd2,
long  qfirst = -1 
)

Definition at line 1631 of file AbsArr.h.

1632 {
1633 long n;
1634 if (qfirst == -1) {
1635 if ((qfirst = fd1.get_qel()) != fd2.get_qel()) return 0;
1636 //qfirst=fd1.get_qel();
1637 } else {
1638 if (qfirst > fd1.get_qel() || qfirst > fd2.get_qel()) return 0;
1639 }
1640 //Iprintn(mcout, qfirst);
1641 for (n = 0; n < qfirst; n++) {
1642 //Iprint3n(mcout, n, fd1[n], fd2[n]);
1643 if (!(fd1[n] == fd2[n])) return 0;
1644 }
1645 return 1;
1646}

◆ ifequal() [2/3]

template<class T >
int ifequal ( const DynLinArr< T > &  fd1,
const T *  fd2,
long  qfirst = -1 
)

Definition at line 1650 of file AbsArr.h.

1650 {
1651 long n;
1652 if (qfirst == -1) {
1653 qfirst = fd1.get_qel();
1654 } else {
1655 if (qfirst > fd1.get_qel()) return 0;
1656 }
1657 for (n = 0; n < qfirst; n++)
1658 if (!(fd1[n] == fd2[n])) return 0;
1659 return 1;
1660}

◆ ifequal() [3/3]

template<class T >
int ifequal ( T *  fd1,
T *  fd2,
long  qfirst 
)

Definition at line 1662 of file AbsArr.h.

1662 {
1663 long n;
1664 for (n = 0; n < qfirst; n++)
1665 if (!(fd1[n] == fd2[n])) return 0;
1666 return 1;
1667}

◆ macro_copy_body()

template<class T >
macro_copy_body ( DynLinArr< T >  ) &

◆ merge()

template<class T >
DynLinArr< T > merge ( const DynLinArr< T > &  fd1,
long  qfd1,
const DynLinArr< T > &  fd2,
long  qfd2 
)

Definition at line 1670 of file AbsArr.h.

1671 {
1672 long n;
1673 if (qfd1 < 0) {
1674 qfd1 = fd1.get_qel();
1675 }
1676 if (qfd2 < 0) {
1677 qfd2 = fd2.get_qel();
1678 }
1679 DynLinArr<T> ret(qfd1 + qfd2);
1680 if (qfd1 + qfd2 == 0) return ret;
1681 for (n = 0; n < qfd1; n++) {
1682 ret[n] = fd1[n];
1683 }
1684 for (n = 0; n < qfd2; n++) {
1685 ret[qfd1 + n] = fd2[n];
1686 }
1687 return ret;
1688}

◆ operator!=() [1/2]

template<class T >
int operator!= ( const DynArr< T > &  f1,
const DynArr< T > &  f2 
)

Definition at line 2874 of file AbsArr.h.

2874 {
2875 if (f1.get_qel() == f2.get_qel()) return 0;
2876 if (f1.get_el() == f2.get_el()) return 0;
2877 return 1;
2878}

◆ operator!=() [2/2]

template<class T >
int operator!= ( const DynLinArr< T > &  f1,
const DynLinArr< T > &  f2 
)

Definition at line 2854 of file AbsArr.h.

2854 {
2855 if (f1 == f2)
2856 return 0;
2857 else
2858 return 1;
2859}

◆ operator<<() [1/2]

template<class T >
std::ostream & operator<< ( std::ostream &  file,
const DynArr< T > &  f 
)

Definition at line 3022 of file AbsArr.h.

3022 {
3023 //mfunnamep("template<class T> std::ostream& operator<<(std::ostream& file,
3024 //const DynArr<T>& f)");
3025 f.check();
3026 Ifile << "DynArr<T>: qdim=" << f.get_qdim() << '\n';
3027 indn.n += 2;
3028 if (s_short_output > 0) {
3029 Ifile << noindent << f.get_qel() << yesindent;
3030 } else {
3031 Ifile << "qel=" << noindent << f.get_qel() << yesindent;
3032 Ifile << "cum_qel=" << noindent << f.get_cum_qel() << yesindent;
3033 }
3034 if (f.get_s_non_emplty() == 1) {
3035 if (s_short_output == 0) {
3036 Ifile << "Content element by element:\n";
3037 Ifile << "(The first number is sequencial number, then there are "
3038 "indexes, the last is the element)\n";
3039 //DynArr<T>& ff(f);
3040 }
3041 long nseq = 0;
3042 IterDynArr<T> iter_f(&((DynArr<T>&)f));
3043 T* at;
3044 while ((at = iter_f.more()) != NULL) {
3045 std::ostringstream ost;
3046 if (s_short_output == 0) {
3047 //Ifile<<"ncur="<<noindent<<iter_f.get_ncur()<<yesindent;
3048 Ifile << "nseq=" << std::setw(5) << nseq << " ncur=";
3049 long n;
3050 for (n = 0; n < iter_f.get_ncur().get_qel(); n++) {
3051 file << ' ' << std::setw(5) << iter_f.get_ncur()[n];
3052 }
3053 ost << indn << " element=" << noindent << (*at) << yesindent;
3054 } else {
3055 ost << indn << noindent << (*at) << yesindent;
3056 }
3057 put_one_n(ost);
3058 file << ost.str();
3059 nseq++;
3060 }
3061 file << yesindent;
3062 } else {
3063 if (s_short_output == 0) {
3064 Ifile << "Content is empty.\n";
3065 }
3066 }
3067 indn.n -= 2;
3068 return file;
3069}
void put_one_n(std::ostringstream &ost)
Definition: String.h:127
const DynLinArr< long > & get_cum_qel(void) const
Definition: AbsArr.h:2552
long get_qdim(void) const
Definition: AbsArr.h:2547
int get_s_non_emplty(void) const
Definition: AbsArr.h:2592
std::ostream & yesindent(std::ostream &f)
Definition: prstream.cpp:19
int s_short_output
Definition: prstream.cpp:23
#define Ifile
Definition: prstream.h:207

◆ operator<<() [2/2]

template<class T >
std::ostream & operator<< ( std::ostream &  file,
const DynLinArr< T > &  f 
)

Definition at line 1320 of file AbsArr.h.

1320 {
1321 //mfunnamep("template<class T> std::ostream& operator<<(std::ostream& file,
1322 //const DynLinArr<T>& f)");
1323 //mcout<<"operator<<(std::ostream& file, const DynLinArr<T>& f) is started\n";
1324 Ifile << "DynLinArr<T>: qel=" << f.get_qel() << '\n';
1325 f.check();
1326 long n;
1327 indn.n += 2;
1328 for (n = 0; n < f.get_qel(); n++) {
1329 //Ifile<<"n="<<n<<" el[n]="<<noindent<<f[n]<<yesindent<<'\n';
1330 if (s_short_output == 0) {
1331 Ifile << "n=" << n << " el[n]=";
1332 }
1333 std::ostringstream ost;
1334 ost << indn << noindent << f[n] << yesindent;
1335 put_one_n(ost);
1336 file << ost.str();
1337 }
1338 //file<<yesindent;
1339 indn.n -= 2;
1340 return file;
1341}
void check(void) const
Definition: AbsArr.h:615

◆ operator==() [1/2]

template<class T >
int operator== ( const DynArr< T > &  f1,
const DynArr< T > &  f2 
)

Definition at line 2861 of file AbsArr.h.

2861 {
2862 if (f1.get_qel() != f2.get_qel()) return 0;
2863 if (f1.get_el() != f2.get_el()) return 0;
2864 return 1;
2865}

◆ operator==() [2/2]

template<class T >
int operator== ( const DynLinArr< T > &  f1,
const DynLinArr< T > &  f2 
)

Definition at line 2832 of file AbsArr.h.

2832 {
2833 if (f1.get_qel() != f2.get_qel()) return 0;
2834 long q = f1.get_qel();
2835 long n;
2836 for (n = 0; n < q; n++) {
2837 if (!(f1.acu(n) == f2.acu(n))) return 0;
2838 }
2839 return 1;
2840}

◆ operator>>() [1/2]

template<class T >
std::istream & operator>> ( std::istream &  file,
DynArr< T > &  f 
)

Definition at line 3099 of file AbsArr.h.

3099 {
3100 mfunnamep(
3101 "template<class T> istream& operator>>(istream& file, DynArr<T>& f)");
3102 definp_endpar dep(&file, 0, 1, 0, s_short_output);
3103 long qdim = 0;
3104 dep.s_short = 0;
3105 DEFINPAP(qdim);
3106 dep.s_short = s_short_output;
3107 check_econd11(qdim, < 0, mcerr);
3108 if (s_short_output == 0) {
3109 set_position("qel=DynLinArr<T>:", *dep.istrm, dep.s_rewind, dep.s_req_sep);
3110 } else {
3111 set_position("DynLinArr<T>:", *dep.istrm, dep.s_rewind, dep.s_req_sep);
3112 }
3113 DynLinArr<long> qel_loc;
3114 //mcout<<"now will read qel_loc\n";
3115 file >> qel_loc;
3116 //mcout<<"qel_loc is read\n";
3117 if (s_short_output == 0) {
3118 set_position("cum_qel=DynLinArr<T>:", *dep.istrm, dep.s_rewind,
3119 dep.s_req_sep);
3120 DynLinArr<long> cum_qel_loc;
3121 file >> cum_qel_loc; // this is in general unnecessary
3122 }
3123 if (qel_loc.get_qel() > 0) {
3124 f.pilfer(DynArr<T>(qel_loc, NULL));
3125 long nseq;
3126 long n;
3127 long qseq = qel_loc[0];
3128 for (n = 1; n < qel_loc.get_qel(); n++) {
3129 qseq *= qel_loc[n];
3130 }
3131 for (n = 0; n < qseq; n++) {
3132 if (s_short_output == 0) {
3133 DEFINPAP(nseq);
3134 check_econd12(nseq, !=, n, mcerr);
3135 DynLinArr<long> ncur(qel_loc.get_qel());
3136 set_position("ncur=", *dep.istrm, dep.s_rewind, dep.s_req_sep);
3137 long m;
3138 for (m = 0; m < qel_loc.get_qel(); m++) {
3139 file >> ncur[m];
3140 }
3141 //T element;
3142 //DEFINPAP(element);
3143 //f.ac(ncur) = element;
3144 set_position("element=", *dep.istrm, dep.s_rewind, dep.s_req_sep);
3145 }
3146 file >> f.ac_lin(n);
3147 }
3148 } else {
3149 if (s_short_output == 0) {
3150 // just pass to end
3151 set_position("Content is empty.", *dep.istrm, dep.s_rewind,
3152 dep.s_req_sep);
3153 }
3154 f.pilfer(DynArr<T>());
3155
3156 }
3157 return file;
3158}
#define check_econd11(a, signb, stream)
Definition: FunNameStack.h:366
#define check_econd12(a, sign, b, stream)
Definition: FunNameStack.h:380
void pilfer(PILF_CONST DynArr< T > &f)
Definition: AbsArr.h:1863
T & ac_lin(long n)
Definition: AbsArr.h:2501
long set_position(const String &word, std::istream &istrm, int s_rewind, int s_req_sep)
Definition: definp.cpp:71
#define DEFINPAP(name)
Definition: definp.h:91

◆ operator>>() [2/2]

template<class T >
std::istream & operator>> ( std::istream &  file,
DynLinArr< T > &  f 
)

Definition at line 1346 of file AbsArr.h.

1346 {
1347 mfunnamep(
1348 "template<class T> istream& operator>>(istream& file, DynLinArr<T>& f)");
1349 //mcout<<"operator<<(std::ostream& file, const DynLinArr<T>& f) is started\n";
1350 definp_endpar dep(&file, 0, 1, 0, s_short_output);
1351 long qel = 0;
1352 dep.s_short = 0;
1353 DEFINPAP(qel);
1354 dep.s_short = s_short_output;
1355 check_econd11(qel, < 0, mcerr);
1356 f.clear();
1357 f.put_qel(qel);
1358 long fn;
1359 for (fn = 0; fn < qel; fn++) {
1360 if (s_short_output == 0) {
1361 long n = 0;
1362 DEFINPAP(n);
1363 check_econd12(fn, !=, n, mcerr);
1364 }
1365 //set_position("el[n]=", *dep.istrm, dep.s_rewind, dep.s_req_sep);
1366 //file >> f[n];
1367 definp_any_par(f[fn], "el[n]=", dep);
1368 }
1369 return file;
1370}
void clear(void)
Definition: AbsArr.h:450
void definp_any_par(T &inp, const String &word, const definp_endpar &dep, int fs_short=0)
Definition: definp.h:66

◆ print_adr_DynLinArr()

template<class T >
void print_adr_DynLinArr ( std::ostream &  file,
const DynLinArr< T > &  f,
int  l,
long  q 
)

Definition at line 1474 of file AbsArr.h.

1475 {
1476 //mfunnamep("template<class T> void print_adr_DynLinArr(std::ostream& file,
1477 //const DynLinArr<T>& f, int l, long q)");
1478 Ifile << "DynLinArr<T>: qel=" << f.get_qel() << " q to print is " << q
1479 << '\n';
1480 f.check();
1481 if (q > f.get_qel()) {
1482 mcerr << "print_adr_DynLinArr(...): q>f.get_qel(), q=" << q
1483 << " f.get_qel()=" << f.get_qel() << '\n';
1484 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
1485 << '\n';
1486 spexit(mcerr);
1487 }
1488 long n;
1489 indn.n += 2;
1490 for (n = 0; n < q; n++) {
1491 //Ifile<<"n="<<n<<" el[n]="<<noindent; f[n]->print(file, l);
1492 //file<<yesindent;
1493 Ifile << "n=" << n << " el[n]=" << noindent;
1494 std::ostringstream ost;
1495 f[n]->print(ost, l);
1496 ost << yesindent;
1497 put_one_n(ost);
1498 file << ost.str();
1499 }
1500 indn.n -= 2;
1501}

◆ print_DynArr()

template<class T >
void print_DynArr ( std::ostream &  file,
const DynArr< T > &  f,
int  l 
)

Definition at line 3198 of file AbsArr.h.

3198 {
3199 //mfunnamep("template<class T> oid print_DynArr(std::ostream& file, const
3200 //DynArr<T>& f, int l)");
3201 f.check();
3202 //Ifile<<"DynArr<T>: qdim="<<f.get_qdim()
3203 // <<" qel="<<noindent<<f.get_qel()<<yesindent<<'\n';
3204 Ifile << "DynArr<T>: qdim=" << f.get_qdim() << '\n';
3205 indn.n += 2;
3206 Ifile << "qel=" << noindent << f.get_qel() << yesindent;
3207 Ifile << "cum_qel=" << noindent << f.get_cum_qel() << yesindent;
3208 Ifile << "Content element by element:\n";
3209 Ifile << "(The first number is sequencial number, then there are indexes, "
3210 "the last is the element)\n";
3211 //DynArr<T>& ff(f);
3212 long nseq = 0;
3213 IterDynArr<T> iter_f(&((DynArr<T>&)f));
3214 T* at;
3215 while ((at = iter_f.more()) != NULL) {
3216 //Ifile<<"ncur="<<noindent<<iter_f.get_ncur()<<yesindent;
3217 Ifile << "nseq=" << std::setw(5) << nseq << " ncur=";
3218 long n;
3219 for (n = 0; n < iter_f.get_ncur().get_qel(); n++) {
3220 file << ' ' << std::setw(5) << iter_f.get_ncur()[n];
3221 }
3222 //file<<'\n';
3223 //Ifile<<"element="<<noindent; at->print(file, l);
3224 //file<<yesindent<<'\n';
3225 std::ostringstream ost;
3226 ost << indn << " element=" << noindent;
3227 at->print(ost, l);
3228 ost << yesindent;
3229 put_one_n(ost);
3230 file << ost.str();
3231 }
3232 file << yesindent;
3233 indn.n -= 2;
3234
3235}

◆ print_DynArr_double()

void print_DynArr_double ( std::ostream &  file,
const DynArr< double > &  f 
)

◆ print_DynArr_float()

void print_DynArr_float ( std::ostream &  file,
const DynArr< float > &  f 
)

◆ print_DynArr_int_w()

void print_DynArr_int_w ( std::ostream &  file,
const DynArr< int > &  f,
int  w 
)

◆ print_DynLinArr() [1/2]

template<class T >
void print_DynLinArr ( std::ostream &  file,
const DynLinArr< T > &  f,
int  l 
)

Definition at line 1405 of file AbsArr.h.

1405 {
1406 //mfunnamep("template<class T> void print_DynLinArr(std::ostream& file, const
1407 //DynLinArr<T>& f, int l)");
1408 Ifile << "DynLinArr<T>: qel=" << f.get_qel() << '\n';
1409 f.check();
1410 long n;
1411 indn.n += 2;
1412 for (n = 0; n < f.get_qel(); n++) {
1413 //Ifile<<"n="<<n<<" el[n]="<<noindent; f[n].print(file, l);
1414 //file<<yesindent;
1415 Ifile << "n=" << n << " el[n]=" << noindent;
1416 std::ostringstream ost;
1417 f[n].print(ost, l);
1418 ost << yesindent;
1419 put_one_n(ost);
1420 file << ost.str();
1421 }
1422 indn.n -= 2;
1423}

◆ print_DynLinArr() [2/2]

template<class T >
void print_DynLinArr ( std::ostream &  file,
const DynLinArr< T > &  f,
int  l,
long  q 
)

Definition at line 1445 of file AbsArr.h.

1445 {
1446 //mfunnamep("template<class T> void print_DynLinArr(std::ostream& file, const
1447 //DynLinArr<T>& f, int l, long q)");
1448 Ifile << "DynLinArr<T>: qel=" << f.get_qel() << " q to print is " << q
1449 << '\n';
1450 f.check();
1451 if (q > f.get_qel()) {
1452 mcerr << "print_DynLinArr(...): q>f.get_qel(), q=" << q
1453 << " f.get_qel()=" << f.get_qel() << '\n';
1454 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
1455 << '\n';
1456 spexit(mcerr);
1457 }
1458 long n;
1459 indn.n += 2;
1460 for (n = 0; n < q; n++) {
1461 //Ifile<<"n="<<n<<" el[n]="<<noindent; f[n].print(file, l);
1462 //file<<yesindent;
1463 Ifile << "n=" << n << " el[n]=" << noindent;
1464 std::ostringstream ost;
1465 f[n].print(ost, l);
1466 ost << yesindent;
1467 put_one_n(ost);
1468 file << ost.str();
1469 }
1470 indn.n -= 2;
1471}

◆ print_DynLinArr_double()

void print_DynLinArr_double ( std::ostream &  file,
const DynLinArr< double > &  f 
)

◆ print_DynLinArr_double2()

void print_DynLinArr_double2 ( std::ostream &  file,
const DynLinArr< double > &  f1,
const DynLinArr< double > &  f2 
)

◆ print_DynLinArr_float()

void print_DynLinArr_float ( std::ostream &  file,
const DynLinArr< float > &  f 
)

◆ print_DynLinArr_int()

void print_DynLinArr_int ( std::ostream &  file,
const DynLinArr< int > &  f 
)

◆ print_DynLinArr_int_double()

void print_DynLinArr_int_double ( std::ostream &  file,
const DynLinArr< int > &  iar,
const DynLinArr< double > &  dar 
)

◆ print_DynLinArr_int_double3()

void print_DynLinArr_int_double3 ( std::ostream &  file,
const DynLinArr< int > &  iar,
const DynLinArr< double > &  dar1,
const DynLinArr< double > &  dar2,
const DynLinArr< double > &  dar3 
)

◆ print_DynLinArr_long()

void print_DynLinArr_long ( std::ostream &  file,
const DynLinArr< long > &  f 
)

◆ put_qel_1()

template<class T >
void put_qel_1 ( DynLinArr< T > &  f,
long  fq 
)

Definition at line 1563 of file AbsArr.h.

1565 {
1566 long q = f.get_qel();
1567 long n;
1568 for (n = 0; n < q; n++)
1569 f[n].put_qel(fq);
1570}

Variable Documentation

◆ fun

void(* fun) (T &f)) ( T &  f)

Definition at line 591 of file AbsArr.h.

591 {
592 long n;
593 for (n = 0; n < ar.qel; n++)
594 (*fun)(ar.el[n]);
595}

Referenced by apply1(), t_integ_generic_point_ar(), and t_integ_generic_step_ar().

◆ max_qel_DynLinArr

long max_qel_DynLinArr
extern

Definition at line 17 of file AbsArr.cpp.

Referenced by DynLinArr< T >::check(), and DynLinArr< T >::DynLinArr().

◆ pq_arrelem_in_line

◆ qel_communicat

DynLinArr<long> qel_communicat
extern

Definition at line 539 of file AbsArr.cpp.

Referenced by DynArr< T >::put_qel().