This repository has been archived by the owner on Jul 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
32 additions
and
30 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include "casadi/casadi.hpp" | ||
using namespace casadi; | ||
class CasADiIterCallback : public Callback { | ||
// Data members | ||
double d; | ||
public: | ||
// Constructor | ||
CasADiIterCallback(const std::string& name, double d, | ||
const Dict& opts=Dict()) : d(d) { | ||
construct(name, opts); | ||
} | ||
|
||
// Destructor | ||
~CasADiIterCallback() override {} | ||
|
||
// Number of inputs and outputs | ||
casadi_int get_n_in() override { return 1;} | ||
casadi_int get_n_out() override { return 1;} | ||
|
||
// Initialize the object | ||
void init() override() { | ||
std::cout << "initializing object" << std::endl; | ||
} | ||
|
||
// Evaluate numerically | ||
std::vector<DM> eval(const std::vector<DM>& arg) const override { | ||
DM x = arg.at(0); | ||
DM f = sin(d*x); | ||
return 1; | ||
} | ||
}; |
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