Exemplo n.º 1
0
void FEM:: multigrid( double* vector_v, double* vector_b, double* vector_res, const int level, double localstiffness[][4], double localmass[][4], double vector_bc[]){
  
  double zero_bc[2] = {0.0, 0.0};
  if(level > 1)
  {
    int cells = (1<<level);
    
    for(int i = 0; i < 2; ++i)
    {
      GSIteration(vector_v, vector_b, cells, localstiffness, localmass, vector_bc);
    }
    Residual(vector_v, vector_b, vector_res, cells, localstiffness, localmass, vector_bc);
    Restriction(vector_res, vector_b+(cells+1), level);
    multigrid(vector_v + (cells+1), vector_b + (cells+1), vector_res + (cells+1), level-1, localstiffness + cells, localmass + cells, zero_bc);
    Prolongation(vector_res, vector_v + (cells + 1), level);
    Correction(vector_v, vector_res, cells);
    for(int i = 0; i<2; ++i)
    {
      GSIteration(vector_v, vector_b, cells, localstiffness, localmass, vector_bc);
    }
  }
  else
  {
    for(int i = 0; i< 1000; ++i)
      GSIteration(vector_v, vector_b, (1<<level), localstiffness, localmass, vector_bc);
  }
  
} 
Exemplo n.º 2
0
Query::Subexpression Query::Restrict(unsigned int which, RestrictionType rt,
				     uint32_t val)
{
    m_restrictions.push_back(Restriction(which, rt, val));
    return Subexpression((int)m_restrictions.size());
}