SERiF 0.0.1a
3+1D Stellar Structure and Evolution
Loading...
Searching...
No Matches
EOSio.h
Go to the documentation of this file.
1/* ***********************************************************************
2//
3// Copyright (C) 2025 -- The 4D-STAR Collaboration
4// File Author: Emily Boudreaux
5// Last Modified: March 20, 2025
6//
7// 4DSSE is free software; you can use it and/or modify
8// it under the terms and restrictions the GNU General Library Public
9// License version 3 (GPLv3) as published by the Free Software Foundation.
10//
11// 4DSSE is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14// See the GNU Library General Public License for more details.
15//
16// You should have received a copy of the GNU Library General Public License
17// along with this software; if not, write to the Free Software
18// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19//
20// *********************************************************************** */
21#pragma once
22#include <string>
23#include <variant>
24#include <memory>
25#include <unordered_map>
26#include "helm.h"
27
28namespace serif::eos {
29 enum EOSFormat {
31 };
32
33 static inline std::unordered_map<EOSFormat, std::string> FormatStringLookup = {
34 {HELM, "Helmholtz"}
35 };
36 // EOS table format includes
37
38 using EOSTable = std::variant<std::unique_ptr<serif::eos::helmholtz::HELMTable>>;
39
57 class EOSio {
58 private:
59 std::string m_filename;
60 bool m_loaded = false;
63
67 void load();
68
72 void loadHelm();
73 public:
79 explicit EOSio(const std::string &filename, EOSFormat format = EOSFormat::HELM);
80
85 EOSio(const EOSio& other);
86
90 ~EOSio() = default;
91
96 [[nodiscard]] std::string getFormatName() const;
97
98 [[nodiscard]] EOSFormat getFormat() const;
99
104 [[nodiscard]] EOSTable& getTable();
105
106 [[nodiscard]] std::string getFilename() const { return m_filename; }
107
108 bool isLoaded() const { return m_loaded; }
109 };
110}
111
std::string m_filename
The filename of the EOS table.
Definition EOSio.h:59
void loadHelm()
Loads the HELM format EOS table.
Definition EOSio.cpp:61
void load()
Loads the EOS table from the file.
Definition EOSio.cpp:55
EOSTable m_table
The EOS table data.
Definition EOSio.h:62
bool m_loaded
Flag indicating if the table is loaded.
Definition EOSio.h:60
~EOSio()=default
Default destructor.
EOSio(const std::string &filename, EOSFormat format=EOSFormat::HELM)
Constructs an EosIO object with the given filename.
Definition EOSio.cpp:31
std::string getFormatName() const
Gets the format name (as a string) of the EOS table.
Definition EOSio.cpp:46
EOSFormat m_format
Definition EOSio.h:61
bool isLoaded() const
Definition EOSio.h:108
EOSFormat getFormat() const
Definition EOSio.cpp:41
EOSTable & getTable()
Gets the EOS table.
Definition EOSio.cpp:51
std::string getFilename() const
Definition EOSio.h:106
@ HELM
Helmholtz EOS format.
Definition EOSio.h:30
std::variant< std::unique_ptr< serif::eos::helmholtz::HELMTable > > EOSTable
Definition EOSio.h:38
static std::unordered_map< EOSFormat, std::string > FormatStringLookup
Definition EOSio.h:33