diff --git a/src/ASM/ASMs2D.C b/src/ASM/ASMs2D.C index 335d8270..9805aa86 100644 --- a/src/ASM/ASMs2D.C +++ b/src/ASM/ASMs2D.C @@ -1336,10 +1336,11 @@ bool ASMs2D::getElementCoordinates (Matrix& X, int iel) const X.resize(nsd,surf->order_u()*surf->order_v()); + int lnod0 = this->getFirstItgElmNode(); RealArray::const_iterator cit = surf->coefs_begin(); for (size_t n = 0; n < X.cols(); n++) { - int ip = this->coeffInd(MNPC[iel-1][n])*surf->dimension(); + int ip = this->coeffInd(MNPC[iel-1][n + lnod0])*surf->dimension(); if (ip < 0) return false; for (size_t i = 0; i < nsd; i++) diff --git a/src/ASM/ASMs2D.h b/src/ASM/ASMs2D.h index a071e90c..1372fc54 100644 --- a/src/ASM/ASMs2D.h +++ b/src/ASM/ASMs2D.h @@ -680,6 +680,8 @@ protected: //! \brief Generates element groups from a partition. virtual void generateThreadGroupsFromElms(const IntVec& elms); + //! \brief Returns 0-based index of first node on integration basis. + virtual int getFirstItgElmNode() const { return 0; } //! \brief Returns 0-based index of last node on integration basis. virtual int getLastItgElmNode() const; diff --git a/src/ASM/ASMs2Dmx.C b/src/ASM/ASMs2Dmx.C index 4e6191a3..2202189f 100644 --- a/src/ASM/ASMs2Dmx.C +++ b/src/ASM/ASMs2Dmx.C @@ -371,42 +371,6 @@ void ASMs2Dmx::closeBoundaries (int dir, int, int) } -bool ASMs2Dmx::getElementCoordinates (Matrix& X, int iel) const -{ -#ifdef INDEX_CHECK - if (iel < 1 || (size_t)iel > MNPC.size()) - { - std::cerr <<" *** ASMs2Dmx::getElementCoordinates: Element index "<< iel - <<" out of range [1,"<< MNPC.size() <<"]."<< std::endl; - return false; - } -#endif - - size_t nenod = surf->order_u()*surf->order_v(); - size_t lnod0 = 0; - for (int i = 1; i < geoBasis; ++i) - lnod0 += m_basis[i-1]->order_u()*m_basis[i-1]->order_v(); - - X.resize(nsd,nenod); - const IntVec& mnpc = MNPC[iel-1]; - - RealArray::const_iterator cit = surf->coefs_begin(); - for (size_t n = 0; n < nenod; n++) - { - int iI = nodeInd[mnpc[lnod0+n]].I; - int iJ = nodeInd[mnpc[lnod0+n]].J; - int ip = (iJ*surf->numCoefs_u() + iI)*surf->dimension(); - for (size_t i = 0; i < nsd; i++) - X(i+1,n+1) = *(cit+(ip+i)); - } - -#if SP_DEBUG > 2 - std::cout <<"\nCoordinates for element "<< iel << X << std::endl; -#endif - return true; -} - - Vec3 ASMs2Dmx::getCoord (size_t inod) const { if (inod > nodeInd.size() && inod <= MLGN.size()) @@ -1162,6 +1126,12 @@ void ASMs2Dmx::swapProjectionBasis () } +int ASMs2Dmx::getFirstItgElmNode () const +{ + return std::accumulate(elem_size.begin(), elem_size.begin() + geoBasis-1, 0); +} + + int ASMs2Dmx::getLastItgElmNode () const { return std::accumulate(elem_size.begin(), elem_size.begin() + geoBasis, -1); diff --git a/src/ASM/ASMs2Dmx.h b/src/ASM/ASMs2Dmx.h index 002c8369..9cdf393e 100644 --- a/src/ASM/ASMs2Dmx.h +++ b/src/ASM/ASMs2Dmx.h @@ -65,12 +65,6 @@ public: //! This is used to reinitialize the patch after it has been refined. virtual void clear(bool retainGeometry); - //! \brief Returns a matrix with nodal coordinates for an element. - //! \param[in] iel Element index - //! \param[out] X 3\f$\times\f$n-matrix, where \a n is the number of nodes - //! in one element - virtual bool getElementCoordinates(Matrix& X, int iel) 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; @@ -229,6 +223,8 @@ public: int thick, int, bool local) const; protected: + //! \brief Returns 0-based index of first node on integration basis. + virtual int getFirstItgElmNode() const; //! \brief Returns 0-based index of last node on integration basis. virtual int getLastItgElmNode() const; diff --git a/src/ASM/ASMs3D.C b/src/ASM/ASMs3D.C index 6620568a..b41ee3e0 100644 --- a/src/ASM/ASMs3D.C +++ b/src/ASM/ASMs3D.C @@ -1603,11 +1603,12 @@ bool ASMs3D::getElementCoordinates (Matrix& X, int iel) const #endif X.resize(3,svol->order(0)*svol->order(1)*svol->order(2)); + int lnod0 = this->getFirstItgElmNode(); RealArray::const_iterator cit = svol->coefs_begin(); for (size_t n = 0; n < X.cols(); n++) { - int ip = this->coeffInd(MNPC[iel-1][n])*svol->dimension(); + int ip = this->coeffInd(MNPC[iel-1][n + lnod0])*svol->dimension(); if (ip < 0) return false; for (size_t i = 0; i < 3; i++) diff --git a/src/ASM/ASMs3D.h b/src/ASM/ASMs3D.h index 5582ceb5..fa09a7a2 100644 --- a/src/ASM/ASMs3D.h +++ b/src/ASM/ASMs3D.h @@ -747,6 +747,8 @@ protected: void generateThreadGroups(size_t strip1, size_t strip2, size_t strip3, bool silence, bool ignoreGlobalLM); + //! \brief Returns 0-based index of first node on integration basis. + virtual int getFirstItgElmNode() const { return 0; } //! \brief Returns 0-based index of last node on integration basis. virtual int getLastItgElmNode() const; diff --git a/src/ASM/ASMs3Dmx.C b/src/ASM/ASMs3Dmx.C index b77ae0e9..2225c4fe 100644 --- a/src/ASM/ASMs3Dmx.C +++ b/src/ASM/ASMs3Dmx.C @@ -1278,6 +1278,12 @@ void ASMs3Dmx::swapProjectionBasis () } +int ASMs3Dmx::getFirstItgElmNode () const +{ + return std::accumulate(elem_size.begin(), elem_size.begin() + geoBasis-1, 0); +} + + int ASMs3Dmx::getLastItgElmNode () const { return std::accumulate(elem_size.begin(), elem_size.begin() + geoBasis, -1); diff --git a/src/ASM/ASMs3Dmx.h b/src/ASM/ASMs3Dmx.h index 1bc33264..3276898a 100644 --- a/src/ASM/ASMs3Dmx.h +++ b/src/ASM/ASMs3Dmx.h @@ -218,6 +218,8 @@ public: virtual bool getSize(int& n1, int& n2, int& n3, int basis) const; protected: + //! \brief Returns 0-based index of first node on integration basis. + virtual int getFirstItgElmNode() const; //! \brief Returns 0-based index of last node on integration basis. virtual int getLastItgElmNode() const;