MeshKit
1.0
|
00001 #ifndef MESHKIT_SIZINGFUNCTION_HPP 00002 #define MESHKIT_SIZINGFUNCTION_HPP 00003 00004 #include "meshkit/Types.hpp" 00005 #include "meshkit/MKCore.hpp" 00006 00007 namespace MeshKit { 00008 00009 class MKCore; 00010 00018 class SizingFunction 00019 { 00020 public: 00021 00023 SizingFunction(const SizingFunction &sf); 00024 00026 SizingFunction(MKCore *mkcore, int num_int = -1, double int_size = -1.0); 00027 00029 virtual ~SizingFunction(); 00030 00032 MKCore *mk_core() const; 00033 00038 virtual double size(double *xyz = NULL) const; 00039 00041 virtual int intervals() const; 00042 00046 virtual void intervals(int num_int); 00047 00049 virtual unsigned int core_index() const; 00050 00051 // a marker for var size or not; by default false; implemented by SizingFunctionVar -> true 00052 virtual bool variable() {return false;} 00053 00054 protected: 00056 MKCore *mkCore; 00057 00059 int thisInterval; 00060 00062 double thisSize; 00063 00065 unsigned int coreIndex; 00066 00067 private: 00068 00069 }; 00070 00072 inline SizingFunction::SizingFunction(const SizingFunction &sf) 00073 : mkCore(sf.mk_core()), thisInterval(sf.intervals()), thisSize(sf.size()) 00074 { 00075 coreIndex = mkCore->add_sizing_function(this); 00076 } 00077 00079 inline SizingFunction::SizingFunction(MKCore *mkcore, int num_int, double int_size) 00080 : mkCore(mkcore), thisInterval(num_int), thisSize(int_size) 00081 { 00082 coreIndex = mkCore->add_sizing_function(this); 00083 } 00084 00086 inline SizingFunction::~SizingFunction() 00087 { 00088 mkCore->remove_sizing_function(coreIndex, false); 00089 } 00090 00092 inline MKCore *SizingFunction::mk_core() const 00093 { 00094 return mkCore; 00095 } 00096 00098 inline double SizingFunction::size(double *) const 00099 { 00100 return thisSize; 00101 } 00102 00104 inline int SizingFunction::intervals() const 00105 { 00106 return thisInterval; 00107 } 00108 00110 inline void SizingFunction::intervals(int num_int) 00111 { 00112 thisInterval = num_int; 00113 } 00114 00116 inline unsigned int SizingFunction::core_index() const 00117 { 00118 return coreIndex; 00119 } 00120 00121 } // namespace MeshKit 00122 00123 #endif 00124 00125