Chombo + EB  3.2
FixedRefinementImplem.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 _FIXEDREFINEMENTIMPLEM_H_
12 #define _FIXEDREFINEMENTIMPLEM_H_
13 
14 #include "MayDay.H"
15 
16 #include "NamespaceHeader.H"
17 
19 {
20 }
21 
22 template <int dim> FixedRefinement<dim>::FixedRefinement(const int & a_maxNumberOfRefinements)
23 {
24  setMaxNumberOfRefinements(a_maxNumberOfRefinements);
25 }
26 
28 {
29 }
30 
31 template <int dim> bool FixedRefinement<dim>::doRefine(IndexTM<int,dim> & a_refineInDir,
32  const CutCellMoments<dim> & a_ccm,
33  const int & a_numberOfRefinements)
34 {
35  bool retval = false;
36 
37  if (a_numberOfRefinements < m_maxNumberOfRefinements)
38  {
39  retval = true;
40 
41  for (int idir = 0; idir < dim; idir++)
42  {
43  a_refineInDir[idir] = 1;
44  }
45  }
46 
47  return retval;
48 }
49 
50 template <int dim> void FixedRefinement<dim>::setMaxNumberOfRefinements(const int & a_maxNumberOfRefinements)
51 {
52  if (a_maxNumberOfRefinements < 0)
53  {
54  MayDay::Abort("FixedRefinement<dim>::setNumberOfRefinements - maxNumberOfRefinements must be >= 0");
55  }
56 
57  m_maxNumberOfRefinements = a_maxNumberOfRefinements;
58 }
59 
61 {
62  return m_maxNumberOfRefinements;
63 }
64 
65 #include "NamespaceFooter.H"
66 
67 #endif
FixedRefinement()
Null constructor.
Definition: FixedRefinementImplem.H:18
virtual bool doRefine(IndexTM< int, dim > &a_refineInDir, const CutCellMoments< dim > &a_ccm, const int &a_numberOfRefinements)
Refine a fixed number of times.
Definition: FixedRefinementImplem.H:31
Definition: IndexTM.H:36
virtual int getMaxNumberOfRefinements()
Get the number of refinements.
Definition: FixedRefinementImplem.H:60
virtual void setMaxNumberOfRefinements(const int &a_maxNumberOfRefinements)
Set the number of refinements.
Definition: FixedRefinementImplem.H:50
int dim
Definition: EBInterface.H:146
Definition: CutCellMoments.H:32
virtual ~FixedRefinement()
Destructor.
Definition: FixedRefinementImplem.H:27
static void Abort(const char *const a_msg=m_nullString)
Print out message to cerr and exit via abort() (if serial) or MPI_Abort() (if parallel).