Ejemplo n.º 1
0
bool ASMs1DSpec::getGridParameters (RealArray& prm, int nSegPerSpan) const
{
  if (!curv) return false;

  // Evaluate the Gauss-Lobatto-Legendre points
  Vector dummy, xGLL;
  if (!Legendre::GLL(dummy,xGLL,curv->order())) return false;

  if (xGLL.size() != (size_t)(nSegPerSpan+1))
  {
    nSegPerSpan = xGLL.size() - 1;
    std::cout <<"Spectral elements: Number of nodes per knot-span reset to "
	      << nSegPerSpan <<" (GLL points)"<< std::endl;
  }

  RealArray::const_iterator uit = curv->basis().begin();
  double ucurr, uprev = *(uit++);
  while (uit != curv->basis().end())
  {
    ucurr = *(uit++);
    if (ucurr > uprev)
      for (int i = 1; i <= nSegPerSpan; i++)
	prm.push_back(0.5*(ucurr-uprev)*(1.0+xGLL(i)) + uprev);
    uprev = ucurr;
  }

  prm.push_back(curv->basis().endparam());
  return true;
}
Ejemplo n.º 2
0
bool ASMs2DSpec::getGridParameters (RealArray& prm, int dir,
				    int nSegPerSpan) const
{
  if (!surf) return false;

  // Evaluate the Gauss-Lobatto-Legendre points in this direction
  Vector dummy, xGLL;
  int p = dir == 0 ? surf->order_u() : surf->order_v();
  if (!Legendre::GLL(dummy,xGLL,p)) return false;

  if (xGLL.size() != (size_t)(nSegPerSpan+1))
  {
    nSegPerSpan = xGLL.size() - 1;
    std::cout <<"Spectral elements: Number of nodes per knot-span in "
	      << char('u'+dir) <<"-directon reset to "<< nSegPerSpan
	      <<" (GLL points)"<< std::endl;
  }

  RealArray::const_iterator uit = surf->basis(dir).begin();
  double uprev = *(uit++);
  while (uit != surf->basis(dir).end())
  {
    double ucurr = *(uit++);
    if (ucurr > uprev)
      for (int i = 1; i <= nSegPerSpan; i++)
	prm.push_back(0.5*(ucurr-uprev)*(1.0+xGLL(i)) + uprev);
    uprev = ucurr;
  }

  prm.push_back(surf->basis(dir).endparam());
  return true;
}