-
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.
- Loading branch information
1 parent
94f52f2
commit a4b6065
Showing
12 changed files
with
125 additions
and
48 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
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,8 @@ | ||
/** | ||
* @brief Contains some common definition and typedefs | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "common/define.hpp" | ||
#include "common/utils.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "define.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* @brief Contains some common definition and typedefs | ||
*/ | ||
#pragma once | ||
|
||
#include <Eigen/Core> | ||
|
||
|
||
using Eigen::ArrayXd; | ||
using Eigen::ArrayXXd; |
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,15 @@ | ||
#include "utils.hpp" | ||
|
||
namespace Demeter { | ||
|
||
void CheckOpenMP() { | ||
#if defined(_OPENMP) | ||
unsigned num_threads = 0; | ||
#pragma omp parallel reduction(+ : num_threads) | ||
num_threads += 1; | ||
std::cerr << "OpenMP version " << _OPENMP << " number of threads " | ||
<< num_threads << '\n'; | ||
#endif | ||
} | ||
|
||
} // 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,16 @@ | ||
/** | ||
* @brief Contains some useful macros and typedefs | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <iostream> | ||
|
||
/// @brief Print the name and value of a variable | ||
#define PRINTER(x) #x << " = " << x | ||
|
||
namespace Demeter { | ||
|
||
void CheckOpenMP(); | ||
|
||
} // 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,5 @@ | ||
#include "cell.hpp" | ||
|
||
namespace Demeter { | ||
void Cell::check() const { assert(materials_.size() == radii_.size() + 1); } | ||
} // 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,43 @@ | ||
#pragma once | ||
|
||
#include <vector> | ||
#include <string> | ||
#include <string_view> | ||
#include <memory> | ||
#include <Eigen/Core> | ||
|
||
#include "demeter/common.hpp" | ||
#include "material.hpp" | ||
|
||
namespace Demeter { | ||
|
||
class Cell { | ||
public: | ||
Cell(double side, std::vector<std::shared_ptr<Material>>& materials, | ||
std::string_view name = "") | ||
: side(side), materials_(materials), name_(name) {} | ||
|
||
Cell(double side, std::vector<double>& radii, | ||
std::vector<std::shared_ptr<Material>>& materials, | ||
std::string_view name = "") | ||
: side(side), radii_(radii), materials_(materials), name_(name) { | ||
check(); | ||
} | ||
|
||
private: | ||
void check() const; | ||
|
||
private: | ||
double side; // we assume that every cell is a square | ||
|
||
std::vector<double> radii_; | ||
// size_t num_rings_; | ||
|
||
// size_t num_sectors_; //TODO | ||
|
||
std::vector<std::shared_ptr<Material>> materials_; | ||
|
||
/* A name for the Cell */ | ||
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
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