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: MassOperator.hpp,v 1.7 2006/07/20 19:08:54 delpinux Exp $ 00019 00020 00021 #ifndef MASS_OPERATOR_HPP 00022 #define MASS_OPERATOR_HPP 00023 00024 #include <PDEOperator.hpp> 00025 00034 class MassOperator 00035 : public PDEOperator 00036 { 00037 private: 00038 ConstReferenceCounting<ScalarFunctionBase> 00039 __Alpha; 00041 public: 00047 std::string typeName() const 00048 { 00049 return "MassOperator"; 00050 } 00051 00057 ConstReferenceCounting<ScalarFunctionBase> 00058 alpha() const 00059 { 00060 return __Alpha; 00061 } 00062 00070 ConstReferenceCounting<PDEOperator> 00071 operator*(const ConstReferenceCounting<ScalarFunctionBase>& c) const 00072 { 00073 ScalarFunctionBuilder functionBuilder; 00074 functionBuilder.setFunction(__Alpha); 00075 functionBuilder.setBinaryOperation(BinaryOperation::product,c); 00076 return new MassOperator(functionBuilder.getBuiltFunction()); 00077 } 00078 00084 ConstReferenceCounting<PDEOperator> 00085 operator-() const 00086 { 00087 ScalarFunctionBuilder functionBuilder; 00088 functionBuilder.setFunction(__Alpha); 00089 functionBuilder.setUnaryMinus(); 00090 return new MassOperator(functionBuilder.getBuiltFunction()); 00091 } 00092 00098 MassOperator(ConstReferenceCounting<ScalarFunctionBase> alpha) 00099 : PDEOperator(PDEOperator::massop, 00100 1), 00101 __Alpha(alpha) 00102 { 00103 ; 00104 } 00105 00111 MassOperator(const MassOperator& M) 00112 : PDEOperator(M), 00113 __Alpha(M.__Alpha) 00114 { 00115 ; 00116 } 00117 00122 ~MassOperator() 00123 { 00124 ; 00125 } 00126 }; 00127 00128 #endif // MASS_OPERATOR_HPP
1.5.6