Skip to content

Commit

Permalink
added script to build all cpp sims. Dropped photon count across the b…
Browse files Browse the repository at this point in the history
…oard in the sims for shorter example run times
  • Loading branch information
jmeneghini committed Jan 20, 2024
1 parent 718d7c5 commit f28c42d
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 10 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ target_include_directories(MIDSX PUBLIC
add_git_submodule(${CMAKE_CURRENT_LIST_DIR}/extern/eigen)
target_link_libraries(MIDSX PUBLIC Eigen3::Eigen)



# Specify the Python interpreter
find_package(Python3 COMPONENTS Interpreter Development)
if(Python3_FOUND)
Expand Down Expand Up @@ -74,6 +72,8 @@ configure_file(
@ONLY
)



# Installation and export
install(TARGETS MIDSX
EXPORT MIDSXTargets
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ COPY . .
# Build and install MIDSX
RUN mkdir build && cd build && cmake .. && make install

# Build the cpp_sims
RUN ./../scripts/build_cpp_sims.sh




7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ To install with the command line:
sudo make install
```

4. To build all the cpp_simulations (not required) assuming you are still in the build directory:
```sh
./../utility_scripts/build_cpp_sims.sh
```

### Installation (Docker)

MIDSX can be built and run in a Docker container. This is currently the only way to build on MacOS. \
Expand All @@ -81,7 +86,7 @@ Then, to run the container with an interactive shell:
```sh
docker run -it jmeneghini/midsx:latest
```
The container will have already installed MIDSX and its dependencies, so you can start using it right away.
The container will have already installed/compiled MIDSX, its dependencies, and the cpp_simulations, so you can start using it right away.

## Documentation
The [documentation](https://jmeneghini.github.io/MIDSX/) for MIDSX is generated via Doxygen and is hosted with Github Pages. \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ int main() {

PhotonSource source = initializeSource();

const int NUM_OF_PHOTONS = 100000000;
const int NUM_OF_PHOTONS = 1000000;

std::cout << std::fixed << std::setprecision(15);

Expand Down
2 changes: 1 addition & 1 deletion cpp_simulations/half_value_layer/hvl_100kVp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int main() {

PhotonSource source = initializeSource();

int N_PHOTONS = 100000000;
int N_PHOTONS = 1000000;
runSimulation(source, physics_engine, initializeSurfaceTallies, [](){return std::vector<std::unique_ptr<VolumeTally>>();}, N_PHOTONS);

auto surface_tally_results = physics_engine.getSurfaceQuantityContainers();
Expand Down
2 changes: 1 addition & 1 deletion cpp_simulations/half_value_layer/hvl_100keV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int main() {

PhotonSource source = initializeSource();

int N_PHOTONS = 100000000;
int N_PHOTONS = 1000000;
runSimulation(source, physics_engine, initializeSurfaceTallies, [](){return std::vector<std::unique_ptr<VolumeTally>>();}, N_PHOTONS);

auto surface_tally_results = physics_engine.getSurfaceQuantityContainers();
Expand Down
2 changes: 1 addition & 1 deletion cpp_simulations/half_value_layer/hvl_30kVp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int main() {

PhotonSource source = initializeSource();

int N_PHOTONS = 100000000;
int N_PHOTONS = 1000000;
runSimulation(source, physics_engine, initializeSurfaceTallies, [](){return std::vector<std::unique_ptr<VolumeTally>>();}, N_PHOTONS);

auto surface_tally_results = physics_engine.getSurfaceQuantityContainers();
Expand Down
2 changes: 1 addition & 1 deletion cpp_simulations/half_value_layer/hvl_30keV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int main() {

PhotonSource source = initializeSource();

int N_PHOTONS = 10000000;
int N_PHOTONS = 1000000;
double run_time;
runSimulation(source, physics_engine, initializeSurfaceTallies, [](){return std::vector<std::unique_ptr<VolumeTally>>();}, N_PHOTONS, run_time);

Expand Down
2 changes: 1 addition & 1 deletion cpp_simulations/radiography/radiography.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ int main() {

PhotonSource source = initializeSource();

const int NUM_OF_PHOTONS = 10000000;
const int NUM_OF_PHOTONS = 1000000;

std::cout << std::fixed << std::setprecision(15);

Expand Down
2 changes: 1 addition & 1 deletion cpp_simulations/radiography/radiography_15_degrees.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ int main() {

PhotonSource source = initializeSource();

const int NUM_OF_PHOTONS = 100000000;
const int NUM_OF_PHOTONS = 1000000;

std::cout << std::fixed << std::setprecision(15);

Expand Down
26 changes: 26 additions & 0 deletions utility_scripts/build_cpp_sims.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# This script builds the C++ simulation executables for the project.

# Set the path to the directory containing the source files.
CPP_SIMS_DIR=./cpp_simulations

# Get dir of this script.
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

cd "${SCRIPT_DIR}"
cd .. # Go up to the project root directory.
pwd || echo

for sim_dir in "${CPP_SIMS_DIR}/"*; do
# Get the name of the simulation.
sim_name=$(basename "$sim_dir")

# Build the simulation.
echo "Building $sim_name..."
mkdir "${sim_dir}/build"
cd "${sim_dir}/build"
cmake ..
make
cd -
done

0 comments on commit f28c42d

Please sign in to comment.