Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into lochel/qss
Browse files Browse the repository at this point in the history
  • Loading branch information
lochel committed May 7, 2015
2 parents 14e08b2 + fa70703 commit ff2cc7c
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 46 deletions.
6 changes: 3 additions & 3 deletions Compiler/BackEnd/BackendDAEOptimize.mo
Expand Up @@ -983,7 +983,6 @@ algorithm
(syst,m,mT) = BackendDAEUtil.getIncidenceMatrixfromOption(syst,BackendDAE.NORMAL(),SOME(funcs));
// check equations
(m_1,(mT_1,_,_,changed)) = traverseIncidenceMatrix(m,removeEqualFunctionCallFinder,(mT,vars,eqns,{}));
_ = not listEmpty(changed);
// update arrayeqns and algorithms, collect info for wrappers
syst = BackendDAE.EQSYSTEM(vars,eqns,SOME(m_1),SOME(mT_1),BackendDAE.NO_MATCHING(),stateSets,partitionKind);
syst = BackendDAEUtil.updateIncidenceMatrix(syst,BackendDAE.NORMAL(),NONE(),changed);
Expand Down Expand Up @@ -4129,7 +4128,7 @@ ToDo: remove me
input BackendDAE.BackendDAE inDAE;
output BackendDAE.BackendDAE outDAE;
algorithm
outDAE := if Flags.getConfigBool(Flags.SYM_EULER) then symEulerWork(inDAE, false) else inDAE;
outDAE := if Flags.getConfigBool(Flags.SYM_EULER) then symEulerWork(BackendDAEUtil.copyBackendDAE(inDAE), false) else inDAE;

end symEulerInit;

Expand All @@ -4149,7 +4148,7 @@ algorithm
// make dt
cref := ComponentReference.makeCrefIdent("$TMP$OMC$DT", DAE.T_REAL_DEFAULT, {});
tmpv := BackendVariable.makeVar(cref);
tmpv := BackendVariable.setVarKind(tmpv, BackendDAE.PARAM());
//tmpv := BackendVariable.setVarKind(tmpv, BackendDAE.PARAM());
tmpv := BackendVariable.setBindExp(tmpv, SOME(DAE.RCONST(0.0)));
shared := BackendVariable.addKnVarDAE(tmpv, shared);

Expand Down Expand Up @@ -4231,6 +4230,7 @@ algorithm
for cr in crlst loop
cref := ComponentReference.crefPrefixDer(cr);
v := BackendVariable.makeVar(cref);
v := BackendVariable.setBindExp(v, SOME(DAE.RCONST(0.0)));
outShared := BackendVariable.addKnVarDAE(v, outShared);
end for;
end symEulerDerVars;
Expand Down
7 changes: 5 additions & 2 deletions Compiler/BackEnd/Initialization.mo
Expand Up @@ -109,8 +109,11 @@ protected
list<BackendDAE.Equation> removedEqns;
algorithm
try
// TODO: remove this once the initialization is moved before post-optimization
dae := BackendDAEOptimize.symEulerInit(inDAE);

// inline all when equations, if active with body else with lhs=pre(lhs)
dae := inlineWhenForInitialization(inDAE);
dae := inlineWhenForInitialization(dae);
// fcall2(Flags.DUMP_INITIAL_SYSTEM, BackendDump.dumpBackendDAE, dae, "inlineWhenForInitialization");

(initVars, outPrimaryParameters, outAllPrimaryParameters) := selectInitializationVariablesDAE(dae);
Expand Down Expand Up @@ -201,7 +204,7 @@ algorithm
initdae := BackendDAEUtil.mapEqSystem(initdae, solveInitialSystemEqSystem);

// transform and optimize DAE
pastOptModules := BackendDAEUtil.getPostOptModules(SOME({"constantLinearSystem", "symEulerInit", "tearingSystem", "calculateStrongComponentJacobians", "solveSimpleEquations"}));
pastOptModules := BackendDAEUtil.getPostOptModules(SOME({"constantLinearSystem", "tearingSystem", "calculateStrongComponentJacobians", "solveSimpleEquations"}));
matchingAlgorithm := BackendDAEUtil.getMatchingAlgorithm(NONE());
daeHandler := BackendDAEUtil.getIndexReductionMethod(NONE());

Expand Down
36 changes: 36 additions & 0 deletions Compiler/Template/SimCodeTV.mo
Expand Up @@ -3597,4 +3597,40 @@ package HpcOmScheduler
end convertFixedLevelScheduleToTaskLists;
end HpcOmScheduler;

package HashTableCrIListArray
type Key = DAE.ComponentRef;
type Value = tuple<list<Integer>, array<Integer>>;

type HashTableCrefFunctionsType = tuple<FuncHashCref,FuncCrefEqual,FuncCrefStr,FuncExpStr>;
type HashTable = tuple<
array<list<tuple<Key,Integer>>>,
tuple<Integer,Integer,array<Option<tuple<Key,Value>>>>,
Integer,
Integer,
HashTableCrefFunctionsType
>;

function FuncHashCref
input Key cr;
input Integer mod;
output Integer res;
end FuncHashCref;

function FuncCrefEqual
input Key cr1;
input Key cr2;
output Boolean res;
end FuncCrefEqual;

function FuncCrefStr
input Key cr;
output String res;
end FuncCrefStr;

function FuncExpStr
input Value exp;
output String res;
end FuncExpStr;
end HashTableCrIListArray;

end SimCodeTV;
4 changes: 1 addition & 3 deletions Compiler/Translation/Makefile
@@ -1,6 +1,4 @@
srcdir = ..
top_builddir = ../..
localedir = $(top_builddir)/build/share/locale/
localedir = $(OMBUILDDIR)/share/locale/
locales = de sv es

release:
Expand Down
4 changes: 2 additions & 2 deletions Compiler/runtime/SimulationResultsCmp.c
Expand Up @@ -604,7 +604,7 @@ void* SimulationResultsCmp_compareResults(int isResultCmp, int runningTestsuite,
if (UNKNOWN_PLOT == SimulationResultsImpl__openFile(filename,&simresglob_c)) {
char *str = (char*) malloc(25+strlen(filename));
*str = 0;
strcat(strcat(str,"Error opening file: "),runningTestsuite ? SystemImpl__basename(filename) : filename);
strcat(strcat(str,"Error opening file: "), filename);
void *res = mmc_mk_scon(str);
free(str);
return mmc_mk_cons(res,mmc_mk_nil());
Expand All @@ -613,7 +613,7 @@ void* SimulationResultsCmp_compareResults(int isResultCmp, int runningTestsuite,
if (UNKNOWN_PLOT == SimulationResultsImpl__openFile(reffilename,&simresglob_ref)) {
char *str = (char*) malloc(35+strlen(reffilename));
*str = 0;
strcat(strcat(str,"Error opening reference file: "),runningTestsuite ? SystemImpl__basename(reffilename) : reffilename);
strcat(strcat(str,"Error opening reference file: "), reffilename);
void *res = mmc_mk_scon(str);
free(str);
return mmc_mk_cons(res,mmc_mk_nil());
Expand Down
67 changes: 36 additions & 31 deletions Makefile.common
Expand Up @@ -46,7 +46,6 @@ mkbuilddirs:
@mkdir -p $(builddir_inc)/c/fmi1/
@mkdir -p $(builddir_inc)/c/fmi2/
@mkdir -p $(builddir_inc)/scripting-API
@mkdir -p $(builddir_inc)/qwt
@mkdir -p $(builddir_java)
@mkdir -p $(builddir_share)/omc/scripts/OpenTurns/
@mkdir -p $(builddir_doc)/omc/testmodels
Expand All @@ -57,10 +56,10 @@ release: omc

bootstrap-dependencies: graphstream $(BOOTSTRAP_FMIL_DEP)
# NOTE: OpenModelicaBootstrappingHeader.h has to be regenerated without any other process writing to so/etc or you get bus errors
$(MAKE) -f $(defaultMakefileTarget) -C Compiler OpenModelicaBootstrappingHeader.h
$(MAKE) -f $(defaultMakefileTarget) -C Compiler/runtime install
$(MAKE) -f $(defaultMakefileTarget) -C Compiler builtin install_scripts
$(MAKE) -f $(defaultMakefileTarget) -C Parser install
$(MAKE) -f $(defaultMakefileTarget) -C Compiler OpenModelicaBootstrappingHeader.h OMBUILDDIR=$(OMBUILDDIR)
$(MAKE) -f $(defaultMakefileTarget) -C Compiler/runtime install OMBUILDDIR=$(OMBUILDDIR)
$(MAKE) -f $(defaultMakefileTarget) -C Compiler builtin install_scripts OMBUILDDIR=$(OMBUILDDIR)
$(MAKE) -f $(defaultMakefileTarget) -C Parser install OMBUILDDIR=$(OMBUILDDIR)

sim-dependencies: fmi fmil opencl_rt lis metis fmi fmil

Expand All @@ -75,10 +74,15 @@ idl: $(builddir_share)/omc/omc_communication.idl
interactive-common: .testvariables mkbuilddirs boehm-gc idl ModelicaExternalC

interactive-short: .testvariables interactive-common
$(MAKE) -C SimulationRuntime/c -f $(defaultMakefileTarget) bootstrap-dependencies
$(MAKE) -C SimulationRuntime/c -f $(defaultMakefileTarget) bootstrap-dependencies OMBUILDDIR=$(OMBUILDDIR)

interactive: .testvariables interactive-common fmil lis Cdaskr CMinpack $(IPOPT_TARGET) $(UMFPACK_TARGET)
$(MAKE) -C SimulationRuntime/c -f $(defaultMakefileTarget)
interactive: .testvariables interactive-common fmil lis Cdaskr CMinpack docs $(IPOPT_TARGET) $(UMFPACK_TARGET)
$(MAKE) -C SimulationRuntime/c -f $(defaultMakefileTarget) OMBUILDDIR=$(OMBUILDDIR)

docs:
$(MAKE) -C Compiler/Translation OMBUILDDIR=$(OMBUILDDIR) release
(cp -p Examples/*.* $(builddir_doc)/omc/testmodels/)
rm -f $(builddir_doc)/omc/testmodels/CMake*.txt

GC_HEADERS=gc.h gc_allocator.h gc_amiga_redirects.h gc_backptr.h gc_config_macros.h gc_gcj.h gc_pthread_redirects.h
libgc-dev: /usr/include/gc/gc_inline.h
Expand Down Expand Up @@ -156,20 +160,20 @@ breakprocess:
all-runtimeCPPinstall:
$(MAKE) mkbuilddirs
$(MAKE) CMinpack
$(MAKE) all runtimeCPPinstall
$(MAKE) all runtimeCPPinstall OMBUILDDIR=$(OMBUILDDIR)

omc-and-runtimeCPPinstall: mkbuilddirs
$(MAKE) CMinpack
$(MAKE) omc runtimeCPPinstall
$(MAKE) omc runtimeCPPinstall OMBUILDDIR=$(OMBUILDDIR)

runtimeCPP: CMinpack
$(MAKE) -C SimulationRuntime/cpp/ -f $(defaultMakefileTarget)
$(MAKE) -C SimulationRuntime/cpp/ -f $(defaultMakefileTarget) OMBUILDDIR=$(OMBUILDDIR)

CMAKE_ARGS=$(filter CMAKE_%, $(MAKEFLAGS))


runtimeCPPinstall: CMinpack copycppheader
$(MAKE) -C SimulationRuntime/cpp/ -f $(defaultMakefileTarget) CC="$(CC)" CXX="$(CXX)" install ANALYZATION_MODE="$(ANALYZATION_MODE)" $(CMAKE_ARGS)
$(MAKE) -C SimulationRuntime/cpp/ -f $(defaultMakefileTarget) CC="$(CC)" CXX="$(CXX)" install ANALYZATION_MODE="$(ANALYZATION_MODE)" $(CMAKE_ARGS) OMBUILDDIR=$(OMBUILDDIR)
test ! `uname` = Darwin || install_name_tool -id @rpath/cpp/libOMCppCVode.dylib $(OMBUILDDIR)/$(LIB_OMC)/cpp/libOMCppCVode.dylib
test ! `uname` = Darwin || install_name_tool -id @rpath/cpp/libOMCppDataExchange.dylib $(OMBUILDDIR)/$(LIB_OMC)/cpp/libOMCppDataExchange.dylib
test ! `uname` = Darwin || install_name_tool -id @rpath/cpp/libOMCppEuler.dylib $(OMBUILDDIR)/$(LIB_OMC)/cpp/libOMCppEuler.dylib
Expand All @@ -189,7 +193,7 @@ testlibrariemsl32cpp:
echo "log is in testsuite/openmodelica/cppruntime/libraries/msl32/testsuite-msl32-cpp-trace.txt"

runtimeCPPclean:
$(MAKE) -C SimulationRuntime/cpp/ -f $(defaultMakefileTarget) clean
$(MAKE) -C SimulationRuntime/cpp/ -f $(defaultMakefileTarget) clean OMBUILDDIR=$(OMBUILDDIR)

fmil:
test -d 3rdParty/FMIL
Expand Down Expand Up @@ -267,10 +271,10 @@ sustst:

cleancompiler:
cd Compiler/boot && rm -rf "$(OMBUILDDIR)"
$(MAKE) -f $(defaultMakefileTarget) -C Compiler/Script clean
$(MAKE) -f $(defaultMakefileTarget) -C Compiler/Script clean OMBUILDDIR=$(OMBUILDDIR)

distclean: clean
(cd Compiler && $(MAKE) -f $(defaultMakefileTarget) reallyclean)
(cd Compiler && $(MAKE) -f $(defaultMakefileTarget) reallyclean OMBUILDDIR=$(OMBUILDDIR))
rm -f Compiler/.depend
rm -f $(autoconfGeneratedFiles)
rm -f config.status config.log
Expand All @@ -281,17 +285,19 @@ gc-clean:
if test -f 3rdParty/gc/Makefile; then make -C 3rdParty/gc distclean; fi
rm -f 3rdParty/gc/Makefile
bootstrap-clean:
$(MAKE) -C Compiler/boot clean -f $(defaultMakefileTarget)
$(MAKE) -C Compiler/boot clean -f $(defaultMakefileTarget) OMBUILDDIR=$(OMBUILDDIR)
openblas-clean:
# OpenBLAS make clean actually gives error-messages. Let it do it, but silently
test ! -d 3rdParty/OpenBLAS-0.2.8 || $(MAKE) -C 3rdParty/OpenBLAS-0.2.8 clean > /dev/null 2>&1

clean: fmil-clean opencl_rt_clean gc-clean lis-clean runtimeCPPclean CMinpack-clean metis-clean Cdaskr-clean bootstrap-clean msgpack-clean graphstream-clean openblas-clean umfpack-clean
(cd SimulationRuntime/c && $(MAKE) -f $(defaultMakefileTarget) clean)
(cd Compiler && $(MAKE) -f $(defaultMakefileTarget) clean)
(cd Parser && $(MAKE) -f $(defaultMakefileTarget) clean)
$(MAKE) -C Compiler/Template -f $(defaultMakefileTarget) clean
if test -f 3rdParty/modelica3d/build/Makefile; then $(MAKE) -C 3rdParty/modelica3d/build clean; fi
(cd SimulationRuntime/c && $(MAKE) -f $(defaultMakefileTarget) clean OMBUILDDIR=$(OMBUILDDIR))
(cd Compiler && $(MAKE) -f $(defaultMakefileTarget) clean OMBUILDDIR=$(OMBUILDDIR))
(cd Parser && $(MAKE) -f $(defaultMakefileTarget) clean OMBUILDDIR=$(OMBUILDDIR))
$(MAKE) -C Compiler/Template -f $(defaultMakefileTarget) clean OMBUILDDIR=$(OMBUILDDIR)
if test -f 3rdParty/modelica3d/build/Makefile; then $(MAKE) -C 3rdParty/modelica3d/build clean OMBUILDDIR=$(OMBUILDDIR); fi
# remove ModelicaExternalC stuff
if test -f 3rdParty/ModelicaExternalC/BuildProjects/autotools/Makefile; then $(MAKE) -C 3rdParty/ModelicaExternalC/BuildProjects/autotools/ distclean OMBUILDDIR=$(OMBUILDDIR); fi
# remove Ipopt/Makefile if there is no Ipopt/Ipopt/Makefile to run configure again!
if test -f 3rdParty/Ipopt/Ipopt/Makefile; then true; else rm -f 3rdParty/Ipopt/Makefile || true; fi
if test -f 3rdParty/Ipopt/Makefile; then $(MAKE) -C 3rdParty/Ipopt distclean || true; fi
Expand Down Expand Up @@ -320,19 +326,19 @@ install: install-dirs
# Application directory (OSX)
if [ "$(APP)" = ".app" ]; then cp -rp ${builddir_app} $(INSTALL_APPDIR); fi
# Binaries
cp -a ./${builddir_bin}/* ${INSTALL_BINDIR}
cp -a ${builddir_bin}/* ${INSTALL_BINDIR}
# Libraries
cp -a ./${builddir_lib}/* ${INSTALL_LIBDIR}
cp -a ${builddir_lib}/* ${INSTALL_LIBDIR}
# Includes
cp -a ./${builddir_inc}/* ${INSTALL_INCLUDEDIR}/omc
cp -a ./${builddir_inc}/$(host_short)/omc/antlr3 ${INSTALL_INCLUDEDIR}/$(host_short)/omc/antlr3
cp -a ${builddir_inc}/* ${INSTALL_INCLUDEDIR}/omc
cp -a $(OMBUILDDIR)/include/$(host_short)/omc/antlr3 ${INSTALL_INCLUDEDIR}/$(host_short)/omc/antlr3
# License
cp -p COPYING ${INSTALL_DOCDIR}/omc/
# Documents
cp -p ./${builddir_doc}/omc/*.pdf ${INSTALL_DOCDIR}/omc/
cp -p ./${builddir_doc}/omc/testmodels/* ${INSTALL_DOCDIR}/omc/testmodels/
test -z "$(HAVE_DOCDIR)" || cp -p ${builddir_doc}/omc/*.pdf ${INSTALL_DOCDIR}/omc/
cp -p ${builddir_doc}/omc/testmodels/* ${INSTALL_DOCDIR}/omc/testmodels/
# man pages
cp -p ./${builddir_man}/man1/*.gz ${INSTALL_MANDIR}/man1/
# cp -p ${builddir_man}/man1/*.gz ${INSTALL_MANDIR}/man1/
# Shared data
cp -p ${builddir_share}/omc/*.* ${INSTALL_SHAREDIR}/omc/
test ! -d ${builddir_share}/omnotebook/ || cp -rp ${builddir_share}/omnotebook/* ${INSTALL_SHAREDIR}/omnotebook/
Expand All @@ -342,10 +348,9 @@ install: install-dirs
# Scripts
cp -rp ${builddir_share}/omc/scripts/*.* ${builddir_share}/omc/scripts/OpenTurns ${INSTALL_SHAREDIR}/omc/scripts
# Java
cp -p ./${builddir_java}/* ${INSTALL_JAVADIR}
cp -p /${builddir_java}/* ${INSTALL_JAVADIR}
# Translations
cp -rp ./${builddir_locale}/* ${INSTALL_LOCALEDIR}/

cp -rp /${builddir_locale}/* ${INSTALL_LOCALEDIR}/

3rdParty/msgpack-0.5.8/Makefile:
cd 3rdParty/msgpack-0.5.8 && ./configure "--host=$(host)" CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS) $(MSGPACK_CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS) "
Expand Down
10 changes: 5 additions & 5 deletions Makefile.omdev.mingw
@@ -1,5 +1,5 @@
# makefile for Windows MinGW OMDev
all : .testvariables settings release
all : .testvariables settings omc

autoconfGeneratedFiles =

Expand Down Expand Up @@ -94,8 +94,8 @@ settings:
@echo Using OMDev: $(OMDEV)
@echo Using Files: $(OMC_BUILD_FROM)
@echo Using Path : '$(PATH)'
@echo Current directory : `pwd`
@echo BUILD DIRECTORY : $(OMBUILDDIR)
@echo Current directory: `pwd`
@echo Building in OMBUILDDIR: $(OMBUILDDIR)
which gcc

# on windows run also msvc test
Expand Down Expand Up @@ -268,7 +268,7 @@ Umfpack_msvc:
(cp -pur 3rdParty/SuiteSparse/install_msvc/include/omc/c/suitesparse/Include/ $(OMBUILDDIR)/include/omc/msvc/suitesparse)

runtimeCPPmsvcinstall: CMinpack_msvc copycppheader
$(MAKE) -C SimulationRuntime/cpp/ -f Makefile.omdev.mingw runtimeCPPmsvc
$(MAKE) -C SimulationRuntime/cpp/ -f Makefile.omdev.mingw runtimeCPPmsvc OMBUILDDIR=$(OMBUILDDIR)
# mkdir -p $(OMBUILDDIR)/lib/omc/msvc/ && cp -p ${OMDEV}/lib/3rdParty/Sundials/lib/release/vc100/*.lib $(OMBUILDDIR)/lib/omc/msvc/
cp -p ${OMDEV}/lib/3rdParty/Sundials/lib/release/vc100/*.dll $(OMBUILDDIR)/bin/
cp -p $(BOOST_PATH)/lib/*vc*.dll $(OMBUILDDIR)/bin/
Expand Down Expand Up @@ -323,7 +323,7 @@ simulationruntimecmsvc: Umfpack_msvc CMinpack_msvc fmil_msvc
rm -rf 3rdParty/gc/build_msvc/

omc-bootstrapped:
$(MAKE) -f $(defaultMakefileTarget) CFLAGS="$(CFLAGS)" bootstrap-dependencies sim-dependencies OMBUILDDIR=$(OMBUILDDIR)
$(MAKE) -f $(defaultMakefileTarget) CFLAGS="$(CFLAGS)" OMBUILDDIR=$(OMBUILDDIR) bootstrap-dependencies sim-dependencies
$(MAKE) -f $(defaultMakefileTarget) -C Compiler/boot CFLAGS="$(CFLAGS)" OMBUILDDIR=$(OMBUILDDIR)

modelica3d:
Expand Down

0 comments on commit ff2cc7c

Please sign in to comment.