diff --git a/src/ASM/ASMs2D.C b/src/ASM/ASMs2D.C index 2c3d0280..1ac5dfdb 100644 --- a/src/ASM/ASMs2D.C +++ b/src/ASM/ASMs2D.C @@ -2626,7 +2626,6 @@ void ASMs2D::generateThreadGroups (size_t strip1, size_t strip2, for (size_t i = 0; i < threadGroups.size(); i++) { std::vector< std::set > nodes(threadGroups[i].size()); - std::set::const_iterator nit; std::cout <<"\n Thread group "<< i+1; for (size_t j = 0; j < threadGroups[i].size(); j++) @@ -2645,19 +2644,9 @@ void ASMs2D::generateThreadGroups (size_t strip1, size_t strip2, } if (nzeroar > 0) std::cout <<" ("<< threadGroups[i][j].size() - nzeroar <<" real)"; -#if SP_DEBUG > 1 - nit = nodes[j].begin(); - std::cout <<"\n\t nodes: "<< *(nit++); - for (k = 1; nit != nodes[j].end(); ++nit, k++) - std::cout << (k%10 > 0 ? " " : "\n\t ") << *nit; -#endif + // Verify that the nodes on this thread are not present on the others - for (k = 0; k < j; k++) - for (nit = nodes[j].begin(); nit != nodes[j].end(); ++nit) - if ((this->getLMType(*nit+1) != 'G' || !ignoreGlobalLM) && - nodes[k].find(*nit) != nodes[k].end()) - std::cout <<"\n ** Warning: Node "<< *nit <<" is present on both" - <<" thread "<< k+1 <<" and thread "<< j+1; + this->checkThreadGroups(nodes, j, ignoreGlobalLM); } } std::cout << std::endl; diff --git a/src/ASM/ASMs3D.C b/src/ASM/ASMs3D.C index 896fcbe4..8534e89c 100644 --- a/src/ASM/ASMs3D.C +++ b/src/ASM/ASMs3D.C @@ -3014,7 +3014,6 @@ void ASMs3D::generateThreadGroups (size_t strip1, size_t strip2, size_t strip3, for (size_t i = 0; i < threadGroupsVol.size(); i++) { std::vector< std::set > nodes(threadGroupsVol[i].size()); - std::set::const_iterator nit; std::cout <<"\n Thread group "<< i+1; for (size_t j = 0; j < threadGroupsVol[i].size(); j++) @@ -3033,19 +3032,9 @@ void ASMs3D::generateThreadGroups (size_t strip1, size_t strip2, size_t strip3, } if (nzerovol) std::cout <<" ("<< threadGroupsVol[i][j].size() - nzerovol <<" real)"; -#if SP_DEBUG > 1 - nit = nodes[j].begin(); - std::cout <<"\n\t nodes: "<< *(nit++); - for (k = 1; nit != nodes[j].end(); ++nit, k++) - std::cout << (k%10 > 0 ? " " : "\n\t ") << *nit; -#endif + // Verify that the nodes on this thread are not present on the others - for (k = 0; k < j; k++) - for (nit = nodes[j].begin(); nit != nodes[j].end(); ++nit) - if ((this->getLMType(*nit+1) != 'G' || !ignoreGlobalLM) && - nodes[k].find(*nit) != nodes[k].end()) - std::cout <<"\n ** Warning: Node "<< *nit <<" is present on both" - <<" thread "<< k+1 <<" and thread "<< j+1; + this->checkThreadGroups(nodes, j, ignoreGlobalLM); } } std::cout << std::endl; diff --git a/src/ASM/ASMstruct.C b/src/ASM/ASMstruct.C index 17d6d1bc..a7347874 100644 --- a/src/ASM/ASMstruct.C +++ b/src/ASM/ASMstruct.C @@ -84,3 +84,27 @@ bool ASMstruct::addXNodes (unsigned short int dim, size_t nXn, IntVec& nodes) return true; } + + +bool ASMstruct::checkThreadGroups (const std::vector>& nodes, + int group, bool ignoreGlobalLM) +{ +#if SP_DEBUG > 1 + auto nit = nodes[group].begin(); + std::cout <<"\n\t nodes: "<< *(nit++); + for (int k = 1; nit != nodes[group].end(); ++nit, k++) + std::cout << (k%10 > 0 ? " " : "\n\t ") << *nit; +#endif + + bool ok = true; + for (int k = 0; k < group; k++) + for (const int& node : nodes[group]) + if ((this->getLMType(node+1) != 'G' || !ignoreGlobalLM) && + nodes[k].find(node) != nodes[k].end()) { + std::cout <<"\n ** Warning: Node "<< node <<" is present on both" + <<" thread "<< k+1 <<" and thread "<< group+1; + ok = false; + } + + return ok; +} diff --git a/src/ASM/ASMstruct.h b/src/ASM/ASMstruct.h index 1add04d0..efc265e6 100644 --- a/src/ASM/ASMstruct.h +++ b/src/ASM/ASMstruct.h @@ -76,6 +76,15 @@ protected: //! of the dimension-specific sub-classes. bool addXNodes(unsigned short int dim, size_t nXn, IntVec& nodes); + //! \brief Perform a sanity check on the thread groups. + //! \param[in] nodes The nodes to santiy check + //! \param[in] group The group to check for + //! \param[in] ignoreGlobalLM If \e true, ignore global lagrange multipliers + //! \return If \e true groups pass checks. + //! \details This checks that no nodes exist on several threads + bool checkThreadGroups(const std::vector>& nodes, + int group, bool ignoreGlobalLM); + protected: Go::GeomObject* geo; //!< Pointer to the actual spline geometry object