-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
add C++ version of utils and dynamics
1 parent
c986fe9
commit 38b3ae2
Showing
16 changed files
with
345 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
|
||
CC = g++ | ||
CFLAGS = -O3 -Wall -shared -std=c++11 -I/usr/include/eigen3 -fPIC -rdynamic | ||
CFLAGS = -O2 -Wall -shared -std=c++11 -I/usr/include/eigen3 -fPIC -rdynamic | ||
PYBIND = `python3 -m pybind11 --includes` | ||
PYCONFIG = `python3-config --extension-suffix` | ||
|
||
SRCS = src/Air.cpp src/Earth.cpp src/gravity.cpp src/Coordinate.cpp | ||
|
||
all: utils | ||
all: atmosphere coordinate dynamics utils | ||
|
||
utils: utils | ||
atmosphere: | ||
$(CC) $(CFLAGS) $(PYBIND) $(SRCS) src/pybind_USStandardAtmosphere.cpp -o USStandardAtmosphere_c$(PYCONFIG) | ||
|
||
coordinate: | ||
$(CC) $(CFLAGS) $(PYBIND) $(SRCS) src/pybind_coordinate.cpp -o coordinate_c$(PYCONFIG) | ||
$(CC) $(CFLAGS) $(PYBIND) $(SRCS) src/pybind_dynamics.cpp -o dynamics_c$(PYCONFIG) | ||
|
||
dynamics: | ||
$(CC) $(CFLAGS) $(PYBIND) $(SRCS) src/pybind_dynamics.cpp -o dynamics_c$(PYCONFIG) | ||
|
||
utils: | ||
$(CC) $(CFLAGS) $(PYBIND) $(SRCS) src/pybind_utils.cpp -o utils_c$(PYCONFIG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "wrapper_utils.hpp" | ||
|
||
PYBIND11_MODULE(utils_c, m) { | ||
m.def("haversine", &haversine, "Haversine formula"); | ||
m.def("wind_ned", &wind_ned, "Wind in NED frame"); | ||
m.def("angle_of_attack_all_rad", &angle_of_attack_all_rad, "Angle of attack in radians"); | ||
m.def("angle_of_attack_ab_rad", &angle_of_attack_ab_rad, "Angle of attack in radians"); | ||
m.def("dynamic_pressure_pa", &dynamic_pressure_pa, "Dynamic pressure in Pascals"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <pybind11/eigen.h> | ||
#include <pybind11/numpy.h> | ||
#include <pybind11/pybind11.h> | ||
|
||
#include <Eigen/Core> | ||
#include <cmath> | ||
|
||
#include "Air.hpp" | ||
|
||
namespace py = pybind11; | ||
|
||
#ifndef SRC_WRAPPER_AIR_HPP_ | ||
#define SRC_WRAPPER_AIR_HPP_ | ||
|
||
using vec3d = Eigen::Matrix<double, 3, 1>; | ||
using vec4d = Eigen::Matrix<double, 4, 1>; | ||
using vecXd = Eigen::Matrix<double, -1, 1>; | ||
using matXd = Eigen::Matrix<double, -1, -1, Eigen::RowMajor>; | ||
|
||
double geopotential_altitude(double z) { return Air::geopotential_altitude(z); } | ||
|
||
double airtemperature_at(double altitude_m) { | ||
return Air::temperature(altitude_m); | ||
} | ||
|
||
double airpressure_at(double altitude_m) { return Air::pressure(altitude_m); } | ||
|
||
double airdensity_at(double altitude_m) { return Air::density(altitude_m); } | ||
|
||
double speed_of_sound(double altitude_m) { | ||
return Air::speed_of_sound(altitude_m); | ||
} | ||
|
||
#endif // SRC_WRAPPER_AIR_HPP_ |
Oops, something went wrong.