00001 #ifdef CH_LANG_CC 00002 /* 00003 * _______ __ 00004 * / ___/ / ___ __ _ / / ___ 00005 * / /__/ _ \/ _ \/ V \/ _ \/ _ \ 00006 * \___/_//_/\___/_/_/_/_.__/\___/ 00007 * Please refer to Copyright.txt, in Chombo's root directory. 00008 */ 00009 #endif 00010 00011 #ifndef _TENSORFINESTENCILSET_H_ 00012 #define _TENSORFINESTENCILSET_H_ 00013 00014 #include "SPACE.H" 00015 #include <stdlib.h> 00016 #include "IntVectSet.H" 00017 #include "ProblemDomain.H" 00018 #include "QuadCFStencil.H" 00019 #include "NamespaceHeader.H" 00020 00021 /// Class to encapsulate fine-level tangential gradient stencil computation 00022 /** This is a helper class which essentially wraps three IntVectSets which 00023 define which type of stencil to use in computing fine-level tangential 00024 gradients. This is only relevant in the presence of a physical boundary 00025 (since the only place where the fine-level stencil is shifted is at a 00026 physical boundary; in a periodic world, all differences are centered.) 00027 */ 00028 class TensorFineStencilSet 00029 { 00030 public: 00031 /// constructors, destructors, defines 00032 00033 /// default constructor -- leaves class in undefined state 00034 TensorFineStencilSet(); 00035 00036 /// full constructor -- defines stencil IntVectSets 00037 TensorFineStencilSet(const IntVectSet& a_fineIVS, 00038 const ProblemDomain& a_domain, 00039 int a_normalDir); 00040 00041 /// destructor 00042 ~TensorFineStencilSet(); 00043 00044 /// define function 00045 void define(const IntVectSet& a_fineIVS, 00046 const ProblemDomain& a_domain, 00047 int a_dir); 00048 00049 /// accessor 00050 /** accessor -- returns cells where fine-level tangential gradient 00051 in a_tanDir direction will use a centered-difference stencil. If 00052 a_tanDir is normal to the face (i.e, isn't a tangential direction 00053 after all), will return an empty IntVectSet. 00054 */ 00055 const IntVectSet& getCenteredStencilSet(int a_tanDir) const; 00056 00057 /// accessor 00058 /** accessor -- returns cells where fine-level tangential gradient 00059 in a_tanDir will use a forward-difference stencil. If a_tanDir 00060 is normal to the face (i.e. it isn't a tangential direction 00061 after all), will return an empty IntVectSet. 00062 */ 00063 const IntVectSet& getForwardStencilSet(int a_tanDir) const; 00064 00065 /// accessor 00066 /** accessor -- returns cells where fine-level tangential gradient 00067 in a_tanDir will use a backward-difference stencil. If a_tanDir 00068 is normal to the face, will return an empty IntVectSet. 00069 */ 00070 const IntVectSet& getBackwardStencilSet(int a_tanDir) const; 00071 00072 /// has this object been defined? 00073 bool isDefined() const; 00074 00075 /// does this contain any non-empty IntVectSets? 00076 bool isEmpty() const; 00077 00078 protected: 00079 /// 00080 bool m_isDefined; 00081 00082 /// 00083 bool m_isEmpty; 00084 00085 /// 00086 int m_normalDir; 00087 00088 #if CH_SPACEDIM == 1 00089 /// 00090 int m_tangentialDirections[SpaceDim]; 00091 #else 00092 /// 00093 int m_tangentialDirections[SpaceDim-1]; 00094 #endif 00095 00096 /// cells which will use centered diffs 00097 #if CH_SPACEDIM == 1 00098 IntVectSet m_centeredSet[SpaceDim]; 00099 #else 00100 IntVectSet m_centeredSet[SpaceDim-1]; 00101 #endif 00102 00103 #if CH_SPACEDIM == 1 00104 /// cells which will use forward diffs 00105 IntVectSet m_forwardSet[SpaceDim]; 00106 #else 00107 IntVectSet m_forwardSet[SpaceDim-1]; 00108 #endif 00109 00110 /// cells which will use backward diffs 00111 #if CH_SPACEDIM == 1 00112 IntVectSet m_backwardSet[SpaceDim]; 00113 #else 00114 IntVectSet m_backwardSet[SpaceDim-1]; 00115 #endif 00116 00117 }; 00118 00119 #include "NamespaceFooter.H" 00120 #endif 00121