PSkel
src/PSkelArgs.h
00001 //-------------------------------------------------------------------------------
00002 // Copyright (c) 2015, ICEI - PUC Minas
00003 // All rights reserved.
00004 // 
00005 // Redistribution and use in source and binary forms, with or without
00006 // modification, are permitted provided that the following conditions are met:
00007 // 
00008 // 1. Redistributions of source code must retain the above copyright notice, this
00009 // list of conditions and the following disclaimer.
00010 // 
00011 // 2. Redistributions in binary form must reproduce the above copyright notice,
00012 // this list of conditions and the following disclaimer in the documentation
00013 // and/or other materials provided with the distribution.
00014 // 
00015 // 3. Neither the name of the copyright holder nor the names of its contributors
00016 // may be used to endorse or promote products derived from this software without
00017 // specific prior written permission.
00018 // 
00019 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00020 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00021 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00022 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00023 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00024 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00025 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00026 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00027 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00028 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 //-------------------------------------------------------------------------------
00030 
00031 
00032 #ifndef PSKEL_ARGS_H
00033 #define PSKEL_ARGS_H
00034 
00035 namespace PSkel{
00036 
00037 //*******************************************************************************************
00038 // ARGS
00039 //*******************************************************************************************
00040 
00041 template<typename T>
00042 class Args{
00043 public:
00044         T *hostArray, *deviceArray;
00045         int width;
00046         
00047         Args();
00048         
00049         /*
00050         __stencil__ ~Args(){
00051                 gpuErrchk( cudaFreeHost(hostArray));
00052         }
00053         */
00054         
00055         Args(int _width);
00056         
00057         __device__ __host__ int getWidth() const;
00058         
00059         __device__ __host__ T & operator()(int x) const;
00060 };
00061 
00062 //*******************************************************************************************
00063 // ARGS2D
00064 //*******************************************************************************************
00065 
00066 template<typename T>
00067 class Args2D{
00068 public:
00069         T *hostArray, *deviceArray;
00070         int width,height;
00071         
00072         Args2D();
00073         
00074         /*
00075         __stencil__ ~Args(){
00076                 gpuErrchk( cudaFreeHost(hostArray));
00077         }
00078         */
00079         
00080         Args2D(int _width,int _height);
00081         
00082         __device__ __host__ int getWidth() const;
00083         
00084         __device__ __host__ int getHeight() const;
00085         
00086         __device__ __host__ T & operator()(int x,int y) const;
00087 };
00088 
00089 //*******************************************************************************************
00090 // ARGS3D
00091 //*******************************************************************************************
00092 
00093 template<typename T>
00094 class Args3D{
00095 public:
00096         T *hostArray, *deviceArray;
00097         int width,height,depth;
00098         
00099         Args3D();
00100         
00101         /*
00102         __stencil__ ~Args(){
00103                 gpuErrchk( cudaFreeHost(hostArray));
00104         }
00105         */
00106         
00107         Args3D(int _width, int _height, int _depth);
00108         
00109         __device__ __host__ int getWidth() const;
00110         
00111         __device__ __host__ int getHeight() const;
00112         
00113         __device__ __host__ int getDepth() const;       
00114         
00115         __device__ __host__ T & operator()(int x,int y,int z) const;
00116 };
00117 
00118 }//end namespace
00119 
00120 #include "PSkelArgs.hpp"
00121 
00122 #endif
 All Classes Files Functions