Ejemplo n.º 1
0
void CycleFASDirichletDebug::Generate()
{
    CommandList* init = new CommandList();
    CommandList* loop = new CommandList();
    CommandList* finalize = new CommandList();

    const int min_level = MG::GetInterface()->MinLevel();
    const int max_level = MG::GetInterface()->MaxLevel();

    init->AddCommand("ClearGrid", "RHS");
    init->AddCommand("ClearGrid", "SOL");
    init->AddCommand("ImportRightHandSide");
    init->AddCommand("ForceDiscreteCompatibility");
    init->AddCommand("CheckConsistency", "RHS");
    init->AddCommand("CopyBoundary", "RHS:SOL");
    init->AddCommand("InitializeIterationCounter");
    init->AddCommand("InitializeResidualNorm", "INITIAL_RESIDUAL");
    init->AddCommand("PrintAllSettings");

    AddCycleDebug(*loop, max_level-min_level+1, gamma);

    loop->AddCommand("ComputeResidualNorm", "RESIDUAL");
    loop->AddCommand("CheckResidual", "RESIDUAL");
    loop->AddCommand("CheckRelativeResidual", "RESIDUAL:INITIAL_RESIDUAL");
    loop->AddCommand("CheckIterationCounter");

    finalize->AddCommand("ExportSolution");

    init->Register("COMMANDLIST_INIT");
    loop->Register("COMMANDLIST_LOOP");
    finalize->Register("COMMANDLIST_FINALIZE");
}
Ejemplo n.º 2
0
void Cycle::AddCycleDebug(CommandList& list, int numLevels, int gamma)
{
  for (int i=0; i<numLevels-1; i++) {
    list.AddCommand("PrintGrid", "RHS");
    list.AddCommand("Smooth", "PRESMOOTHSTEPS");
    list.AddCommand("PrintGrid", "SOL");
    list.AddCommand("PrintDefect");
    list.AddCommand("Restrict");
  }

  list.AddCommand("PrintGrid", "RHS");
  list.AddCommand("Solve");
  list.AddCommand("PrintGrid", "SOL");
  list.AddCommand("PrintDefect");

  for (int i=1; i<gamma; i++) {

    for (int j=0; j<numLevels-2; j++) {

      for (int k=0; k<=j; k++) {
        list.AddCommand("Prolongate");
        list.AddCommand("PrintGrid", "RHS");
        list.AddCommand("Smooth", "PRESMOOTHSTEPS");
        list.AddCommand("PrintGrid", "SOL");
        list.AddCommand("PrintDefect");
      }

      for (int k=0; k<=j; k++) {
        list.AddCommand("PrintGrid", "RHS");
        list.AddCommand("Smooth", "PRESMOOTHSTEPS");
        list.AddCommand("PrintGrid", "SOL");
        list.AddCommand("PrintDefect");
        list.AddCommand("Restrict");
      }

      list.AddCommand("PrintGrid", "RHS");
      list.AddCommand("Solve");
      list.AddCommand("PrintGrid", "SOL");
      list.AddCommand("PrintDefect");

    }

    for (int j=numLevels-4; j>=0; j--) {

      for (int k=0; k<=j; k++) {
        list.AddCommand("Prolongate");
        list.AddCommand("PrintGrid", "RHS");
        list.AddCommand("Smooth", "POSTSMOOTHSTEPS");
        list.AddCommand("PrintGrid", "SOL");
        list.AddCommand("PrintDefect");
      }

      for (int k=0; k<=j; k++) {
        list.AddCommand("PrintGrid", "RHS");
        list.AddCommand("Smooth", "PRESMOOTHSTEPS");
        list.AddCommand("PrintGrid", "SOL");
        list.AddCommand("PrintDefect");
        list.AddCommand("Restrict");
      }

      list.AddCommand("PrintGrid", "RHS");
      list.AddCommand("Solve");
      list.AddCommand("PrintGrid", "SOL");
      list.AddCommand("PrintDefect");
    }

  }

  for (int i=0; i<numLevels-1; i++) {
    list.AddCommand("Prolongate");
    list.AddCommand("PrintGrid", "RHS");
    list.AddCommand("Smooth", "POSTSMOOTHSTEPS");
    list.AddCommand("PrintGrid", "SOL");
    list.AddCommand("PrintDefect");
  }
}