.. _program_listing_file_src_hall_symbol.hpp: Program Listing for File hall_symbol.hpp ======================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/hall_symbol.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* This file is part of brille. Copyright © 2020 Greg Tucker brille is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. brille is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with brille. If not, see . */ #ifndef BRILLE_HALL_SYMBOL_HPP_ #define BRILLE_HALL_SYMBOL_HPP_ #include #include #include #include #include #include "bravais.hpp" #include "symmetry.hpp" // for class Symmetry #include "pointsymmetry.hpp" // and PointSymmetry namespace brille { // template using Matrix = std::array; // template using Vector = std::array; // template using Matrices = std::vector>; // template using Vectors = std::vector>; class SeitzSymbol { int N; std::string T; std::string A; public: explicit SeitzSymbol(const int n=0, const std::string& t="", const std::string& a=""): N{n}, T{t}, A{a} {}; SeitzSymbol(const int n, const std::string& t, const char a): N{n}, T{t} {A=a;}; int set_order(const int n){ N = n; return N; } int get_order() const {return N;} std::string set_tran(const std::string& t){ T = t; return T; } std::string set_axis(const std::string& a){ A = a; return A; } std::string add_tran(const char& t){ T += t; return T; } std::string add_axis(const char& a){ A += a; return A; } std::string get_tran() const { return T; } std::string get_axis() const { return A; } std::string to_ascii() const; bool validate(); Matrix getr() const; Matrix getr(const SeitzSymbol& pre) const; Vector gett() const; Vector gett(const SeitzSymbol& pre) const; char implicit_axis() const { return A.size() ? A[0] : 'z'; } char implicit_axis(const SeitzSymbol& pre) const { char a = '!'; if (A.size()){ a = A[0]; } else { int tn = std::abs(this->N); int pn = std::abs(pre.get_order()); if (2 == tn){ if (2 == pn || 4 == pn) a = 'x'; if (3 == pn || 6 == pn) a = '?'; } if (3 == tn) a = '*'; } return a; } protected: Matrix inner_getr(const char, const char) const; Vector inner_gett(int, char, char) const; }; class HallSymbol { Bravais L; bool centrosymmetric; std::vector symbols; Motion V; // change of basis '4×4' matrix public: explicit HallSymbol(const Bravais b, const bool c, const std::vector& ss): L{b}, centrosymmetric{c}, symbols{ss} {}; explicit HallSymbol(const Bravais b=Bravais::_, const bool c=false): L{b}, centrosymmetric{c} {}; HallSymbol(const std::string& strrep){ this->from_ascii(strrep); }; Bravais getl() const { return L; } Bravais setl(const Bravais& b){ L = b; return L; } Bravais setl(const char b, const bool c){ switch (b) { case 'P': L = Bravais::P; break; case 'A': L = Bravais::A; break; case 'B': L = Bravais::B; break; case 'C': L = Bravais::C; break; case 'I': L = Bravais::I; break; case 'R': L = Bravais::R; break; case 'F': L = Bravais::F; break; default: L = Bravais::_; } centrosymmetric = c; return L; } bool setcs(const bool& cs){ centrosymmetric = cs; return centrosymmetric; } std::vector setsymbols(const std::vector& s){ symbols = s; return symbols; } std::vector addsymbol(SeitzSymbol s){ symbols.push_back(s); return symbols; } bool from_ascii(const std::string&); std::string to_ascii() const; bool validate(); Symmetry get_generators() const; }; } // namespace brille #endif