diff --git a/src/gpu/GridGenerator/grid/GridImp.cu b/src/gpu/GridGenerator/grid/GridImp.cu index f25a88f2bc90b47f8ac0c0443de1b73f506514c6..895d77b42d477b914d97f186c537d6f6300acd3b 100644 --- a/src/gpu/GridGenerator/grid/GridImp.cu +++ b/src/gpu/GridGenerator/grid/GridImp.cu @@ -863,33 +863,22 @@ CUDA_HOST void GridImp::findFluidNodeIndices(bool splitDomain) { findFluidNodeIndicesBorder(); this->fluidNodeIndices.clear(); - this->fluidNodeIndicesBorder.clear(); for (uint index = 0; index < this->size; index++) { int sparseIndex = this->getSparseIndex(index); if (sparseIndex == -1) continue; + if (this->field.isFluid(index)) + this->fluidNodeIndices.push_back((uint)sparseIndex+1); + } - // + 1 for numbering shift between GridGenerator and VF_GPU - // When splitDomain: push indices of fluid nodes in bulk to "fluidNodeIndices" and push indices of special fluid nodes (not in bulk) to fluidNodeIndicesBorder - // When not splitDomain: push indices of all fluid nodes to "fluidNodeIndices" - //if (this->field.isFluid(index)) { - // this->fluidNodeIndices.push_back((uint)sparseIndex + 1); - //} - - if (this->field.isFluid(index)) { - if (splitDomain) - //if (this->field.isFluidNodeOfSpecialInterest(index)) - if (this->isSendNode(index)) - this->fluidNodeIndicesBorder.push_back((uint)sparseIndex + 1); - else - this->fluidNodeIndices.push_back((uint)sparseIndex + 1); - else - this->fluidNodeIndices.push_back((uint)sparseIndex + 1); - } + // If splitDomain: remove all indices in fluidNodeIndicesBorder from fluidNodeIndices + if (splitDomain) { + std::sort(this->fluidNodeIndices.begin(), this->fluidNodeIndices.end()); + auto it = std::set_difference(this->fluidNodeIndices.begin(), this->fluidNodeIndices.end(), + this->fluidNodeIndicesBorder.begin(), this->fluidNodeIndicesBorder.end(), + this->fluidNodeIndices.begin()); + this->fluidNodeIndices.resize(it - this->fluidNodeIndices.begin()); } - std::sort(this->fluidNodeIndicesBorder.begin(), this->fluidNodeIndicesBorder.end()); - printf("old size: %i \n", this->fluidNodeIndicesBorder.size()); - printf("old: %i \n", this->fluidNodeIndicesBorder.back()); } void GridImp::findFluidNodeIndicesBorder() { @@ -902,7 +891,6 @@ void GridImp::findFluidNodeIndicesBorder() { for (CommunicationIndices& ci : this->communicationIndices) std::copy(ci.sendIndices.begin(), ci.sendIndices.end(), std::back_inserter(this->fluidNodeIndicesBorder)); - printf("new size 1: %i \n", this->fluidNodeIndicesBorder.size()); // remove duplicate elements std::sort(this->fluidNodeIndicesBorder.begin(), this->fluidNodeIndicesBorder.end()); @@ -911,8 +899,6 @@ void GridImp::findFluidNodeIndicesBorder() { this->fluidNodeIndicesBorder.end()); // + 1 for numbering shift between GridGenerator and VF_GPU - printf("new size 2: %i \n", this->fluidNodeIndicesBorder.size()); - printf("new: %i \n", this->fluidNodeIndicesBorder.back()); for (size_t i = 0; i < this->fluidNodeIndicesBorder.size(); i++) this->fluidNodeIndicesBorder[i] = this->getSparseIndex(this->fluidNodeIndicesBorder[i])+1; }