From 9b4078cbe3f75d247352db9dcde1d2136ab68bac Mon Sep 17 00:00:00 2001 From: Anna Wellmann <a.wellmann@tu-braunschweig.de> Date: Tue, 31 Aug 2021 13:03:25 +0200 Subject: [PATCH] Use new method in findFluidNodeIndices --- src/gpu/GridGenerator/grid/GridImp.cu | 34 ++++++++------------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/src/gpu/GridGenerator/grid/GridImp.cu b/src/gpu/GridGenerator/grid/GridImp.cu index f25a88f2b..895d77b42 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; } -- GitLab