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

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 {
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;
}
}
......@@ -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" +
......
......@@ -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
......
......@@ -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);
}
}
......@@ -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){
......
......@@ -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
......
......@@ -2,7 +2,7 @@
#define __${viewModel.callSolverName?upper_case}_H__
#include <ilcplex/ilocplex.h>
#include "armadillo.h"
#include "armadillo"
#include "CplexMat.h"
......
#ifndef MACMAKETEST_CplexMat_H
#define MACMAKETEST_CplexMat_H
#include<armadillo.h>
#include<armadillo>
#include <ilcplex/ilocplex.h>
using namespace arma;
......
#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:
......
#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"
......
......@@ -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 << "[";
......
#ifndef HELPERA_H
#define HELPERA_H
#include <iostream>
#include "armadillo.h"
#include "armadillo"
#include <stdarg.h>
#include <initializer_list>
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