Garfield++ 3.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 1370 of file AbsArr.h.

Constructor & Destructor Documentation

◆ DynArr() [1/13]

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

Definition at line 1373 of file AbsArr.h.

1373{ ; }

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 1375 of file AbsArr.h.

1376 : qel(DynLinArr<long>(1)),
1377 cum_qel(DynLinArr<long>(1)),
1378 el(DynLinArr<T>(fqel)) {
1379#ifdef DEBUG_DYNARR
1380 mcout << "explicit DynArr(long fqel, T* val=NULL) is called\n";
1381#endif
1382 qel[0] = fqel;
1383 cum_qel[0] = 1;
1384 if (val != NULL) assignAll(*val);
1385 }
void assignAll(const T &val)
Definition: AbsArr.h:2479
#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 1386 of file AbsArr.h.

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

◆ DynArr() [4/13]

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

Definition at line 1397 of file AbsArr.h.

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

◆ DynArr() [5/13]

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

Definition at line 1407 of file AbsArr.h.

1408 : qel(DynLinArr<long>(1)), cum_qel(DynLinArr<long>(1)), el(f.get_qel()) {
1409 qel[0] = f.get_qel();
1410 cum_qel[0] = 1;
1411 for (long n = 0; n < qel[0]; n++) ac(n) = f[n];
1412 }
T & ac(long i)
Definition: AbsArr.h:1717
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 1415 of file AbsArr.h.

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

◆ DynArr() [7/13]

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

Definition at line 1429 of file AbsArr.h.

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

◆ DynArr() [8/13]

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

Definition at line 1445 of file AbsArr.h.

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

◆ 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 1459 of file AbsArr.h.

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

◆ DynArr() [10/13]

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

Definition at line 1479 of file AbsArr.h.

1479 : qel(fqel) {
1480 long qdim = qel.get_qel();
1481 if (qdim <= 0) return;
1482 cum_qel.put_qel(qdim);
1483 long ndim;
1484 long size = qel[0];
1485 for (ndim = 1; ndim < qdim; ndim++) size *= qel[ndim];
1486 el.put_qel(size);
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];
1490 assignAll(val);
1491 }
void put_qel(long fqel)
Definition: AbsArr.h:530

◆ DynArr() [11/13]

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

Definition at line 1493 of file AbsArr.h.

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

◆ DynArr() [12/13]

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

Definition at line 1509 of file AbsArr.h.

1509 : RegPassivePtr() {
1510#ifdef DEBUG_DYNARR
1511 mcout << "DynArr(const DynArr<T>& f) is working\n";
1512#endif
1513 *this = f;
1514 }
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 1515 of file AbsArr.h.

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

◆ ~DynArr()

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

Definition at line 2224 of file AbsArr.h.

2224{}

Member Function Documentation

◆ ac() [1/8]

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

Definition at line 1747 of file AbsArr.h.

1751 {
1752 long q;
1753 if ((q = qel.get_qel()) != ind.get_qel()) {
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()
1759 << '\n';
1760 spexit(mcerr);
1761 }
1762#ifdef ALR_CHECK_EACH_BOUND
1763#ifdef DEBUG_DYNARR
1764 if (q == 1) // faster for this case
1765 return el[ind.acu(0)];
1766 else
1767 return el[calc_lin_ind(ind)];
1768#else
1769 if (q == 1)
1770 return el[ind.acu(0)];
1771 else
1772 return el.acu(calc_lin_ind(ind));
1773#endif
1774#else
1775 if (q == 1)
1776 return el[ind.acu(0)];
1777 else
1778 return el[calc_lin_ind(ind)];
1779#endif
1780 }
#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 1781 of file AbsArr.h.

1782 {
1783 long q;
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()
1790 << '\n';
1791 spexit(mcerr);
1792 }
1793/*
1794#ifdef ALR_CHECK_EACH_BOUND
1795#ifdef DEBUG_DYNARR
1796 return el[calc_lin_ind(ind)];
1797#else
1798 return el.acu(calc_lin_ind(ind));
1799#endif
1800#else
1801 return el[calc_lin_ind(ind)];
1802#endif
1803 //return el[calc_lin_ind(ind)];
1804 */
1805
1806#ifdef ALR_CHECK_EACH_BOUND
1807#ifdef DEBUG_DYNARR
1808 if (q == 1) // faster for this case
1809 return el[ind.acu(0)];
1810 else
1811 return el[calc_lin_ind(ind)];
1812#else
1813 if (q == 1)
1814 return el[ind.acu(0)];
1815 else
1816 return el.acu(calc_lin_ind(ind));
1817#endif
1818#else
1819 if (q == 1)
1820 return el[ind.acu(0)];
1821 else
1822 return el[calc_lin_ind(ind)];
1823#endif
1824 }

◆ ac() [3/8]

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

Definition at line 1717 of file AbsArr.h.

1717 {
1718 // for 1-dimensional array
1719 if (qel.get_qel() == 1) return el[i];
1720 mcerr << "ERROR in DynArr::ac(long i): qel.get_qel()!= 1, qel.get_qel()="
1721 << qel.get_qel() << '\n';
1722 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
1723 << '\n';
1724 spexit(mcerr);
1725 return el[0];
1726 }

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::Parabol::Parabol(), 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 1727 of file AbsArr.h.

1727 {
1728 // for 1-dimensional array
1729 if (qel.get_qel() == 1) return el[i];
1730 mcerr << "ERROR in DynArr::ac(long i): qel.get_qel()!= 1, qel.get_qel()="
1731 << qel.get_qel() << '\n';
1732 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
1733 << '\n';
1734 spexit(mcerr);
1735 return el[0];
1736 }

◆ ac() [5/8]

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

Definition at line 1907 of file AbsArr.h.

1908 {
1909 if (qel.get_qel() == 2) {
1910#ifdef ALR_CHECK_EACH_BOUND
1911 if (i1 >= 0 && i1 < qel.acu(0)) {
1912 if (i2 >= 0 && i2 < qel.acu(1)) {
1913#ifdef DEBUG_DYNARR
1914 return el[i1 * cum_qel.acu(0) + i2];
1915#else
1916 return el.acu(i1 * cum_qel.acu(0) + i2);
1917#endif
1918 } else {
1919 mcerr << "Error in DynArr::ac(long i1, long i2): i2 < 0 || i2 >= "
1920 "qel.acu(1)\n";
1921 Iprint2n(mcout, i2, qel[1]);
1922 }
1923 } else {
1924 mcerr << "Error in DynArr::ac(long i1, long i2): i1 < 0 || i1 >= "
1925 "qel.acu(0)\n";
1926 Iprint2n(mcout, i1, qel[0]);
1927 }
1928 } else {
1929 mcerr << "ERROR in DynArr::ac(long i1, long i2): qel.get_qel()!= 2,"
1930 << " qel.get_qel()=" << qel.get_qel() << '\n';
1931 }
1932 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
1933 << '\n';
1934 spexit(mcerr);
1935 return el[0];
1936#else // for ifdef ALR_CHECK_EACH_BOUND
1937 return el[i1 * cum_qel.acu(0) + i2];
1938
1939#endif
1940 }
#define Iprint2n(file, name1, name2)
Definition: prstream.h:220

◆ ac() [6/8]

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

Definition at line 1974 of file AbsArr.h.

1975 {
1976 if (qel.get_qel() == 2) {
1977#ifdef ALR_CHECK_EACH_BOUND
1978 if (i1 >= 0 && i1 < qel.acu(0)) {
1979 if (i2 >= 0 && i2 < qel.acu(1)) {
1980#ifdef DEBUG_DYNARR
1981 return el[i1 * cum_qel.acu(0) + i2];
1982#else
1983 return el.acu(i1 * cum_qel.acu(0) + i2);
1984#endif
1985 } else {
1986 mcerr << "Error in DynArr::ac(long i1, long i2): i2 < 0 || i2 >= "
1987 "qel.acu(1)\n";
1988 Iprint2n(mcout, i2, qel[1]);
1989 }
1990 } else {
1991 mcerr << "Error in DynArr::ac(long i1, long i2): i1 < 0 || i1 >= "
1992 "qel.acu(0)\n";
1993 Iprint2n(mcout, i1, qel[0]);
1994 }
1995 } else {
1996 mcerr << "ERROR in DynArr::ac(long i1, long i2): qel.get_qel()!= 2,"
1997 << " qel.get_qel()=" << qel.get_qel() << '\n';
1998 }
1999 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
2000 << '\n';
2001 spexit(mcerr);
2002 return el[0];
2003#else // for ifdef ALR_CHECK_EACH_BOUND
2004 return el[i1 * cum_qel.acu(0) + i2];
2005
2006#endif
2007 }

◆ ac() [7/8]

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

Definition at line 2051 of file AbsArr.h.

2052 {
2053 if (qel.get_qel() != 3) {
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()
2058 << '\n';
2059 spexit(mcerr);
2060 }
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 "
2064 ">= qel.acu(0)\n";
2065 Iprint2n(mcout, i1, qel[0]);
2066 spexit(mcerr);
2067 }
2068 if (i2 < 0 || i2 >= qel.acu(1)) {
2069 mcerr << "Error in DynArr::ac(long i1, long i2, long i3): i2 < 0 || i2 "
2070 ">= qel.acu(1)\n";
2071 Iprint2n(mcout, i2, qel[1]);
2072 spexit(mcerr);
2073 }
2074 if (i3 < 0 || i3 >= qel.acu(2)) {
2075 mcerr << "Error in DynArr::ac(long i1, long i2, long i3): i3 < 0 || i3 "
2076 ">= qel.acu(2)\n";
2077 Iprint2n(mcout, i3, qel[2]);
2078 spexit(mcerr);
2079 }
2080#ifdef DEBUG_DYNARR
2081 return el.acu(i1 * cum_qel.acu(0) + i2 * cum_qel.acu(1) + i3);
2082#else
2083 return el[i1 * cum_qel.acu(0) + i2 * cum_qel[1] + i3];
2084#endif
2085#else
2086 return el[i1 * cum_qel.acu(0) + i2 * cum_qel[1] + i3];
2087#endif
2088 // return el[i1*cum_qel[0] + i2*cum_qel[1] + i3];
2089 }

◆ ac() [8/8]

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

Definition at line 2091 of file AbsArr.h.

2092 {
2093 if (qel.get_qel() != 3) {
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()
2098 << '\n';
2099 spexit(mcerr);
2100 }
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 "
2104 ">= qel.acu(0)\n";
2105 Iprint2n(mcout, i1, qel[0]);
2106 spexit(mcerr);
2107 }
2108 if (i2 < 0 || i2 >= qel.acu(1)) {
2109 mcerr << "Error in DynArr::ac(long i1, long i2, long i3): i2 < 0 || i2 "
2110 ">= qel.acu(1)\n";
2111 Iprint2n(mcout, i2, qel[1]);
2112 spexit(mcerr);
2113 }
2114 if (i3 < 0 || i3 >= qel.acu(2)) {
2115 mcerr << "Error in DynArr::ac(long i1, long i2, long i3): i3 < 0 || i3 "
2116 ">= qel.acu(2)\n";
2117 Iprint2n(mcout, i3, qel[2]);
2118 spexit(mcerr);
2119 }
2120#ifdef DEBUG_DYNARR
2121 return el.acu(i1 * cum_qel.acu(0) + i2 * cum_qel.acu(1) + i3);
2122#else
2123 return el[i1 * cum_qel.acu(0) + i2 * cum_qel[1] + i3];
2124#endif
2125#else
2126 return el[i1 * cum_qel.acu(0) + i2 * cum_qel[1] + i3];
2127#endif
2128 // return el[i1*cum_qel[0] + i2*cum_qel[1] + i3];
2129 }

◆ ac_lin() [1/2]

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

Definition at line 2134 of file AbsArr.h.

2134 {
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()
2141 << '\n';
2142 spexit(mcerr);
2143 return el[0];
2144#else
2145 return el[n];
2146#endif
2147 }

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 2148 of file AbsArr.h.

2148 {
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()
2155 << '\n';
2156 spexit(mcerr);
2157 return el[0];
2158#else
2159 return el[n];
2160#endif
2161 }

◆ acp() [1/2]

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

Definition at line 1826 of file AbsArr.h.

1829 {
1830 long q;
1831 if ((q = qel.get_qel()) > ind.get_qel()) {
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()
1837 << '\n';
1838 spexit(mcerr);
1839 }
1840
1841#ifdef ALR_CHECK_EACH_BOUND
1842#ifdef DEBUG_DYNARR
1843 if (q == 1) // faster for this case
1844 return el[ind.acu(0)];
1845 else
1846 return el[calc_lin_ind(ind)];
1847#else
1848 if (q == 1)
1849 return el[ind.acu(0)];
1850 else
1851 return el.acu(calc_lin_ind(ind));
1852#endif
1853#else
1854 if (q == 1)
1855 return el[ind.acu(0)];
1856 else
1857 return el[calc_lin_ind(ind)];
1858#endif
1859 }

◆ acp() [2/2]

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

Definition at line 1861 of file AbsArr.h.

1861 {
1862 long q;
1863 if ((q = qel.get_qel()) > ind.get_qel()) {
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()
1869 << '\n';
1870 spexit(mcerr);
1871 }
1872#ifdef ALR_CHECK_EACH_BOUND
1873#ifdef DEBUG_DYNARR
1874 if (q == 1) // faster for this case
1875 return el[ind.acu(0)];
1876 else
1877 return el[calc_lin_ind(ind)];
1878#else
1879 if (q == 1)
1880 return el[ind.acu(0)];
1881 else
1882 return el.acu(calc_lin_ind(ind));
1883#endif
1884#else
1885 if (q == 1)
1886 return el[ind.acu(0)];
1887 else
1888 return el[calc_lin_ind(ind)];
1889#endif
1890 }

◆ acu() [1/6]

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

Definition at line 1892 of file AbsArr.h.

1893 {
1894 if (qel.get_qel() == 1)
1895 return el.acu(ind.acu(0));
1896 else
1897 return el.acu(calc_lin_ind(ind));
1898 }

◆ acu() [2/6]

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

Definition at line 1899 of file AbsArr.h.

1900 {
1901 if (qel.get_qel() == 1)
1902 return el.acu(ind.acu(0));
1903 else
1904 return el.acu(calc_lin_ind(ind));
1905 }

◆ acu() [3/6]

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

Definition at line 1737 of file AbsArr.h.

1738 {
1739 return el.acu(i1);
1740 }

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 1741 of file AbsArr.h.

1743 {
1744 return el.acu(i1);
1745 }

◆ acu() [5/6]

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

Definition at line 2041 of file AbsArr.h.

2043 {
2044 return el.acu(i1 * cum_qel.acu(0) + i2);
2045 }

◆ acu() [6/6]

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

Definition at line 2046 of file AbsArr.h.

2047 {
2048 return el.acu(i1 * cum_qel.acu(0) + i2);
2049 }

◆ 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 2164 of file AbsArr.h.

2164{ return el[n]; }

◆ assignAll()

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

Definition at line 2479 of file AbsArr.h.

2479 {
2480 check();
2481 // try faster and simpler way (30.10.2006):
2482 el.assignAll(val);
2483 /*
2484 IterDynArr<T> iter(this);
2485 T* at;
2486 while( (at=iter.more()) != NULL )
2487 {
2488 *at=val;
2489 }
2490 */
2491}
void check(void) const
Definition: AbsArr.h:2209

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 2186 of file AbsArr.h.

2186 {
2187 qel.clear();
2188 cum_qel.clear();
2189 el.clear();
2190 }
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 2192 of file AbsArr.h.

2192{ 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 2193 of file AbsArr.h.

2193 {
2194 return gconfirm_ind_ext(qel, ind);
2195 }
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 2223 of file AbsArr.h.

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

◆ 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 2170 of file AbsArr.h.

2170{ 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 2214 of file AbsArr.h.

2214 {
2215 long q = qel.get_qel();
2216 if (q == 0) return 0;
2217 long n;
2218 for (n = 0; n < q; n++) {
2219 if (qel[n] <= 0) return 0;
2220 }
2221 return 1;
2222 }

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 2326 of file AbsArr.h.

2326 {
2327#ifdef DEBUG_DYNLINARR
2328 mcout << "DynArr<T>& DynArr<T>::operator=(const DynArr<D>& f)\n";
2329#endif
2330 check();
2331 f.check();
2332 DynLinArr<long> fqel = f.get_qel();
2333 DynLinArr<long> fcum_qel = f.get_cum_qel();
2334 // for example, one of its elements.
2335 const long q = f.get_qel_lin();
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);
2339 return *this;
2340}
const DynLinArr< long > & get_cum_qel(void) const
Definition: AbsArr.h:2173
long get_qel_lin(void) const
Definition: AbsArr.h:2131
const DynLinArr< long > & get_qel(void) const
Definition: AbsArr.h:2169
T & acu_lin(long n)
Definition: AbsArr.h:2163
void pass(long q, DynLinArr< long > fqel, DynLinArr< long > fcum_qel, T *fel)
Definition: AbsArr.h:1553

◆ operator=() [2/2]

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

Definition at line 2308 of file AbsArr.h.

2308 {
2309#ifdef DEBUG_DYNARR
2310 mcout << "DynArr<T>& DynArr<T>::operator=(const DynArr<T>& f)\n";
2311#endif
2312 if (this != &f) {
2313 // mcout<<"DynLinArr<T>& operator=(const DynLinArr<T>& f): long(el)="
2314 //<<long(el)<<'\n';
2315 check();
2316 f.check();
2317 qel = f.qel;
2318 cum_qel = f.cum_qel;
2319 el = f.el;
2320 }
2321 return *this;
2322}

◆ operator[]() [1/2]

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

Definition at line 1666 of file AbsArr.h.

1666 {
1667 if (qel.get_qel() < 1) {
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()
1671 << '\n';
1672 spexit(mcerr);
1673 }
1674#ifdef ALR_CHECK_EACH_BOUND
1675 if (n >= 0 && n < qel.acu(0)) {
1676#endif
1677 return IndexingProvider<T>(*this, 1, n * cum_qel.acu(0));
1678#ifdef ALR_CHECK_EACH_BOUND
1679 } else {
1680 mcerr << "Error in IndexingProvider<T> DynArr::operator[](long n): n < 0 "
1681 "|| n >= qel.acu(0)\n";
1682 Iprint2n(mcout, n, qel.acu(0));
1683 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
1684 << '\n';
1685 spexit(mcerr);
1686 }
1687#endif
1688 }

◆ operator[]() [2/2]

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

Definition at line 1690 of file AbsArr.h.

1690 {
1691 if (qel.get_qel() < 1) {
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()
1695 << '\n';
1696 spexit(mcerr);
1697 }
1698#ifdef ALR_CHECK_EACH_BOUND
1699 if (n >= 0 && n < qel.acu(0)) {
1700#endif
1701 // DynArr<T>* temp = static_cast<DynArr<T>* >(this);
1702 DynArr<T>* temp = const_cast<DynArr<T>*>(this);
1703 // static_cast<const IndexingProvider<T> >(*this);
1704 return IndexingProvider<T>(*temp, 1, n * cum_qel.acu(0));
1705#ifdef ALR_CHECK_EACH_BOUND
1706 } else {
1707 mcerr << "Error in IndexingProvider<T> DynArr::operator[](long n): n < 0 "
1708 "|| n >= qel.acu(0)\n";
1709 Iprint2n(mcout, n, qel.acu(0));
1710 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
1711 << '\n';
1712 spexit(mcerr);
1713 }
1714#endif
1715 }

◆ pass()

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

Definition at line 1553 of file AbsArr.h.

1556 {
1557 clear();
1558 qel = fqel;
1559 cum_qel = fcum_qel;
1560 el.pass(q, fel);
1561 }
void clear(void)
Definition: AbsArr.h:2186

◆ pilfer()

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

Definition at line 1522 of file AbsArr.h.

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

2410{
2411 check();
2412 if (qel.get_qel() == 0) {
2413 *this = DynArr<T>(qel_communicat, val);
2414 return;
2415 }
2416
2417 DynArr<T> datemp(qel_communicat, val); // all init to val
2418 IterDynArr<T> iter(&datemp);
2419 T* at;
2420 while ((at = iter.more()) != NULL) {
2421 if (confirm_ind_ext(iter.get_ncur()))
2422 *at = acp(iter.get_ncur()); // change to old values where they were
2423 }
2424 *this = datemp;
2425}
int confirm_ind_ext(const DynLinArr< long > &ind)
Definition: AbsArr.h:2193
T & acp(const DynLinArr< long > &ind)
Definition: AbsArr.h:1826
DynLinArr< long > qel_communicat
Definition: AbsArr.cpp:519

◆ top()

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

Definition at line 2537 of file AbsArr.h.

2537 {
2538 mfunnamep("template<class T> DynArr<T> DynArr<T>::top(void)");
2539 check();
2540 long qdim = get_qdim();
2541 check_econd11(qdim, != 2, mcerr);
2542 long n1, n2;
2543 DynArr<T> r(qel[1], qel[0]);
2544 for (n1 = 0; n1 < qel[0]; n1++) {
2545 for (n2 = 0; n2 < qel[1]; n2++) {
2546 r.ac(n2, n1) = ac(n1, n2);
2547 }
2548 }
2549 return r;
2550}
#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:2168

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: