MCPcopy Create free account
hub / github.com/KaHIP/KaHIP / Java_KaHIPWrapper_cnativeKaffpa

Function Java_KaHIPWrapper_cnativeKaffpa

misc/java_jni_wrapper/KaHIPWrapper.cpp:19–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17*/
18
19JNIEXPORT void JNICALL Java_KaHIPWrapper_cnativeKaffpa
20 (JNIEnv *pEnv, jclass jObj, jint jn, jintArray jvwgt, jintArray jxadj, jintArray jadjcwgt, jintArray jadjncy,
21 jint jnparts, jdouble jimbalance, jboolean jsuppress_output, jint jseed, jint jmode, jobject jRetObj)
22{
23 jsize i;
24 jsize len;
25 jfieldID fid;
26 jclass resultClass;
27 jintArray jpart;
28 jint jedgecut;
29 jint *vwgtJArray, *xadjJArray, *adjcwgtJArray, *adjncyJArray, *partJArray;
30 int n, nparts, seed, mode;
31 int *vwgt, *xadj, *adjcwgt, *adjncy, *part;
32 double imbalance;
33 bool suppress_output;
34 int edgecut;
35
36 // convert java input data types to C++ data types
37 n = (jint)jn;
38
39 len = pEnv->GetArrayLength(jvwgt);
40 if (len == 0) {
41 vwgt = 0;
42 } else {
43 vwgtJArray = pEnv->GetIntArrayElements(jvwgt, 0);
44 vwgt = (int*)malloc(len * sizeof(int));
45 for (i = 0; i < len; i++) vwgt[i] = (int)vwgtJArray[i];
46 }
47
48 len = pEnv->GetArrayLength(jxadj);
49 xadjJArray = pEnv->GetIntArrayElements(jxadj, 0);
50 xadj = (int*)malloc(len * sizeof(int));
51
52 for (i = 0; i < len; i++) {
53 xadj[i] = (int)xadjJArray[i];
54 }
55
56 len = pEnv->GetArrayLength(jadjcwgt);
57 if (len == 0) {
58 adjcwgt = 0;
59 } else {
60 adjcwgtJArray = pEnv->GetIntArrayElements(jadjcwgt, 0);
61 adjcwgt = (int*)malloc(len * sizeof(int));
62 for (i = 0; i < len; i++) adjcwgt[i] = (int)adjcwgtJArray[i];
63 }
64
65 len = pEnv->GetArrayLength(jadjncy);
66 adjncyJArray = pEnv->GetIntArrayElements(jadjncy, 0);
67 adjncy = (int*)malloc(len * sizeof(int));
68
69 for (i = 0; i < len; i++) {
70 adjncy[i] = (int)adjncyJArray[i];
71 }
72
73 nparts = (int)jnparts;
74 imbalance = (double)jimbalance;
75 suppress_output = (bool)jsuppress_output;
76 seed = (int)jseed;

Callers

nothing calls this directly

Calls 1

kaffpaFunction · 0.50

Tested by

no test coverage detected