Skip to content
Snippets Groups Projects
sfx_sheba.h 3.99 KiB
Newer Older
  • Learn to ignore specific revisions
  • 数学の武士's avatar
    数学の武士 committed
    #pragma once
    
    数学の武士's avatar
    数学の武士 committed
    #include "sfx_template_parameters.h"
    
    数学の武士's avatar
    数学の武士 committed
    #include "model_base.h"
    #include "sfx_data.h"
    
    数学の武士's avatar
    数学の武士 committed
    
    
    数学の武士's avatar
    数学の武士 committed
    template<typename T, MemType memIn, MemType memOut, MemType RunMem >
    
    数学の武士's avatar
    数学の武士 committed
    class FluxShebaBase : public ModelBase<T, memIn, memOut, RunMem>
    
    数学の武士's avatar
    数学の武士 committed
    {
    
    数学の武士's avatar
    数学の武士 committed
    public:
        using ModelBase<T, memIn, memOut, RunMem>::res_sfx;
        using ModelBase<T, memIn, memOut, RunMem>::sfx;
        using ModelBase<T, memIn, memOut, RunMem>::meteo;
        using ModelBase<T, memIn, memOut, RunMem>::grid_size;
        using ModelBase<T, memIn, memOut, RunMem>::ifAllocated;
        using ModelBase<T, memIn, memOut, RunMem>::allocated_size;
    
    数学の武士's avatar
    数学の武士 committed
    
    
    数学の武士's avatar
    数学の武士 committed
        sfx_surface_param surface_param;
        sfx_phys_constants phys_constants;
        sfx_sheba_param model_param;
        sfx_sheba_numericsTypeC numerics;
    
    数学の武士's avatar
    数学の武士 committed
    
    
    数学の武士's avatar
    数学の武士 committed
        FluxShebaBase(sfxDataVecTypeC* sfx,
                    meteoDataVecTypeC* meteo,
                    const sfx_sheba_param model_param, 
                    const sfx_surface_param surface_param,
                    const sfx_sheba_numericsTypeC numerics,
                    const sfx_phys_constants phys_constants,
                    const int grid_size);
        ~FluxShebaBase();
    };
    
    template<typename T, MemType memIn, MemType memOut, MemType RunMem >
    class FluxSheba : public FluxShebaBase<T, memIn, memOut, RunMem>
    {};
    
    数学の武士's avatar
    数学の武士 committed
    
    
    数学の武士's avatar
    数学の武士 committed
    template<typename T, MemType memIn, MemType memOut >
    class FluxSheba<T, memIn, memOut, MemType::CPU> : public FluxShebaBase<T, memIn, memOut, MemType::CPU>
    {
        using FluxShebaBase<T, memIn, memOut, MemType::CPU>::res_sfx;
        using FluxShebaBase<T, memIn, memOut, MemType::CPU>::sfx;
        using FluxShebaBase<T, memIn, memOut, MemType::CPU>::meteo;
        using FluxShebaBase<T, memIn, memOut, MemType::CPU>::surface_param;
        using FluxShebaBase<T, memIn, memOut, MemType::CPU>::phys_constants;
        using FluxShebaBase<T, memIn, memOut, MemType::CPU>::grid_size;
        using FluxShebaBase<T, memIn, memOut, MemType::CPU>::ifAllocated;
        using FluxShebaBase<T, memIn, memOut, MemType::CPU>::allocated_size;
        using FluxShebaBase<T, memIn, memOut, MemType::CPU>::model_param;
        using FluxShebaBase<T, memIn, memOut, MemType::CPU>::numerics;
    public:
        FluxSheba(sfxDataVecTypeC* sfx,
                    meteoDataVecTypeC* meteo,
                    const sfx_sheba_param model_param, 
                    const sfx_surface_param surface_param,
                    const sfx_sheba_numericsTypeC numerics,
                    const sfx_phys_constants phys_constants,
                    const int grid_size) : FluxShebaBase<T, memIn, memOut, MemType::CPU>(sfx, meteo, model_param, 
                                           surface_param, numerics, phys_constants, grid_size) {}
        ~FluxSheba() = default;
        void compute_flux();
    };
    
    数学の武士's avatar
    数学の武士 committed
    
    
    数学の武士's avatar
    数学の武士 committed
    #ifdef INCLUDE_CUDA
    template<typename T, MemType memIn, MemType memOut >
    class FluxSheba<T, memIn, memOut, MemType::GPU> : public FluxShebaBase<T, memIn, memOut, MemType::GPU>
    {
        using FluxShebaBase<T, memIn, memOut, MemType::GPU>::res_sfx;
        using FluxShebaBase<T, memIn, memOut, MemType::GPU>::sfx;
        using FluxShebaBase<T, memIn, memOut, MemType::GPU>::meteo;
        using FluxShebaBase<T, memIn, memOut, MemType::GPU>::surface_param;
        using FluxShebaBase<T, memIn, memOut, MemType::GPU>::phys_constants;
        using FluxShebaBase<T, memIn, memOut, MemType::GPU>::grid_size;
        using FluxShebaBase<T, memIn, memOut, MemType::GPU>::ifAllocated;
        using FluxShebaBase<T, memIn, memOut, MemType::GPU>::allocated_size;
        using FluxShebaBase<T, memIn, memOut, MemType::GPU>::model_param;
        using FluxShebaBase<T, memIn, memOut, MemType::GPU>::numerics;
    public:
        FluxSheba(sfxDataVecTypeC* sfx,
                    meteoDataVecTypeC* meteo,
                    const sfx_sheba_param model_param, 
                    const sfx_surface_param surface_param,
                    const sfx_sheba_numericsTypeC numerics,
                    const sfx_phys_constants phys_constants,
                    const int grid_size) : FluxShebaBase<T, memIn, memOut, MemType::GPU>(sfx, meteo, model_param, 
                                           surface_param, numerics, phys_constants, grid_size) {}
        ~FluxSheba() = default;
        void compute_flux();
    };
    #endif