-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Lattice class for assemblies and core
- Loading branch information
1 parent
0e80e49
commit cb0cf10
Showing
7 changed files
with
74 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#pragma once | ||
|
||
#include "model/cell.hpp" | ||
#include "model/material.hpp" | ||
#include "model/material.hpp" | ||
#include "model/lattice.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include "lattice.hpp" | ||
|
||
namespace Demeter { | ||
std::string Lattice::print() const { | ||
std::string s = "Lattice:\n"; | ||
for (const auto& c : cells_) { | ||
s += c.get().print(false); | ||
} | ||
return s; | ||
} | ||
|
||
} // namespace Demeter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* @file lattice.hpp | ||
* @author Kenneth Assogba | ||
* @brief Lattice class | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <vector> | ||
#include <initializer_list> | ||
#include <iostream> | ||
|
||
#include "demeter/model/cell.hpp" | ||
|
||
namespace Demeter { | ||
|
||
class Lattice { | ||
public: | ||
Lattice(std::vector<std::reference_wrapper<Cell>>& cells, | ||
std::string name = "") | ||
: cells_(cells), name_(name) {} | ||
Lattice(std::initializer_list<std::reference_wrapper<Cell>>& cells, | ||
std::string name = "") | ||
: cells_(cells), name_(name) {} | ||
|
||
std::vector<std::reference_wrapper<Cell>>& cells() { return cells_; } | ||
const std::vector<std::reference_wrapper<Cell>>& cells() const { | ||
return cells_; | ||
} | ||
|
||
friend std::ostream& operator<<(std::ostream& os, const Lattice& l) { | ||
return os << l.print(); | ||
} | ||
std::string print() const; | ||
|
||
private: | ||
std::vector<std::reference_wrapper<Cell>> cells_; | ||
|
||
std::string name_; | ||
}; | ||
|
||
} // namespace Demeter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters