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 _SMOOTHINTERSECTION_H_ 00012 #define _SMOOTHINTERSECTION_H_ 00013 00014 #include "MayDay.H" 00015 #include "RealVect.H" 00016 #include "Vector.H" 00017 00018 #include "BaseIF.H" 00019 00020 #include "NamespaceHeader.H" 00021 00022 /// 00023 /** 00024 This implicit function is the maximum of two (of more) implicit 00025 functions with which it is constructed. This results in an implicit 00026 function whose interior is the intersection of the interiors of the given 00027 implicit functions. 00028 For the maximum, it uses the smooth absolute value Ae(a,b) \approx |a-b| 00029 max(a,b) = 0.5*(a+b + | a-b |) 00030 */ 00031 class SmoothIntersection: public BaseIF 00032 { 00033 public: 00034 00035 /// 00036 /** 00037 Constructor specifying any number of implicit functions as inputs. 00038 */ 00039 SmoothIntersection(const Vector<BaseIF*>& a_impFuncs, 00040 const Real & a_delta); 00041 00042 /// Destructor 00043 virtual ~SmoothIntersection(); 00044 00045 /// 00046 /** 00047 Return the value of the function at a_point. 00048 */ 00049 virtual Real value(const RealVect& a_point) const; 00050 00051 /// 00052 virtual Real derivative(const IntVect& a_deriv, 00053 const RealVect& a_point) const; 00054 00055 00056 virtual BaseIF* newImplicitFunction() const; 00057 00058 ///max(a,b) = 0.5*(a+b + | a-b |) 00059 /** 00060 loops through all the functions 00061 */ 00062 virtual Real smoothMax(const IntVect & a_deriv, 00063 const RealVect & a_point, 00064 const int & a_closestIF, 00065 const int & a_nextClosestIF 00066 ) const; 00067 00068 void findClosest(int & a_closestIF, 00069 int & a_nextClosestIF, 00070 int & a_numWithinDelta, 00071 const RealVect & a_point) const; 00072 00073 protected: 00074 int m_numFuncs; // number of implicit functions 00075 Vector<BaseIF*> m_impFuncs; // implicit functions 00076 Real m_delta ; //smoothing length scale 00077 00078 00079 //debug stuff 00080 IntVect m_ivDebug; 00081 Real m_dxDebug; 00082 RealVect m_rvDebug; 00083 00084 00085 00086 private: 00087 SmoothIntersection() 00088 { 00089 MayDay::Abort("SmoothIntersection uses strong construction"); 00090 } 00091 00092 SmoothIntersection(const SmoothIntersection& a_inputIF) 00093 { 00094 MayDay::Abort("SmoothIntersection does not have copy construction"); 00095 } 00096 00097 void operator=(const SmoothIntersection& a_inputIF) 00098 { 00099 MayDay::Abort("SmoothIntersection doesn't allow assignment"); 00100 } 00101 }; 00102 00103 #include "NamespaceFooter.H" 00104 #endif