From 891798e63942553a1d878f10db627c461565306d Mon Sep 17 00:00:00 2001 From: Knut Morten Okstad Date: Sun, 23 Apr 2017 01:30:11 +0200 Subject: [PATCH] Added: protected virtual method to renumber global node numbers in the model. Applications that have private data depending on global node numbers (e.g., nodal point load tables) need to overload this method. --- src/SIM/SIMbase.C | 17 ++++++++++++++--- src/SIM/SIMbase.h | 3 +++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/SIM/SIMbase.C b/src/SIM/SIMbase.C index 0d1132f6..994ce581 100644 --- a/src/SIM/SIMbase.C +++ b/src/SIM/SIMbase.C @@ -246,9 +246,9 @@ bool SIMbase::preprocess (const IntVec& ignored, bool fixDup) if (renum > 0) IFEM::cout <<"\nRenumbered "<< renum <<" nodes."<< std::endl; - for (mit = myModel.begin(); mit != myModel.end(); ++mit) - (*mit)->renumberNodes(*g2l); - ASMs2DC1::renumberNodes(*g2l); + // Apply the old-to-new node number mapping to all node tables in the model + if (!this->renumberNodes(*g2l)) + return false; // Perform specialized preprocessing before the assembly initialization. // This typically involves the system-level Lagrange multipliers, etc. @@ -368,6 +368,17 @@ bool SIMbase::preprocess (const IntVec& ignored, bool fixDup) } +bool SIMbase::renumberNodes (const std::map& nodeMap) +{ + bool ok = true; + for (PatchVec::const_iterator it = myModel.begin(); it != myModel.end(); ++it) + ok &= (*it)->renumberNodes(nodeMap); + + ASMs2DC1::renumberNodes(nodeMap); + return ok; +} + + void SIMbase::generateThreadGroups (const Property& p, bool silence) { ASMbase* pch = this->getPatch(p.patch); diff --git a/src/SIM/SIMbase.h b/src/SIM/SIMbase.h index 1bf73dcd..f398a469 100644 --- a/src/SIM/SIMbase.h +++ b/src/SIM/SIMbase.h @@ -480,6 +480,9 @@ protected: virtual bool preprocessB() { return true; } //! \brief Preprocesses the result sampling points. virtual void preprocessResultPoints() = 0; + //! \brief Renumbers all global node numbers if the model. + //! \param[in] nodeMap Mapping from old to new node number + virtual bool renumberNodes(const std::map& nodeMap); //! \brief Extracts all local solution vector(s) for a specified patch. //! \param[in] problem Integrand to receive the patch-level solution vectors