/********************************************************
 *  ██████╗  ██████╗████████╗██╗
 * ██╔════╝ ██╔════╝╚══██╔══╝██║
 * ██║  ███╗██║        ██║   ██║
 * ██║   ██║██║        ██║   ██║
 * ╚██████╔╝╚██████╗   ██║   ███████╗
 *  ╚═════╝  ╚═════╝   ╚═╝   ╚══════╝
 * Geophysical Computational Tools & Library (GCTL)
 *
 * Copyright (c) 2023  Yi Zhang (yizhang-geo@zju.edu.cn)
 *
 * GCTL is distributed under a dual licensing scheme. You can redistribute 
 * it and/or modify it under the terms of the GNU Lesser General Public 
 * License as published by the Free Software Foundation, either version 2 
 * of the License, or (at your option) any later version. You should have 
 * received a copy of the GNU Lesser General Public License along with this 
 * program. If not, see <http://www.gnu.org/licenses/>.
 * 
 * If the terms and conditions of the LGPL v.2. would prevent you from using 
 * the GCTL, please consider the option to obtain a commercial license for a 
 * fee. These licenses are offered by the GCTL's original author. As a rule, 
 * licenses are provided "as-is", unlimited in time for a one time fee. Please 
 * send corresponding requests to: yizhang-geo@zju.edu.cn. Please do not forget 
 * to include some description of your company and the realm of its activities. 
 * Also add information on how to contact you by electronic and paper mail.
 ******************************************************/

#ifndef _GCTL_REGULAR_MESH_SPH_3D_H
#define _GCTL_REGULAR_MESH_SPH_3D_H

#include "mesh.h"

namespace gctl
{
    class regular_mesh_sph_3d : public base_mesh
    {
    public:

        /**
         * 以下为mesh类型的虚函数实现
         */

        void load_gmsh(std::string filename, index_packed_e packed = Packed){}
		void save_gmsh(std::string filename, index_packed_e packed = Packed);

		void load_binary(std::string filename);
		void save_binary(std::string filename);

		void show_mesh_dimension(std::ostream &os) const;

        /**
         * 以下为regular_mesh_sph_3d的专有函数
         */
        regular_mesh_sph_3d();
        regular_mesh_sph_3d(std::string in_name, std::string in_info, double lon_min, double lat_min, 
            double rad_min, double lon_size, double lat_size, double rad_size, int lon_bnum, int lat_bnum, int rad_bnum);
        virtual ~regular_mesh_sph_3d();

        void init(std::string in_name, std::string in_info, double lon_min, double lat_min, double rad_min, 
            double lon_size, double lat_size, double rad_size, int lon_bnum, int lat_bnum, int rad_bnum);

        int get_lon_bnum() const;
        int get_lat_bnum() const;
        int get_rad_bnum() const;
        double get_lon_min() const;
        double get_lat_min() const;
        double get_rad_min() const;
        double get_lon_size() const;
        double get_lat_size() const;
        double get_rad_size() const;

    protected:
        int rm_lon_bnum, rm_lat_bnum, rm_rad_bnum;
        double rm_lon_min, rm_lat_min, rm_rad_min;
        double rm_lon_size, rm_lat_size, rm_rad_size;
        array<vertex3ds> nodes;
        array<tesseroid> elements;
    };
}

#endif // _GCTL_REGULAR_MESH_SPH_3D_H