mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Simplify parameter
This commit is contained in:
parent
21b23b7aa4
commit
c7fec18a86
@ -116,22 +116,22 @@ createBridge(const boost::property_tree::ptree& prm, std::unique_ptr<Opm::BdaBri
|
|||||||
|
|
||||||
template <int bz>
|
template <int bz>
|
||||||
Dune::BlockVector<Dune::FieldVector<double, bz>>
|
Dune::BlockVector<Dune::FieldVector<double, bz>>
|
||||||
testOpenclSolver(std::unique_ptr<Opm::BdaBridge<Matrix<bz>, Vector<bz>, bz> >& bridge, Matrix<bz>& matrix, Vector<bz>& rhs)
|
testOpenclSolver(Opm::BdaBridge<Matrix<bz>, Vector<bz>, bz>& bridge, Matrix<bz>& matrix, Vector<bz>& rhs)
|
||||||
{
|
{
|
||||||
Dune::InverseOperatorResult result;
|
Dune::InverseOperatorResult result;
|
||||||
Vector<bz> x(rhs.size());
|
Vector<bz> x(rhs.size());
|
||||||
auto wellContribs = Opm::WellContributions::create("opencl", false);
|
auto wellContribs = Opm::WellContributions::create("opencl", false);
|
||||||
auto mat2 = matrix; // deep copy to make sure nnz values are in contiguous memory
|
auto mat2 = matrix; // deep copy to make sure nnz values are in contiguous memory
|
||||||
// matrix created by readMatrixMarket() did not have contiguous memory
|
// matrix created by readMatrixMarket() did not have contiguous memory
|
||||||
bridge->solve_system(&mat2, &mat2, /*numJacobiBlocks=*/0, rhs, *wellContribs, result);
|
bridge.solve_system(&mat2, &mat2, /*numJacobiBlocks=*/0, rhs, *wellContribs, result);
|
||||||
bridge->get_result(x);
|
bridge.get_result(x);
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <int bz>
|
template <int bz>
|
||||||
Dune::BlockVector<Dune::FieldVector<double, bz>>
|
Dune::BlockVector<Dune::FieldVector<double, bz>>
|
||||||
testOpenclSolverJacobi(std::unique_ptr<Opm::BdaBridge<Matrix<bz>, Vector<bz>, bz> >& bridge, Matrix<bz>& matrix, Vector<bz>& rhs)
|
testOpenclSolverJacobi(Opm::BdaBridge<Matrix<bz>, Vector<bz>, bz>& bridge, Matrix<bz>& matrix, Vector<bz>& rhs)
|
||||||
{
|
{
|
||||||
Dune::InverseOperatorResult result;
|
Dune::InverseOperatorResult result;
|
||||||
Vector<bz> x(rhs.size());
|
Vector<bz> x(rhs.size());
|
||||||
@ -140,8 +140,8 @@ testOpenclSolverJacobi(std::unique_ptr<Opm::BdaBridge<Matrix<bz>, Vector<bz>, bz
|
|||||||
// matrix created by readMatrixMarket() did not have contiguous memory
|
// matrix created by readMatrixMarket() did not have contiguous memory
|
||||||
auto mat3 = matrix; // another deep copy, to make sure Jacobi matrix memory is different
|
auto mat3 = matrix; // another deep copy, to make sure Jacobi matrix memory is different
|
||||||
// the sparsity pattern and values are actually the same
|
// the sparsity pattern and values are actually the same
|
||||||
bridge->solve_system(&mat2, &mat3, /*numJacobiBlocks=*/2, rhs, *wellContribs, result);
|
bridge.solve_system(&mat2, &mat3, /*numJacobiBlocks=*/2, rhs, *wellContribs, result);
|
||||||
bridge->get_result(x);
|
bridge.get_result(x);
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
@ -162,7 +162,7 @@ void test3(const pt::ptree& prm)
|
|||||||
// should create bridge only once
|
// should create bridge only once
|
||||||
|
|
||||||
// test openclSolver without Jacobi matrix
|
// test openclSolver without Jacobi matrix
|
||||||
auto sol = testOpenclSolver<bz>(bridge, matrix, rhs2);
|
auto sol = testOpenclSolver<bz>(*bridge, matrix, rhs2);
|
||||||
BOOST_REQUIRE_EQUAL(sol.size(), duneSolution.size());
|
BOOST_REQUIRE_EQUAL(sol.size(), duneSolution.size());
|
||||||
for (size_t i = 0; i < sol.size(); ++i) {
|
for (size_t i = 0; i < sol.size(); ++i) {
|
||||||
for (int row = 0; row < bz; ++row) {
|
for (int row = 0; row < bz; ++row) {
|
||||||
@ -171,7 +171,7 @@ void test3(const pt::ptree& prm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// test openclSolver with Jacobi matrix
|
// test openclSolver with Jacobi matrix
|
||||||
auto solJacobi = testOpenclSolverJacobi<bz>(bridge, matrix, rhs2);
|
auto solJacobi = testOpenclSolverJacobi<bz>(*bridge, matrix, rhs2);
|
||||||
BOOST_REQUIRE_EQUAL(solJacobi.size(), duneSolution.size());
|
BOOST_REQUIRE_EQUAL(solJacobi.size(), duneSolution.size());
|
||||||
for (size_t i = 0; i < solJacobi.size(); ++i) {
|
for (size_t i = 0; i < solJacobi.size(); ++i) {
|
||||||
for (int row = 0; row < bz; ++row) {
|
for (int row = 0; row < bz; ++row) {
|
||||||
|
Loading…
Reference in New Issue
Block a user