Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:18:31

0001 /*******************************************************************************
0002  * Copyright (c) 2018-2019 LongGang Pang, lgpang@qq.com
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and/or associated documentation files (the
0006  * "Materials"), to deal in the Materials without restriction, including
0007  * without limitation the rights to use, copy, modify, merge, publish,
0008  * distribute, sublicense, and/or sell copies of the Materials, and to
0009  * permit persons to whom the Materials are furnished to do so, subject to
0010  * the following conditions:
0011  *
0012  * The above copyright notice and this permission notice shall be included
0013  * in all copies or substantial portions of the Materials.
0014  *
0015  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0016  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0017  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
0018  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
0019  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
0020  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
0021  * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
0022  ******************************************************************************/
0023 
0024 
0025 #ifndef __CL_BULKINFO__
0026 #define __CL_BULKINFO__
0027 /*!< Use cpp exceptionn to handel errors */
0028 #define __CL_ENABLE_EXCEPTIONS 
0029 // System includes
0030 //#include <CL/cl.hpp>
0031 #include <cstdlib>
0032 #include <cstdio>
0033 #include <string>
0034 #include <vector>
0035 #include <cmath>
0036 #include <iostream>
0037 #include <fstream>
0038 #include <sstream>
0039 #include <cassert>
0040 #include <ctime>
0041 #include <algorithm>
0042 #include <map>
0043 
0044 #include <random>
0045 
0046 #include "Config.h"
0047 #include "opencl_backend.h"
0048 
0049 namespace clvisc {
0050 
0051 /*! \class Output module to save bulkinfo
0052  *  */
0053 class BulkInfo
0054 {
0055     private:
0056     int nx_, ny_, neta_;
0057     int nx_skip_;
0058     int ny_skip_;
0059     int neta_skip_;
0060     OpenclBackend backend_;
0061     std::string compile_option_;
0062 
0063     cl::Kernel kernel_bulk3d_;
0064     // store the medium information of whole evolution
0065     std::vector<float> bulk_data_;
0066     std::vector<std::string> data_info_;
0067     // collect 3-dimensional bulk info for 1 step
0068     cl::Buffer d_bulk3d_1step_;
0069     std::vector<float> h_bulk3d_1step_;
0070     // num of cells to output along each dimension
0071     int nx_out_;
0072     int ny_out_;
0073     int neta_out_;
0074 
0075     public:
0076     // using sparse lattice in the output to save memory
0077     BulkInfo(int nx, int ny, int nz,
0078            int nx_skip, int ny_skip, int neta_skip,
0079            const OpenclBackend & backend, 
0080            const std::string & compile_option);
0081 
0082     void add_data(const cl::Buffer & d_ev, 
0083                   const cl::Buffer & d_shear_pi,
0084                   const cl::Buffer & d_bulk_pi,
0085                   const cl::Image2D & eos_table);
0086 
0087     void save(const std::string & fpath);
0088 
0089     const std::vector<float> & get_data();
0090 
0091     const std::vector<std::string> & get_data_info();
0092 };
0093 
0094 } // end namespace clvisc
0095 
0096 #endif 
0097 
0098 
0099 /*! \mainpage 
0100  *  \section  */
0101 
0102 /*! 
0103  *  \example 
0104 *
0105  *  \code
0106  *
0107  *
0108 
0109 
0110  * \endcode
0111 */
0112 
0113