Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
bulkinfo.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file bulkinfo.h
1 /*******************************************************************************
2  * Copyright (c) 2018-2019 LongGang Pang, lgpang@qq.com
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and/or associated documentation files (the
6  * "Materials"), to deal in the Materials without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Materials, and to
9  * permit persons to whom the Materials are furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included
13  * in all copies or substantial portions of the Materials.
14  *
15  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21  * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
22  ******************************************************************************/
23 
24 
25 #ifndef __CL_BULKINFO__
26 #define __CL_BULKINFO__
27 
28 #define __CL_ENABLE_EXCEPTIONS
29 // System includes
30 //#include <CL/cl.hpp>
31 #include <cstdlib>
32 #include <cstdio>
33 #include <string>
34 #include <vector>
35 #include <cmath>
36 #include <iostream>
37 #include <fstream>
38 #include <sstream>
39 #include <cassert>
40 #include <ctime>
41 #include <algorithm>
42 #include <map>
43 
44 #include <random>
45 
46 #include "Config.h"
47 #include "opencl_backend.h"
48 
49 namespace clvisc {
50 
53 class BulkInfo
54 {
55  private:
56  int nx_, ny_, neta_;
57  int nx_skip_;
58  int ny_skip_;
62 
64  // store the medium information of whole evolution
65  std::vector<float> bulk_data_;
66  std::vector<std::string> data_info_;
67  // collect 3-dimensional bulk info for 1 step
69  std::vector<float> h_bulk3d_1step_;
70  // num of cells to output along each dimension
71  int nx_out_;
72  int ny_out_;
73  int neta_out_;
74 
75  public:
76  // using sparse lattice in the output to save memory
77  BulkInfo(int nx, int ny, int nz,
78  int nx_skip, int ny_skip, int neta_skip,
79  const OpenclBackend & backend,
80  const std::string & compile_option);
81 
82  void add_data(const cl::Buffer & d_ev,
83  const cl::Buffer & d_shear_pi,
84  const cl::Buffer & d_bulk_pi,
85  const cl::Image2D & eos_table);
86 
87  void save(const std::string & fpath);
88 
89  const std::vector<float> & get_data();
90 
91  const std::vector<std::string> & get_data_info();
92 };
93 
94 } // end namespace clvisc
95 
96 #endif
97 
98