Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Heed::DynArr< T > Class Template Reference

#include <AbsArr.h>

+ Inheritance diagram for Heed::DynArr< T >:

Classes

class  IndexingProvider
 

Public Member Functions

 DynArr (void)
 
 DynArr (long fqel, T *val=NULL)
 
 DynArr (long fqel, T val, ArgInterp_Val)
 
 DynArr (long fqel, const T *ar, ArgInterp_Arr)
 
 DynArr (const DynLinArr< T > &f)
 
 DynArr (long fqel1, long fqel2, T *val=NULL)
 
 DynArr (long fqel1, long fqel2, T val, ArgInterp_Val)
 
 DynArr (long fqel1, long fqel2, long fqel3, T *val=NULL)
 
 DynArr (long fqel1, long fqel2, long fqel3, long fqel4, T *val=NULL)
 
 DynArr (const DynLinArr< long > &fqel, T val, ArgInterp_Val)
 
 DynArr (const DynLinArr< long > &fqel, T *val)
 
 DynArr (const DynArr< T > &f)
 
 DynArr (const DynArr< T > &f, Pilfer)
 
void pilfer (const DynArr< T > &f)
 
DynArr< T > & operator= (const DynArr< T > &f)
 
template<class D >
DynArr< T > & operator= (const DynArr< D > &f)
 
void pass (long q, DynLinArr< long > fqel, DynLinArr< long > fcum_qel, T *fel)
 
IndexingProvider< T > operator[] (long n)
 
const IndexingProvider< T > operator[] (long n) const
 
T & ac (long i)
 
const T & ac (long i) const
 
T & acu (long i1)
 
const T & acu (long i1) const
 
T & ac (const DynLinArr< long > &ind)
 
const T & ac (const DynLinArr< long > &ind) const
 
T & acp (const DynLinArr< long > &ind)
 
const T & acp (const DynLinArr< long > &ind) const
 
T & acu (const DynLinArr< long > &ind)
 
const T & acu (const DynLinArr< long > &ind) const
 
T & ac (long i1, long i2)
 
const T & ac (long i1, long i2) const
 
T & acu (long i1, long i2)
 
const T & acu (long i1, long i2) const
 
T & ac (long i1, long i2, long i3)
 
const T & ac (long i1, long i2, long i3) const
 
long get_qel_lin (void) const
 
T & ac_lin (long n)
 
const T & ac_lin (long n) const
 
T & acu_lin (long n)
 
const T & acu_lin (long n) const
 
void assignAll (const T &val)
 
long get_qdim (void) const
 
const DynLinArr< long > & get_qel (void) const
 
const DynLinArr< T > & get_el (void) const
 
const DynLinArr< long > & get_cum_qel (void) const
 
void put_qel (T *val=NULL)
 
void clear (void)
 
int confirm_ind (const DynLinArr< long > &ind)
 
int confirm_ind_ext (const DynLinArr< long > &ind)
 
DynArr< T > top (void)
 
void check (void) const
 
int get_s_non_emplty (void) const
 
virtual DynArrcopy () const
 
virtual ~DynArr ()
 
- Public Member Functions inherited from Heed::RegPassivePtr
 RegPassivePtr (void)
 
 RegPassivePtr (char fs_ban_del, char fs_ban_sub, char fs_ban_cop=0)
 
 RegPassivePtr (const RegPassivePtr &f)
 
RegPassivePtroperator= (const RegPassivePtr &f)
 
CountPP_ns::CountPassivePtrbook (void) const
 
void clear_pointers (void) const
 
virtual RegPassivePtrcopy () const
 
virtual ~RegPassivePtr ()
 
virtual void print (std::ostream &file, int l=1) const
 
void set_s_ban_del (char fs_ban_del)
 
char get_s_ban_del (void) const
 
void set_s_ban_sub (char fs_ban_sub)
 
char get_s_ban_sub (void) const
 
void set_s_ban_cop (char fs_ban_cop)
 
char get_s_ban_cop (void) const
 
void set_s_allow_del_at_zero_count (char fs_allow_del_at_zero_count)
 
char get_s_allow_del_at_zero_count (void) const
 
long get_total_number_of_references (void) const
 

Friends

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

Additional Inherited Members

- Static Public Member Functions inherited from Heed::RegPassivePtr
static void set_s_ban_del_ignore (char fs_ban_del_ignore)
 
static char get_s_ban_del_ignore (void)
 
static void set_s_print_adr_cpp (char fs_print_adr_cpp)
 
static char get_s_print_adr_cpp (void)
 

Detailed Description

template<class T>
class Heed::DynArr< T >

Definition at line 1367 of file AbsArr.h.

Constructor & Destructor Documentation

◆ DynArr() [1/13]

template<class T >
Heed::DynArr< T >::DynArr ( void  )
inline

Definition at line 1370 of file AbsArr.h.

1370{ ; }

Referenced by Heed::DynArr< T >::copy().

◆ DynArr() [2/13]

template<class T >
Heed::DynArr< T >::DynArr ( long  fqel,
T *  val = NULL 
)
inlineexplicit

Definition at line 1372 of file AbsArr.h.

1373 : qel(DynLinArr<long>(1)),
1374 cum_qel(DynLinArr<long>(1)),
1375 el(DynLinArr<T>(fqel)) {
1376#ifdef DEBUG_DYNARR
1377 mcout << "explicit DynArr(long fqel, T* val=NULL) is called\n";
1378#endif
1379 qel[0] = fqel;
1380 cum_qel[0] = 1;
1381 if (val != NULL) assignAll(*val);
1382 }
void assignAll(const T &val)
Definition: AbsArr.h:2463
#define mcout
Definition: prstream.h:126

◆ DynArr() [3/13]

template<class T >
Heed::DynArr< T >::DynArr ( long  fqel,
val,
ArgInterp_Val   
)
inline

Definition at line 1383 of file AbsArr.h.

1384 : qel(DynLinArr<long>(1)),
1385 cum_qel(DynLinArr<long>(1)),
1386 el(DynLinArr<T>(fqel)) {
1387#ifdef DEBUG_DYNARR
1388 mcout << "explicit DynArr(long fqel, T* val=NULL) is called\n";
1389#endif
1390 qel[0] = fqel;
1391 cum_qel[0] = 1;
1392 assignAll(val);
1393 }

◆ DynArr() [4/13]

template<class T >
Heed::DynArr< T >::DynArr ( long  fqel,
const T *  ar,
ArgInterp_Arr   
)
inline

Definition at line 1394 of file AbsArr.h.

1395 : qel(DynLinArr<long>(1)), cum_qel(DynLinArr<long>(1)), el(fqel) {
1396 qel[0] = fqel;
1397 cum_qel[0] = 1;
1398 long n;
1399 for (n = 0; n < fqel; n++) el.acu(n) = ar[n];
1400 }

◆ DynArr() [5/13]

template<class T >
Heed::DynArr< T >::DynArr ( const DynLinArr< T > &  f)
inline

Definition at line 1404 of file AbsArr.h.

1405 : qel(DynLinArr<long>(1)), cum_qel(DynLinArr<long>(1)), el(f.get_qel()) {
1406 qel[0] = f.get_qel();
1407 cum_qel[0] = 1;
1408 for (long n = 0; n < qel[0]; n++) ac(n) = f[n];
1409 }
T & ac(long i)
Definition: AbsArr.h:1700
long get_qel(void) const
Definition: AbsArr.h:283

◆ DynArr() [6/13]

template<class T >
Heed::DynArr< T >::DynArr ( long  fqel1,
long  fqel2,
T *  val = NULL 
)
inline

Definition at line 1412 of file AbsArr.h.

1413 : qel(DynLinArr<long>(2)),
1414 cum_qel(DynLinArr<long>(2)),
1415 el(fqel1 * fqel2) {
1416#ifdef DEBUG_DYNARR
1417 mcout << "DynArr(long fqel1, long fqel2, T* val=NULL) is called\n";
1418#endif
1419 qel[0] = fqel1;
1420 qel[1] = fqel2;
1421 cum_qel[0] = fqel2;
1422 cum_qel[1] = 1;
1423 if (val != NULL) assignAll(*val);
1424 }

◆ DynArr() [7/13]

template<class T >
Heed::DynArr< T >::DynArr ( long  fqel1,
long  fqel2,
val,
ArgInterp_Val   
)
inline

Definition at line 1426 of file AbsArr.h.

1427 : qel(DynLinArr<long>(2)),
1428 cum_qel(DynLinArr<long>(2)),
1429 el(fqel1 * fqel2) {
1430#ifdef DEBUG_DYNARR
1431 mcout
1432 << "DynArr(long fqel1, long fqel2, T val, ArgInterp_Val t) is called\n";
1433#endif
1434 qel[0] = fqel1;
1435 qel[1] = fqel2;
1436 cum_qel[0] = fqel2;
1437 cum_qel[1] = 1;
1438 assignAll(val);
1439 }

◆ DynArr() [8/13]

template<class T >
Heed::DynArr< T >::DynArr ( long  fqel1,
long  fqel2,
long  fqel3,
T *  val = NULL 
)
inline

Definition at line 1442 of file AbsArr.h.

1443 : qel(DynLinArr<long>(3)),
1444 cum_qel(DynLinArr<long>(3)),
1445 el(fqel1 * fqel2 * fqel3) {
1446 qel[0] = fqel1;
1447 qel[1] = fqel2;
1448 qel[2] = fqel3;
1449 cum_qel[0] = fqel2 * fqel3;
1450 cum_qel[1] = fqel3;
1451 cum_qel[2] = 1;
1452 if (val != NULL) assignAll(*val);
1453 }

◆ DynArr() [9/13]

template<class T >
Heed::DynArr< T >::DynArr ( long  fqel1,
long  fqel2,
long  fqel3,
long  fqel4,
T *  val = NULL 
)
inline

Definition at line 1456 of file AbsArr.h.

1457 : qel(DynLinArr<long>(4)),
1458 cum_qel(DynLinArr<long>(4)),
1459 el(fqel1 * fqel2 * fqel3 * fqel4) {
1460 qel[0] = fqel1;
1461 qel[1] = fqel2;
1462 qel[2] = fqel3;
1463 qel[3] = fqel4;
1464 cum_qel[0] = fqel2 * fqel3 * fqel4;
1465 cum_qel[1] = fqel3 * fqel4;
1466 cum_qel[2] = fqel4;
1467 cum_qel[3] = 1;
1468 if (val != NULL) assignAll(*val);
1469 }

◆ DynArr() [10/13]

template<class T >
Heed::DynArr< T >::DynArr ( const DynLinArr< long > &  fqel,
val,
ArgInterp_Val   
)
inline

Definition at line 1476 of file AbsArr.h.

1476 : qel(fqel) {
1477 long qdim = qel.get_qel();
1478 if (qdim <= 0) return;
1479 cum_qel.put_qel(qdim);
1480 long ndim;
1481 long size = qel[0];
1482 for (ndim = 1; ndim < qdim; ndim++) size *= qel[ndim];
1483 el.put_qel(size);
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];
1487 assignAll(val);
1488 }
void put_qel(long fqel)
Definition: AbsArr.h:527

◆ DynArr() [11/13]

template<class T >
Heed::DynArr< T >::DynArr ( const DynLinArr< long > &  fqel,
T *  val 
)
inlineexplicit

Definition at line 1490 of file AbsArr.h.

1490 : qel(fqel) {
1491 // fqel: array of dimensions
1492 // val: address of value to fill, may be NULL
1493 long qdim = qel.get_qel();
1494 if (qdim <= 0) return;
1495 cum_qel.put_qel(qdim);
1496 long ndim;
1497 long size = qel[0];
1498 for (ndim = 1; ndim < qdim; ndim++) size *= qel[ndim];
1499 el.put_qel(size);
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];
1503 if (val != NULL) assignAll(*val);
1504 }

◆ DynArr() [12/13]

template<class T >
Heed::DynArr< T >::DynArr ( const DynArr< T > &  f)
inline

Definition at line 1506 of file AbsArr.h.

1506 : RegPassivePtr() {
1507#ifdef DEBUG_DYNARR
1508 mcout << "DynArr(const DynArr<T>& f) is working\n";
1509#endif
1510 *this = f;
1511 }
RegPassivePtr(void)
Definition: AbsPtr.h:346

◆ DynArr() [13/13]

template<class T >
Heed::DynArr< T >::DynArr ( const DynArr< T > &  f,
Pilfer   
)
inline

Definition at line 1512 of file AbsArr.h.

1513 : qel(f.qel, steal), cum_qel(f.cum_qel, steal), el(f.el, steal) {
1514#ifdef DEBUG_DYNARR
1515 mcout << "DynArr( DynArr<T>& f, Pilfer) is working\n";
1516#endif
1517 }
@ steal
Definition: AbsPtr.h:185

◆ ~DynArr()

template<class T >
virtual Heed::DynArr< T >::~DynArr ( )
inlinevirtual

Definition at line 2207 of file AbsArr.h.

2207{}

Member Function Documentation

◆ ac() [1/8]

template<class T >
T & Heed::DynArr< T >::ac ( const DynLinArr< long > &  ind)
inline

Definition at line 1730 of file AbsArr.h.

1734 {
1735 long q;
1736 if ((q = qel.get_qel()) != ind.get_qel()) {
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()
1742 << '\n';
1743 spexit(mcerr);
1744 }
1745#ifdef ALR_CHECK_EACH_BOUND
1746#ifdef DEBUG_DYNARR
1747 if (q == 1) // faster for this case
1748 return el[ind.acu(0)];
1749 else
1750 return el[calc_lin_ind(ind)];
1751#else
1752 if (q == 1)
1753 return el[ind.acu(0)];
1754 else
1755 return el.acu(calc_lin_ind(ind));
1756#endif
1757#else
1758 if (q == 1)
1759 return el[ind.acu(0)];
1760 else
1761 return el[calc_lin_ind(ind)];
1762#endif
1763 }
#define spexit(stream)
Definition: FunNameStack.h:256
T & acu(long n)
Definition: AbsArr.h:247
#define mcerr
Definition: prstream.h:128

◆ ac() [2/8]

template<class T >
const T & Heed::DynArr< T >::ac ( const DynLinArr< long > &  ind) const
inline

Definition at line 1764 of file AbsArr.h.

1765 {
1766 long q;
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()
1773 << '\n';
1774 spexit(mcerr);
1775 }
1776/*
1777#ifdef ALR_CHECK_EACH_BOUND
1778#ifdef DEBUG_DYNARR
1779 return el[calc_lin_ind(ind)];
1780#else
1781 return el.acu(calc_lin_ind(ind));
1782#endif
1783#else
1784 return el[calc_lin_ind(ind)];
1785#endif
1786 //return el[calc_lin_ind(ind)];
1787 */
1788
1789#ifdef ALR_CHECK_EACH_BOUND
1790#ifdef DEBUG_DYNARR
1791 if (q == 1) // faster for this case
1792 return el[ind.acu(0)];
1793 else
1794 return el[calc_lin_ind(ind)];
1795#else
1796 if (q == 1)
1797 return el[ind.acu(0)];
1798 else
1799 return el.acu(calc_lin_ind(ind));
1800#endif
1801#else
1802 if (q == 1)
1803 return el[ind.acu(0)];
1804 else
1805 return el[calc_lin_ind(ind)];
1806#endif
1807 }

◆ ac() [3/8]

template<class T >
T & Heed::DynArr< T >::ac ( long  i)
inline

Definition at line 1700 of file AbsArr.h.

1700 {
1701 // for 1-dimensional array
1702 if (qel.get_qel() == 1) return el[i];
1703 mcerr << "ERROR in DynArr::ac(long i): qel.get_qel()!= 1, qel.get_qel()="
1704 << qel.get_qel() << '\n';
1705 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
1706 << '\n';
1707 spexit(mcerr);
1708 return el[0];
1709 }

Referenced by Heed::convert_DynArr(), Heed::copy_DynArr(), Heed::determinant_DynArr(), Heed::DynArr< T >::DynArr(), Heed::DynLinArr< T >::DynLinArr(), Heed::inverse_DynArr(), Heed::inverse_DynArr_prot(), Heed::Parabola::Parabola(), Heed::print_DynArr_double(), Heed::print_DynArr_float(), Heed::print_DynArr_int_w(), Heed::DynLinArr< T >::top(), and Heed::DynArr< T >::top().

◆ ac() [4/8]

template<class T >
const T & Heed::DynArr< T >::ac ( long  i) const
inline

Definition at line 1710 of file AbsArr.h.

1710 {
1711 // for 1-dimensional array
1712 if (qel.get_qel() == 1) return el[i];
1713 mcerr << "ERROR in DynArr::ac(long i): qel.get_qel()!= 1, qel.get_qel()="
1714 << qel.get_qel() << '\n';
1715 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
1716 << '\n';
1717 spexit(mcerr);
1718 return el[0];
1719 }

◆ ac() [5/8]

template<class T >
T & Heed::DynArr< T >::ac ( long  i1,
long  i2 
)
inline

Definition at line 1890 of file AbsArr.h.

1891 {
1892 if (qel.get_qel() == 2) {
1893#ifdef ALR_CHECK_EACH_BOUND
1894 if (i1 >= 0 && i1 < qel.acu(0)) {
1895 if (i2 >= 0 && i2 < qel.acu(1)) {
1896#ifdef DEBUG_DYNARR
1897 return el[i1 * cum_qel.acu(0) + i2];
1898#else
1899 return el.acu(i1 * cum_qel.acu(0) + i2);
1900#endif
1901 } else {
1902 mcerr << "Error in DynArr::ac(long i1, long i2): i2 < 0 || i2 >= "
1903 "qel.acu(1)\n";
1904 Iprint2n(mcout, i2, qel[1]);
1905 }
1906 } else {
1907 mcerr << "Error in DynArr::ac(long i1, long i2): i1 < 0 || i1 >= "
1908 "qel.acu(0)\n";
1909 Iprint2n(mcout, i1, qel[0]);
1910 }
1911 } else {
1912 mcerr << "ERROR in DynArr::ac(long i1, long i2): qel.get_qel()!= 2,"
1913 << " qel.get_qel()=" << qel.get_qel() << '\n';
1914 }
1915 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
1916 << '\n';
1917 spexit(mcerr);
1918 return el[0];
1919#else // for ifdef ALR_CHECK_EACH_BOUND
1920 return el[i1 * cum_qel.acu(0) + i2];
1921
1922#endif
1923 }
#define Iprint2n(file, name1, name2)
Definition: prstream.h:219

◆ ac() [6/8]

template<class T >
const T & Heed::DynArr< T >::ac ( long  i1,
long  i2 
) const
inline

Definition at line 1957 of file AbsArr.h.

1958 {
1959 if (qel.get_qel() == 2) {
1960#ifdef ALR_CHECK_EACH_BOUND
1961 if (i1 >= 0 && i1 < qel.acu(0)) {
1962 if (i2 >= 0 && i2 < qel.acu(1)) {
1963#ifdef DEBUG_DYNARR
1964 return el[i1 * cum_qel.acu(0) + i2];
1965#else
1966 return el.acu(i1 * cum_qel.acu(0) + i2);
1967#endif
1968 } else {
1969 mcerr << "Error in DynArr::ac(long i1, long i2): i2 < 0 || i2 >= "
1970 "qel.acu(1)\n";
1971 Iprint2n(mcout, i2, qel[1]);
1972 }
1973 } else {
1974 mcerr << "Error in DynArr::ac(long i1, long i2): i1 < 0 || i1 >= "
1975 "qel.acu(0)\n";
1976 Iprint2n(mcout, i1, qel[0]);
1977 }
1978 } else {
1979 mcerr << "ERROR in DynArr::ac(long i1, long i2): qel.get_qel()!= 2,"
1980 << " qel.get_qel()=" << qel.get_qel() << '\n';
1981 }
1982 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
1983 << '\n';
1984 spexit(mcerr);
1985 return el[0];
1986#else // for ifdef ALR_CHECK_EACH_BOUND
1987 return el[i1 * cum_qel.acu(0) + i2];
1988
1989#endif
1990 }

◆ ac() [7/8]

template<class T >
T & Heed::DynArr< T >::ac ( long  i1,
long  i2,
long  i3 
)
inline

Definition at line 2034 of file AbsArr.h.

2035 {
2036 if (qel.get_qel() != 3) {
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()
2041 << '\n';
2042 spexit(mcerr);
2043 }
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 "
2047 ">= qel.acu(0)\n";
2048 Iprint2n(mcout, i1, qel[0]);
2049 spexit(mcerr);
2050 }
2051 if (i2 < 0 || i2 >= qel.acu(1)) {
2052 mcerr << "Error in DynArr::ac(long i1, long i2, long i3): i2 < 0 || i2 "
2053 ">= qel.acu(1)\n";
2054 Iprint2n(mcout, i2, qel[1]);
2055 spexit(mcerr);
2056 }
2057 if (i3 < 0 || i3 >= qel.acu(2)) {
2058 mcerr << "Error in DynArr::ac(long i1, long i2, long i3): i3 < 0 || i3 "
2059 ">= qel.acu(2)\n";
2060 Iprint2n(mcout, i3, qel[2]);
2061 spexit(mcerr);
2062 }
2063#ifdef DEBUG_DYNARR
2064 return el.acu(i1 * cum_qel.acu(0) + i2 * cum_qel.acu(1) + i3);
2065#else
2066 return el[i1 * cum_qel.acu(0) + i2 * cum_qel[1] + i3];
2067#endif
2068#else
2069 return el[i1 * cum_qel.acu(0) + i2 * cum_qel[1] + i3];
2070#endif
2071 // return el[i1*cum_qel[0] + i2*cum_qel[1] + i3];
2072 }

◆ ac() [8/8]

template<class T >
const T & Heed::DynArr< T >::ac ( long  i1,
long  i2,
long  i3 
) const
inline

Definition at line 2074 of file AbsArr.h.

2075 {
2076 if (qel.get_qel() != 3) {
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()
2081 << '\n';
2082 spexit(mcerr);
2083 }
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 "
2087 ">= qel.acu(0)\n";
2088 Iprint2n(mcout, i1, qel[0]);
2089 spexit(mcerr);
2090 }
2091 if (i2 < 0 || i2 >= qel.acu(1)) {
2092 mcerr << "Error in DynArr::ac(long i1, long i2, long i3): i2 < 0 || i2 "
2093 ">= qel.acu(1)\n";
2094 Iprint2n(mcout, i2, qel[1]);
2095 spexit(mcerr);
2096 }
2097 if (i3 < 0 || i3 >= qel.acu(2)) {
2098 mcerr << "Error in DynArr::ac(long i1, long i2, long i3): i3 < 0 || i3 "
2099 ">= qel.acu(2)\n";
2100 Iprint2n(mcout, i3, qel[2]);
2101 spexit(mcerr);
2102 }
2103#ifdef DEBUG_DYNARR
2104 return el.acu(i1 * cum_qel.acu(0) + i2 * cum_qel.acu(1) + i3);
2105#else
2106 return el[i1 * cum_qel.acu(0) + i2 * cum_qel[1] + i3];
2107#endif
2108#else
2109 return el[i1 * cum_qel.acu(0) + i2 * cum_qel[1] + i3];
2110#endif
2111 // return el[i1*cum_qel[0] + i2*cum_qel[1] + i3];
2112 }

◆ ac_lin() [1/2]

template<class T >
T & Heed::DynArr< T >::ac_lin ( long  n)
inline

Definition at line 2117 of file AbsArr.h.

2117 {
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()
2124 << '\n';
2125 spexit(mcerr);
2126 return el[0];
2127#else
2128 return el[n];
2129#endif
2130 }

Referenced by Heed::DynArr< T >::IndexingProvider< D >::operator=(), and Heed::operator>>().

◆ ac_lin() [2/2]

template<class T >
const T & Heed::DynArr< T >::ac_lin ( long  n) const
inline

Definition at line 2131 of file AbsArr.h.

2131 {
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()
2138 << '\n';
2139 spexit(mcerr);
2140 return el[0];
2141#else
2142 return el[n];
2143#endif
2144 }

◆ acp() [1/2]

template<class T >
T & Heed::DynArr< T >::acp ( const DynLinArr< long > &  ind)
inline

Definition at line 1809 of file AbsArr.h.

1812 {
1813 long q;
1814 if ((q = qel.get_qel()) > ind.get_qel()) {
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()
1820 << '\n';
1821 spexit(mcerr);
1822 }
1823
1824#ifdef ALR_CHECK_EACH_BOUND
1825#ifdef DEBUG_DYNARR
1826 if (q == 1) // faster for this case
1827 return el[ind.acu(0)];
1828 else
1829 return el[calc_lin_ind(ind)];
1830#else
1831 if (q == 1)
1832 return el[ind.acu(0)];
1833 else
1834 return el.acu(calc_lin_ind(ind));
1835#endif
1836#else
1837 if (q == 1)
1838 return el[ind.acu(0)];
1839 else
1840 return el[calc_lin_ind(ind)];
1841#endif
1842 }

◆ acp() [2/2]

template<class T >
const T & Heed::DynArr< T >::acp ( const DynLinArr< long > &  ind) const
inline

Definition at line 1844 of file AbsArr.h.

1844 {
1845 long q;
1846 if ((q = qel.get_qel()) > ind.get_qel()) {
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()
1852 << '\n';
1853 spexit(mcerr);
1854 }
1855#ifdef ALR_CHECK_EACH_BOUND
1856#ifdef DEBUG_DYNARR
1857 if (q == 1) // faster for this case
1858 return el[ind.acu(0)];
1859 else
1860 return el[calc_lin_ind(ind)];
1861#else
1862 if (q == 1)
1863 return el[ind.acu(0)];
1864 else
1865 return el.acu(calc_lin_ind(ind));
1866#endif
1867#else
1868 if (q == 1)
1869 return el[ind.acu(0)];
1870 else
1871 return el[calc_lin_ind(ind)];
1872#endif
1873 }

◆ acu() [1/6]

template<class T >
T & Heed::DynArr< T >::acu ( const DynLinArr< long > &  ind)
inline

Definition at line 1875 of file AbsArr.h.

1876 {
1877 if (qel.get_qel() == 1)
1878 return el.acu(ind.acu(0));
1879 else
1880 return el.acu(calc_lin_ind(ind));
1881 }

◆ acu() [2/6]

template<class T >
const T & Heed::DynArr< T >::acu ( const DynLinArr< long > &  ind) const
inline

Definition at line 1882 of file AbsArr.h.

1883 {
1884 if (qel.get_qel() == 1)
1885 return el.acu(ind.acu(0));
1886 else
1887 return el.acu(calc_lin_ind(ind));
1888 }

◆ acu() [3/6]

template<class T >
T & Heed::DynArr< T >::acu ( long  i1)
inline

Definition at line 1720 of file AbsArr.h.

1721 {
1722 return el.acu(i1);
1723 }

Referenced by Heed::operator*(), Heed::operator+(), and Heed::operator-().

◆ acu() [4/6]

template<class T >
const T & Heed::DynArr< T >::acu ( long  i1) const
inline

Definition at line 1724 of file AbsArr.h.

1726 {
1727 return el.acu(i1);
1728 }

◆ acu() [5/6]

template<class T >
T & Heed::DynArr< T >::acu ( long  i1,
long  i2 
)
inline

Definition at line 2024 of file AbsArr.h.

2026 {
2027 return el.acu(i1 * cum_qel.acu(0) + i2);
2028 }

◆ acu() [6/6]

template<class T >
const T & Heed::DynArr< T >::acu ( long  i1,
long  i2 
) const
inline

Definition at line 2029 of file AbsArr.h.

2030 {
2031 return el.acu(i1 * cum_qel.acu(0) + i2);
2032 }

◆ acu_lin() [1/2]

◆ acu_lin() [2/2]

template<class T >
const T & Heed::DynArr< T >::acu_lin ( long  n) const
inline

Definition at line 2147 of file AbsArr.h.

2147{ return el[n]; }

◆ assignAll()

template<class T >
void Heed::DynArr< T >::assignAll ( const T &  val)

Definition at line 2463 of file AbsArr.h.

2463 {
2464 check();
2465 // try faster and simpler way (30.10.2006):
2466 el.assignAll(val);
2467 /*
2468 IterDynArr<T> iter(this);
2469 T* at;
2470 while( (at=iter.more()) != NULL )
2471 {
2472 *at=val;
2473 }
2474 */
2475}
void check(void) const
Definition: AbsArr.h:2192

Referenced by Heed::DynArr< T >::DynArr(), Heed::inverse_DynArr(), and Heed::inverse_DynArr_prot().

◆ check()

template<class T >
void Heed::DynArr< T >::check ( void  ) const
inline

◆ clear()

template<class T >
void Heed::DynArr< T >::clear ( void  )
inline

Definition at line 2169 of file AbsArr.h.

2169 {
2170 qel.clear();
2171 cum_qel.clear();
2172 el.clear();
2173 }
void clear(void)
Definition: AbsArr.h:313

Referenced by Heed::DynArr< T >::pass().

◆ confirm_ind()

template<class T >
int Heed::DynArr< T >::confirm_ind ( const DynLinArr< long > &  ind)
inline

Definition at line 2175 of file AbsArr.h.

2175{ return gconfirm_ind(qel, ind); }
int gconfirm_ind(const DynLinArr< long > &qel, const DynLinArr< long > &ind)
Definition: AbsArr.cpp:418

◆ confirm_ind_ext()

template<class T >
int Heed::DynArr< T >::confirm_ind_ext ( const DynLinArr< long > &  ind)
inline

Definition at line 2176 of file AbsArr.h.

2176 {
2177 return gconfirm_ind_ext(qel, ind);
2178 }
int gconfirm_ind_ext(const DynLinArr< long > &qel, const DynLinArr< long > &ind)
Definition: AbsArr.cpp:433

◆ copy()

template<class T >
virtual DynArr * Heed::DynArr< T >::copy ( ) const
inlinevirtual

Reimplemented from Heed::RegPassivePtr.

Definition at line 2206 of file AbsArr.h.

2206{ return new DynArr(*this); }
DynArr(void)
Definition: AbsArr.h:1370

◆ get_cum_qel()

template<class T >
const DynLinArr< long > & Heed::DynArr< T >::get_cum_qel ( void  ) const
inline

◆ get_el()

template<class T >
const DynLinArr< T > & Heed::DynArr< T >::get_el ( void  ) const
inline

Definition at line 2153 of file AbsArr.h.

2153{ return el; }

Referenced by Heed::apeq_mant(), Heed::operator!=(), and Heed::operator==().

◆ get_qdim()

◆ get_qel()

◆ get_qel_lin()

template<class T >
long Heed::DynArr< T >::get_qel_lin ( void  ) const
inline

◆ get_s_non_emplty()

template<class T >
int Heed::DynArr< T >::get_s_non_emplty ( void  ) const
inline

Definition at line 2197 of file AbsArr.h.

2197 {
2198 long q = qel.get_qel();
2199 if (q == 0) return 0;
2200 long n;
2201 for (n = 0; n < q; n++) {
2202 if (qel[n] <= 0) return 0;
2203 }
2204 return 1;
2205 }

Referenced by Heed::operator<<().

◆ operator=() [1/2]

template<class T >
template<class D >
DynArr< T > & Heed::DynArr< T >::operator= ( const DynArr< D > &  f)

Definition at line 2309 of file AbsArr.h.

2309 {
2310#ifdef DEBUG_DYNLINARR
2311 mcout << "DynArr<T>& DynArr<T>::operator=(const DynArr<D>& f)\n";
2312#endif
2313 if (this == &f) return *this;
2314 check();
2315 f.check();
2316 DynLinArr<long> fqel = f.get_qel();
2317 DynLinArr<long> fcum_qel = f.get_cum_qel();
2318 // for example, one of its elements.
2319 const long q = f.get_qel_lin();
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);
2323 return *this;
2324}
const DynLinArr< long > & get_cum_qel(void) const
Definition: AbsArr.h:2156
long get_qel_lin(void) const
Definition: AbsArr.h:2114
const DynLinArr< long > & get_qel(void) const
Definition: AbsArr.h:2152
T & acu_lin(long n)
Definition: AbsArr.h:2146
void pass(long q, DynLinArr< long > fqel, DynLinArr< long > fcum_qel, T *fel)
Definition: AbsArr.h:1550

◆ operator=() [2/2]

template<class T >
DynArr< T > & Heed::DynArr< T >::operator= ( const DynArr< T > &  f)

Definition at line 2291 of file AbsArr.h.

2291 {
2292#ifdef DEBUG_DYNARR
2293 mcout << "DynArr<T>& DynArr<T>::operator=(const DynArr<T>& f)\n";
2294#endif
2295 if (this != &f) {
2296 // mcout<<"DynLinArr<T>& operator=(const DynLinArr<T>& f): long(el)="
2297 //<<long(el)<<'\n';
2298 check();
2299 f.check();
2300 qel = f.qel;
2301 cum_qel = f.cum_qel;
2302 el = f.el;
2303 }
2304 return *this;
2305}

◆ operator[]() [1/2]

template<class T >
IndexingProvider< T > Heed::DynArr< T >::operator[] ( long  n)
inline

Definition at line 1657 of file AbsArr.h.

1657 {
1658 if (qel.get_qel() < 1) {
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()
1662 << '\n';
1663 spexit(mcerr);
1664 }
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";
1669 Iprint2n(mcout, n, qel.acu(0));
1670 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
1671 << '\n';
1672 spexit(mcerr);
1673 }
1674#endif
1675 return IndexingProvider<T>(*this, 1, n * cum_qel.acu(0));
1676 }

◆ operator[]() [2/2]

template<class T >
const IndexingProvider< T > Heed::DynArr< T >::operator[] ( long  n) const
inline

Definition at line 1678 of file AbsArr.h.

1678 {
1679 if (qel.get_qel() < 1) {
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()
1683 << '\n';
1684 spexit(mcerr);
1685 }
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";
1690 Iprint2n(mcout, n, qel.acu(0));
1691 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
1692 << '\n';
1693 spexit(mcerr);
1694 }
1695#endif
1696 DynArr<T>* temp = const_cast<DynArr<T>*>(this);
1697 return IndexingProvider<T>(*temp, 1, n * cum_qel.acu(0));
1698 }

◆ pass()

template<class T >
void Heed::DynArr< T >::pass ( long  q,
DynLinArr< long >  fqel,
DynLinArr< long >  fcum_qel,
T *  fel 
)
inline

Definition at line 1550 of file AbsArr.h.

1553 {
1554 clear();
1555 qel = fqel;
1556 cum_qel = fcum_qel;
1557 el.pass(q, fel);
1558 }
void clear(void)
Definition: AbsArr.h:2169

◆ pilfer()

template<class T >
void Heed::DynArr< T >::pilfer ( const DynArr< T > &  f)
inline

Definition at line 1519 of file AbsArr.h.

1519 {
1520#ifdef DEBUG_DYNARR
1521 mcout << "DynArr::pilfer is called\n";
1522#endif
1523 if (this != &f) {
1524 if (qel.get_qel() != 0) {
1525 if (f.qel.get_qel() != 0) {
1526 mcerr << "ERROR in DynArr::pilfer(...):\n";
1527 mcerr << "Both the destination and source arrays are not empty\n";
1528 // For explanations why it is dangerous, see similar function
1529 // of ActivePtr.
1530 spexit(mcerr);
1531 } else {
1532 qel.clear();
1533 cum_qel.clear();
1534 el.clear();
1535 }
1536 }
1537 qel.pilfer(f.qel);
1538 cum_qel.pilfer(f.cum_qel);
1539 el.pilfer(f.el);
1540 f.qel.clear();
1541 f.cum_qel.clear();
1542 f.el.clear();
1543 }
1544 }
void pilfer(const DynLinArr< T > &f)
Definition: AbsArr.h:315

Referenced by Heed::operator>>().

◆ put_qel()

template<class T >
void Heed::DynArr< T >::put_qel ( T *  val = NULL)

Definition at line 2392 of file AbsArr.h.

2394{
2395 check();
2396 if (qel.get_qel() == 0) {
2397 *this = DynArr<T>(qel_communicat, val);
2398 return;
2399 }
2400
2401 DynArr<T> datemp(qel_communicat, val); // all init to val
2402 IterDynArr<T> iter(&datemp);
2403 T* at;
2404 while ((at = iter.more()) != NULL) {
2405 if (confirm_ind_ext(iter.get_ncur()))
2406 *at = acp(iter.get_ncur()); // change to old values where they were
2407 }
2408 *this = datemp;
2409}
int confirm_ind_ext(const DynLinArr< long > &ind)
Definition: AbsArr.h:2176
T & acp(const DynLinArr< long > &ind)
Definition: AbsArr.h:1809
DynLinArr< long > qel_communicat
Definition: AbsArr.cpp:519

◆ top()

template<class T >
DynArr< T > Heed::DynArr< T >::top ( void  )

Definition at line 2521 of file AbsArr.h.

2521 {
2522 mfunnamep("template<class T> DynArr<T> DynArr<T>::top(void)");
2523 check();
2524 long qdim = get_qdim();
2525 check_econd11(qdim, != 2, mcerr);
2526 long n1, n2;
2527 DynArr<T> r(qel[1], qel[0]);
2528 for (n1 = 0; n1 < qel[0]; n1++) {
2529 for (n2 = 0; n2 < qel[1]; n2++) {
2530 r.ac(n2, n1) = ac(n1, n2);
2531 }
2532 }
2533 return r;
2534}
#define check_econd11(a, signb, stream)
Definition: FunNameStack.h:155
#define mfunnamep(string)
Definition: FunNameStack.h:49
long get_qdim(void) const
Definition: AbsArr.h:2151

Friends And Related Function Documentation

◆ apply1

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

◆ apply2

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

The documentation for this class was generated from the following file: