Skip to content

Commit

Permalink
xxx split
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-iob committed May 27, 2024
1 parent 3b05b03 commit 31444a2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/LA/system_solvers_split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1607,14 +1607,16 @@ void SplitSystemSolver::generateSplitPermutation(long nItems, IS *permutation) c
std::size_t nElements = blockSize * nItems;

// Create permutations
PetscInt *permutationStorage;
PetscMalloc(nElements * sizeof(PetscInt), &permutationStorage);

PetscInt elementsGlobalOffset;
#if BITPIT_ENABLE_MPI == 1
long elementsGlobalOffset = blockSize * itemsGlobalOffset;
std::fill_n(permutationStorage, nElements, elementsGlobalOffset);
elementsGlobalOffset = static_cast<PetscInt>(blockSize * itemsGlobalOffset);
#else
elementsGlobalOffset = 0;
#endif

PetscInt *permutationStorage;
PetscMalloc(nElements * sizeof(PetscInt), &permutationStorage);

PetscInt *splitPermutationStorage = permutationStorage;
for (int split = 0; split < nSplits; ++split) {
int splitBlockSize = splitBlockSizes[split];
Expand All @@ -1623,7 +1625,7 @@ void SplitSystemSolver::generateSplitPermutation(long nItems, IS *permutation) c
workspace.resize(nSplitElements);
generateSplitIndexes(split, nItems, &workspace);
for (std::size_t k = 0; k < nSplitElements; ++k) {
splitPermutationStorage[k] = static_cast<PetscInt>(workspace[k]);
splitPermutationStorage[k] = elementsGlobalOffset + static_cast<PetscInt>(workspace[k]);

}
splitPermutationStorage += nSplitElements;
Expand Down

0 comments on commit 31444a2

Please sign in to comment.