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 _LATHEIF_H_ 00012 #define _LATHEIF_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 takes one or two implicit functions and uses them 00025 to produce a generalized surface of revolution. 00026 00027 In 3D, if one function is given, then it is restricted to x >= 0 in the 00028 x-y plane (z = 0), revolved around the y axis, and the y axis is rotated 00029 to the z axis. In 2D, the function is restricted to x >= 0 and the x axis 00030 (y = 0) and revolved around the origin. 00031 00032 In 3D, if two functions are given then the first is restricted to x >= 0 00033 in the x-y plane (z = 0), revolved around the y axis, and the y axis is 00034 rotated to the z axis. At each angle between 0 and 2*Pi, the second 00035 function restricted to the x axis (y = z = 0) is used to get an angle to 00036 rotate the first function in the x-y plane with respect to a given point 00037 before it is rotated about the y axis. In 2D, the first function is used 00038 as above and the second function is ignored. 00039 00040 Note: the second function (if given) should have the same value at x = 0 00041 and x = 2*Pi (y = z = 0) or a values that differs by some integer multiple 00042 of 2*Pi. 00043 */ 00044 class LatheIF: public BaseIF 00045 { 00046 public: 00047 /// 00048 /** 00049 Constructor specifying one implicit function to be rotated and whether 00050 the domain is on the inside (a_inside), i.e. where the function is 00051 negative. 00052 */ 00053 LatheIF(const BaseIF& a_impFunc1, 00054 const bool& a_inside); 00055 00056 /// 00057 /** 00058 Constructor specifying two implicit functions, one to be rotated 00059 and the other to cause an additional rotation about a_point, and 00060 whether the domain is on the inside (a_inside), i.e. where the 00061 function is negative. 00062 */ 00063 LatheIF(const BaseIF& a_impFunc1, 00064 const BaseIF& a_impFunc2, 00065 const RealVect& a_point, 00066 const bool& a_inside); 00067 00068 /// Copy constructor 00069 LatheIF(const LatheIF& a_inputIF); 00070 00071 /// Destructor 00072 virtual ~LatheIF(); 00073 00074 /// 00075 /** 00076 Return the value of the function at a_point. 00077 */ 00078 virtual Real value(const RealVect& a_point) const; 00079 00080 virtual BaseIF* newImplicitFunction() const; 00081 00082 virtual bool fastIntersection(const RealVect& a_low, 00083 const RealVect& a_high)const 00084 { 00085 return false; 00086 // #if CH_SPACEDIM == 3 00087 // if (m_impFunc2 == NULL) 00088 // { 00089 // return true; 00090 // } 00091 // else 00092 // { 00093 // return false; 00094 // } 00095 // #elif CH_SPACEDIM == 2 00096 // return false; 00097 // #else 00098 // MayDay::Abort("need higher dim in LatheIF\n"); 00099 // #endif 00100 } 00101 00102 virtual GeometryService::InOut InsideOutside(const RealVect& a_low, 00103 const RealVect& a_high) const ; 00104 00105 /// 00106 /** 00107 Pass this call onto the IFs contained in this IF class. 00108 */ 00109 virtual void boxLayoutChanged(const DisjointBoxLayout & a_newBoxLayout, 00110 const RealVect & a_dx) 00111 { 00112 m_impFunc1->boxLayoutChanged(a_newBoxLayout,a_dx); 00113 00114 if (m_impFunc2 != NULL) 00115 { 00116 m_impFunc2->boxLayoutChanged(a_newBoxLayout,a_dx); 00117 } 00118 } 00119 00120 protected: 00121 BaseIF* m_impFunc1; // implicit function to rotate 00122 BaseIF* m_impFunc2; // implicit function to use for rotation 00123 00124 RealVect m_point; // point for center of second rotation 00125 00126 bool m_inside; // inside flag 00127 00128 private: 00129 LatheIF() 00130 { 00131 MayDay::Abort("LatheIF uses strong construction"); 00132 } 00133 00134 void operator=(const LatheIF& a_inputIF) 00135 { 00136 MayDay::Abort("LatheIF doesn't allow assignment"); 00137 } 00138 }; 00139 00140 #include "NamespaceFooter.H" 00141 #endif