changed: introduce a method to obtain first node on integration basis
use this in ASMsxD::getElementCoordinates. we can then reuse this method in ASMsxDmx
This commit is contained in:
@@ -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++)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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++)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user