00001 // This file is part of ff3d - http://www.freefem.org/ff3d 00002 // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino 00003 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 2, or (at your option) 00007 // any later version. 00008 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software Foundation, 00016 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 00018 // $Id: FunctionExpressionDerivative.hpp,v 1.2 2006/07/23 22:14:19 delpinux Exp $ 00019 00020 #ifndef FUNCTION_EXPRESSION_DERIVATIVE_HPP 00021 #define FUNCTION_EXPRESSION_DERIVATIVE_HPP 00022 00023 #include <FunctionExpression.hpp> 00024 #include <ErrorHandler.hpp> 00025 00034 class FunctionExpressionDerivative 00035 : public FunctionExpression 00036 { 00037 public: 00038 enum Direction { 00039 x, 00040 y, 00041 z, 00042 undefined 00043 }; 00044 00045 private: 00046 FunctionExpressionDerivative::Direction __direction; 00048 ReferenceCounting<FunctionExpression> __derivedFunction; 00055 bool hasBoundaryExpression() const 00056 { 00057 return __derivedFunction->hasBoundaryExpression(); 00058 } 00059 00067 static FunctionExpressionDerivative::Direction 00068 getDirection(const std::string& name) 00069 { 00070 if (name == "dx") return x; 00071 if (name == "dy") return y; 00072 if (name == "dz") return z; 00073 throw ErrorHandler(__FILE__,__LINE__, 00074 "unknown derivation direction", 00075 ErrorHandler::unexpected); 00076 return undefined; 00077 } 00078 00079 public: 00084 void execute(); 00085 00092 FunctionExpressionDerivative(const std::string& directionName, 00093 ReferenceCounting<FunctionExpression> function); 00094 00100 FunctionExpressionDerivative(const FunctionExpressionDerivative& f); 00101 00106 ~FunctionExpressionDerivative(); 00107 }; 00108 00109 #endif // FUNCTION_EXPRESSION_DERIVATIVE_HPP
1.5.6