basis for project to upload to server.
This commit is contained in:
6
.ipynb_checkpoints/Untitled-checkpoint.ipynb
Normal file
6
.ipynb_checkpoints/Untitled-checkpoint.ipynb
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"cells": [],
|
||||||
|
"metadata": {},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 5
|
||||||
|
}
|
||||||
0
.ipynb_checkpoints/main-checkpoint.jl
Normal file
0
.ipynb_checkpoints/main-checkpoint.jl
Normal file
45
MakeFile
Normal file
45
MakeFile
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
TARGET_EXEC := sim
|
||||||
|
|
||||||
|
BUILD_DIR := ./build
|
||||||
|
SRC_DIR := ./src
|
||||||
|
SHADER_DIR := ./shaders
|
||||||
|
|
||||||
|
# Find all the C and C++ files we want to compile
|
||||||
|
SRCS := $(shell find $(SRC_DIR) -name '*.cpp')
|
||||||
|
GLSLS := $(shell find $(SHADER_DIR) -name '*.glsl')
|
||||||
|
|
||||||
|
# Prepends BUILD_DIR and appends .o to every src file
|
||||||
|
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
|
||||||
|
SPIRVS := $(GLSLS:%.glsl=$(BUILD_DIR)/%.sphv)
|
||||||
|
|
||||||
|
# String substitution (suffix version without %).
|
||||||
|
DEPS := $(OBJS:.o=.d)
|
||||||
|
|
||||||
|
# Every folder in ./src will need to be passed to GCC so that it can find header files
|
||||||
|
INC_DIRS := $(shell find $(SRC_DIRS) -type d)
|
||||||
|
# Add a prefix to INC_DIRS. So moduleA would become -ImoduleA. GCC understands this -I flag
|
||||||
|
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
|
||||||
|
|
||||||
|
|
||||||
|
# The -MMD and -MP flags together generate Makefiles for us!
|
||||||
|
CPPFLAGS := $(INC_FLAGS) -MMD -MP
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# The final build step.
|
||||||
|
$(BUILD_DIR)/$(TARGET_EXEC): $(OBJS)
|
||||||
|
$(CXX) $(OBJS) -o $@ $(LDFLAGS)
|
||||||
|
|
||||||
|
# Build step for C++ source
|
||||||
|
$(BUILD_DIR)/%.cpp.o: %.cpp $(SPIRVS) .simdb
|
||||||
|
mkdir -p $(dir $@)
|
||||||
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $i@
|
||||||
|
|
||||||
|
#build the shaders
|
||||||
|
$(SPIRVS): $(GLSL)
|
||||||
|
mkdir -p $(dir $@)
|
||||||
|
glslc $(shaders).glsl $(shaders).spv
|
||||||
|
|
||||||
|
|
||||||
|
run: $(BUILD_DIR)/$(TARGET_EXEC)
|
||||||
|
./$(BUILD_DIR)/$(TARGET_EXEC)
|
||||||
72
Untitled.ipynb
Normal file
72
Untitled.ipynb
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 4,
|
||||||
|
"id": "f6e13c4a-8200-4c09-b402-025fae57236f",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"ename": "LoadError",
|
||||||
|
"evalue": "ArgumentError: Package FixedSizeArrays not found in current path.\n- Run `import Pkg; Pkg.add(\"FixedSizeArrays\")` to install the FixedSizeArrays package.",
|
||||||
|
"output_type": "error",
|
||||||
|
"traceback": [
|
||||||
|
"ArgumentError: Package FixedSizeArrays not found in current path.\n- Run `import Pkg; Pkg.add(\"FixedSizeArrays\")` to install the FixedSizeArrays package.",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"using FixedSizeArrays"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 3,
|
||||||
|
"id": "251cbbae-41f5-4ef9-b16b-4fd63a07a126",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"ename": "LoadError",
|
||||||
|
"evalue": "UndefVarError: `FixedSizeArray` not defined in `Main`\nSuggestion: check for spelling errors or missing imports.",
|
||||||
|
"output_type": "error",
|
||||||
|
"traceback": [
|
||||||
|
"UndefVarError: `FixedSizeArray` not defined in `Main`\nSuggestion: check for spelling errors or missing imports.",
|
||||||
|
"",
|
||||||
|
"Stacktrace:",
|
||||||
|
" [1] top-level scope",
|
||||||
|
" @ In[3]:1"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"struct Ground \n",
|
||||||
|
" nurtrient::FixedSizeArray{Float32}(undef, (1000, 1000, 50))\n",
|
||||||
|
"end "
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "83f4cd41-3b52-43ff-a536-3381d5fe1faa",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "Julia 1.11.3",
|
||||||
|
"language": "julia",
|
||||||
|
"name": "julia-1.11"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"file_extension": ".jl",
|
||||||
|
"mimetype": "application/julia",
|
||||||
|
"name": "julia",
|
||||||
|
"version": "1.11.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 5
|
||||||
|
}
|
||||||
42
datastructure.yaml
Normal file
42
datastructure.yaml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
weather:
|
||||||
|
rain mm
|
||||||
|
rain nutrients
|
||||||
|
rain ph value
|
||||||
|
temperature
|
||||||
|
wind
|
||||||
|
oxigen
|
||||||
|
CO2
|
||||||
|
humidity
|
||||||
|
ice
|
||||||
|
snow
|
||||||
|
|
||||||
|
locations:
|
||||||
|
-
|
||||||
|
plant:
|
||||||
|
growth: float
|
||||||
|
type: string
|
||||||
|
moister: % #hoeveelheid vocht de plant heeft(hoe dicht bij het is bij uitdrogen)
|
||||||
|
Nutrienten:
|
||||||
|
onkruid: %
|
||||||
|
|
||||||
|
|
||||||
|
distance to neighbours:
|
||||||
|
-
|
||||||
|
neighbourID:
|
||||||
|
distance: float #locations are static so only need to know the distance between the squares
|
||||||
|
layers:
|
||||||
|
-
|
||||||
|
Compaction
|
||||||
|
H2O/water
|
||||||
|
organic life
|
||||||
|
dead organic mattter
|
||||||
|
Kalk
|
||||||
|
Roots
|
||||||
|
stones
|
||||||
|
|
||||||
|
plantType:
|
||||||
|
-
|
||||||
|
type:
|
||||||
|
Moister release ratio
|
||||||
|
nurtrient absobertion capacity
|
||||||
|
GrowthShadowRatio
|
||||||
17
include/layers.hpp
Normal file
17
include/layers.hpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#ifndef LAYERS_H_
|
||||||
|
#define LAYERS_H_
|
||||||
|
|
||||||
|
struct Layer_s{
|
||||||
|
unsigned int size;
|
||||||
|
unsigned int* location_index;
|
||||||
|
float* compaction;
|
||||||
|
float* H2O;
|
||||||
|
float* Organic_life;
|
||||||
|
float* Organic_dead;
|
||||||
|
float* Lime;
|
||||||
|
float* Roots;
|
||||||
|
float* Stone_volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // LAYERS_H_
|
||||||
20
include/neighbours.hpp
Normal file
20
include/neighbours.hpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#ifndef NEIGHBOURS_H_
|
||||||
|
#define NEIGHBOURS_H_
|
||||||
|
|
||||||
|
template <int edge_ammount>
|
||||||
|
class Neighbours_s {
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned int size;
|
||||||
|
unsigned int[edge_ammount] location_index_A;
|
||||||
|
unsigned int[edge_ammount] location_index_B;
|
||||||
|
float[edge_ammount] distance;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct neighbourloop{
|
||||||
|
int[locations-1] till_next;
|
||||||
|
int[allNeighbours] distance;
|
||||||
|
int[allNeighbours] neighbour;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NEIGHBOURS_H_
|
||||||
19
include/plant_types.hpp
Normal file
19
include/plant_types.hpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef PLANT_TYPES_H_
|
||||||
|
#define PLANT_TYPES_H_
|
||||||
|
|
||||||
|
#include <sqlite3.h>
|
||||||
|
|
||||||
|
static class Plant_type_s{
|
||||||
|
public:
|
||||||
|
void LoadIn(sqlite3 *db);
|
||||||
|
private:
|
||||||
|
unsigned int size;
|
||||||
|
char** name;
|
||||||
|
float* Moister_release_ratio;
|
||||||
|
float* Nutrient_absorbtion_cap;
|
||||||
|
float* Growth_Shadow_ratio;
|
||||||
|
}plant_types;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // PLANT_TYPES_H_
|
||||||
14
include/plants.hpp
Normal file
14
include/plants.hpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef PLANTS_H_
|
||||||
|
#define PLANTS_H_
|
||||||
|
|
||||||
|
struct Plant_s{
|
||||||
|
unsigned int* location_index;
|
||||||
|
unsigned int* plant_type_index;
|
||||||
|
float* Growth;
|
||||||
|
float* Moister;
|
||||||
|
float* Nutrient;
|
||||||
|
float* Weeds;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // PLANTS_H_
|
||||||
20
include/weather.hpp
Normal file
20
include/weather.hpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#ifndef WEATHER_H_
|
||||||
|
#define WEATHER_H_
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
class Weather{
|
||||||
|
private:
|
||||||
|
float* rain;
|
||||||
|
float* rain_nutrient;
|
||||||
|
float* rain_ph;
|
||||||
|
float* temperature;
|
||||||
|
float* wind;
|
||||||
|
float* O2;
|
||||||
|
float* CO2;
|
||||||
|
float* H2O;
|
||||||
|
float* CH4;
|
||||||
|
float* N2;
|
||||||
|
float* airpressure;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // WEATHER_H_
|
||||||
26
main.cpp
Normal file
26
main.cpp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// opencl
|
||||||
|
#include <CL/cl.hpp>
|
||||||
|
// raylib
|
||||||
|
#include <raylib.h>
|
||||||
|
// sqllite
|
||||||
|
#include <sqlite3.h>
|
||||||
|
|
||||||
|
#include "include/layers.hpp"
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
// import data
|
||||||
|
sqlite3 *db;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// setup opencl pipeline
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// setup raylib env
|
||||||
|
|
||||||
|
|
||||||
|
//while loop
|
||||||
|
// raylib thread (60fps)
|
||||||
|
// opencl sim (every 15 seconds) swap data every 15 seconds
|
||||||
|
}
|
||||||
34
tables.db
Normal file
34
tables.db
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
-- weather definition
|
||||||
|
|
||||||
|
CREATE TABLE weather (
|
||||||
|
rain_mm NUMERIC NOT NULL,
|
||||||
|
"day" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||||
|
rain_nutrient NUMERIC NOT NULL,
|
||||||
|
rain_ph NUMERIC DEFAULT (random() % 1 + 7) NOT NULL,
|
||||||
|
temperature NUMERIC NOT NULL,
|
||||||
|
WindSpeed NUMERIC NOT NULL,
|
||||||
|
O2 NUMERIC DEFAULT (0.21) NOT NULL,
|
||||||
|
CO2 NUMERIC DEFAULT (0.001) NOT NULL,
|
||||||
|
Humidity NUMERIC DEFAULT (random() % 100) NOT NULL,
|
||||||
|
CH4 NUMERIC NOT NULL,
|
||||||
|
N2 NUMERIC DEFAULT (.78) NOT NULL,
|
||||||
|
AirPressure NUMERIC NOT NULL,
|
||||||
|
CONSTRAINT weather_pk PRIMARY KEY ("day")
|
||||||
|
);
|
||||||
|
-- Locations definition
|
||||||
|
|
||||||
|
CREATE TABLE Locations (
|
||||||
|
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||||
|
loc_x NUMERIC NOT NULL,
|
||||||
|
loc_y NUMERIC NOT NULL,
|
||||||
|
loc_z NUMERIC NOT NULL
|
||||||
|
);
|
||||||
|
-- Distance definition
|
||||||
|
|
||||||
|
CREATE TABLE Distance (
|
||||||
|
distance NUMERIC NOT NULL,
|
||||||
|
vecA INTEGER NOT NULL,
|
||||||
|
vecB INTEGER NOT NULL,
|
||||||
|
CONSTRAINT Distance_Locations_FK FOREIGN KEY (vecA) REFERENCES Locations(id),
|
||||||
|
CONSTRAINT Distance_Locations_FK_1 FOREIGN KEY (vecB) REFERENCES Locations(id)
|
||||||
|
);
|
||||||
1
tests/tests.cpp
Normal file
1
tests/tests.cpp
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "tests.h"
|
||||||
Reference in New Issue
Block a user