Skip to content
Snippets Groups Projects
sfx_esm.h 3.75 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 FluxEsmBase : 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;
        sfx_phys_constants phys;
        sfx_esm_param_C model;
        sfx_esm_numericsType_C numerics;
    
    数学の武士's avatar
    数学の武士 committed
    
    
    数学の武士's avatar
    数学の武士 committed
        FluxEsmBase(sfxDataVecTypeC* sfx,
                    meteoDataVecTypeC* meteo,
    
    数学の武士's avatar
    数学の武士 committed
                    const sfx_esm_param_C model, 
                    const sfx_surface_param surface,
                    const sfx_esm_numericsType_C numerics,
                    const sfx_phys_constants phys,
    
    数学の武士's avatar
    数学の武士 committed
                    const int grid_size);
        ~FluxEsmBase();
    };
    
    数学の武士's avatar
    数学の武士 committed
    
    
    数学の武士's avatar
    数学の武士 committed
    template<typename T, MemType memIn, MemType memOut, MemType RunMem >
    class FluxEsm : public FluxEsmBase<T, memIn, memOut, RunMem>
    {};
    
    template<typename T, MemType memIn, MemType memOut >
    class FluxEsm<T, memIn, memOut, MemType::CPU> : public FluxEsmBase<T, memIn, memOut, MemType::CPU>
    {
        using FluxEsmBase<T, memIn, memOut, MemType::CPU>::res_sfx;
        using FluxEsmBase<T, memIn, memOut, MemType::CPU>::sfx;
        using FluxEsmBase<T, memIn, memOut, MemType::CPU>::meteo;
    
    数学の武士's avatar
    数学の武士 committed
        using FluxEsmBase<T, memIn, memOut, MemType::CPU>::surface;
        using FluxEsmBase<T, memIn, memOut, MemType::CPU>::phys;
    
    数学の武士's avatar
    数学の武士 committed
        using FluxEsmBase<T, memIn, memOut, MemType::CPU>::grid_size;
        using FluxEsmBase<T, memIn, memOut, MemType::CPU>::ifAllocated;
        using FluxEsmBase<T, memIn, memOut, MemType::CPU>::allocated_size;
    
    数学の武士's avatar
    数学の武士 committed
        using FluxEsmBase<T, memIn, memOut, MemType::CPU>::model;
    
    数学の武士's avatar
    数学の武士 committed
        using FluxEsmBase<T, memIn, memOut, MemType::CPU>::numerics;
    
    数学の武士's avatar
    数学の武士 committed
    public:
    
    数学の武士's avatar
    数学の武士 committed
        FluxEsm(sfxDataVecTypeC* sfx,
                    meteoDataVecTypeC* meteo,
    
    数学の武士's avatar
    数学の武士 committed
                    const sfx_esm_param_C model, 
                    const sfx_surface_param surface,
                    const sfx_esm_numericsType_C numerics,
                    const sfx_phys_constants phys,
                    const int grid_size) : FluxEsmBase<T, memIn, memOut, MemType::CPU>(sfx, meteo, model, 
                                           surface, numerics, phys, grid_size) {}
    
    数学の武士's avatar
    数学の武士 committed
        ~FluxEsm() = default;
        void compute_flux();
    };
    
    数学の武士's avatar
    数学の武士 committed
    
    
    数学の武士's avatar
    数学の武士 committed
    #ifdef INCLUDE_CUDA
    template<typename T, MemType memIn, MemType memOut >
    class FluxEsm<T, memIn, memOut, MemType::GPU> : public FluxEsmBase<T, memIn, memOut, MemType::GPU>
    {
        using FluxEsmBase<T, memIn, memOut, MemType::GPU>::res_sfx;
        using FluxEsmBase<T, memIn, memOut, MemType::GPU>::sfx;
        using FluxEsmBase<T, memIn, memOut, MemType::GPU>::meteo;
    
    数学の武士's avatar
    数学の武士 committed
        using FluxEsmBase<T, memIn, memOut, MemType::GPU>::surface;
        using FluxEsmBase<T, memIn, memOut, MemType::GPU>::phys;
    
    数学の武士's avatar
    数学の武士 committed
        using FluxEsmBase<T, memIn, memOut, MemType::GPU>::grid_size;
        using FluxEsmBase<T, memIn, memOut, MemType::GPU>::ifAllocated;
        using FluxEsmBase<T, memIn, memOut, MemType::GPU>::allocated_size;
    
    数学の武士's avatar
    数学の武士 committed
        using FluxEsmBase<T, memIn, memOut, MemType::GPU>::model;
    
    数学の武士's avatar
    数学の武士 committed
        using FluxEsmBase<T, memIn, memOut, MemType::GPU>::numerics;
    
    数学の武士's avatar
    数学の武士 committed
    public:
    
    数学の武士's avatar
    数学の武士 committed
        FluxEsm(sfxDataVecTypeC* sfx,
                    meteoDataVecTypeC* meteo,
    
    数学の武士's avatar
    数学の武士 committed
                    const sfx_esm_param_C model, 
                    const sfx_surface_param surface,
                    const sfx_esm_numericsType_C numerics,
                    const sfx_phys_constants phys,
                    const int grid_size) : FluxEsmBase<T, memIn, memOut, MemType::GPU>(sfx, meteo, model, 
                                           surface, numerics, phys, grid_size) {}
    
    数学の武士's avatar
    数学の武士 committed
        ~FluxEsm() = default;
        void compute_flux();
    };
    #endif