Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
EMAM2Cpp
Commits
0594a35a
Commit
0594a35a
authored
Apr 22, 2019
by
Jean Meurice
Browse files
Autopilot generation tweaks
parent
1f019507
Pipeline
#120118
passed with stages
in 31 minutes and 37 seconds
Changes
12
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/generator/cmake/CMakeFindModule.java
View file @
0594a35a
...
...
@@ -41,6 +41,7 @@ public class CMakeFindModule extends ViewModelBase {
private
List
<
String
>
libPaths
=
new
ArrayList
<>();
private
Boolean
findPath
;
private
Boolean
findLibrary
;
private
Boolean
fortranQuadMath
=
false
;
private
boolean
required
;
...
...
@@ -63,6 +64,8 @@ public class CMakeFindModule extends ViewModelBase {
this
.
findPath
=
findPath
;
this
.
findLibrary
=
findLibrary
;
this
.
required
=
required
;
if
(
packageName
.
equals
(
"GFortran"
))
this
.
fortranQuadMath
=
true
;
}
// methods
...
...
@@ -134,4 +137,13 @@ public class CMakeFindModule extends ViewModelBase {
public
void
setFindLibrary
(
Boolean
findLibrary
)
{
this
.
findLibrary
=
findLibrary
;
}
public
Boolean
getFortranQuadMath
()
{
return
fortranQuadMath
;
}
public
void
setFortranQuadMath
(
Boolean
fortranQuadMath
)
{
this
.
fortranQuadMath
=
fortranQuadMath
;
}
}
src/main/java/de/monticore/lang/monticar/generator/cpp/ArmadilloHelperSource.java
View file @
0594a35a
...
...
@@ -28,7 +28,7 @@ public class ArmadilloHelperSource {
public
static
String
armadilloHelperSourceCode
=
"#ifndef HELPERA_H\n"
+
"#define HELPERA_H\n"
+
"#include <iostream>\n"
+
"#include \"armadillo
.h
\"\n"
+
"#include \"armadillo\"\n"
+
"#include <stdarg.h>\n"
+
"#include <initializer_list>\n"
+
"#include <fstream>\n"
+
...
...
src/main/java/de/monticore/lang/monticar/generator/cpp/LanguageUnitCPP.java
View file @
0594a35a
...
...
@@ -97,10 +97,12 @@ public class LanguageUnitCPP extends LanguageUnit {
//includes
//add default include
String
backendName
=
MathConverter
.
curBackend
.
getBackendName
();
if
(
backendName
.
equals
(
"OctaveBackend"
)
||
backendName
.
equals
(
"ArmadilloBackend"
)){
String
includeHeaderName
=
MathConverter
.
curBackend
.
getIncludeHeaderName
();
resultString
+=
"#include \""
+
includeHeaderName
+
".h\"\n"
;
alreadyGeneratedIncludes
.
add
(
includeHeaderName
);
if
(
MathConverter
.
curBackend
.
getBackendName
().
equals
(
"OctaveBackend"
))
{
resultString
+=
"#include \"octave/oct.h\"\n"
;
alreadyGeneratedIncludes
.
add
(
"octave/oct"
);
}
else
if
(
MathConverter
.
curBackend
.
getBackendName
().
equals
(
"ArmadilloBackend"
))
{
resultString
+=
"#include \""
+
MathConverter
.
curBackend
.
getIncludeHeaderName
()
+
"\"\n"
;
alreadyGeneratedIncludes
.
add
(
MathConverter
.
curBackend
.
getIncludeHeaderName
());
}
for
(
Variable
v
:
bluePrint
.
getVariables
())
{
//TODO remove multiple same includes
...
...
src/main/java/de/monticore/lang/monticar/generator/cpp/mathopt/optimizationSolver/solver/ipopt/IpoptSolverGeneratorImplementation.java
View file @
0594a35a
...
...
@@ -141,8 +141,9 @@ public class IpoptSolverGeneratorImplementation implements NLPSolverGeneratorImp
CMakeFindModule
findCoinMumps
=
new
CMakeFindModule
(
"CoinMumps"
,
""
,
"coinmumps"
,
new
ArrayList
<
String
>(),
new
ArrayList
<
String
>(),
false
,
true
,
true
);
CMakeFindModule
findCoinLapack
=
new
CMakeFindModule
(
"CoinLapack"
,
""
,
"coinlapack"
,
new
ArrayList
<
String
>(),
new
ArrayList
<
String
>(),
false
,
true
,
true
);
CMakeFindModule
findCoinBlas
=
new
CMakeFindModule
(
"CoinBlas"
,
""
,
"coinblas"
,
new
ArrayList
<
String
>(),
new
ArrayList
<
String
>(),
false
,
true
,
true
);
CMakeFindModule
findCoinMetis
=
new
CMakeFindModule
(
"CoinMetis"
,
""
,
"coinmetis"
,
new
ArrayList
<
String
>(),
new
ArrayList
<
String
>(),
false
,
true
,
true
);
CMakeFindModule
findGfortran
=
new
CMakeFindModule
(
"GFortran"
,
""
,
"gfortran"
,
new
ArrayList
<
String
>(),
new
ArrayList
<
String
>(),
false
,
true
,
true
);
return
Arrays
.
asList
(
findCPPAD
,
findIPOpt
,
findCoinMumps
,
findCoinLapack
,
findCoinBlas
,
findGfortran
);
return
Arrays
.
asList
(
findCPPAD
,
findIPOpt
,
findCoinMumps
,
findCoinLapack
,
findCoinBlas
,
findCoinMetis
,
findGfortran
);
}
}
src/main/resources/template/autopilotadapter/AutopilotAdapterCpp.ftl
View file @
0594a35a
...
...
@@ -6,7 +6,7 @@
#
include
<stdlib.h>
#
include
<stdio.h>
#
include
<time.h>
#
include
"armadillo
.h
"
#
include
"armadillo"
void
copy_double_array_to_mat(double
*
data, int size, mat &dest)
{
...
...
src/main/resources/template/cmake/CMakeListsCppTemplate.ftl
View file @
0594a35a
...
...
@@ -11,6 +11,7 @@ set(CMAKE_MODULE_PATH ${r"${CMAKE_MODULE_PATH}"} ${r"${CMAKE_CURRENT_SOURCE_DIR}
find_package
(${
var
.packageName
}
<#if var.required>REQUIRED<#else></#if>)
<#
if
var.findPath>set(INCLUDE_DIRS $
{
r
"${INCLUDE_DIRS}"
}
$
{
r
"${"
}
$
{
var
.packageName
}
$
{
r
"_INCLUDE_DIRS}"
}
)</#if>
<#
if
var.findLibrary>set(LIBS $
{
r
"${LIBS}"
}
$
{
r
"${"
}
$
{
var
.packageName
}
$
{
r
"_LIBRARIES}"
}
)</#if>
<#
if
var.fortranQuadMath>set(LIBS $
{
r
"${LIBS}"
}
"quadmath")</#if>
</#
list
>
# additional commands
...
...
src/main/resources/template/optimizationSolver/cplex/CallCplexTemplate_HeaderOnly.ftl
View file @
0594a35a
...
...
@@ -2,7 +2,7 @@
#
define
__$
{
viewModel
.callSolverName
?
upper_case
}
_H__
#
include
<ilcplex/ilocplex.h>
#
include
"armadillo
.h
"
#
include
"armadillo"
#
include
"CplexMat.h"
...
...
src/main/resources/template/optimizationSolver/cplex/CplexMat.h
View file @
0594a35a
#ifndef MACMAKETEST_CplexMat_H
#define MACMAKETEST_CplexMat_H
#include
<armadillo
.h
>
#include
<armadillo>
#include
<ilcplex/ilocplex.h>
using
namespace
arma
;
...
...
src/main/resources/template/optimizationSolver/ipopt/ADMat.h
View file @
0594a35a
#ifndef MACMAKETEST_ADMAT_H
#define MACMAKETEST_ADMAT_H
#include
<armadillo
.h
>
#include
<armadillo>
#include
<cppad/ipopt/solve.hpp>
using
namespace
arma
;
typedef
CppAD
::
AD
<
double
>
adouble
;
namespace
std
{
double
abs
(
const
adouble
&
ad
)
{
return
abs
(
Value
(
ad
));
}
}
class
ADMat
:
public
field
<
adouble
>
{
public:
...
...
src/main/resources/template/optimizationSolver/ipopt/CallIpoptTemplate_HeaderOnly.ftl
View file @
0594a35a
#
ifndef
__$
{
viewModel
.callSolverName
?
upper_case
}
_H__
#
define
__$
{
viewModel
.callSolverName
?
upper_case
}
_H__
#
include
"
armadillo
.h
"
#
include
"
armadillo
"
#
include
<
cppad
/
ipopt
/
solve
.hpp
>
#
include
"ADMat.h"
...
...
src/main/resources/vendor/catch.hpp
View file @
0594a35a
...
...
@@ -12013,7 +12013,7 @@ using Catch::Detail::Approx;
#ifndef _FILESTRING_CONVERSION___A
#define _FILESTRING_CONVERSION___A
#include
"armadillo
.h
"
#include
"armadillo"
using
namespace
arma
;
void
toFileString
(
std
::
ofstream
&
myfile
,
mat
A
){
myfile
<<
"["
;
...
...
src/test/resources/results/armadillo/detectionObjectDetector2/l0/HelperA.h
View file @
0594a35a
#ifndef HELPERA_H
#define HELPERA_H
#include
<iostream>
#include
"armadillo
.h
"
#include
"armadillo"
#include
<stdarg.h>
#include
<initializer_list>
using
namespace
arma
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment