diff --git a/src/ASM/LR/ASMu2Dmx.C b/src/ASM/LR/ASMu2Dmx.C index d167777c..ec28eae4 100644 --- a/src/ASM/LR/ASMu2Dmx.C +++ b/src/ASM/LR/ASMu2Dmx.C @@ -668,3 +668,22 @@ bool ASMu2Dmx::refine (const LR::RefineData& prm, return true; } + + +Vec3 ASMu2Dmx::getCoord (size_t inod) const +{ + size_t b = 0; + size_t nbb = 0; + while (nbb + nb[b] < inod && b < nb.size()) + nbb += nb[b++]; + ++b; + + const LR::Basisfunction* basis = this->getBasis(b)->getBasisfunction(inod-nbb-1); + if (!basis) { + std::cerr << "Asked to get coordinate for node " << inod + << ", but only have " << this->getBasis(b)->nBasisFunctions() + << " nodes in basis " << b << std::endl; + return Vec3(); + } + return Vec3(&(*basis->cp()),nsd); +} diff --git a/src/ASM/LR/ASMu2Dmx.h b/src/ASM/LR/ASMu2Dmx.h index 5b7e48c9..df3bebc1 100644 --- a/src/ASM/LR/ASMu2Dmx.h +++ b/src/ASM/LR/ASMu2Dmx.h @@ -72,6 +72,9 @@ public: //! \brief Returns the classification of a node. //! \param[in] inod 1-based node index local to current patch virtual char getNodeType(size_t inod) const; + //! \brief Returns the global coordinates for the given node. + //! \param[in] inod 1-based node index local to current patch + virtual Vec3 getCoord(size_t inod) const; //! \brief Initializes the patch level MADOF array for mixed problems. virtual void initMADOF(const int* sysMadof);