Skip to content

Commit

Permalink
Merge branch 'master' into tearing
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaeuber committed Jun 16, 2015
2 parents 8b71ff9 + 58dc0b9 commit d9bc4f7
Show file tree
Hide file tree
Showing 95 changed files with 8,219 additions and 9,475 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -13,3 +13,6 @@ simulation/libraries/msl32/Modelica.Mechanics.MultiBody.Examples.Elementary.Doub
simulation/modelica/solver/externalInput.csv
# Reference files are stored as .mat.xz
ReferenceFiles/**/*.mat
/invalid-files.log
/invalid-files.sorted
/.gitvalidfiles.sorted
255 changes: 255 additions & 0 deletions .gitvalidfiles

Large diffs are not rendered by default.

35 changes: 34 additions & 1 deletion Makefile
Expand Up @@ -83,6 +83,7 @@ gitlibraries.log
# Sorted by time it takes to run the tests...
# DO NOT ADD ANYTHING HERE THAT YOU EXPECT WILL TAKE MORE THAN 5 SECONDS TO RUN IN THE NEXT 18 YEARS
FASTLOGS= \
modelicaexternal-objects.log \
simulationalgorithms-functions.log \
simulationarrays.log \
simulationasserts.log \
Expand Down Expand Up @@ -208,6 +209,9 @@ modelicaothers.log: omc-diff
modelicaexternal-functions.log: omc-diff
$(MAKE) -C flattening/modelica/external-functions -f Makefile test > $@
@echo $@ done
modelicaexternal-objects.log: omc-diff
$(MAKE) -C flattening/modelica/external-objects -f Makefile test > $@
@echo $@ done
modelicaequations.log: omc-diff
$(MAKE) -C flattening/modelica/equations -f Makefile test > $@
@echo $@ done
Expand Down Expand Up @@ -525,7 +529,12 @@ failingtest: omc-diff
cd ../msl31; $(MAKE) -f Makefile failingtest;
cd ../msl32; $(MAKE) -f Makefile failingtest;

clean: clean_g_1 clean_g_2 clean_g_3 clean_g_4
clean:
test -e .git || $(MAKE) clean_g_1 clean_g_2 clean_g_3 clean_g_4
test ! -e .git || $(MAKE) git-clean

git-clean:
git clean -fdxq -e 'runtest.db*'

clean_g_1 :
$(MAKE) -C flattening/modelica/algorithms-functions -f Makefile clean
Expand Down Expand Up @@ -615,3 +624,27 @@ clean_g_4:
$(MAKE) -C simulation/libraries/3rdParty/PlanarMechanics -f Makefile clean
$(MAKE) -C simulation/libraries/3rdParty/siemens -f Makefile clean
$(MAKE) -C simulation/libraries/msl32 -f Makefile clean

git-sanity-check: git-clean
find -name "*.cpp" > invalid-files.log
find -name "*.h" >> invalid-files.log
find -name "*.c" >> invalid-files.log
find -name "*.xml" >> invalid-files.log
find -name "*.graphml" >> invalid-files.log
find -name "*~*" >> invalid-files.log
find -name "*.fmu" >> invalid-files.log
find -name "*.libs" >> invalid-files.log
find -name "*.log" >> invalid-files.log
find -name "*.makefile" >> invalid-files.log
find -name "*.sh" >> invalid-files.log
find -name "*.o" >> invalid-files.log
find -name "*.so" >> invalid-files.log
find -name "*.lib" >> invalid-files.log
find -name "*.a" >> invalid-files.log
find -name "*.mat" >> invalid-files.log
find -name "*.csv" >> invalid-files.log
sort invalid-files.log > invalid-files.sorted
sort .gitvalidfiles > .gitvalidfiles.sorted
comm --check-order -23 invalid-files.sorted .gitvalidfiles.sorted > invalid-files.log
cat invalid-files.log
test ! -s invalid-files.log
Binary file not shown.
4 changes: 3 additions & 1 deletion difftool/Makefile
Expand Up @@ -5,7 +5,9 @@ endif

OMBUILDDIR=../../build

$(OMBUILDDIR)/bin/omc-diff$(EXT): lex.yy.o
$(OMBUILDDIR)/bin/omc-diff$(EXT): lex.yy.o $(OMBUILDDIR)/bin
$(CC) -o $@ lex.yy.o
lex.yy.c: omc-diff.l
flex omc-diff.l
$(OMBUILDDIR)/bin:
mkdir -p "$@"
33 changes: 33 additions & 0 deletions flattening/modelica/arrays/ArrayOuterParamExpand.mo
@@ -0,0 +1,33 @@
// name: ArrayOuterParamExpand
// keywords: array inner outer parameter
// status: correct
//
// Checks that outer parameters are expanded correctly.
//

model A
outer parameter Real[3] p1;
parameter Real[3] p2;
Real v;
equation
v = p1 * p2;
end A;

model ArrayOuterParamExpand
inner parameter Real[3] p1;
A a;
end ArrayOuterParamExpand;

// Result:
// class ArrayOuterParamExpand
// parameter Real p1[1];
// parameter Real p1[2];
// parameter Real p1[3];
// parameter Real a.p2[1];
// parameter Real a.p2[2];
// parameter Real a.p2[3];
// Real a.v;
// equation
// a.v = p1[1] * a.p2[1] + p1[2] * a.p2[2] + p1[3] * a.p2[3];
// end ArrayOuterParamExpand;
// endResult
1 change: 1 addition & 0 deletions flattening/modelica/arrays/Makefile
Expand Up @@ -80,6 +80,7 @@ ArrayMulMatrixSimplifier.mo \
ArrayMultiplication.mo \
ArrayMult.mo \
ArrayOperators.mo \
ArrayOuterParamExpand.mo \
ArrayRange.mo \
ArrayRecursiveDim1.mo \
ArrayReduce2.mo \
Expand Down
35 changes: 35 additions & 0 deletions flattening/modelica/enums/EnumArrayMod1.mo
@@ -0,0 +1,35 @@
// name: EnumArrayMod1
// keywords: enumeration enum array mod
// status: correct
//
// Tests that enumeration arrays with modifiers work correctly.
//


model EnumArrayMod1
record R
E e;
end R;

type E = enumeration(a, b, c);

R[E] re(e = {i for i in E});
end EnumArrayMod1;

// Result:
// function EnumArrayMod1.R "Automatically generated record constructor for EnumArrayMod1.R"
// input enumeration(a, b, c) e;
// output R res;
// end EnumArrayMod1.R;
//
// function EnumArrayMod1.R$re "Automatically generated record constructor for EnumArrayMod1.R$re"
// input enumeration(a, b, c) e;
// output R$re res;
// end EnumArrayMod1.R$re;
//
// class EnumArrayMod1
// enumeration(a, b, c) re[EnumArrayMod1.E.a].e = EnumArrayMod1.E.a;
// enumeration(a, b, c) re[EnumArrayMod1.E.b].e = EnumArrayMod1.E.b;
// enumeration(a, b, c) re[EnumArrayMod1.E.c].e = EnumArrayMod1.E.c;
// end EnumArrayMod1;
// endResult
30 changes: 30 additions & 0 deletions flattening/modelica/enums/EnumInnerOuterDim.mo
@@ -0,0 +1,30 @@
// name: EnumInnerOuterDim
// keywords: enumeration enum inner outer dimension
// status: correct
//
// Tests that inner outer arrays with enumeration dimensions are handled
// correctly.
//

type E = enumeration (A, B, C);

block Model1
outer parameter Real[E] p1;
parameter Real[E] p2 = p1;
end Model1;

block Model2
inner parameter Real[E] p1;
Model1 m1;
end Model2;

// Result:
// class Model2
// parameter Real p1[E.A];
// parameter Real p1[E.B];
// parameter Real p1[E.C];
// parameter Real m1.p2[E.A] = p1[E.A];
// parameter Real m1.p2[E.B] = p1[E.B];
// parameter Real m1.p2[E.C] = p1[E.C];
// end Model2;
// endResult
2 changes: 2 additions & 0 deletions flattening/modelica/enums/Makefile
Expand Up @@ -16,10 +16,12 @@ Enum11.mo \
Enum12.mo \
Enum13.mo \
EnumArrayDimBinding.mo \
EnumArrayMod1.mo \
EnumConnectArray.mo \
EnumDimSum.mo \
EnumFor.mo \
EnumFor2.mo \
EnumInnerOuterDim.mo \
EnumInvalidLiteral.mo \
EnumMatrixProduct.mo \
EnumRange.mo \
Expand Down
49 changes: 49 additions & 0 deletions flattening/modelica/external-objects/Makefile
@@ -0,0 +1,49 @@
# relative path to rtest
TEST = ../../../rtest -v

# Tests to run.
TESTFILES = testExternalObject.mo

# test that currently fail. Move up when fixed.
FAILINGTESTFILES= \

# Dependency files that are not .mo .mos or Makefile
# Add them here or they will be cleaned.
DEPENDENCIES = \
*.mo \
*.mos \
Makefile

CLEAN = `ls | grep -w -v -f deps.tmp`

.PHONY : test clean getdeps

test :
@echo
@echo Running tests...
@echo
@echo OPENMODELICAHOME=" $(OPENMODELICAHOME) "
@$(TEST) $(TESTFILES)

# Cleans all files that are not listed as dependencies
clean :
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@rm -f $(CLEAN)

# Run this if you want to list out the files (dependencies).
# do it after cleaning and updating the folder
# then you can get a list of file names (which must be dependencies
# since you got them from repository + your own new files)
# then add them to the DEPENDENCIES. You can find the
# list in deps.txt
getdeps:
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@echo $(CLEAN) | sed -r 's/deps.txt|deps.tmp//g' | sed 's/ / \\\n/g' > deps.txt
@echo Dependency list saved in deps.txt.
@echo Copy the list from deps.txt and add it to the Makefile @DEPENDENCIES

failingtest :
@echo
@echo Running failing tests...
@echo
@$(TEST) $(FAILINGTESTFILES)
45 changes: 45 additions & 0 deletions flattening/modelica/external-objects/testExternalObject.mo
@@ -0,0 +1,45 @@
// name: testExternalObject
// keywords: external object
// cflags: +i=ExtObjectTest.Ex
// status: correct
//
// description: External object in extended class

package ExtObjectTest
model Ex
package ExtPackage1 = ExtPackage;
ExtPackage1.ExtObj mapping = ExtPackage1.ExtObj();
end Ex;

package ExtPackage
class ExtObj
extends ExternalObject;
function constructor
output ExtObj mapping;
external "C" mapping = initMapping();
end constructor;
function destructor
input ExtObj mapping;
external "C" destroyMapping(mapping);
end destructor;
end ExtObj;
end ExtPackage;
end ExtObjectTest;

// Result:
// function ExtObjectTest.Ex.ExtPackage1.ExtObj.constructor
// output ExtObjectTest.Ex.ExtPackage1.ExtObj mapping;
//
// external "C" mapping = initMapping();
// end ExtObjectTest.Ex.ExtPackage1.ExtObj.constructor;
//
// function ExtObjectTest.Ex.ExtPackage1.ExtObj.destructor
// input ExtObjectTest.Ex.ExtPackage1.ExtObj mapping;
//
// external "C" destroyMapping(mapping);
// end ExtObjectTest.Ex.ExtPackage1.ExtObj.destructor;
//
// class ExtObjectTest.Ex
// ExtObjectTest.Ex.ExtPackage1.ExtObj mapping = ExtObjectTest.Ex.ExtPackage1.ExtObj.constructor();
// end ExtObjectTest.Ex;
// endResult
1 change: 1 addition & 0 deletions flattening/modelica/modification/Makefile
Expand Up @@ -52,6 +52,7 @@ Overwriting1.mo \
Overwriting2.mo \
Shadow1.mo \
UsertypeModifications.mo \
UsertypeArrayMod.mo \
TestMissingModifiers.mos


Expand Down
38 changes: 38 additions & 0 deletions flattening/modelica/modification/UsertypeArrayMod.mo
@@ -0,0 +1,38 @@
// name: UsertypeArrayMod
// keywords: modification array type
// status: correct
//

model UsertypeArrayMod
type T = Real[3, 2](start = {{1, 2}, {3, 4}, {5, 6}});
T x[4, 1];
end UsertypeArrayMod;

// Result:
// class UsertypeArrayMod
// Real x[1,1,1,1](start = 1.0);
// Real x[1,1,1,2](start = 2.0);
// Real x[1,1,2,1](start = 3.0);
// Real x[1,1,2,2](start = 4.0);
// Real x[1,1,3,1](start = 5.0);
// Real x[1,1,3,2](start = 6.0);
// Real x[2,1,1,1](start = 1.0);
// Real x[2,1,1,2](start = 2.0);
// Real x[2,1,2,1](start = 3.0);
// Real x[2,1,2,2](start = 4.0);
// Real x[2,1,3,1](start = 5.0);
// Real x[2,1,3,2](start = 6.0);
// Real x[3,1,1,1](start = 1.0);
// Real x[3,1,1,2](start = 2.0);
// Real x[3,1,2,1](start = 3.0);
// Real x[3,1,2,2](start = 4.0);
// Real x[3,1,3,1](start = 5.0);
// Real x[3,1,3,2](start = 6.0);
// Real x[4,1,1,1](start = 1.0);
// Real x[4,1,1,2](start = 2.0);
// Real x[4,1,2,1](start = 3.0);
// Real x[4,1,2,2](start = 4.0);
// Real x[4,1,3,1](start = 5.0);
// Real x[4,1,3,2](start = 6.0);
// end UsertypeArrayMod;
// endResult

0 comments on commit d9bc4f7

Please sign in to comment.