@@ -892,6 +892,61 @@ BOOST_AUTO_TEST_CASE(test_getWellRanks)
892892}
893893#endif
894894
895+ BOOST_AUTO_TEST_CASE (MultiplyWellConnectivities)
896+ {
897+ Dune::CpGrid grid;
898+ std::array<int , 3 > dims { 3 , 3 , 1 };
899+ std::array<double , 3 > size { 1 ., 1 ., 1 . };
900+ grid.createCartesian (dims, size);
901+ Opm::GraphOfGrid gog (grid);
902+ if (grid.size (0 ) == 0 )
903+ return ;
904+
905+ std::unordered_map<std::string, std::set<int >> wells {
906+ { " first row" , { 0 , 1 , 2 } },
907+ { " first column" , { 0 , 3 , 6 } },
908+ { " intersecting first row" , { 1 , 2 , 4 , 5 } }
909+ };
910+ float factor = 5 ;
911+ for (const auto & well : wells) {
912+ // multiplies weights of well edges, not between two wells
913+ gog.multiplyWellConnectivity (well.second , factor);
914+ }
915+ BOOST_REQUIRE (gog.size () == 9 );
916+ BOOST_REQUIRE (gog.getWells ().size () == 0 );
917+ int err;
918+ int nVer = getGraphOfGridNumVertices (&gog, &err);
919+ BOOST_REQUIRE (err == ZOLTAN_OK );
920+ BOOST_REQUIRE (nVer == 9 );
921+
922+ auto checkEdge = [&gog](int from, int to, float weight) {
923+ const auto & edgesFrom = gog.edgeList (from);
924+ BOOST_REQUIRE (edgesFrom.at (to) == weight);
925+ const auto & edgesTo = gog.edgeList (to);
926+ BOOST_REQUIRE (edgesTo.at (from) == weight);
927+ };
928+ // left-to-right edges
929+ checkEdge (0 , 1 , 5 .);
930+ checkEdge (1 , 2 , 25 .);
931+ checkEdge (3 , 4 , 1 .);
932+ checkEdge (4 , 5 , 5 .);
933+ checkEdge (6 , 7 , 1 .);
934+ checkEdge (7 , 8 , 1 .);
935+ // front-to-back edges
936+ checkEdge (0 , 3 , 5 .);
937+ checkEdge (1 , 4 , 5 .);
938+ checkEdge (2 , 5 , 5 .);
939+ checkEdge (3 , 6 , 5 .);
940+ checkEdge (4 , 7 , 1 .);
941+ checkEdge (5 , 8 , 1 .);
942+
943+ int nrEdges = 0 ;
944+ for (int i=0 ; i<gog.size (); ++i) {
945+ nrEdges += gog.edgeList (i).size ();
946+ }
947+ BOOST_REQUIRE (nrEdges == 24 );
948+ }
949+
895950bool
896951init_unit_test_func ()
897952{
0 commit comments