OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
ListElem.h
Go to the documentation of this file.
1 #ifndef LISTEELEM
2 #define LISTEELEM
3 
4 /*
5 Andreas Adelmann & Arno Candel
6 Paul Scherrer Institut PSI
7 
8 $Header: /afs/psi.ch/user/a/adelmann/public/cvsroot/ChargedParticles/ListElem.h,v 1.4 2001/08/16 15:22:35 arno Exp $
9 $Id: ListElem.h,v 1.4 2001/08/16 15:22:35 arno Exp $
10 $Locker: $
11 
12 $Revision: 1.4 $
13 $State: Exp $
14 $Date: 2001/08/16 15:22:35 $
15 
16 $Log: ListElem.h,v $
17 Revision 1.4 2001/08/16 15:22:35 arno
18 added ouput of Planar Projections, thus new ListElem needed, with 2 indices
19 
20 Revision 1.3 2001/08/14 08:30:35 candel
21 List output only from 1 to N-1, assures centered R plots
22 
23 Revision 1.2 2001/08/11 05:46:40 adelmann
24 Add header with CVS tags
25 
26 add << operator
27 
28 
29 */
30 
31 #include <list>
32 #include <string>
33 #include <fstream>
34 
35 class ListElem {
36 public:
37  ListElem(double sval, double tval, unsigned int mval, unsigned int nval, double denval) :
38  s(sval),
39  t(tval),
40  m(mval),
41  n(nval),
42  den(denval)
43  {}
44 
46  {}
47 
48 
49  bool operator< (const ListElem &elem) const {
50  return ((m < elem.m) && (n <= elem.n));
51  }
52 
53  void print(Inform os, const std::list<ListElem> &l) {
54  unsigned int mmax = 0;
55  unsigned int nmax = 0;
56  for(std::list<ListElem>::const_iterator it = l.begin(); it != l.end() ; ++it) {
57  if(it->m > mmax) mmax = it->m;
58  if(it->n > nmax) nmax = it->n;
59  }
60 
61  for(std::list<ListElem>::const_iterator it = l.begin(); it != l.end(); ++it)
62  if((it->m < mmax) && (it->n < nmax)) {
63  os << it->s << " " << it->t << " " << it->m << " " << it->n << " " << it->den << endl;
64  }
65  }
66 
67  double s;
68  double t;
69  unsigned int m, n;
70  double den;
71 };
72 /*
73 ofstream& operator<<(ofstream& os, const list<ListElem> &l)
74 {
75  unsigned int mmax=0;
76  unsigned int nmax=0;
77  for(list<ListElem>::const_iterator it=l.begin(); it!=l.end() ;++it) {
78  if (it->m > mmax) mmax=it->m;
79  if (it->n > nmax) nmax=it->n;
80  }
81 
82  for(list<ListElem>::const_iterator it=l.begin();it!=l.end();++it)
83  if ((it->m < mmax)&&(it->n < nmax)) {
84  os << it->s << " " << it->t << " " << it->m << " " << it->n << " " << it->den << endl;
85  }
86  return os;
87 }
88 */
89 #endif
~ListElem()
Definition: ListElem.h:45
double den
Definition: ListElem.h:70
ListElem(double sval, double tval, unsigned int mval, unsigned int nval, double denval)
Definition: ListElem.h:37
unsigned int n
Definition: ListElem.h:69
bool operator<(const ListElem &elem) const
Definition: ListElem.h:49
unsigned int m
Definition: ListElem.h:69
void print(Inform os, const std::list< ListElem > &l)
Definition: ListElem.h:53
double s
Definition: ListElem.h:67
Definition: Inform.h:41
double t
Definition: ListElem.h:68
Inform & endl(Inform &inf)
Definition: Inform.cpp:42