ViennaLS
Loading...
Searching...
No Matches
lsMaterialMap.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <set>
4#include <vector>
5
6namespace viennals {
7
9 std::vector<int> materialMap;
10 std::set<int> materials;
11
12public:
13 MaterialMap() = default;
15 MaterialMap(MaterialMap &&) = default;
16
17 void insertNextMaterial(const int passedMaterialId) {
18 materialMap.push_back(passedMaterialId);
19 materials.insert(passedMaterialId);
20 }
21
22 void setMaterialId(const std::size_t index, const int materialId) {
23 if (index >= materialMap.size()) {
24 materialMap.resize(index + 1);
25 }
26 materialMap[index] = materialId;
27 materials.insert(materialId);
28 }
29
30 std::size_t getNumberOfLayers() const { return materialMap.size(); }
31
32 std::size_t getNumberOfMaterials() const { return materials.size(); }
33
34 int getMaterialId(const std::size_t index) const {
35 if (index >= materialMap.size())
36 return -1;
37 return materialMap[index];
38 }
39};
40
41} // namespace viennals
Definition lsMaterialMap.hpp:8
std::size_t getNumberOfMaterials() const
Definition lsMaterialMap.hpp:32
std::size_t getNumberOfLayers() const
Definition lsMaterialMap.hpp:30
int getMaterialId(const std::size_t index) const
Definition lsMaterialMap.hpp:34
void insertNextMaterial(const int passedMaterialId)
Definition lsMaterialMap.hpp:17
MaterialMap(MaterialMap &)=default
void setMaterialId(const std::size_t index, const int materialId)
Definition lsMaterialMap.hpp:22
MaterialMap(MaterialMap &&)=default
Definition lsAdvect.hpp:46