Commit 0594a35a authored by Jean Meurice's avatar Jean Meurice
Browse files

Autopilot generation tweaks

parent 1f019507
Pipeline #120118 passed with stages
in 31 minutes and 37 seconds
...@@ -41,6 +41,7 @@ public class CMakeFindModule extends ViewModelBase { ...@@ -41,6 +41,7 @@ public class CMakeFindModule extends ViewModelBase {
private List<String> libPaths = new ArrayList<>(); private List<String> libPaths = new ArrayList<>();
private Boolean findPath; private Boolean findPath;
private Boolean findLibrary; private Boolean findLibrary;
private Boolean fortranQuadMath = false;
private boolean required; private boolean required;
...@@ -63,6 +64,8 @@ public class CMakeFindModule extends ViewModelBase { ...@@ -63,6 +64,8 @@ public class CMakeFindModule extends ViewModelBase {
this.findPath = findPath; this.findPath = findPath;
this.findLibrary = findLibrary; this.findLibrary = findLibrary;
this.required = required; this.required = required;
if (packageName.equals("GFortran"))
this.fortranQuadMath = true;
} }
// methods // methods
...@@ -134,4 +137,13 @@ public class CMakeFindModule extends ViewModelBase { ...@@ -134,4 +137,13 @@ public class CMakeFindModule extends ViewModelBase {
public void setFindLibrary(Boolean findLibrary) { public void setFindLibrary(Boolean findLibrary) {
this.findLibrary = findLibrary; this.findLibrary = findLibrary;
} }
public Boolean getFortranQuadMath() {
return fortranQuadMath;
}
public void setFortranQuadMath(Boolean fortranQuadMath) {
this.fortranQuadMath = fortranQuadMath;
}
} }
...@@ -28,7 +28,7 @@ public class ArmadilloHelperSource { ...@@ -28,7 +28,7 @@ public class ArmadilloHelperSource {
public static String armadilloHelperSourceCode = "#ifndef HELPERA_H\n" + public static String armadilloHelperSourceCode = "#ifndef HELPERA_H\n" +
"#define HELPERA_H\n" + "#define HELPERA_H\n" +
"#include <iostream>\n" + "#include <iostream>\n" +
"#include \"armadillo.h\"\n" + "#include \"armadillo\"\n" +
"#include <stdarg.h>\n" + "#include <stdarg.h>\n" +
"#include <initializer_list>\n" + "#include <initializer_list>\n" +
"#include <fstream>\n" + "#include <fstream>\n" +
......
...@@ -97,10 +97,12 @@ public class LanguageUnitCPP extends LanguageUnit { ...@@ -97,10 +97,12 @@ public class LanguageUnitCPP extends LanguageUnit {
//includes //includes
//add default include //add default include
String backendName = MathConverter.curBackend.getBackendName(); String backendName = MathConverter.curBackend.getBackendName();
if (backendName.equals("OctaveBackend") || backendName.equals("ArmadilloBackend")){ if (MathConverter.curBackend.getBackendName().equals("OctaveBackend")) {
String includeHeaderName = MathConverter.curBackend.getIncludeHeaderName(); resultString += "#include \"octave/oct.h\"\n";
resultString += "#include \"" + includeHeaderName + ".h\"\n"; alreadyGeneratedIncludes.add("octave/oct");
alreadyGeneratedIncludes.add(includeHeaderName); } else if (MathConverter.curBackend.getBackendName().equals("ArmadilloBackend")) {
resultString += "#include \"" + MathConverter.curBackend.getIncludeHeaderName() + "\"\n";
alreadyGeneratedIncludes.add(MathConverter.curBackend.getIncludeHeaderName());
} }
for (Variable v : bluePrint.getVariables()) { for (Variable v : bluePrint.getVariables()) {
//TODO remove multiple same includes //TODO remove multiple same includes
......
...@@ -141,8 +141,9 @@ public class IpoptSolverGeneratorImplementation implements NLPSolverGeneratorImp ...@@ -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 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 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 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); 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);
} }
} }
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
#include "armadillo.h" #include "armadillo"
void copy_double_array_to_mat(double *data, int size, mat &dest){ void copy_double_array_to_mat(double *data, int size, mat &dest){
......
...@@ -11,6 +11,7 @@ set(CMAKE_MODULE_PATH ${r"${CMAKE_MODULE_PATH}"} ${r"${CMAKE_CURRENT_SOURCE_DIR} ...@@ -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>) 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.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.findLibrary>set(LIBS ${r"${LIBS}"} ${r"${"}${var.packageName}${r"_LIBRARIES}"})</#if>
<#if var.fortranQuadMath>set(LIBS ${r"${LIBS}"} "quadmath")</#if>
</#list> </#list>
# additional commands # additional commands
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define __${viewModel.callSolverName?upper_case}_H__ #define __${viewModel.callSolverName?upper_case}_H__
#include <ilcplex/ilocplex.h> #include <ilcplex/ilocplex.h>
#include "armadillo.h" #include "armadillo"
#include "CplexMat.h" #include "CplexMat.h"
......
#ifndef MACMAKETEST_CplexMat_H #ifndef MACMAKETEST_CplexMat_H
#define MACMAKETEST_CplexMat_H #define MACMAKETEST_CplexMat_H
#include<armadillo.h> #include<armadillo>
#include <ilcplex/ilocplex.h> #include <ilcplex/ilocplex.h>
using namespace arma; using namespace arma;
......
#ifndef MACMAKETEST_ADMAT_H #ifndef MACMAKETEST_ADMAT_H
#define MACMAKETEST_ADMAT_H #define MACMAKETEST_ADMAT_H
#include<armadillo.h> #include<armadillo>
#include<cppad/ipopt/solve.hpp> #include<cppad/ipopt/solve.hpp>
using namespace arma; using namespace arma;
typedef CppAD::AD<double> adouble; typedef CppAD::AD<double> adouble;
namespace std {
double abs(const adouble &ad) {
return abs(Value(ad));
}
}
class ADMat : public field<adouble> { class ADMat : public field<adouble> {
public: public:
......
#ifndef __${viewModel.callSolverName?upper_case}_H__ #ifndef __${viewModel.callSolverName?upper_case}_H__
#define __${viewModel.callSolverName?upper_case}_H__ #define __${viewModel.callSolverName?upper_case}_H__
#include"armadillo.h" #include"armadillo"
#include<cppad/ipopt/solve.hpp> #include<cppad/ipopt/solve.hpp>
#include "ADMat.h" #include "ADMat.h"
......
...@@ -12013,7 +12013,7 @@ using Catch::Detail::Approx; ...@@ -12013,7 +12013,7 @@ using Catch::Detail::Approx;
#ifndef _FILESTRING_CONVERSION___A #ifndef _FILESTRING_CONVERSION___A
#define _FILESTRING_CONVERSION___A #define _FILESTRING_CONVERSION___A
#include "armadillo.h" #include "armadillo"
using namespace arma; using namespace arma;
void toFileString(std::ofstream& myfile, mat A){ void toFileString(std::ofstream& myfile, mat A){
myfile << "["; myfile << "[";
......
#ifndef HELPERA_H #ifndef HELPERA_H
#define HELPERA_H #define HELPERA_H
#include <iostream> #include <iostream>
#include "armadillo.h" #include "armadillo"
#include <stdarg.h> #include <stdarg.h>
#include <initializer_list> #include <initializer_list>
using namespace arma; using namespace arma;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment