added: calculate grid parameters in ASMs3DLag without using spline object

This commit is contained in:
Arne Morten Kvarving 2020-07-07 12:24:23 +02:00
parent 8e26a3903a
commit 67e18c1288
2 changed files with 42 additions and 0 deletions

View File

@ -1054,3 +1054,39 @@ void ASMs3DLag::generateThreadGroups (char lIndex, bool, bool)
threadGroupsFace[lIndex].calcGroups(d1,d2,1);
threadGroupsFace[lIndex].applyMap(map);
}
bool ASMs3DLag::getGridParameters (RealArray& prm, int dir, int nSegPerSpan) const
{
if (svol)
return this->ASMs3D::getGridParameters(prm, dir, nSegPerSpan);
if (nSegPerSpan < 1)
{
std::cerr <<" *** ASMs3DLag::getGridParameters: Too few knot-span points "
<< nSegPerSpan+1 <<" in direction "<< dir << std::endl;
return false;
}
int nel1 = dir == 0 ? (nx-1)/(p1-1) : (dir == 1 ? (ny-1)/(p2-1) : (nz-1)/(p3-1));
double ucurr = 0.0, uprev = 0.0, du = 1.0 / nel;
for (int i = 0; i < nel1; ++i)
{
ucurr += du;
if (ucurr > uprev)
if (nSegPerSpan == 1)
prm.push_back(uprev);
else for (int j = 0; j < nSegPerSpan; j++)
{
double xg = (double)(2*j-nSegPerSpan)/(double)nSegPerSpan;
prm.push_back(0.5*(ucurr*(1.0+xg) + uprev*(1.0-xg)));
}
uprev = ucurr;
}
if (ucurr > prm.back())
prm.push_back(ucurr);
return true;
}

View File

@ -72,6 +72,12 @@ public:
//! \param[in] inod 1-based node index local to current patch
virtual Vec3 getCoord(size_t inod) const;
//! \brief Calculates parameter values for visualization nodal points.
//! \param[out] prm Parameter values in given direction for all points
//! \param[in] dir Parameter direction (0,1,2)
//! \param[in] nSegSpan Number of visualization segments over each knot-span
virtual bool getGridParameters(RealArray& prm, int dir, int nSegSpan) const;
protected:
//! \brief Assigned global coordinates for the given node.
//! \param[in] inod 1-based node index local to current patch