Skip to content

Commit

Permalink
Rearranged code in src across subdirectories
Browse files Browse the repository at this point in the history
New includes appearance (with paths) may help when working on #4 and/or #13
  • Loading branch information
kolayne committed Oct 24, 2020
1 parent 688150d commit e381bc9
Show file tree
Hide file tree
Showing 22 changed files with 44 additions and 42 deletions.
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@ set(CMAKE_CXX_COMPILER g++)
set(CMAKE_CXX_STANDARD 14)


set(SOURCES src/simulation_logic.cu src/random_generator.cu src/SimulationMap.cu src/Polyhedron.cu src/Particle.cu
src/MapNode.cu src/SpacePoint.cu src/Face.cu src/visualization_integration.cu)
set(SOURCES src/main_logic/simulation_logic.cu src/external/random_generator.cu src/simulation_objects/SimulationMap.cu
src/simulation_objects/geometric/Polyhedron.cu src/simulation_objects/Particle.cu
src/simulation_objects/MapNode.cu src/simulation_objects/geometric/SpacePoint.cu
src/simulation_objects/geometric/Face.cu src/external/visualization_integration.cu)

option(COMPILE_FOR_CPU "Make produced executable run on CPU instead of GPU" OFF)

if(COMPILE_FOR_CPU)
list(APPEND SOURCES src/main.cpp)
list(APPEND SOURCES src/main_logic/main.cpp)

set_source_files_properties(${SOURCES} PROPERTIES LANGUAGE CXX)
add_definitions(-x c++)
add_definitions(-DCOMPILE_FOR_CPU -D__host__= -D__device__= -D__global__=)
else()
list(APPEND SOURCES src/main.cu)
list(APPEND SOURCES src/main_logic/main.cu)
endif()

add_executable(minds_crawl ${SOURCES})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ std::uniform_real_distribution<double> distribution(0., 1.);


#include "curand_kernel.h"
#include "common.cuh"
#include "../common.cuh"

#include "random_generator.cuh"

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <string>

#include "visualization_integration.cuh"
#include "Particle.cuh"
#include "../simulation_objects/Particle.cuh"


__host__ std::string get_visualization_endpoint()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#define MINDS_CRAWL_VISUALIZATION_INTEGRATION_CUH


#include "../lib/HTTPRequest/include/HTTPRequest.hpp"
#include "../../lib/HTTPRequest/include/HTTPRequest.hpp"

#include "MapNode.cuh"
#include "../simulation_objects/MapNode.cuh"
#include <string>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

#include <cstdio>

#include "SimulationMap.cuh"
#include "Polyhedron.cuh"
#include "MapNode.cuh"
#include "Particle.cuh"
#include "../simulation_objects/SimulationMap.cuh"
#include "../simulation_objects/geometric/Polyhedron.cuh"
#include "../simulation_objects/MapNode.cuh"
#include "../simulation_objects/Particle.cuh"
#include "simulation_logic.cuh"
#include "random_generator.cuh"
#include "jones_constants.hpp"
#include "common.cuh"
#include "../external/random_generator.cuh"
#include "../jones_constants.hpp"
#include "../common.cuh"

namespace jc = jones_constants;

Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp → src/main_logic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "simulation_logic.cuh"
#include "iterations_wrapper.cuh"
#include "visualization_integration.cuh"
#include "../external/visualization_integration.cuh"


void wrapped_run_iteration_project_nutrients(SimulationMap *const simulation_map, const int *const iteration_number)
Expand Down
4 changes: 2 additions & 2 deletions src/main.cu → src/main_logic/main.cu
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include "simulation_logic.cuh"
#include "iterations_wrapper.cuh"
#include "visualization_integration.cuh"
#include "random_generator.cuh"
#include "../external/visualization_integration.cuh"
#include "../external/random_generator.cuh"


const int cuda_block_size = 256;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#include <cstdio>

#include "simulation_logic.cuh"
#include "random_generator.cuh"
#include "Particle.cuh"
#include "jones_constants.hpp"
#include "../external/random_generator.cuh"
#include "../simulation_objects/Particle.cuh"
#include "../jones_constants.hpp"

namespace jc = jones_constants;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#define MINDS_CRAWL_SIMULATION_LOGIC_CUH


#include "MapNode.cuh"
#include "SimulationMap.cuh"
#include "common.cuh"
#include "../simulation_objects/MapNode.cuh"
#include "../simulation_objects/SimulationMap.cuh"
#include "../common.cuh"


/**
Expand Down
2 changes: 1 addition & 1 deletion src/MapNode.cu → src/simulation_objects/MapNode.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "MapNode.cuh"
#include "Particle.cuh"
#include "Polyhedron.cuh"
#include "geometric/Polyhedron.cuh"


__host__ __device__ MapNode::MapNode(Polyhedron *polyhedron, Face *polyhedron_face, SpacePoint coordinates) :
Expand Down
6 changes: 3 additions & 3 deletions src/MapNode.cuh → src/simulation_objects/MapNode.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#define MINDS_CRAWL_MAPNODE_CUH


#include "common.cuh"
#include "SpacePoint.cuh"
#include "Face.cuh"
#include "../common.cuh"
#include "geometric/SpacePoint.cuh"
#include "geometric/Face.cuh"

class Particle;

Expand Down
4 changes: 2 additions & 2 deletions src/Particle.cu → src/simulation_objects/Particle.cu
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "Particle.cuh"
#include "MapNode.cuh"
#include "random_generator.cuh"
#include "jones_constants.hpp"
#include "../external/random_generator.cuh"
#include "../jones_constants.hpp"

namespace jc = jones_constants;

Expand Down
6 changes: 3 additions & 3 deletions src/Particle.cuh → src/simulation_objects/Particle.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#define MINDS_CRAWL_PARTICLE_CUH


#include "Face.cuh"
#include "Polyhedron.cuh"
#include "SpacePoint.cuh"
#include "geometric/Face.cuh"
#include "geometric/Polyhedron.cuh"
#include "geometric/SpacePoint.cuh"

class MapNode;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
#include <utility>

#include "SimulationMap.cuh"
#include "Polyhedron.cuh"
#include "Face.cuh"
#include "jones_constants.hpp"
#include "random_generator.cuh"
#include "geometric/Polyhedron.cuh"
#include "geometric/Face.cuh"
#include "../jones_constants.hpp"
#include "../external/random_generator.cuh"


typedef bool(MapNode::*SetNodeMethod)(MapNode *);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@


#include "MapNode.cuh"
#include "simulation_logic.cuh"
#include "common.cuh"
#include "../main_logic/simulation_logic.cuh"
#include "../common.cuh"


/// Object describing a simulation's map
Expand Down
4 changes: 2 additions & 2 deletions src/Face.cu → src/simulation_objects/geometric/Face.cu
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include <utility>

#include "Face.cuh"
#include "MapNode.cuh"
#include "../MapNode.cuh"
#include "Polyhedron.cuh"
#include "common.cuh"
#include "../../common.cuh"


__host__ __device__ SpacePoint calculate_normal(const SpacePoint *vertices)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <utility>

#include "Polyhedron.cuh"
#include "common.cuh"
#include "../../common.cuh"


__host__ __device__ Polyhedron::Polyhedron(Face *faces, int n_of_faces) :
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit e381bc9

Please sign in to comment.