Skip to content

Commit

Permalink
Merge branch 'hotfix' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
GPMueller committed Jul 4, 2019
2 parents 246b7d6 + 59075d6 commit 005e14e
Show file tree
Hide file tree
Showing 97 changed files with 45,246 additions and 1,016 deletions.
2 changes: 1 addition & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ set(META_AUTHOR_MAINTAINER "Gideon Mueller")
set(META_AUTHOR_EMAIL "[email protected]")
set(META_VERSION_MAJOR "2")
set(META_VERSION_MINOR "0")
set(META_VERSION_PATCH "0")
set(META_VERSION_PATCH "1")
set(META_VERSION "${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH}")
set(META_VERSION_REVISION "${GIT_REV}")
### Compiler
Expand Down
3 changes: 0 additions & 3 deletions core/include/engine/Vectormath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,9 +553,6 @@ namespace Engine
// Get the norm of a vectorfield
void norm( const vectorfield & vf, scalarfield & norm );

// Pair of Minimum and Maximum of any component of any vector of a vectorfield
std::pair<scalar, scalar> minmax_component(const vectorfield & v1);

// Maximum absolute component of a vectorfield
scalar max_abs_component(const vectorfield & vf);

Expand Down
10 changes: 5 additions & 5 deletions core/python/spirit/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,21 @@ def set_output_to_console(p_state, output, level):
_Set_Output_To_File = _spirit.Log_Set_Output_To_File
_Set_Output_To_File.argtypes = [ctypes.c_void_p, ctypes.c_bool, ctypes.c_int]
_Set_Output_To_File.restype = None
def set_outputToFile(p_state, output, level):
def set_output_to_file(p_state, output, level):
"""Set whether the Log is output to a file and the level up to which messages are logged."""
_Set_Output_To_File(ctypes.c_void_p(p_state), ctypes.c_bool(output), ctypes.c_int(level))

_Get_Output_To_Console = _spirit.Log_Get_Output_To_Console
_Get_Output_To_Console.argtypes = [ctypes.c_void_p]
_Get_Output_To_Console.restype = ctypes.c_bool
def GetOutputToConsole(p_state):
def get_output_to_console(p_state):
"""Returns a bool indicating whether the Log is output to the console."""
return bool(_Get_Output_To_Console(ctypes.c_void_p(p_state)))

_Get_Output_Console_Level = _spirit.Log_Get_Output_Console_Level
_Get_Output_Console_Level.argtypes = [ctypes.c_void_p]
_Get_Output_Console_Level.restype = ctypes.c_int
def GetOutputConsoleLevel(p_state):
def get_output_console_level(p_state):
"""Returns the level up to which the Log is output to the console.
The return value will be one of the integers defined above.
Expand All @@ -123,14 +123,14 @@ def GetOutputConsoleLevel(p_state):
_Get_Output_To_File = _spirit.Log_Get_Output_To_File
_Get_Output_To_File.argtypes = [ctypes.c_void_p]
_Get_Output_To_File.restype = ctypes.c_bool
def GetOutputToFile(p_state):
def get_output_to_file(p_state):
"""Returns a bool indicating whether the Log is output to a file."""
return bool(_Get_Output_To_File(ctypes.c_void_p(p_state)))

_Get_Output_File_Level = _spirit.Log_Get_Output_File_Level
_Get_Output_File_Level.argtypes = [ctypes.c_void_p]
_Get_Output_File_Level.restype = ctypes.c_int
def GetOutputFileLevel(p_state):
def get_output_file_level(p_state):
"""Returns the level up to which the Log is output to a file.
The return value will be one of the integers defined above.
Expand Down
254 changes: 126 additions & 128 deletions core/src/Spirit/Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,202 +6,200 @@
#include <string>

void Log_Send( State *state, Spirit_Log_Level level, Spirit_Log_Sender sender, const char * message, int idx_image, int idx_chain ) noexcept
try
{
try
{
Log( static_cast<Utility::Log_Level>(level), static_cast<Utility::Log_Sender>(sender),
std::string(message), idx_image, idx_chain );
}
catch( ... )
{
spirit_handle_exception_api(idx_image, idx_chain);
}
Log( static_cast<Utility::Log_Level>(level), static_cast<Utility::Log_Sender>(sender),
std::string(message), idx_image, idx_chain );
}
catch( ... )
{
spirit_handle_exception_api(idx_image, idx_chain);
}

std::vector<Utility::LogEntry> Log_Get_Entries(State *state) noexcept
try
{
try
{
// Get all entries
return Log.GetEntries();
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);

Utility::LogEntry Error = { std::chrono::system_clock::now(),
Utility::Log_Sender::API, Utility::Log_Level::Error,
"GetEntries() failed", -1, -1 };
std::vector<Utility::LogEntry> ret = { Error };
return ret;
}
// Get all entries
return Log.GetEntries();
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);

Utility::LogEntry Error = { std::chrono::system_clock::now(),
Utility::Log_Sender::API, Utility::Log_Level::Error,
"GetEntries() failed", -1, -1 };
std::vector<Utility::LogEntry> ret = { Error };
return ret;
}

void Log_Append(State *state) noexcept
try
{
try
{
Log.Append_to_File();
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
}
Log.Append_to_File();
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
}

void Log_Dump(State *state) noexcept
try
{
Log.Dump_to_File();
}
catch( ... )
{
try
{
Log.Dump_to_File();
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
}
spirit_handle_exception_api(-1, -1);
}

int Log_Get_N_Entries(State *state) noexcept
try
{
return Log.n_entries;
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
return 0;
}

int Log_Get_N_Errors(State *state) noexcept
try
{
return Log.n_errors;
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
return 0;
}

int Log_Get_N_Warnings(State *state) noexcept
try
{
return Log.n_warnings;
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
return 0;
}

// Set Log parameters
void Log_Set_Output_File_Tag(State *state, const char * tag) noexcept
try
{
std::string file_tag = tag;
Log.file_tag = file_tag;

if( file_tag == std::string("<time>") )
Log.fileName = "Log_" + Utility::Timing::CurrentDateTime() + ".txt";
else if( file_tag == std::string("") )
Log.fileName = "Log.txt";
else
Log.fileName = "Log_" + file_tag + ".txt";
}
catch( ... )
{
try
{
Log.file_tag = tag;
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
}
spirit_handle_exception_api(-1, -1);
}

void Log_Set_Output_Folder(State *state, const char * folder) noexcept
try
{
try
{
Log.output_folder = folder;
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
}
Log.output_folder = folder;
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
}

void Log_Set_Output_To_Console(State *state, bool output, int level) noexcept
try
{
try
{
Log.messages_to_console = output;
Log.level_console = Utility::Log_Level(level);
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
}
Log.messages_to_console = output;
Log.level_console = Utility::Log_Level(level);
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
}

void Log_Set_Output_To_File(State *state, bool output, int level) noexcept
try
{
try
{
Log.messages_to_file = output;
Log.level_file = Utility::Log_Level(level);
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
}
Log.messages_to_file = output;
Log.level_file = Utility::Log_Level(level);
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
}

// Get Log parameters
const char * Log_Get_Output_File_Tag(State *state) noexcept
try
{
return Log.file_tag.c_str();
}
catch( ... )
{
try
{
return Log.file_tag.c_str();
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
return "";
}
spirit_handle_exception_api(-1, -1);
return "";
}

const char * Log_Get_Output_Folder(State *state) noexcept
try
{
return Log.output_folder.c_str();
}
catch( ... )
{
try
{
return Log.output_folder.c_str();
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
return "";
}
spirit_handle_exception_api(-1, -1);
return "";
}

bool Log_Get_Output_To_Console(State *state) noexcept
try
{
return Log.messages_to_console;
}
catch( ... )
{
try
{
return Log.messages_to_console;
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
return false;
}
spirit_handle_exception_api(-1, -1);
return false;
}

int Log_Get_Output_Console_Level(State *state) noexcept
try
{
return (int)Log.level_console;
}
catch( ... )
{
try
{
return (int)Log.level_console;
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
return 0;
}
spirit_handle_exception_api(-1, -1);
return 0;
}

bool Log_Get_Output_To_File(State *state) noexcept
try
{
try
{
return Log.messages_to_file;
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
return false;
}
return Log.messages_to_file;
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
return false;
}

int Log_Get_Output_File_Level(State *state) noexcept
try
{
return (int)Log.level_file;
}
catch( ... )
{
try
{
return (int)Log.level_file;
}
catch( ... )
{
spirit_handle_exception_api(-1, -1);
return 0;
}
spirit_handle_exception_api(-1, -1);
return 0;
}
Loading

0 comments on commit 005e14e

Please sign in to comment.