Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
chrxh committed Sep 23, 2023
2 parents e7b87b3 + f82fdb1 commit 28bf0ac
Show file tree
Hide file tree
Showing 38 changed files with 580 additions and 217 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Further information and artwork:
An Nvidia graphics card with compute capability 6.0 or higher is needed. Please check [https://en.wikipedia.org/wiki/CUDA#GPUs_supported](https://en.wikipedia.org/wiki/CUDA#GPUs_supported).

# 💽 Installer
Installer for Windows: [alien-installer.msi](https://alien-project.org/media/files/alien-installer.msi) (Updated: 2023-09-14)
Installer for Windows: [alien-installer.msi](https://alien-project.org/media/files/alien-installer.msi) (Updated: 2023-09-21)

In the case that the program crashes for an unknown reason, please refer to the troubleshooting section in [alien-project.org/downloads.html](https://alien-project.org/downloads.html).

Expand Down
10 changes: 10 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Release notes

## [4.3.0] - 2023-09-23
### Added
- gui/browser: tab widget added to show the uploaded genomes and simulations from server
- gui/browser: possibility to upload and download genomes
- gui/genome editor: toolbar button added to upload current genome
- cli: file logger added (creates log.txt)

### Fixed
- gui/browser: layout problem for multiline descriptions

## [4.2.0] - 2023-09-21
### Added
- command-line interface for running simulation files for a specified number of time steps
Expand Down
10 changes: 10 additions & 0 deletions imgui.ini
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ Pos=733,403
Size=400,218
Collapsed=0

[Window][Upload genome]
Pos=733,403
Size=400,218
Collapsed=0

[Window][Shader parameters]
Pos=207,336
Size=302,127
Expand All @@ -308,6 +313,11 @@ Pos=345,242
Size=1100,632
Collapsed=0

[Window][Delete user]
Pos=623,480
Size=501,168
Collapsed=0

[Table][0xFB3C2B09,3]
RefScale=13
Column 0 Sort=0v
Expand Down
2 changes: 2 additions & 0 deletions source/Base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ add_library(alien_base_lib
Definitions.cpp
Definitions.h
Exceptions.h
FileLogger.cpp
FileLogger.h
GlobalSettings.cpp
GlobalSettings.h
Hashes.h
Expand Down
3 changes: 3 additions & 0 deletions source/Base/Definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ using std::int64_t;
using std::uint32_t;
using std::uint64_t;

class _FileLogger;
using FileLogger = std::shared_ptr<_FileLogger>;

constexpr float NEAR_ZERO = 1.0e-4f;

template <typename T>
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion source/Base/Resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Const
{
std::string const ProgramVersion = "4.2.0";
std::string const ProgramVersion = "4.3.0";

std::string const BasePath = "resources/";

Expand Down
3 changes: 3 additions & 0 deletions source/Cli/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "Base/LoggingService.h"
#include "Base/Resources.h"
#include "Base/StringHelper.h"
#include "Base/FileLogger.h"
#include "EngineImpl/SimulationControllerImpl.h"
#include "EngineInterface/Serializer.h"

Expand Down Expand Up @@ -91,6 +92,8 @@ namespace
int main(int argc, char** argv)
{
try {
FileLogger fileLogger = std::make_shared<_FileLogger>();

CLI::App app{"Command-line interface for ALIEN v" + Const::ProgramVersion};

//parse command line arguments
Expand Down
75 changes: 67 additions & 8 deletions source/EngineInterface/Serializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,9 @@ bool Serializer::serializeGenomeToFile(std::string const& filename, std::vector<
try {
//wrap constructor cell around genome
ClusteredDataDescription data;
data.addCluster(ClusterDescription().addCell(CellDescription().setCellFunction(ConstructorDescription().setGenome(genome))));
if (!wrapGenome(data, genome)) {
return false;
}

zstr::ofstream stream(filename, std::ios::binary);
if (!stream) {
Expand All @@ -781,24 +783,57 @@ bool Serializer::serializeGenomeToFile(std::string const& filename, std::vector<
bool Serializer::deserializeGenomeFromFile(std::vector<uint8_t>& genome, std::string const& filename)
{
try {
//constructor cell is wrapped around genome
ClusteredDataDescription data;
if (!deserializeDataDescription(data, filename)) {
return false;
}
if (data.clusters.size() != 1) {
if (!unwrapGenome(genome, data)) {
return false;
}
return true;
} catch (...) {
return false;
}
}

bool Serializer::serializeGenomeToString(std::string& output, std::vector<uint8_t> const& input)
{
try {
std::stringstream stdStream;
zstr::ostream stream(stdStream, std::ios::binary);
if (!stream) {
return false;
}
auto cluster = data.clusters.front();
if (cluster.cells.size() != 1) {

ClusteredDataDescription data;
if (!wrapGenome(data, input)) {
return false;
}
auto cell = cluster.cells.front();
if (cell.getCellFunctionType() != CellFunction_Constructor) {

serializeDataDescription(data, stream);
stream.flush();
output = stdStream.str();
return true;
} catch (...) {
return false;
}
}

bool Serializer::deserializeGenomeFromString(std::vector<uint8_t>& output, std::string const& input)
{
try {
std::stringstream stdStream(input);
zstr::istream stream(stdStream, std::ios::binary);
if (!stream) {
return false;
}
genome = std::get<ConstructorDescription>(*cell.cellFunction).genome;

ClusteredDataDescription data;
deserializeDataDescription(data, stream);

if (!unwrapGenome(output, data)) {
return false;
}
return true;
} catch (...) {
return false;
Expand Down Expand Up @@ -918,3 +953,27 @@ void Serializer::deserializeSimulationParameters(SimulationParameters& parameter
parameters = AuxiliaryDataParser::decodeSimulationParameters(tree);
}

bool Serializer::wrapGenome(ClusteredDataDescription& output, std::vector<uint8_t> const& input)
{
output.clear();
output.addCluster(ClusterDescription().addCell(CellDescription().setCellFunction(ConstructorDescription().setGenome(input))));
return true;
}


bool Serializer::unwrapGenome(std::vector<uint8_t>& output, ClusteredDataDescription const& input)
{
if (input.clusters.size() != 1) {
return false;
}
auto cluster = input.clusters.front();
if (cluster.cells.size() != 1) {
return false;
}
auto cell = cluster.cells.front();
if (cell.getCellFunctionType() != CellFunction_Constructor) {
return false;
}
output = std::get<ConstructorDescription>(*cell.cellFunction).genome;
return true;
}
6 changes: 6 additions & 0 deletions source/EngineInterface/Serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class Serializer
static bool serializeGenomeToFile(std::string const& filename, std::vector<uint8_t> const& genome);
static bool deserializeGenomeFromFile(std::vector<uint8_t>& genome, std::string const& filename);

static bool serializeGenomeToString(std::string& output, std::vector<uint8_t> const& input);
static bool deserializeGenomeFromString(std::vector<uint8_t>& output, std::string const& input);

static bool serializeSimulationParametersToFile(std::string const& filename, SimulationParameters const& parameters);
static bool deserializeSimulationParametersFromFile(SimulationParameters& parameters, std::string const& filename);

Expand All @@ -46,4 +49,7 @@ class Serializer

static void serializeSimulationParameters(SimulationParameters const& parameters, std::ostream& stream);
static void deserializeSimulationParameters(SimulationParameters& parameters, std::istream& stream);

static bool wrapGenome(ClusteredDataDescription& output, std::vector<uint8_t> const& input);
static bool unwrapGenome(std::vector<uint8_t>& output, ClusteredDataDescription const& input);
};
Loading

0 comments on commit 28bf0ac

Please sign in to comment.