TinkeCell API
1.0.0
C/Python/Octave/Ruby API
|
The TinkerCell C API is a collection of functions that allow C programs to directly interact with TinkerCell's visual interface. SWIG is used to extend this API to other languages, such as Python, Perl, R, etc. The functions provided in this API are coverted to Signals, which are much slower than function calls. But they can be used to communicate between threads, which is the main reason why they are used in TinkerCell.The API uses six main data structures:
item: just a reference to a TinkerCell object. Items are represented as integers in Python and Octave and as long ints in C.
string: a string of characters used. Represented as const char* in C.
tc_items array of items
tc_items A = tc_allItems() A.length tc_getItem(A,3) long x = tc_find("x") tc_setItem(A,3,x) tc_items A2 = tc_createItemsArray(10) //array of length 10
tc_strings: array of strings
tc_items A = tc_allItems() tc_strings S = tc_getNames( A ) S.length tc_getString(S,3) tc_setString(S,3,"hello") tc_strings S2 = tc_createStringsArray(10) //array of length 10
tc_matrix: Two dimensional array of reals with row and column names. The rownames and colnames fields are tc_strings objects
long x = tc_find("x") tc_matrix M = tc_getNumericalData( x, "Parameters" ) int r = M.rows int c = M.cols tc_getColumnName(M,2) tc_setColumnName(M,2,"col2") tc_getRowName(M,1) tc_setRowName(M,1,"row1") tc_getMatrixValue(M,2,3) tc_setMatrixValue(M,2,3,0.5) tc_matrix M2 = tc_createMatrix(5,4)
tc_table: Two dimensional array of Strings with row and column names. The rownames and colnames fields are tc_strings objects
long x = tc_find("x") tc_table S = tc_getTextData( x, "Text Attributes" ) S.rows S.cols tc_getString( S.rownames, 1) tc_getString( S.colnames, 2) tc_getTableValue(S,2,3) tc_setTableValue(S,2,3,"hello") tc_table S2 = tc_createTable(4,5)