Skip to content

Commit

Permalink
Incorporate Markus's comments; mostly indentation-related
Browse files Browse the repository at this point in the history
  • Loading branch information
michal-toth committed Oct 21, 2024
1 parent 79d53d9 commit 4cabe9a
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 145 deletions.
2 changes: 1 addition & 1 deletion CMakeLists_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ if(Boost_VERSION_STRING VERSION_GREATER 1.53)
tests/cpgrid/lookUpCellCentroid_cpgrid_test.cpp
tests/cpgrid/lookupdataCpGrid_test.cpp
tests/cpgrid/shifted_cart_test.cpp
tests/test_graphofgrid.cpp
tests/test_graphofgrid.cpp
)
endif()

Expand Down
6 changes: 0 additions & 6 deletions opm/grid/GraphOfGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ void GraphOfGrid<Grid>::createGraph ()
template<typename Grid>
int GraphOfGrid<Grid>::contractVertices (int gID1, int gID2)
{
// ensure gID1<gID2
if (gID1==gID2)
return gID1;
if (gID2<gID1)
std::swap(gID1,gID2);

// check if the gIDs are in the graph or a well
// do nothing if the vertex is not there
auto pgID1 = find(gID1);
Expand Down
5 changes: 5 additions & 0 deletions opm/grid/GraphOfGrid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class GraphOfGrid{
}

/// \brief Return properties of vertex of given ID.
///
/// If no such vertex exists, returns vertex with
/// process -1, weight 0, and empty edgeList.
/// If the vertex is in a well, return the well's vertex.
Expand All @@ -108,6 +109,7 @@ class GraphOfGrid{
}

/// \brief Number of vertices for given vertex
///
// returns -1 if vertex with such global ID is not in the graph (or wells)
int numEdges (int gID) const
{
Expand All @@ -132,13 +134,15 @@ class GraphOfGrid{
}

/// \brief Contract two vertices
///
/// Vertex weights are added, and edges are merged. Edge weights
/// for their common neighbors are added up.
/// Returns global ID of the resulting vertex, which is smaller ID.
/// If either gID is in a well, well's ID can be returned if it is smaller.
int contractVertices (int gID1, int gID2);

/// \brief Register the well to the list of wells
///
/// If checkIntersection==true, it checks if any of well's cells is
/// in another well(s) and merges them together.
void addWell (const std::set<int>& well, bool checkIntersection=true);
Expand All @@ -154,6 +158,7 @@ class GraphOfGrid{
void createGraph (); // edge weight=1

/// \brief Identify the well containing the cell with this global ID
///
/// returns the smallest cell-ID in the well or
/// returns -1 if no well contains given gID
int wellID (int gID) const;
Expand Down
17 changes: 12 additions & 5 deletions opm/grid/GraphOfGridWrappers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ namespace Opm {
namespace {
using ZOLTAN_ID_PTR = int*;
}
/// \brief callback ftion for ZOLTAN_NUM_OBJ_FN

/// \brief callback function for ZOLTAN_NUM_OBJ_FN
///
/// returns the number of vertices in the graph
int getGraphOfGridNumVertices(void* pGraph, int *err)
{
Expand All @@ -50,10 +52,11 @@ namespace Opm {
}

/// \brief callback ftion for ZOLTAN_OBJ_LIST_FN
///
/// fills the vector gIDs with vertex global IDs
/// and the vector objWeights with their weights
void getGraphOfGridVerticesList(void* pGraph,
int dimGlobalID,
[[maybe_unused]] int dimGlobalID,
[[maybe_unused]] int dimLocalID,
ZOLTAN_ID_PTR gIDs,
[[maybe_unused]] ZOLTAN_ID_PTR lIDs,
Expand All @@ -76,10 +79,11 @@ namespace Opm {
}

/// \brief callback ftion for ZOLTAN_NUM_EDGES_MULTI_FN
///
/// takes the list of global IDs (gIDs) and fills (consecutively)
/// vector numEdges with the number of their edges
void getGraphOfGridNumEdges(void *pGraph,
int dimGlobalID,
[[maybe_unused]] int dimGlobalID,
[[maybe_unused]] int dimLocalID,
int numCells,
ZOLTAN_ID_PTR gIDs,
Expand All @@ -106,12 +110,14 @@ namespace Opm {
}

/// \brief callback ftion for ZOLTAN_EDGE_LIST_MULTI_FN
///
/// takes the list of global IDs (gIDs) and fills (consecutively):
/// vector nborGIDs with the list of neighbors (all into 1 vector),
/// vector nborProc with neighbors' process numbers,
/// vector edgeWeights with edge weights.
/// The vector numEdges provides the number of edges for each gID
void getGraphOfGridEdgeList(void *pGraph, int dimGlobalID,
void getGraphOfGridEdgeList(void *pGraph,
[[maybe_unused]] int dimGlobalID,
[[maybe_unused]] int dimLocalID,
int numCells,
ZOLTAN_ID_PTR gIDs,
Expand Down Expand Up @@ -151,8 +157,8 @@ namespace Opm {
*err = ZOLTAN_OK;
}

// Wells:
/// \brief Adds well to the GraphOfGrid
///
/// Adding the well contracts vertices of the well into one vertex.
void addFutureConnectionWells (GraphOfGrid<Dune::CpGrid>& gog,
const std::unordered_map<std::string, std::set<int>>& wells)
Expand All @@ -162,6 +168,7 @@ namespace Opm {
}

/// \brief Add well cells' global IDs to the list
///
/// Output of the partitioning is missing vertices that were contracted.
/// This function fills in omitted gIDs and gives them the properties
/// (like process number and ownership) of their representative cell (well ID).
Expand Down
Loading

0 comments on commit 4cabe9a

Please sign in to comment.