#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; double myHostArray[] = { 5, 10, 15, 20 }; uc.DefineVariable("MyArray[]", &myHostArray); // The uCalc array values come from the host array cout << uc.Eval("MyArray[0]") << endl; cout << uc.Eval("MyArray[1]") << endl; cout << uc.Eval("MyArray[2]") << endl; cout << uc.Eval("MyArray[3]") << endl; cout << "" << endl; // Changing the uCalc array updates the pinned array uc.Eval("MyArray[0] = 10; MyArray[1] = 20; MyArray[2] = 30; MyArray[3] = 40; "); // The changes the uCalc array are reflected in the host array cout << myHostArray[0] << endl; cout << myHostArray[1] << endl; cout << myHostArray[2] << endl; cout << myHostArray[3] << endl; cout << "" << endl; // One more round trip myHostArray[0] = 10; myHostArray[1] = 11; myHostArray[2] = 12; myHostArray[3] = 13; cout << uc.Eval("MyArray[0]") << endl; cout << uc.Eval("MyArray[1]") << endl; cout << uc.Eval("MyArray[2]") << endl; cout << uc.Eval("MyArray[3]") << endl; }