1 #ifndef PYNE_MATERIAL_LIBRARY 2 #define PYNE_MATERIAL_LIBRARY 8 #include <unordered_map> 11 #if !defined(JSON_IS_AMALGAMATION) 12 #define JSON_IS_AMALGAMATION 15 #ifndef PYNE_IS_AMALGAMATED 21 typedef std::shared_ptr<pyne::Material> shr_mat_ptr;
22 typedef std::unordered_map<std::string, shr_mat_ptr> mat_map;
23 typedef std::set<std::string> matname_set;
24 typedef std::set<int> nuc_set;
48 void from_hdf5(
const std::string& filename,
const std::string& datapath);
53 void from_json(
const std::string& filename);
54 void load_json(Json::Value json);
55 Json::Value dump_json();
56 void write_json(
const std::string& filename);
70 const std::string& datapath =
"/materials",
71 bool h5_overwrite =
false)
const;
151 typedef mat_map::const_iterator const_iterator;
152 iterator begin() {
return material_library.begin(); }
153 iterator end() {
return material_library.end(); }
155 const_iterator cbegin()
const {
return material_library.cbegin(); }
156 const_iterator cend()
const {
return material_library.cend(); }
157 std::size_t size()
const {
return material_library.size(); }
158 bool emtpy()
const {
return material_library.empty(); }
159 std::size_t count(std::string mat_name)
const {
160 return material_library.count(mat_name);
162 std::shared_ptr<Material>& operator[](
const std::string& k) {
163 return material_library[k];
165 std::shared_ptr<Material>& operator[](std::string&& k) {
166 return material_library[k];
181 int get_length_of_table(hid_t db,
const std::string& datapath)
const;
188 mat_map material_library;
192 #endif // PYNE_MATERIAL_LIBRARY int ensure_material_number(pyne::Material &mat) const
Return a material material number, ensure it exist as an int, if it exist as a string convert it into...
Definition: material_library.cpp:136
void add_material(pyne::Material mat)
Add a material to the library.
Definition: material_library.cpp:186
Material composed of nuclides.
Definition: material.h:71
pyne::mat_map get_mat_library() const
Get the material library itself.
Definition: material_library.h:135
void from_hdf5(const std::string &filename, const std::string &datapath)
loads the pyne materials in map of name vs Material
Definition: material_library.cpp:32
mat_map::iterator iterator
Definition: material_library.h:150
pyne::matname_set get_keylist() const
Get the list of materials in the Library.
Definition: material_library.h:140
pyne::shr_mat_ptr get_material_ptr(const std::string &mat_name) const
Get a material of the Library by name.
Definition: material_library.cpp:216
std::string ensure_material_name_and_number(pyne::Material &mat) const
Return a material material number, ensure it exist if it does not exist build it using the material n...
Definition: material_library.cpp:166
void del_material(const std::string &mat_name)
remove a material of the Library by name
Definition: material_library.cpp:206
pyne::nuc_set get_nuclist() const
Get the list of nuclides in the Library.
Definition: material_library.h:145
pyne::Material get_material(const std::string &mat_name) const
remove a material of the Library by name
Definition: material_library.cpp:211
void write_hdf5_nucpath(hid_t db, std::string nucpath) const
Writes this nucpath to an HDF5 file. This happens according to protocol 1.
Definition: material_library.cpp:300
void from_json(const std::string &filename)
loads the pyne materials in map of name vs Material /
Definition: material_library.cpp:112
void write_hdf5(const std::string &filename, const std::string &datapath="/materials", bool h5_overwrite=false) const
Writes MaterialLibrary out to an HDF5 file. This happens according to protocol 1. Writting in a file ...
Definition: material_library.cpp:226
void merge(const pyne::MaterialLibrary &mat_lib)
Merge a material library into the current one.
Definition: material_library.cpp:80
A container representing enrichment cascades.
Definition: _atomic_data.h:16
Definition: material_library.h:26