CHROMA
t_circular_buffer.cc
Go to the documentation of this file.
1 #include "chroma.h"
2 
3 using namespace Chroma;
4 
5 int main(int argc, char *argv[])
6 {
7  Chroma::initialize(&argc, &argv);
8 
10 
11 
12  for(int i=0; i < 10; i++) {
13  c.push(i);
14 
15  QDPIO::cout << "Getting at elements: " << std::endl;
16  QDPIO::cout << "Size is " << c.size() << std::endl;
17  QDPIO::cout << "contents: " ;
18  for(int j=0; j < c.size(); j++) {
19  int ith_elem;
20  c.get(j, ith_elem);
21  QDPIO::cout << " " << ith_elem;
22  }
23  QDPIO::cout << std::endl;
24  }
25 
26 
27  // Nuke buffer
28  c.reset();
29 
30  try {
31  int foo;
32  c.get(0,foo);
33  }
35  QDPIO::cout << "Caught deliberate exception: " << e.error_string << std::endl;
36  QDPIO::cout << "Index requested : " << e.i << std::endl;
37  QDPIO::cout << "Buffer size :" << e.size << std::endl;
38  }
39 
40 
41  for(int i=11; i < 20; i++) {
42  c.push(i);
43 
44  QDPIO::cout << "Getting at elements: " << std::endl;
45  QDPIO::cout << "Size is " << c.size() << std::endl;
46  QDPIO::cout << "contents: " ;
47  for(int j=0; j < c.size(); j++) {
48  int ith_elem;
49  c.get(j, ith_elem);
50  QDPIO::cout << " " << ith_elem;
51  }
52  QDPIO::cout << std::endl;
53  }
54 
55  try {
56  int foo;
57  c.get(7, foo);
58  }
60  QDPIO::cout << "Caught deliberate exception: " << e.error_string << std::endl;
61  QDPIO::cout << "Index requested : " << e.i << std::endl;
62  QDPIO::cout << "Buffer size :" << e.size << std::endl;
63  }
64 
65 
67  exit(0);
68 }
Primary include file for CHROMA in application codes.
Circular Buffer.
unsigned j
Definition: ldumul_w.cc:35
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
Double c
Definition: invbicg.cc:108
int i
Definition: pbg5p_w.cc:55
void initialize(int *argc, char ***argv)
Chroma initialisation routine.
Definition: chroma_init.cc:114
void finalize(void)
Chroma finalization routine.
Definition: chroma_init.cc:308
int main(int argc, char *argv[])