00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _OUTPUTAMRMULTIGRIDINSPECTOR_H_
00012 #define _OUTPUTAMRMULTIGRIDINSPECTOR_H_
00013
00014 #include "AMRMultiGrid.H"
00015 #include "NamespaceHeader.H"
00016
00017
00018
00019
00020 template <class T>
00021 class OutputAMRMultiGridInspector: public AMRMultiGridInspector<T>
00022 {
00023 public:
00024
00025
00026
00027
00028
00029 OutputAMRMultiGridInspector(const std::string& a_name,
00030 AMRMultiGrid<T>& a_solver)
00031 :AMRMultiGridInspector<T>(),
00032 m_name(a_name),
00033 m_solver(&a_solver)
00034 {
00035 }
00036
00037
00038 ~OutputAMRMultiGridInspector()
00039 {
00040 }
00041
00042
00043 void recordResiduals(const Vector<T*>& a_residuals,
00044 int a_minLevel,
00045 int a_maxLevel,
00046 int a_iter)
00047 {
00048 char name[1024];
00049 snprintf(name, 1024, "%s.residual.iter.%d", m_name.c_str(), a_iter);
00050 std::string nameStr(name);
00051 m_solver->outputAMR(const_cast<Vector<T*>&>(a_residuals), nameStr,
00052 a_maxLevel, a_minLevel);
00053 }
00054
00055 void recordCorrections(const Vector<T*>& a_corrections,
00056 int a_minLevel,
00057 int a_maxLevel,
00058 int a_iter)
00059 {
00060 char name[1024];
00061 snprintf(name, 1024, "%s.correction.iter.%d", m_name.c_str(), a_iter);
00062 std::string nameStr(name);
00063 m_solver->outputAMR(const_cast<Vector<T*>&>(a_corrections), nameStr,
00064 a_maxLevel, a_minLevel);
00065 }
00066
00067 private:
00068
00069 std::string m_name;
00070 AMRMultiGrid<T>* m_solver;
00071 };
00072
00073 #include "NamespaceFooter.H"
00074 #endif