Exemplo n.º 1
0
void CSysMatrix::BuildJacobiPreconditioner(void) {
  
  unsigned long iPoint, iVar, jVar;
  double **invBlock;
  
  /*--- Small nVar x nVar matrix for intermediate computations ---*/
  invBlock = new double* [nVar];
  for (iVar = 0; iVar < nVar; iVar++)
    invBlock[iVar] = new double [nVar];
  
  /*--- Compute Jacobi Preconditioner ---*/
  for (iPoint = 0; iPoint < nPoint; iPoint++) {
    
    /*--- Compute the inverse of the diagonal block ---*/
    InverseDiagonalBlock(iPoint, invBlock);
    
    /*--- Set the inverse of the matrix to the invM structure (which is a vector) ---*/
    for (iVar = 0; iVar < nVar; iVar++)
      for (jVar = 0; jVar < nVar; jVar++)
        invM[iPoint*nVar*nVar+iVar*nVar+jVar] = invBlock[iVar][jVar];
  }
  
  for (iVar = 0; iVar < nVar; iVar++)
    delete [] invBlock[iVar];
  delete [] invBlock;
  
}
Exemplo n.º 2
0
void CSysMatrix::BuildJacobiPreconditioner(void) {
  
  unsigned long iPoint, iVar, jVar;
  
  /*--- Compute Jacobi Preconditioner ---*/
  for (iPoint = 0; iPoint < nPoint; iPoint++) {
    
    /*--- Compute the inverse of the diagonal block ---*/
    InverseDiagonalBlock(iPoint, block_inverse);
    
    /*--- Set the inverse of the matrix to the invM structure (which is a vector) ---*/
    for (iVar = 0; iVar < nVar; iVar++)
      for (jVar = 0; jVar < nVar; jVar++)
        invM[iPoint*nVar*nVar+iVar*nVar+jVar] = block_inverse[iVar*nVar+jVar];
  }
  
}