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 _SMOOTHUNION_H_ 00012 #define _SMOOTHUNION_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 min(a,b) = 0.5*(a+b - | a-b |) 00030 */ 00031 class SmoothUnion: public BaseIF 00032 { 00033 public: 00034 00035 /// 00036 /** 00037 Constructor specifying any number of implicit functions as inputs. 00038 */ 00039 SmoothUnion(const Vector<BaseIF*>& a_impFuncs, 00040 const Real & a_delta); 00041 00042 /// Destructor 00043 virtual ~SmoothUnion(); 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 //min(a,b) = 0.5*(a+b - | a-b |) 00059 virtual Real smoothMin(const IntVect & a_deriv, 00060 const RealVect & a_point, 00061 const int & a_closestIF, 00062 const int & a_nextClosestIF) const; 00063 00064 void findClosest(int & a_closestIF, 00065 int & a_nextClosestIF, 00066 int & a_numWithinDelta, 00067 const RealVect & a_point) const; 00068 protected: 00069 int m_numFuncs; // number of implicit functions 00070 Vector<BaseIF*> m_impFuncs; // implicit functions 00071 Real m_delta ; //smoothing length scale 00072 00073 private: 00074 SmoothUnion() 00075 { 00076 MayDay::Abort("SmoothUnion uses strong construction"); 00077 } 00078 00079 SmoothUnion(const SmoothUnion& a_inputIF) 00080 { 00081 MayDay::Abort("SmoothUnion does not have copy construction"); 00082 } 00083 00084 void operator=(const SmoothUnion& a_inputIF) 00085 { 00086 MayDay::Abort("SmoothUnion doesn't allow assignment"); 00087 } 00088 }; 00089 00090 #include "NamespaceFooter.H" 00091 #endif