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: DivMuGrad.hpp,v 1.4 2007/05/20 23:02:47 delpinux Exp $ 00019 00020 // Implement the - div(µ·grad(·)) operator, in the domain. 00021 // using finit differences on a Structured3DMesh 00022 00023 #ifndef DIV_MU_GRAD_HPP 00024 #define DIV_MU_GRAD_HPP 00025 00026 #include <PDEOperator.hpp> 00027 #include <ScalarFunctionBase.hpp> 00028 #include <ScalarFunctionBuilder.hpp> 00029 00052 class DivMuGrad 00053 : public PDEOperator 00054 { 00055 ConstReferenceCounting<ScalarFunctionBase> 00056 __mu; 00058 public: 00066 ConstReferenceCounting<ScalarFunctionBase> 00067 coefficient(const size_t& i) 00068 { 00069 ASSERT (i<1); 00070 return __mu; 00071 } 00072 00078 std::string typeName() const 00079 { 00080 return "DivMuGrad"; 00081 } 00082 00088 ConstReferenceCounting<ScalarFunctionBase> 00089 mu() const 00090 { 00091 return __mu; 00092 } 00093 00101 ConstReferenceCounting<PDEOperator> 00102 operator*(const ConstReferenceCounting<ScalarFunctionBase>& c) const 00103 { 00104 ScalarFunctionBuilder functionBuilder; 00105 functionBuilder.setFunction(__mu); 00106 functionBuilder.setBinaryOperation(BinaryOperation::product,c); 00107 return new DivMuGrad(functionBuilder.getBuiltFunction()); 00108 } 00109 00115 ConstReferenceCounting<PDEOperator> 00116 operator-() const 00117 { 00118 ScalarFunctionBuilder functionBuilder; 00119 functionBuilder.setFunction(__mu); 00120 functionBuilder.setUnaryMinus(); 00121 return new DivMuGrad(functionBuilder.getBuiltFunction()); 00122 } 00123 00129 DivMuGrad(ConstReferenceCounting<ScalarFunctionBase> mu) 00130 : PDEOperator(PDEOperator::divmugrad, 00131 1), 00132 __mu(mu) 00133 { 00134 ; 00135 } 00136 00142 DivMuGrad(const DivMuGrad& D) 00143 : PDEOperator(D), 00144 __mu(D.__mu) 00145 { 00146 ; 00147 } 00148 00153 ~DivMuGrad() 00154 { 00155 ; 00156 } 00157 }; 00158 00159 #endif // DIV_MU_GRAD_HPP
1.5.6