This file contains hidden or 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
    
  
  
    
  | use krpc_client::Client; | |
| use krpc_client::error::RpcError; | |
| use krpc_client::services::space_center::SpaceCenter; | |
| const INDENT_WIDTH: usize = 4; | |
| // Port of https://krpc.github.io/krpc/cpp/api/space-center/parts.html#trees-of-parts | |
| fn main() -> Result<(), RpcError> { | |
| let client = Client::new("kRPC TEST", "127.0.0.1", 50000, 50001).unwrap(); | |
| let sc = SpaceCenter::new(client); | 
  
    
      This file contains hidden or 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
    
  
  
    
  | #include <iostream> | |
| #include "ridc.h" | |
| using namespace std; | |
| class MyOde : public ODE { | |
| public: | |
| MyOde(int my_neq /**, anything else I want **/) { | |
| ti = 0; | |
| neq = 10; | 
  
    
      This file contains hidden or 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
    
  
  
    
  | #include <iostream> | |
| #include "ridc.h" | |
| using namespace std; | |
| class MyOde : public ODE { | |
| public: | |
| MyOde() { | |
| ti = 0; | |
| neq = 10; | 
  
    
      This file contains hidden or 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
    
  
  
    
  | #include <iostream> | |
| #include "ridc.h" | |
| using namespace std; | |
| class MyOde : public ODE { | |
| public: | |
| void rhs(double t, double *u, PARAMETER param, double *f) { | |
| cout << "This is the user defined RHS function." << endl; | |
| } | 
  
    
      This file contains hidden or 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
    
  
  
    
  | #include <iostream> | |
| using namespace std; | |
| //////////////////////////// ridc.h | |
| template <class UserDefined> | |
| void ridc() | |
| { | |
| UserDefined::step(); | |
| } | 
  
    
      This file contains hidden or 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
    
  
  
    
  | class Implicit { | |
| void rhs(...) { ... } | |
| void step(...) { ... } | |
| } | |
| class Explicit { | |
| void rhs(...) { ... } | |
| void step(...) { ... } | |
| } | 
  
    
      This file contains hidden or 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
    
  
  
    
  | package main | |
| /* | |
| #include <stdio.h> | |
| void echostr(char *str); | |
| */ | |
| import "C" | |
| /* | |
| void echostr(char *str) | |
| { | 
  
    
      This file contains hidden or 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
    
  
  
    
  | package main | |
| /* | |
| #include <stdio.h> | |
| void echostr(char *str) | |
| { | |
| printf("%s\n", str); | |
| } | |
| */ | |
| import "C" | |
| import "fmt" | 
NewerOlder