Skip to content

Commit 6b617b1

Browse files
committed
Bug fixes to make things work in parallel
1 parent 876f33c commit 6b617b1

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

Common/src/fem/fem_geometry_structure.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ CMeshFEM::CMeshFEM(CGeometry* geometry, CConfig* config) {
223223
blasFunctions = new CBlasStructure;
224224

225225
/*--- Define the linear partitioning of the elements. ---*/
226+
Global_nElem = geometry->GetGlobal_nElem();
226227
CLinearPartitioner elemPartitioner(Global_nElem, 0);
227228

228229
/*--- The new FEM mesh class has the same problem dimension/zone. ---*/
@@ -671,9 +672,8 @@ CMeshFEM::CMeshFEM(CGeometry* geometry, CConfig* config) {
671672
/* Determine the number of elements per rank of the originally partitioned grid
672673
stored in cumulative storage format. */
673674
vector<unsigned long> nElemPerRankOr(size + 1);
674-
675-
for (int i = 0; i < size; ++i) nElemPerRankOr[i] = elemPartitioner.GetFirstIndexOnRank(i);
676-
nElemPerRankOr[size] = Global_nElem;
675+
for (int i = 0; i <= size; ++i)
676+
nElemPerRankOr[i] = elemPartitioner.GetCumulativeSizeBeforeRank(i);
677677

678678
/* Determine to which ranks I have to send messages to find out the information
679679
of the halos stored on this rank. */

Common/src/fem/geometry_structure_fem_part.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,8 +1162,8 @@ void CPhysicalGeometry::SetColorFEMGrid_Parallel(CConfig* config) {
11621162
/*--- Determine the array, which stores the distribution of the graph nodes
11631163
over the ranks. ---*/
11641164
vector<idx_t> vtxdist(size + 1);
1165-
vtxdist[0] = 0;
1166-
for (int i = 0; i < size; ++i) vtxdist[i + 1] = (idx_t)end_node[i];
1165+
for (int i = 0; i <= size; ++i)
1166+
vtxdist[i] = static_cast<idx_t>(elemPartitioner.GetCumulativeSizeBeforeRank(i));
11671167

11681168
/* Create the array xadjPar, which contains the number of edges for each
11691169
vertex of the graph in ParMETIS format. */

0 commit comments

Comments
 (0)