void DiffSideBySidePanel::PrepareViews()
{
    // Prepare the views by selecting the proper syntax highlight
    wxFileName fnLeft(m_filePickerLeft->GetPath());
    wxFileName fnRight(m_filePickerRight->GetPath());

    bool useRightSideLexer = false;
    if(fnLeft.GetExt() == "svn-base") {
        // doing svn diff, use the lexer for the right side file
        useRightSideLexer = true;
    }

    LexerConf::Ptr_t leftLexer =
        EditorConfigST::Get()->GetLexerForFile(useRightSideLexer ? fnRight.GetFullName() : fnLeft.GetFullName());
    wxASSERT(leftLexer);

    LexerConf::Ptr_t rightLexer = EditorConfigST::Get()->GetLexerForFile(fnRight.GetFullName());
    wxASSERT(rightLexer);

    leftLexer->Apply(m_stcLeft, true);
    rightLexer->Apply(m_stcRight, true);

    // Create the markers we need
    DefineMarkers(m_stcLeft);
    DefineMarkers(m_stcRight);

    // Turn off PP highlighting
    m_stcLeft->SetProperty("lexer.cpp.track.preprocessor", "0");
    m_stcLeft->SetProperty("lexer.cpp.update.preprocessor", "0");

    m_stcRight->SetProperty("lexer.cpp.track.preprocessor", "0");
    m_stcRight->SetProperty("lexer.cpp.update.preprocessor", "0");
}
void DirichletPoisson<T>::generate(IMathMatrix<T>& A, MathVector<T>& b) const
{
  int xdir, ydir;
  T h = length / numDivs;
  for (int x = 1; x < numDivs; ++x)
  {
    for (int y = 1; y < numDivs; ++y)
    {
      int pointOffset = getPointOffset(x, y);
      A(pointOffset, pointOffset) = 1;

      // Check the left direction point
      xdir = x - 1;
      ydir = y;
      if (xdir == 0)
      {
        // Update the b for the current point
        b[pointOffset] += 0.25*(fnLeft(yLow + ydir*h));
      }
      else
      {
        // Update A at [currentpoint][directionPoint] = -1/4
        A(pointOffset, getPointOffset(xdir, ydir)) = -0.25;
      }

      // Check the right direction point
      xdir = x + 1;
      if (xdir == numDivs)
      {
        // Update the b for the current point
        b[pointOffset] += 0.25*(fnRight(yLow + ydir*h));
      }
      else
      {
        A(pointOffset, getPointOffset(xdir, ydir)) = -0.25;
      }
      
      // Check the up direction point
      xdir = x;
      ydir = y + 1;
      if (ydir == numDivs)
      {
        b[pointOffset] += 0.25*(fnHigh(xLow + xdir*h));
      }
      else
      {
        A(pointOffset, getPointOffset(xdir, ydir)) = -0.25;
      }

      // Check the down direction point
      ydir = y - 1;
      if (ydir == 0)
      {
        b[pointOffset] += 0.25*(fnLow(xLow + xdir*h));
      }
      else
      {
        A(pointOffset, getPointOffset(xdir, ydir)) = -0.25;
      }

      // Subtract the forcing function from b
      b[pointOffset] -= ((h*h)*(fnForce(xLow + x*h, yLow + y*h)))/4.0;
    }
  }
}