Multigrid extension for NeuroFEM 
  last change: 04.03.2008  

Integration - Code changes

To integrate the new solver into the NeuroFEM package some small changes in the NeuroFEM code are required. Those changes are for the following reasons:
  • Including the fmgsolver header file
  • Private FMG-object variable inside the pebbles class
  • Creating the FMG-object in the prepareSimulator method
  • Using the FMG solver in the forwardSimulation method
All the changes are within only two files and are alltogether just a few additional lines of code. The changes are listed below:
Code from file "neurofem/include/ansimulatoreegmegneurofempebbles_c.h"
#include
#include <../pebbles/pebbles.hh>
#include <../../fmg/fmgsolver.h>
Code from file "neurofem/include/ansimulatoreegmegneurofempebbles_c.h"
class ANALYSIS_EXPORT anSimulatorEEGMEGNeuroFEMpebbles_c : public anAbstractSimulatorEEGMEGNeuroFEM_c
{
  ...
  protected:
  // Member Variables
  RS_AMG::OutBack* m_pebbles_solver;
  FMGSolver* fmgsol;
};
Code from file "neurofem/source/ansimulatoreegmegneurofempebbles_c.cpp"
void anSimulatorEEGMEGNeuroFEMpebbles_c::prepareSimulatorEEGMEGNeuroFEMpebbles()
{
  ...
  else if (m_NeuroFEMSimSettings.m_SolverMethod == 5)
  {
    starttime = cpuclock.GetTime();
    fmgsol = new FMGSolver(VolumeGrid);
    fmgsol->Init(mxkn3d, m_NumberVolumeGridNodes, m_NumberVolumeGridElements, m_vecbgo, m_vecsol);
    cpu_precond = cpuclock.GetTime()- starttime;
    cout << " Time for Matrix-hierarchy construction (in sec.): "
    << cpu_precond << endl << endl;
  }

  ...
}
Code from file "neurofem/source/ansimulatoreegmegneurofempebbles_c.cpp"
void anSimulatorEEGMEGNeuroFEMpebbles_c::forwardSimulation(...)
{
  ...
  else if (m_NeuroFEMSimSettings.m_SolverMethod == 5)
  {
    starttime = cpuclock.GetTime();
    fmgsol->Solve();
    cpu_solver = cpuclock.GetTime()- starttime;
    cout << " Solver time for FMG (in sec.): " << cpu_solver << endl << endl;
  }

  ...
}