00001 #ifndef CONTOURFITTINGTRANSFORMATION_H 00002 #define CONTOURFITTINGTRANSFORMATION_H 00003 00004 #include "SundanceDefs.h" 00005 00006 #include "Expr.h" 00007 #include "Mesh.h" 00008 #include "TSFSmartPtr.h" 00009 #include "TSFTimeMonitor.h" 00010 #include "MeshTransformation.h" 00011 00012 00013 namespace Sundance 00014 { 00015 00016 using namespace TSF; 00017 using std::string; 00018 00019 using std::ostream; 00020 00021 /** 00022 *\ingroup Geometry 00023 * Transforms a mesh so that the level curve f(x)=0 lies on cell edges. 00024 * For any original cell that is intersected by the curve, displace points 00025 * to lie on the curve. 00026 */ 00027 00028 class ContourFittingTransformation : public MeshTransformationBase 00029 { 00030 public: 00031 /** */ 00032 ContourFittingTransformation(const Expr& f, 00033 const string& insideLabel, 00034 const string& outsideLabel); 00035 00036 /** */ 00037 virtual ~ContourFittingTransformation() {;} 00038 00039 /** */ 00040 virtual void transform(Mesh& mesh) const ; 00041 00042 /** */ 00043 virtual void undo(Mesh& mesh) const ; 00044 00045 /** */ 00046 static Point displaceTowards(const Point& xA, 00047 const Point& xB, 00048 const double& fA, 00049 const double& fB); 00050 protected: 00051 Expr f_; 00052 string insideLabel_; 00053 string outsideLabel_; 00054 mutable TSFArray<Point> old_; 00055 00056 }; 00057 00058 00059 00060 } 00061 #endif