Skip to content

Commit

Permalink
Wip
Browse files Browse the repository at this point in the history
Signed-off-by: Geoffroy Jamgotchian <[email protected]>
  • Loading branch information
geofjamg committed Nov 19, 2023
1 parent 80ef976 commit dc1ef17
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @author Geoffroy Jamgotchian <geoffroy.jamgotchian at rte-france.com>
*/

#include <iostream>
#include <kinsol/kinsol.h>
#include <sundials/sundials_nvector.h>
#include <sunmatrix/sunmatrix_sparse.h>
Expand All @@ -25,6 +26,8 @@ extern "C" {

JNIEXPORT void JNICALL Java_com_powsybl_math_solver_KinsolSolver_test(JNIEnv * env, jobject) {
try {
std::cout << "start" << std::endl;

SUNContext sunctx;
int error = SUNContext_Create(nullptr, &sunctx);
if (error != 0) {
Expand Down
15 changes: 15 additions & 0 deletions src/test/java/com/powsybl/math/solver/KinsolSolver.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Copyright (c) 2023, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package com.powsybl.math.solver;

/**
* @author Geoffroy Jamgotchian {@literal <geoffroy.jamgotchian at rte-france.com>}
*/
public class KinsolSolver {

public native void test();
}
24 changes: 24 additions & 0 deletions src/test/java/com/powsybl/mathnative/SolverTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Copyright (c) 2023, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package com.powsybl.mathnative;

import com.powsybl.math.matrix.SparseMatrix;
import com.powsybl.math.solver.KinsolSolver;
import org.junit.jupiter.api.Test;

/**
* @author Geoffroy Jamgotchian {@literal <geoffroy.jamgotchian at rte-france.com>}
*/
class SolverTest {

@Test
void test() {
SparseMatrix m = new SparseMatrix(0, 0, new int[] {}, new int[] {}, new double[] {});
KinsolSolver solver = new KinsolSolver();
solver.test();
}
}

0 comments on commit dc1ef17

Please sign in to comment.