/**
 * @brief Datatypes and functions for the builder module
 *
 * @author: Junyi Wang (jywang)
 *
 * @copyright Copyright (c) 2024, TBPLaS develop team.
 */

#ifndef TBPLAS_BUILDER_BASE_H
#define TBPLAS_BUILDER_BASE_H

#include <tuple>

#include <eigen3/Eigen/Dense>

#include "base/datatypes.h"

namespace tbplas::builder {

// Datatype aliases
using cell_index_t = int32_t;
using orbital_index_t = uint64_t;
using rn_t = std::tuple<cell_index_t, cell_index_t, cell_index_t>;
using pair_t = std::tuple<orbital_index_t, orbital_index_t>;
using complex_t = base::complex_t;

/**
 * @brief Convert cell index to vector
 *
 * @tparam scalar_t datatype of components of cell index
 * @param[in] rn cell index to convert
 * @return vector converted from cell index
 */
template <typename scalar_t>
Eigen::Vector3d rn2vec(const std::tuple<scalar_t, scalar_t, scalar_t>& rn)
{
    return Eigen::Vector3d(static_cast<double>(std::get<0>(rn)),
        static_cast<double>(std::get<1>(rn)),
        static_cast<double>(std::get<2>(rn)));
}

} // namespace tbplas::builder
#endif // TBPLAS_BUILDER_BASE_H