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

#include <AbsArr.h>

+ Inheritance diagram for 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 (PILF_CONST DynArr< T > &f, Pilfer)
 
void pilfer (PILF_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
 
 macro_copy_total (DynArr)
 
virtual ~DynArr (void)
 

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))
 

Detailed Description

template<class T>
class DynArr< T >

Definition at line 1698 of file AbsArr.h.

Constructor & Destructor Documentation

◆ DynArr() [1/13]

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

Definition at line 1706 of file AbsArr.h.

1706{ ; }

◆ DynArr() [2/13]

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

Definition at line 1708 of file AbsArr.h.

1709 : qel(DynLinArr<long>(1)),
1710 cum_qel(DynLinArr<long>(1)),
1711 el(DynLinArr<T>(fqel)) {
1712#ifdef DEBUG_DYNARR
1713 mcout << "explicit DynArr(long fqel, T* val=NULL) is called\n";
1714#endif
1715 qel[0] = fqel;
1716 cum_qel[0] = 1;
1717 if (val != NULL) assignAll(*val);
1718 }
void assignAll(const T &val)
Definition: AbsArr.h:2880
#define mcout
Definition: prstream.h:133

◆ DynArr() [3/13]

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

Definition at line 1719 of file AbsArr.h.

1720 : qel(DynLinArr<long>(1)),
1721 cum_qel(DynLinArr<long>(1)),
1722 el(DynLinArr<T>(fqel)) {
1723#ifdef DEBUG_DYNARR
1724 mcout << "explicit DynArr(long fqel, T* val=NULL) is called\n";
1725#endif
1726 qel[0] = fqel;
1727 cum_qel[0] = 1;
1728 assignAll(val);
1729 }

◆ DynArr() [4/13]

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

Definition at line 1730 of file AbsArr.h.

1731 : qel(DynLinArr<long>(1)), cum_qel(DynLinArr<long>(1)), el(fqel) {
1732 qel[0] = fqel;
1733 cum_qel[0] = 1;
1734 long n;
1735 for (n = 0; n < fqel; n++)
1736 el.acu(n) = ar[n];
1737 }

◆ DynArr() [5/13]

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

Definition at line 1741 of file AbsArr.h.

1742 : qel(DynLinArr<long>(1)), cum_qel(DynLinArr<long>(1)), el(f.get_qel()) {
1743 qel[0] = f.get_qel();
1744 cum_qel[0] = 1;
1745 for (long n = 0; n < qel[0]; n++)
1746 ac(n) = f[n];
1747 }
T & ac(long i)
Definition: AbsArr.h:2057
long get_qel(void) const
Definition: AbsArr.h:420

◆ DynArr() [6/13]

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

Definition at line 1750 of file AbsArr.h.

1751 : qel(DynLinArr<long>(2)),
1752 cum_qel(DynLinArr<long>(2)),
1753 el(fqel1 * fqel2) {
1754#ifdef DEBUG_DYNARR
1755 mcout << "DynArr(long fqel1, long fqel2, T* val=NULL) is called\n";
1756#endif
1757 qel[0] = fqel1;
1758 qel[1] = fqel2;
1759 cum_qel[0] = fqel2;
1760 cum_qel[1] = 1;
1761 if (val != NULL) assignAll(*val);
1762 }

◆ DynArr() [7/13]

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

Definition at line 1764 of file AbsArr.h.

1765 : qel(DynLinArr<long>(2)),
1766 cum_qel(DynLinArr<long>(2)),
1767 el(fqel1 * fqel2) {
1768#ifdef DEBUG_DYNARR
1769 mcout
1770 << "DynArr(long fqel1, long fqel2, T val, ArgInterp_Val t) is called\n";
1771#endif
1772 qel[0] = fqel1;
1773 qel[1] = fqel2;
1774 cum_qel[0] = fqel2;
1775 cum_qel[1] = 1;
1776 assignAll(val);
1777 }

◆ DynArr() [8/13]

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

Definition at line 1780 of file AbsArr.h.

1781 : qel(DynLinArr<long>(3)),
1782 cum_qel(DynLinArr<long>(3)),
1783 el(fqel1 * fqel2 * fqel3) {
1784 qel[0] = fqel1;
1785 qel[1] = fqel2;
1786 qel[2] = fqel3;
1787 cum_qel[0] = fqel2 * fqel3;
1788 cum_qel[1] = fqel3;
1789 cum_qel[2] = 1;
1790 if (val != NULL) assignAll(*val);
1791 }

◆ DynArr() [9/13]

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

Definition at line 1794 of file AbsArr.h.

1795 : qel(DynLinArr<long>(4)),
1796 cum_qel(DynLinArr<long>(4)),
1797 el(fqel1 * fqel2 * fqel3 * fqel4) {
1798 qel[0] = fqel1;
1799 qel[1] = fqel2;
1800 qel[2] = fqel3;
1801 qel[3] = fqel4;
1802 cum_qel[0] = fqel2 * fqel3 * fqel4;
1803 cum_qel[1] = fqel3 * fqel4;
1804 cum_qel[2] = fqel4;
1805 cum_qel[3] = 1;
1806 if (val != NULL) assignAll(*val);
1807 }

◆ DynArr() [10/13]

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

Definition at line 1814 of file AbsArr.h.

1814 : qel(fqel) {
1815 long qdim = qel.get_qel();
1816 if (qdim <= 0) return;
1817 cum_qel.put_qel(qdim);
1818 long ndim;
1819 long size = qel[0];
1820 for (ndim = 1; ndim < qdim; ndim++)
1821 size *= qel[ndim];
1822 el.put_qel(size);
1823 cum_qel[qdim - 1] = 1;
1824 for (ndim = qdim - 2; ndim >= 0; ndim--)
1825 cum_qel[ndim] = qel[ndim + 1] * cum_qel[ndim + 1];
1826 assignAll(val);
1827 }
void put_qel(long fqel)
Definition: AbsArr.h:774

◆ DynArr() [11/13]

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

Definition at line 1829 of file AbsArr.h.

1829 : qel(fqel) {
1830 // fqel: array of dimensions
1831 // val: address of value to fill, may be NULL
1832 long qdim = qel.get_qel();
1833 if (qdim <= 0) return;
1834 cum_qel.put_qel(qdim);
1835 long ndim;
1836 long size = qel[0];
1837 for (ndim = 1; ndim < qdim; ndim++)
1838 size *= qel[ndim];
1839 el.put_qel(size);
1840 cum_qel[qdim - 1] = 1;
1841 for (ndim = qdim - 2; ndim >= 0; ndim--)
1842 cum_qel[ndim] = qel[ndim + 1] * cum_qel[ndim + 1];
1843 if (val != NULL) assignAll(*val);
1844 }

◆ DynArr() [12/13]

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

Definition at line 1846 of file AbsArr.h.

1848 : RegPassivePtr()
1849#endif
1850 {
1851#ifdef DEBUG_DYNARR
1852 mcout << "DynArr(const DynArr<T>& f) is working\n";
1853#endif
1854 *this = f;
1855 }

◆ DynArr() [13/13]

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

Definition at line 1856 of file AbsArr.h.

1857 : qel(f.qel, steal), cum_qel(f.cum_qel, steal), el(f.el, steal) {
1858#ifdef DEBUG_DYNARR
1859 mcout << "DynArr( DynArr<T>& f, Pilfer) is working\n";
1860#endif
1861 }
@ steal
Definition: AbsPtr.h:513

◆ ~DynArr()

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

Definition at line 2604 of file AbsArr.h.

2604{}

Member Function Documentation

◆ ac() [1/8]

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

Definition at line 2108 of file AbsArr.h.

2112 {
2113 long q;
2114 if ((q = qel.get_qel()) != ind.get_qel()) {
2115 mcerr << "ERROR in DynArr::ac(const DynLinArr<long>& ind): "
2116 << "qel.get_qel()!= ind.get_qel()\n"
2117 << "qel.get_qel()=" << qel.get_qel()
2118 << " ind.get_qel()=" << ind.get_qel() << '\n';
2119 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
2120 << '\n';
2121 spexit(mcerr);
2122 }
2123#ifdef ALR_CHECK_EACH_BOUND
2124#ifdef DEBUG_DYNARR
2125 if (q == 1) // faster for this case
2126 return el[ind.acu(0)];
2127 else
2128 return el[calc_lin_ind(ind)];
2129#else
2130 if (q == 1)
2131 return el[ind.acu(0)];
2132 else
2133 return el.acu(calc_lin_ind(ind));
2134#endif
2135#else
2136 if (q == 1)
2137 return el[ind.acu(0)];
2138 else
2139 return el[calc_lin_ind(ind)];
2140#endif
2141 }
#define spexit(stream)
Definition: FunNameStack.h:536
T & acu(long n)
Definition: AbsArr.h:372
#define mcerr
Definition: prstream.h:135

◆ ac() [2/8]

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

Definition at line 2142 of file AbsArr.h.

2143 {
2144 long q;
2145 if ((q = qel.get_qel()) != ind.get_qel()) {
2146 mcerr << "ERROR in DynArr::ac(const DynLinArr<long>& ind): "
2147 << "qel.get_qel()!= ind.get_qel()\n"
2148 << "qel.get_qel()=" << qel.get_qel()
2149 << " ind.get_qel()=" << ind.get_qel() << '\n';
2150 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
2151 << '\n';
2152 spexit(mcerr);
2153 }
2154/*
2155#ifdef ALR_CHECK_EACH_BOUND
2156#ifdef DEBUG_DYNARR
2157 return el[calc_lin_ind(ind)];
2158#else
2159 return el.acu(calc_lin_ind(ind));
2160#endif
2161#else
2162 return el[calc_lin_ind(ind)];
2163#endif
2164 //return el[calc_lin_ind(ind)];
2165 */
2166
2167#ifdef ALR_CHECK_EACH_BOUND
2168#ifdef DEBUG_DYNARR
2169 if (q == 1) // faster for this case
2170 return el[ind.acu(0)];
2171 else
2172 return el[calc_lin_ind(ind)];
2173#else
2174 if (q == 1)
2175 return el[ind.acu(0)];
2176 else
2177 return el.acu(calc_lin_ind(ind));
2178#endif
2179#else
2180 if (q == 1)
2181 return el[ind.acu(0)];
2182 else
2183 return el[calc_lin_ind(ind)];
2184#endif
2185 }

◆ ac() [3/8]

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

Definition at line 2057 of file AbsArr.h.

2058 {
2059 if (qel.get_qel() == 1)
2060 return el[i];
2061 else {
2062 mcerr << "ERROR in DynArr::ac(long i): qel.get_qel()!= 1, qel.get_qel()="
2063 << qel.get_qel() << '\n';
2064 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
2065 << '\n';
2066 spexit(mcerr);
2067#ifdef INS_CRETURN // Insert calming return
2068 return el[0]; // to quiet Microsoft Visual Studio compiler against
2069 // "not all control paths return a value"
2070#endif
2071 }
2072 //return el[i];
2073 }

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

◆ ac() [4/8]

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

Definition at line 2074 of file AbsArr.h.

2075 {
2076 if (qel.get_qel() == 1)
2077 return el[i];
2078 else {
2079 mcerr << "ERROR in DynArr::ac(long i): qel.get_qel()!= 1, qel.get_qel()="
2080 << qel.get_qel() << '\n';
2081 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
2082 << '\n';
2083 spexit(mcerr);
2084#ifdef INS_CRETURN // Insert calming return
2085 return el[0]; // to quiet Microsoft Visual Studio compiler against
2086 // "not all control paths return a value"
2087#endif
2088 }
2089 /*
2090 if(qel.get_qel() != 1)
2091 { mcerr<<"ERROR in DynArr::ac(long i): qel.get_qel()!= 1, qel.get_qel()="
2092 <<qel.get_qel()<<'\n';
2093 mcerr<<"Type of T is (in internal notations) "<<typeid(T).name()<<'\n';
2094 spexit(mcerr); }
2095 return el[i];
2096 */
2097 }

◆ ac() [5/8]

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

Definition at line 2268 of file AbsArr.h.

2269 {
2270 if (qel.get_qel() == 2) {
2271#ifdef ALR_CHECK_EACH_BOUND
2272 if (i1 >= 0 && i1 < qel.acu(0)) {
2273 if (i2 >= 0 && i2 < qel.acu(1)) {
2274#ifdef DEBUG_DYNARR
2275 return el[i1 * cum_qel.acu(0) + i2];
2276#else
2277 return el.acu(i1 * cum_qel.acu(0) + i2);
2278#endif
2279 } else {
2280 mcerr << "Error in DynArr::ac(long i1, long i2): i2 < 0 || i2 >= "
2281 "qel.acu(1)\n";
2282 Iprint2n(mcout, i2, qel[1]);
2283 }
2284 } else {
2285 mcerr << "Error in DynArr::ac(long i1, long i2): i1 < 0 || i1 >= "
2286 "qel.acu(0)\n";
2287 Iprint2n(mcout, i1, qel[0]);
2288 }
2289 } else {
2290 mcerr << "ERROR in DynArr::ac(long i1, long i2): qel.get_qel()!= 2,"
2291 << " qel.get_qel()=" << qel.get_qel() << '\n';
2292 }
2293 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
2294 << '\n';
2295 spexit(mcerr);
2296#ifdef INS_CRETURN // Insert calming return
2297 return el[0]; // to quiet Microsoft Visual Studio compiler against
2298 // "not all control paths return a value"
2299#endif
2300#else // for ifdef ALR_CHECK_EACH_BOUND
2301 return el[i1 * cum_qel.acu(0) + i2];
2302
2303#endif
2304 }
#define Iprint2n(file, name1, name2)
Definition: prstream.h:236

◆ ac() [6/8]

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

Definition at line 2338 of file AbsArr.h.

2339 {
2340 if (qel.get_qel() == 2) {
2341#ifdef ALR_CHECK_EACH_BOUND
2342 if (i1 >= 0 && i1 < qel.acu(0)) {
2343 if (i2 >= 0 && i2 < qel.acu(1)) {
2344#ifdef DEBUG_DYNARR
2345 return el[i1 * cum_qel.acu(0) + i2];
2346#else
2347 return el.acu(i1 * cum_qel.acu(0) + i2);
2348#endif
2349 } else {
2350 mcerr << "Error in DynArr::ac(long i1, long i2): i2 < 0 || i2 >= "
2351 "qel.acu(1)\n";
2352 Iprint2n(mcout, i2, qel[1]);
2353 }
2354 } else {
2355 mcerr << "Error in DynArr::ac(long i1, long i2): i1 < 0 || i1 >= "
2356 "qel.acu(0)\n";
2357 Iprint2n(mcout, i1, qel[0]);
2358 }
2359 } else {
2360 mcerr << "ERROR in DynArr::ac(long i1, long i2): qel.get_qel()!= 2,"
2361 << " qel.get_qel()=" << qel.get_qel() << '\n';
2362 }
2363 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
2364 << '\n';
2365 spexit(mcerr);
2366#ifdef INS_CRETURN // Insert calming return
2367 return el[0]; // to quiet Microsoft Visual Studio compiler against
2368 // "not all control paths return a value"
2369#endif
2370#else // for ifdef ALR_CHECK_EACH_BOUND
2371 return el[i1 * cum_qel.acu(0) + i2];
2372
2373#endif
2374 }

◆ ac() [7/8]

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

Definition at line 2418 of file AbsArr.h.

2419 {
2420 if (qel.get_qel() != 3) {
2421 mcerr << "ERROR in DynArr::ac(long i1, long i2, long i3): "
2422 "qel.get_qel()!= 3,"
2423 << " qel.get_qel()=" << qel.get_qel() << '\n';
2424 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
2425 << '\n';
2426 spexit(mcerr);
2427 }
2428#ifdef ALR_CHECK_EACH_BOUND
2429 if (i1 < 0 || i1 >= qel.acu(0)) {
2430 mcerr << "Error in DynArr::ac(long i1, long i2, long i3): i1 < 0 || i1 "
2431 ">= qel.acu(0)\n";
2432 Iprint2n(mcout, i1, qel[0]);
2433 spexit(mcerr);
2434 }
2435 if (i2 < 0 || i2 >= qel.acu(1)) {
2436 mcerr << "Error in DynArr::ac(long i1, long i2, long i3): i2 < 0 || i2 "
2437 ">= qel.acu(1)\n";
2438 Iprint2n(mcout, i2, qel[1]);
2439 spexit(mcerr);
2440 }
2441 if (i3 < 0 || i3 >= qel.acu(2)) {
2442 mcerr << "Error in DynArr::ac(long i1, long i2, long i3): i3 < 0 || i3 "
2443 ">= qel.acu(2)\n";
2444 Iprint2n(mcout, i3, qel[2]);
2445 spexit(mcerr);
2446 }
2447#ifdef DEBUG_DYNARR
2448 return el.acu(i1 * cum_qel.acu(0) + i2 * cum_qel.acu(1) + i3);
2449#else
2450 return el[i1 * cum_qel.acu(0) + i2 * cum_qel[1] + i3];
2451#endif
2452#else
2453 return el[i1 * cum_qel.acu(0) + i2 * cum_qel[1] + i3];
2454#endif
2455 //return el[i1*cum_qel[0] + i2*cum_qel[1] + i3];
2456 }

◆ ac() [8/8]

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

Definition at line 2458 of file AbsArr.h.

2459 {
2460 if (qel.get_qel() != 3) {
2461 mcerr << "ERROR in DynArr::ac(long i1, long i2, long i3): "
2462 "qel.get_qel()!= 3,"
2463 << " qel.get_qel()=" << qel.get_qel() << '\n';
2464 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
2465 << '\n';
2466 spexit(mcerr);
2467 }
2468#ifdef ALR_CHECK_EACH_BOUND
2469 if (i1 < 0 || i1 >= qel.acu(0)) {
2470 mcerr << "Error in DynArr::ac(long i1, long i2, long i3): i1 < 0 || i1 "
2471 ">= qel.acu(0)\n";
2472 Iprint2n(mcout, i1, qel[0]);
2473 spexit(mcerr);
2474 }
2475 if (i2 < 0 || i2 >= qel.acu(1)) {
2476 mcerr << "Error in DynArr::ac(long i1, long i2, long i3): i2 < 0 || i2 "
2477 ">= qel.acu(1)\n";
2478 Iprint2n(mcout, i2, qel[1]);
2479 spexit(mcerr);
2480 }
2481 if (i3 < 0 || i3 >= qel.acu(2)) {
2482 mcerr << "Error in DynArr::ac(long i1, long i2, long i3): i3 < 0 || i3 "
2483 ">= qel.acu(2)\n";
2484 Iprint2n(mcout, i3, qel[2]);
2485 spexit(mcerr);
2486 }
2487#ifdef DEBUG_DYNARR
2488 return el.acu(i1 * cum_qel.acu(0) + i2 * cum_qel.acu(1) + i3);
2489#else
2490 return el[i1 * cum_qel.acu(0) + i2 * cum_qel[1] + i3];
2491#endif
2492#else
2493 return el[i1 * cum_qel.acu(0) + i2 * cum_qel[1] + i3];
2494#endif
2495 //return el[i1*cum_qel[0] + i2*cum_qel[1] + i3];
2496 }

◆ ac_lin() [1/2]

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

Definition at line 2501 of file AbsArr.h.

2501 {
2502 long qelln = el.get_qel();
2503#ifdef ALR_CHECK_BOUND
2504 if (n >= 0 && n < qelln) {
2505 return el[n];
2506 } else {
2507 mcerr << "ERROR in T& DynArr::ac_lin(long n): "
2508 << "n is out of bounds, n=" << n << " qelln=" << qelln << '\n';
2509 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
2510 << '\n';
2511 spexit(mcerr);
2512#ifdef INS_CRETURN
2513 return el[0]; // to quiet Microsoft Visial Studio compiler against
2514 // "not all control paths return a value"
2515#endif
2516 }
2517#else
2518 return el[n];
2519#endif
2520 }

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

◆ ac_lin() [2/2]

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

Definition at line 2521 of file AbsArr.h.

2521 {
2522 long qelln = el.get_qel();
2523#ifdef ALR_CHECK_BOUND
2524 if (n >= 0 && n < qelln) {
2525 return el[n];
2526 } else {
2527 mcerr << "ERROR in T& DynArr::ac_lin(long n): "
2528 << "n is out of bounds, n=" << n << " qelln=" << qelln << '\n';
2529 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
2530 << '\n';
2531 spexit(mcerr);
2532#ifdef INS_CRETURN
2533 return el[0]; // to quiet Microsoft Visial Studio compiler against
2534 // "not all control paths return a value"
2535#endif
2536 }
2537#else
2538 return el[n];
2539#endif
2540 }

◆ acp() [1/2]

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

Definition at line 2187 of file AbsArr.h.

2190 {
2191 long q;
2192 if ((q = qel.get_qel()) > ind.get_qel()) {
2193 mcerr << "ERROR in DynArr::acp(const DynLinArr<long>& ind): "
2194 << "qel.get_qel()!= ind.get_qel()\n"
2195 << "qel.get_qel()=" << qel.get_qel()
2196 << " ind.get_qel()=" << ind.get_qel() << '\n';
2197 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
2198 << '\n';
2199 spexit(mcerr);
2200 }
2201
2202#ifdef ALR_CHECK_EACH_BOUND
2203#ifdef DEBUG_DYNARR
2204 if (q == 1) // faster for this case
2205 return el[ind.acu(0)];
2206 else
2207 return el[calc_lin_ind(ind)];
2208#else
2209 if (q == 1)
2210 return el[ind.acu(0)];
2211 else
2212 return el.acu(calc_lin_ind(ind));
2213#endif
2214#else
2215 if (q == 1)
2216 return el[ind.acu(0)];
2217 else
2218 return el[calc_lin_ind(ind)];
2219#endif
2220 }

◆ acp() [2/2]

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

Definition at line 2222 of file AbsArr.h.

2222 {
2223 long q;
2224 if ((q = qel.get_qel()) > ind.get_qel()) {
2225 mcerr << "ERROR in DynArr::acp(const DynLinArr<long>& ind): "
2226 << "qel.get_qel()!= ind.get_qel()\n"
2227 << "qel.get_qel()=" << qel.get_qel()
2228 << " ind.get_qel()=" << ind.get_qel() << '\n';
2229 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
2230 << '\n';
2231 spexit(mcerr);
2232 }
2233#ifdef ALR_CHECK_EACH_BOUND
2234#ifdef DEBUG_DYNARR
2235 if (q == 1) // faster for this case
2236 return el[ind.acu(0)];
2237 else
2238 return el[calc_lin_ind(ind)];
2239#else
2240 if (q == 1)
2241 return el[ind.acu(0)];
2242 else
2243 return el.acu(calc_lin_ind(ind));
2244#endif
2245#else
2246 if (q == 1)
2247 return el[ind.acu(0)];
2248 else
2249 return el[calc_lin_ind(ind)];
2250#endif
2251 }

◆ acu() [1/6]

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

Definition at line 2253 of file AbsArr.h.

2254 {
2255 if (qel.get_qel() == 1)
2256 return el.acu(ind.acu(0));
2257 else
2258 return el.acu(calc_lin_ind(ind));
2259 }

◆ acu() [2/6]

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

Definition at line 2260 of file AbsArr.h.

2261 {
2262 if (qel.get_qel() == 1)
2263 return el.acu(ind.acu(0));
2264 else
2265 return el.acu(calc_lin_ind(ind));
2266 }

◆ acu() [3/6]

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

Definition at line 2098 of file AbsArr.h.

2099 {
2100 return el.acu(i1);
2101 }

Referenced by operator*(), operator+(), operator-(), and t_total_integ_step_ar().

◆ acu() [4/6]

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

Definition at line 2102 of file AbsArr.h.

2104 {
2105 return el.acu(i1);
2106 }

◆ acu() [5/6]

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

Definition at line 2408 of file AbsArr.h.

2410 {
2411 return el.acu(i1 * cum_qel.acu(0) + i2);
2412 }

◆ acu() [6/6]

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

Definition at line 2413 of file AbsArr.h.

2414 {
2415 return el.acu(i1 * cum_qel.acu(0) + i2);
2416 }

◆ acu_lin() [1/2]

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

◆ acu_lin() [2/2]

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

Definition at line 2543 of file AbsArr.h.

2543{ return el[n]; }

◆ assignAll()

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

Definition at line 2880 of file AbsArr.h.

2880 {
2881 check();
2882 // try faster and simpler way (30.10.2006):
2883 el.assignAll(val);
2884 /*
2885 IterDynArr<T> iter(this);
2886 T* at;
2887 while( (at=iter.more()) != NULL )
2888 {
2889 *at=val;
2890 }
2891 */
2892}
void check(void) const
Definition: AbsArr.h:2587

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

◆ check()

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

Definition at line 2587 of file AbsArr.h.

2587 {
2588 qel.check();
2589 cum_qel.check();
2590 el.check();
2591 }
void check(void) const
Definition: AbsArr.h:615

Referenced by convert_DynArr(), copy_DynArr(), DynLinArr< T >::DynLinArr(), operator<<(), DynArr< T >::operator=(), print_DynArr(), print_DynArr_double(), print_DynArr_float(), and print_DynArr_int_w().

◆ clear()

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

Definition at line 2565 of file AbsArr.h.

2565 {
2566 qel.clear();
2567 cum_qel.clear();
2568 el.clear();
2569 }
void clear(void)
Definition: AbsArr.h:450

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

◆ confirm_ind()

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

Definition at line 2571 of file AbsArr.h.

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

◆ confirm_ind_ext()

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

Definition at line 2572 of file AbsArr.h.

2572 {
2573 return gconfirm_ind_ext(qel, ind);
2574 }
int gconfirm_ind_ext(const DynLinArr< long > &qel, const DynLinArr< long > &ind)
Definition: AbsArr.cpp:448

◆ get_cum_qel()

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

Definition at line 2552 of file AbsArr.h.

2552{ return cum_qel; }

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

◆ get_el()

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

Definition at line 2549 of file AbsArr.h.

2549{ return el; }

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

◆ get_qdim()

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

◆ get_qel()

◆ get_qel_lin()

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

Definition at line 2498 of file AbsArr.h.

2498{ return el.get_qel(); }

Referenced by change_sign(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), and DynArr< T >::operator=().

◆ get_s_non_emplty()

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

Definition at line 2592 of file AbsArr.h.

2592 {
2593 long q = qel.get_qel();
2594 if (q == 0) return 0;
2595 long n;
2596 for (n = 0; n < q; n++) {
2597 if (qel[n] <= 0) return 0;
2598 }
2599 return 1;
2600 }

Referenced by operator<<().

◆ macro_copy_total()

template<class T >
DynArr< T >::macro_copy_total ( DynArr< T >  )

◆ operator=() [1/2]

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

Definition at line 2709 of file AbsArr.h.

2709 {
2710#ifdef DEBUG_DYNLINARR
2711 mcout << "DynArr<T>& DynArr<T>::operator=(const DynArr<D>& f)\n";
2712#endif
2713 //if(this != &f)
2714 //{
2715 //mcout<<"DynLinArr<T>& operator=(const DynLinArr<T>& f): long(el)="
2716 //<<long(el)<<'\n';
2717 check();
2718 f.check();
2719 DynLinArr<long> qel = f.get_qel();
2720 DynLinArr<long> cum_qel = f.get_cum_qel();
2721 // for example, one of its elements.
2722 long q = f.get_qel_lin();
2723#ifdef USE_REPLACE_ALLOC
2724 T* temp_el;
2725 if (q > 0) {
2726 temp_el = (T*)malloc(sizeof(T) * q);
2727 long n;
2728 for (n = 0; n < q; n++)
2729 new (&(temp_el[n])) T;
2730 } else
2731 temp_el = NULL;
2732#else
2733 T* temp_el = (q > 0) ? (new T[q]) : (T*)NULL;
2734#endif
2735 long n;
2736 for (n = 0; n < q; n++)
2737 temp_el[n] = f.acu_lin(n);
2738 pass(q, qel, cum_qel, temp_el);
2739 //}
2740 return *this;
2741}
void pass(long q, DynLinArr< long > fqel, DynLinArr< long > fcum_qel, T *fel)
Definition: AbsArr.h:1893
const DynLinArr< long > & get_cum_qel(void) const
Definition: AbsArr.h:2552
T & acu_lin(long n)
Definition: AbsArr.h:2542
long get_qel_lin(void) const
Definition: AbsArr.h:2498
const DynLinArr< long > & get_qel(void) const
Definition: AbsArr.h:2548

◆ operator=() [2/2]

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

Definition at line 2691 of file AbsArr.h.

2691 {
2692#ifdef DEBUG_DYNARR
2693 mcout << "DynArr<T>& DynArr<T>::operator=(const DynArr<T>& f)\n";
2694#endif
2695 if (this != &f) {
2696 //mcout<<"DynLinArr<T>& operator=(const DynLinArr<T>& f): long(el)="
2697 //<<long(el)<<'\n';
2698 check();
2699 f.check();
2700 qel = f.qel;
2701 cum_qel = f.cum_qel;
2702 el = f.el;
2703 }
2704 return *this;
2705}

◆ operator[]() [1/2]

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

Definition at line 2006 of file AbsArr.h.

2006 {
2007 if (qel.get_qel() < 1) {
2008 mcerr << "ERROR in DynArr::IndexingProvider DynArr::operator[](long n): "
2009 "qel.get_qel()< 1, qel.get_qel()=" << qel.get_qel() << '\n';
2010 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
2011 << '\n';
2012 spexit(mcerr);
2013 }
2014#ifdef ALR_CHECK_EACH_BOUND
2015 if (n >= 0 && n < qel.acu(0)) {
2016#endif
2017 return IndexingProvider<T>(*this, 1, n * cum_qel.acu(0));
2018#ifdef ALR_CHECK_EACH_BOUND
2019 } else {
2020 mcerr << "Error in IndexingProvider<T> DynArr::operator[](long n): n < 0 "
2021 "|| n >= qel.acu(0)\n";
2022 Iprint2n(mcout, n, qel.acu(0));
2023 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
2024 << '\n';
2025 spexit(mcerr);
2026 }
2027#endif
2028 }

◆ operator[]() [2/2]

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

Definition at line 2030 of file AbsArr.h.

2030 {
2031 if (qel.get_qel() < 1) {
2032 mcerr << "ERROR in DynArr::IndexingProvider DynArr::operator[](long n): "
2033 "qel.get_qel()< 1, qel.get_qel()=" << qel.get_qel() << '\n';
2034 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
2035 << '\n';
2036 spexit(mcerr);
2037 }
2038#ifdef ALR_CHECK_EACH_BOUND
2039 if (n >= 0 && n < qel.acu(0)) {
2040#endif
2041 //DynArr<T>* temp = static_cast<DynArr<T>* >(this);
2042 DynArr<T>* temp = const_cast<DynArr<T>*>(this);
2043 // static_cast<const IndexingProvider<T> >(*this);
2044 return IndexingProvider<T>(*temp, 1, n * cum_qel.acu(0));
2045#ifdef ALR_CHECK_EACH_BOUND
2046 } else {
2047 mcerr << "Error in IndexingProvider<T> DynArr::operator[](long n): n < 0 "
2048 "|| n >= qel.acu(0)\n";
2049 Iprint2n(mcout, n, qel.acu(0));
2050 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
2051 << '\n';
2052 spexit(mcerr);
2053 }
2054#endif
2055 }

◆ pass()

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

Definition at line 1893 of file AbsArr.h.

1896 {
1897 clear();
1898 qel = fqel;
1899 cum_qel = fcum_qel;
1900 el.pass(q, fel);
1901 }
void clear(void)
Definition: AbsArr.h:2565

◆ pilfer()

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

Definition at line 1863 of file AbsArr.h.

1863 {
1864#ifdef DEBUG_DYNARR
1865 mcout << "DynArr::pilfer is called\n";
1866#endif
1867 if (this != &f) {
1868 if (qel.get_qel() != 0) {
1869 if (f.qel.get_qel() != 0) {
1870 mcerr << "ERROR in DynArr::pilfer(...):\n";
1871 mcerr << "Both the destination and source arrays are not empty\n";
1872 // For explanations why it is dangerous, see similar function
1873 // of ActivePtr.
1874 spexit(mcerr);
1875 } else {
1876 qel.clear();
1877 cum_qel.clear();
1878 el.clear();
1879 }
1880 }
1881 qel.pilfer(f.qel);
1882 cum_qel.pilfer(f.cum_qel);
1883 el.pilfer(f.el);
1884 f.qel.clear();
1885 f.cum_qel.clear();
1886 f.el.clear();
1887 }
1888 }
void pilfer(PILF_CONST DynLinArr< T > &f)
Definition: AbsArr.h:454

Referenced by operator>>().

◆ put_qel()

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

Definition at line 2812 of file AbsArr.h.

2814 {
2815 check();
2816 if (qel.get_qel() == 0) {
2817 *this = DynArr<T>(qel_communicat, val);
2818 return;
2819 }
2820
2821 DynArr<T> datemp(qel_communicat, val); // all init to val
2822 IterDynArr<T> iter(&datemp);
2823 T* at;
2824 while ((at = iter.more()) != NULL) {
2825 if (confirm_ind_ext(iter.get_ncur()))
2826 *at = acp(iter.get_ncur()); // change to old values where they were
2827 }
2828 *this = datemp;
2829}
DynLinArr< long > qel_communicat
Definition: AbsArr.cpp:539
T & acp(const DynLinArr< long > &ind)
Definition: AbsArr.h:2187
int confirm_ind_ext(const DynLinArr< long > &ind)
Definition: AbsArr.h:2572

◆ top()

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

Definition at line 2933 of file AbsArr.h.

2933 {
2934 mfunnamep("template<class T> DynArr<T> DynArr<T>::top(void)");
2935 check();
2936 long qdim = get_qdim();
2937 check_econd11(qdim, != 2, mcerr);
2938 long n1, n2;
2939 DynArr<T> r(qel[1], qel[0]);
2940 for (n1 = 0; n1 < qel[0]; n1++) {
2941 for (n2 = 0; n2 < qel[1]; n2++) {
2942 r.ac(n2, n1) = ac(n1, n2);
2943 }
2944 }
2945 return r;
2946}
#define check_econd11(a, signb, stream)
Definition: FunNameStack.h:366
#define mfunnamep(string)
Definition: FunNameStack.h:77
long get_qdim(void) const
Definition: AbsArr.h:2547

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: