Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Commit

Permalink
Make linear systems not depend on nonlinear
Browse files Browse the repository at this point in the history
Make shared debugging routines static inline functions. This helps
compiling source FMUs that contain linear systems but no non-linear
systems.
  • Loading branch information
sjoelund authored and OpenModelica-Hudson committed Jan 18, 2017
1 parent 21f7de2 commit 733fc0a
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 35 deletions.
1 change: 1 addition & 0 deletions SimulationRuntime/c/simulation/solver/linearSystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "model_help.h"
#include "util/omc_error.h"
#include "util/rtclock.h"
#include "nonlinearSystem.h"
#include "linearSystem.h"
#include "linearSolverLapack.h"
#if !defined(OMC_MINIMAL_RUNTIME)
Expand Down
27 changes: 0 additions & 27 deletions SimulationRuntime/c/simulation/solver/nonlinearSolverHomotopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,33 +497,6 @@ void debugVectorInt(int logName, char* vectorName, modelica_boolean* vector, int
}


void debugString(int logName, char* message)
{
if(ACTIVE_STREAM(logName))
{
infoStreamPrint(logName, 1, "%s", message);
messageClose(logName);
}
}

void debugInt(int logName, char* message, int value)
{
if(ACTIVE_STREAM(logName))
{
infoStreamPrint(logName, 1, "%s %d", message, value);
messageClose(logName);
}
}

void debugDouble(int logName, char* message, double value)
{
if(ACTIVE_STREAM(logName))
{
infoStreamPrint(logName, 1, "%s %18.10e", message, value);
messageClose(logName);
}
}

/* Prototypes for linear algebra functions
* \author bbachmann
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,4 @@ int freeHomotopyData(void** data);

int solveHomotopy(DATA *data, threadData_t *threadData, int sysNumber);

void debugString(int logName, char* message);
void debugInt(int logName, char* message, int value);
void debugDouble(int logName, char* message, double value);

#endif
30 changes: 27 additions & 3 deletions SimulationRuntime/c/simulation/solver/nonlinearSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,33 @@ extern void debugMatrixPermutedDouble(int logName, char* matrixName, double* mat
extern void debugMatrixDouble(int logName, char* matrixName, double* matrix, int n, int m);
extern void debugVectorDouble(int logName, char* vectorName, double* vector, int n);
extern void debugVectorInt(int logName, char* vectorName, modelica_boolean* vector, int n);
extern void debugString(int logName, char* message);
extern void debugInt(int logName, char* message, int value);
extern void debugDouble(int logName, char* message, double value);

static inline void debugString(int logName, char* message)
{
if(ACTIVE_STREAM(logName))
{
infoStreamPrint(logName, 1, "%s", message);
messageClose(logName);
}
}

static inline void debugInt(int logName, char* message, int value)
{
if(ACTIVE_STREAM(logName))
{
infoStreamPrint(logName, 1, "%s %d", message, value);
messageClose(logName);
}
}

static inline void debugDouble(int logName, char* message, double value)
{
if(ACTIVE_STREAM(logName))
{
infoStreamPrint(logName, 1, "%s %18.10e", message, value);
messageClose(logName);
}
}

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ for flag in $TRY_FLAGS; do
AC_TRY_LINK([], [return 0;], [CFLAGS="$OLD_CFLAGS $flag"],[CFLAGS="$OLD_CFLAGS"])
done
OLD_CFLAGS="$CFLAGS"
for flag in -Wno-parentheses-equality -Wno-unused-variable; do
for flag in -Wno-parentheses-equality -Wno-unused-variable -Werror=implicit-function-declaration; do
CFLAGS="$RUNTIMECFLAGS $flag -Werror"
AC_TRY_LINK([], [return 0;], [EXTRA_CFLAGS_GENERATED_CODE="$EXTRA_CFLAGS_GENERATED_CODE $flag"],[])
done
Expand Down

0 comments on commit 733fc0a

Please sign in to comment.