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

#include <tline.h>

+ Inheritance diagram for CopiedPointCoorMesh< T >:

Public Member Functions

long get_qi (void) const
 
get_xmin (void) const
 
get_xmax (void) const
 
const DynLinArr< T > & get_mesh (void) const
 
void get_scoor (long n, T &b) const
 
int get_interval (long n, T &b1, T &b2) const
 
int get_interval (T x, long &n1) const
 
int get_interval (T x, long &n1, T &b1, long &n2, T &b2) const
 
int get_interval_extrap (T x, long &n1, T &b1, long &n2, T &b2) const
 
int get_step (long n, T &fstep) const
 
 CopiedPointCoorMesh (void)
 
 CopiedPointCoorMesh (long fq, T *famesh)
 
 CopiedPointCoorMesh (DynLinArr< T > &famesh)
 
 CopiedPointCoorMesh (const CopiedPointCoorMesh< T > &f)
 
CopiedPointCoorMesh< T > & operator= (const CopiedPointCoorMesh< T > &f)
 
void print (std::ostream &file) const
 

Detailed Description

template<class T>
class CopiedPointCoorMesh< T >

Definition at line 760 of file tline.h.

Constructor & Destructor Documentation

◆ CopiedPointCoorMesh() [1/4]

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

Definition at line 795 of file tline.h.

803 : q(0), xmin(0), xmax(0), x_old(0), n_old(-1) {
804 ;
805 }

◆ CopiedPointCoorMesh() [2/4]

template<class T >
CopiedPointCoorMesh< T >::CopiedPointCoorMesh ( long  fq,
T *  famesh 
)

Definition at line 861 of file tline.h.

862 : q(fq), mesh(fq), x_old(0), n_old(-1) {
863 if (q <= 1) {
864 mcerr << "ERROR in CopiedPointCoorMesh<T>::CopiedPointCoorMesh<T>:\n"
865 << "q <= 1\n";
866 Iprintn(mcerr, q);
867 spexit(mcerr);
868 }
869 long n;
870 for (n = 0; n < q; n++) {
871 mesh[n] = famesh[n];
872 }
873 xmin = mesh[0];
874 xmax = mesh[q - 1];
875#ifdef TLINE_REDUCE_TO_RAW_ARR
876 amesh = &mesh;
877#endif
878 // check consistence
879 if (xmin > xmax) {
880 mcerr << "ERROR in CopiedPointCoorMesh<T>::PointCoorMesh<T>:\n"
881 << "xmin > xmax\n";
882 Iprint2n(mcerr, xmin, xmax);
883 spexit(mcerr);
884 }
885#ifdef CHECK_POINT_MESH
886 long n;
887 for (n = 0; n < q - 1; n++) {
888#ifdef TLINE_REDUCE_TO_RAW_ARR
889 if ((*amesh)[n] >= (*amesh)[n + 1])
890#else
891 if (mesh[n] >= mesh[n + 1])
892#endif
893 {
894 mcerr << "ERROR in CopiedPointCoorMesh<T>::PointCoorMesh<T>:\n"
895 << "mesh[n] >= mesh[n+1]\n";
896 Iprint3n(mcerr, n, mesh[n], mesh[n + 1]);
897 spexit(mcerr);
898 }
899 }
900#endif
901
902}
#define spexit(stream)
Definition: FunNameStack.h:536
#define Iprint3n(file, name1, name2, name3)
Definition: prstream.h:249
#define mcerr
Definition: prstream.h:135
#define Iprintn(file, name)
Definition: prstream.h:216
#define Iprint2n(file, name1, name2)
Definition: prstream.h:236

◆ CopiedPointCoorMesh() [3/4]

template<class T >
CopiedPointCoorMesh< T >::CopiedPointCoorMesh ( DynLinArr< T > &  famesh)

Definition at line 905 of file tline.h.

906 : q(fmesh.get_qel()), mesh(fmesh), x_old(0), n_old(-1) {
907 if (q <= 1) {
908 mcerr << "ERROR in CopiedPointCoorMesh<T>::CopiedPointCoorMesh<T>:\n"
909 << "q <= 1\n";
910 Iprintn(mcerr, q);
911 spexit(mcerr);
912 }
913 //long n;
914 //for(n=0; n<q; n++)
915 //{
916 // mesh[n] = famesh[n];
917 //}
918 xmin = mesh[0];
919 xmax = mesh[q - 1];
920#ifdef TLINE_REDUCE_TO_RAW_ARR
921 amesh = &mesh;
922#endif
923 // check consistence
924 if (xmin > xmax) {
925 mcerr << "ERROR in CopiedPointCoorMesh<T>::PointCoorMesh<T>:\n"
926 << "xmin > xmax\n";
927 Iprint2n(mcerr, xmin, xmax);
928 spexit(mcerr);
929 }
930#ifdef CHECK_POINT_MESH
931 long n;
932 for (n = 0; n < q - 1; n++) {
933#ifdef TLINE_REDUCE_TO_RAW_ARR
934 if ((*amesh)[n] >= (*amesh)[n + 1])
935#else
936 if (mesh[n] >= mesh[n + 1])
937#endif
938 {
939 mcerr << "ERROR in CopiedPointCoorMesh<T>::PointCoorMesh<T>:\n"
940 << "mesh[n] >= mesh[n+1]\n";
941 Iprint3n(mcerr, n, mesh[n], mesh[n + 1]);
942 spexit(mcerr);
943 }
944 }
945#endif
946
947}

◆ CopiedPointCoorMesh() [4/4]

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

Definition at line 795 of file tline.h.

816 : q(f.q),
817 mesh(f.mesh),
818 xmin(f.xmin),
819 xmax(f.xmax),
820 x_old(f.x_old),
821 n_old(f.n_old)
822#ifdef TLINE_REDUCE_TO_RAW_ARR
823 amesh(&mesh)
824#endif
825 {
826 }

Member Function Documentation

◆ get_interval() [1/3]

template<class T >
int CopiedPointCoorMesh< T >::get_interval ( long  n,
T &  b1,
T &  b2 
) const
inline

Definition at line 775 of file tline.h.

775 {
776 if (n < 0 || n >= q - 1) return 0;
777#ifdef TLINE_REDUCE_TO_RAW_ARR
778 b1 = (*amesh)[n];
779 b2 = (*amesh)[n + 1];
780#else
781 {
782 b1 = mesh[n];
783 b2 = mesh[n + 1];
784 }
785#endif
786 return 1;
787 }

Referenced by CopiedPointCoorMesh< T >::CopiedPointCoorMesh(), and VirtCopiedPointCoorMesh< T >::get_interval().

◆ get_interval() [2/3]

template<class T >
int CopiedPointCoorMesh< T >::get_interval ( x,
long &  n1 
) const

Definition at line 950 of file tline.h.

950 {
951 if (x < xmin || x >= xmax) {
952 n1 = 0;
953 return 0;
954 }
955#ifdef TLINE_REDUCE_TO_RAW_ARR
956 if (n_old >= 0 && x_old <= x) {
957 n1 = t_find_interval_end<T, T*>(x, q, amesh, n_old);
958 } else {
959 n1 = t_find_interval<T, T*>(x, q, amesh);
960 }
961//n1 = t_find_interval< T , D >(x, q, amesh);
962#else
963 if (n_old >= 0 && x_old <= x) {
964 n1 = t_find_interval_end<T, DynLinArr<T> >(x, q, mesh, n_old);
965 } else {
966 n1 = t_find_interval<T, DynLinArr<T> >(x, q, mesh);
967 }
968//n1 = t_find_interval< T , T* >(x, q, &amesh);
969#endif
970
971 if (n1 < 0) {
972 mcerr << "ERROR in CopiedPointCoorMesh<T>::get_interval:\n"
973 << "n1 < 0\n";
974 print(mcerr);
975 Iprintn(mcerr, n1);
976 spexit(mcerr);
977 }
978 n_old = n1;
979 x_old = x;
980 return 1;
981}
void print(std::ostream &file) const
Definition: tline.h:1096

◆ get_interval() [3/3]

template<class T >
int CopiedPointCoorMesh< T >::get_interval ( x,
long &  n1,
T &  b1,
long &  n2,
T &  b2 
) const

Definition at line 984 of file tline.h.

985 {
986 if (x < xmin || x >= xmax) {
987 n1 = 0;
988 n2 = 0;
989 b1 = 0;
990 b2 = 0;
991 return 0;
992 }
993#ifdef TLINE_REDUCE_TO_RAW_ARR
994 if (n_old >= 0 && x_old <= x) {
995 n1 = t_find_interval_end<T, T*>(x, q, amesh, n_old);
996 } else {
997 n1 = t_find_interval<T, T*>(x, q, amesh);
998 }
999//n1 = t_find_interval< T , D >(x, q, amesh);
1000#else
1001 if (n_old >= 0 && x_old <= x) {
1002 n1 = t_find_interval_end<T, DynLinArr<T> >(x, q, mesh, n_old);
1003 } else {
1004 n1 = t_find_interval<T, DynLinArr<T> >(x, q, mesh);
1005 }
1006//n1 = t_find_interval< T , T* >(x, q, &amesh);
1007#endif
1008 n2 = n1 + 1;
1009#ifdef TLINE_REDUCE_TO_RAW_ARR
1010 b1 = amesh[n1];
1011 b2 = amesh[n2];
1012#else
1013 b1 = mesh[n1];
1014 b2 = mesh[n2];
1015#endif
1016 if (n1 < 0 || n1 >= q || n2 < 0 || n2 >= q || b1 < xmin || b1 > xmax ||
1017 b2 < xmin || b2 > xmax) {
1018 mcerr << "ERROR in CopiedPointCoorMesh<T>::get_interval:\n"
1019 << "n1 < 0 || n1 >= q || n2 < 0 || n2 >= q || b1 < xmin || b1 > xmax "
1020 "|| b2 < xmin || b2 > xmax\n";
1021 print(mcerr);
1022 Iprint4n(mcerr, n1, n2, b1, b2);
1023 spexit(mcerr);
1024 }
1025 n_old = n1;
1026 x_old = x;
1027 return 1;
1028}
#define Iprint4n(file, name1, name2, name3, name4)
Definition: prstream.h:260

◆ get_interval_extrap()

template<class T >
int CopiedPointCoorMesh< T >::get_interval_extrap ( x,
long &  n1,
T &  b1,
long &  n2,
T &  b2 
) const

Definition at line 1031 of file tline.h.

1032 {
1033 int i_ret = 1;
1034
1035 if (x < xmin) {
1036 i_ret = 0;
1037 n1 = 0;
1038 n2 = 1;
1039 b1 = xmin;
1040#ifdef TLINE_REDUCE_TO_RAW_ARR
1041 b2 = (*amesh)[1];
1042#else
1043 b2 = mesh[1];
1044#endif
1045 } else if (x >= xmax) {
1046 i_ret = 2;
1047 n1 = q - 2;
1048 n2 = q - 1;
1049#ifdef TLINE_REDUCE_TO_RAW_ARR
1050 b1 = (*amesh)[q - 2];
1051#else
1052 b1 = mesh[q - 2];
1053#endif
1054 b2 = xmax;
1055 } else {
1056#ifndef TLINE_REDUCE_TO_RAW_ARR
1057 if (n_old >= 0 && x_old <= x) {
1058 n1 = t_find_interval_end<T, DynLinArr<T> >(x, q, mesh, n_old);
1059 } else {
1060 n1 = t_find_interval<T, DynLinArr<T> >(x, q, mesh);
1061 }
1062//n1 = t_find_interval< T , D >(x, q, amesh);
1063#else
1064 if (n_old >= 0 && x_old <= x) {
1065 n1 = t_find_interval_end<T, T*>(x, q, amesh, n_old);
1066 } else {
1067 n1 = t_find_interval<T, T*>(x, q, amesh);
1068 }
1069//n1 = t_find_interval< T , T* >(x, q, &amesh);
1070#endif
1071 n2 = n1 + 1;
1072#ifndef TLINE_REDUCE_TO_RAW_ARR
1073 b1 = mesh[n1];
1074 b2 = mesh[n2];
1075#else
1076 b1 = amesh[n1];
1077 b2 = amesh[n2];
1078#endif
1079 if (n1 < 0 || n1 >= q || n2 < 0 || n2 >= q || b1 < xmin || b1 > xmax ||
1080 b2 < xmin || b2 > xmax) {
1081 mcerr << "ERROR in CopiedPointCoorMesh<T>::get_interval:\n"
1082 << "n1 < 0 || n1 >= q || n2 < 0 || n2 >= q || b1 < xmin || b1 > "
1083 "xmax || b2 < xmin || b2 > xmax\n";
1084 print(mcerr);
1085 Iprint4n(mcerr, n1, n2, b1, b2);
1086 spexit(mcerr);
1087 }
1088 n_old = n1;
1089 x_old = x;
1090 }
1091 return i_ret;
1092
1093}

Referenced by VirtCopiedPointCoorMesh< T >::get_interval_extrap().

◆ get_mesh()

template<class T >
const DynLinArr< T > & CopiedPointCoorMesh< T >::get_mesh ( void  ) const
inline

Definition at line 766 of file tline.h.

766{ return mesh; }

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

◆ get_qi()

template<class T >
long CopiedPointCoorMesh< T >::get_qi ( void  ) const
inline

Definition at line 763 of file tline.h.

763{ return q - 1; }

Referenced by apeq_mant(), VirtCopiedPointCoorMesh< T >::get_qi(), operator!=(), and operator==().

◆ get_scoor()

template<class T >
void CopiedPointCoorMesh< T >::get_scoor ( long  n,
T &  b 
) const
inline

Definition at line 767 of file tline.h.

769 {
770 b = (*amesh)[n];
771 }
772#else
773 { b = mesh[n]; }

Referenced by VirtCopiedPointCoorMesh< T >::get_scoor().

◆ get_step()

template<class T >
int CopiedPointCoorMesh< T >::get_step ( long  n,
T &  fstep 
) const
inline

Definition at line 795 of file tline.h.

795 {
796 if (n < 0 || n >= q - 1) return 0;
797 T b1, b2;
798 get_interval(n, b1, b2);
799 fstep = b2 - b1;
800 return 1;
801 }
int get_interval(long n, T &b1, T &b2) const
Definition: tline.h:775

Referenced by VirtCopiedPointCoorMesh< T >::get_step().

◆ get_xmax()

template<class T >
T CopiedPointCoorMesh< T >::get_xmax ( void  ) const
inline

Definition at line 765 of file tline.h.

765{ return xmax; }

Referenced by apeq_mant(), VirtCopiedPointCoorMesh< T >::get_xmax(), operator!=(), and operator==().

◆ get_xmin()

template<class T >
T CopiedPointCoorMesh< T >::get_xmin ( void  ) const
inline

Definition at line 764 of file tline.h.

764{ return xmin; }

Referenced by apeq_mant(), VirtCopiedPointCoorMesh< T >::get_xmin(), operator!=(), and operator==().

◆ operator=()

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

Definition at line 827 of file tline.h.

827 {
828 if (this != &f) {
829 q = f.q;
830 mesh = f.mesh;
831 xmin = f.xmin;
832 xmax = f.xmax;
833 x_old = f.x_old;
834 n_old = f.n_old;
835#ifdef TLINE_REDUCE_TO_RAW_ARR
836 amesh = &mesh;
837#endif
838 }
839 return *this;
840 }

◆ print()

template<class T >
void CopiedPointCoorMesh< T >::print ( std::ostream &  file) const

Definition at line 1096 of file tline.h.

1096 {
1097 Ifile << "CopiedPointCoorMesh<T>:\n";
1098 indn.n += 2;
1099 Ifile << "Type of T is (in internal notations) " << typeid(T).name() << '\n';
1100 //Ifile<<"Type of D is (in internal notations) "<<typeid(D).name()<<'\n';
1101 Iprint3n(file, q, xmin, xmax);
1102 Iprint2n(file, n_old, x_old);
1103
1104 Ifile << "mesh= " << mesh << '\n';
1105
1106 //#else
1107 //Ifile<<"amesh:"<<'\n';
1108 //long n;
1109 //indn.n+=2;
1110 //for( n=0; n<q; n++)
1111 //{
1112 //Ifile<<"n="<<n<<" amesh[n]="<<noindent<<amesh[n]<<yesindent<<'\n';
1113 //}
1114 //file<<yesindent;
1115 //indn.n-=2;
1116 //#endif
1117 indn.n -= 2;
1118}
indentation indn
Definition: prstream.cpp:13
#define Ifile
Definition: prstream.h:207

Referenced by operator<<(), and VirtCopiedPointCoorMesh< T >::print().


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