Chombo + EB + MF  3.2
OutputAMRMultiGridInspector.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _OUTPUTAMRMULTIGRIDINSPECTOR_H_
12 #define _OUTPUTAMRMULTIGRIDINSPECTOR_H_
13 
14 #include "AMRMultiGrid.H"
15 #include "NamespaceHeader.H"
16 
17 //! \class OutputAMRMultiGridInspector
18 //! This subclass of AMRMultiGridInspector simply writes output files
19 //! containing residuals and corrections at each multigrid iteration.
20 template <class T>
22 {
23  public:
24 
25  //! Create an AMRMultiGridInspector that inspects the given AMRMultiGrid solver and
26  //! generates output files containing intermediate data.
27  //! a_name The name of the inspector. This gets prepended to the output files.
28  //! a_solver The AMRMultiGrid solver with which this inspector is associated.
29  OutputAMRMultiGridInspector(const std::string& a_name,
30  AMRMultiGrid<T>& a_solver)
32  m_name(a_name),
33  m_solver(&a_solver)
34  {
35  }
36 
37  //! Destructor.
39  {
40  }
41 
42  // Overridden methods.
43  void recordResiduals(const Vector<T*>& a_residuals,
44  int a_minLevel,
45  int a_maxLevel,
46  int a_iter)
47  {
48  char name[1024];
49  snprintf(name, 1024, "%s.residual.iter.%d", m_name.c_str(), a_iter);
50  std::string nameStr(name);
51  m_solver->outputAMR(const_cast<Vector<T*>&>(a_residuals), nameStr,
52  a_maxLevel, a_minLevel);
53  }
54 
55  void recordCorrections(const Vector<T*>& a_corrections,
56  int a_minLevel,
57  int a_maxLevel,
58  int a_iter)
59  {
60  char name[1024];
61  snprintf(name, 1024, "%s.correction.iter.%d", m_name.c_str(), a_iter);
62  std::string nameStr(name);
63  m_solver->outputAMR(const_cast<Vector<T*>&>(a_corrections), nameStr,
64  a_maxLevel, a_minLevel);
65  }
66 
67  private:
68 
69  std::string m_name;
71 };
72 
73 #include "NamespaceFooter.H"
74 #endif
AMRMultiGrid< T > * m_solver
Definition: OutputAMRMultiGridInspector.H:70
~OutputAMRMultiGridInspector()
Destructor.
Definition: OutputAMRMultiGridInspector.H:38
Definition: AMRMultiGrid.H:308
const char * name(const FArrayBox &a_dummySpecializationArg)
Definition: CH_HDF5.H:907
OutputAMRMultiGridInspector(const std::string &a_name, AMRMultiGrid< T > &a_solver)
Definition: OutputAMRMultiGridInspector.H:29
Definition: OutputAMRMultiGridInspector.H:21
Definition: AMRMultiGrid.H:259
std::string m_name
Definition: OutputAMRMultiGridInspector.H:69
void recordResiduals(const Vector< T *> &a_residuals, int a_minLevel, int a_maxLevel, int a_iter)
Definition: OutputAMRMultiGridInspector.H:43
void recordCorrections(const Vector< T *> &a_corrections, int a_minLevel, int a_maxLevel, int a_iter)
Definition: OutputAMRMultiGridInspector.H:55