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: PDE.hpp,v 1.5 2007/05/20 23:02:47 delpinux Exp $ 00019 00020 // This class describes a PDE 00021 00022 #ifndef PDE_HPP 00023 #define PDE_HPP 00024 00025 #include <VectorialPDEOperator.hpp> 00026 #include <ScalarFunctionBuilder.hpp> 00027 #include <ScalarFunctionBase.hpp> 00028 00037 class PDE 00038 { 00039 private: 00040 ConstReferenceCounting<VectorialPDEOperator> 00041 __vectorPDEOperator; 00043 ConstReferenceCounting<ScalarFunctionBase> 00044 __secondMember; 00050 PDE() 00051 { 00052 ; 00053 } 00054 public: 00062 ReferenceCounting<PDE> 00063 operator * (const ConstReferenceCounting<ScalarFunctionBase>& c) const 00064 { 00065 ScalarFunctionBuilder functionBuilder; 00066 functionBuilder.setFunction(__secondMember); 00067 functionBuilder.setBinaryOperation(BinaryOperation::product, 00068 c); 00069 00070 PDE* newPDE = new PDE(); 00071 (*newPDE).__secondMember = functionBuilder.getBuiltFunction(); 00072 00073 (*newPDE).__vectorPDEOperator = (*__vectorPDEOperator) * c; 00074 return newPDE; 00075 } 00076 00083 ConstReferenceCounting<ScalarFunctionBase> 00084 secondMember() const 00085 { 00086 return __secondMember; 00087 } 00088 00097 ConstReferenceCounting<PDEOperatorSum> 00098 operator [] (const size_t& i) const 00099 { 00100 ASSERT (i<(*__vectorPDEOperator).size()); 00101 return (*__vectorPDEOperator)[i]; 00102 } 00103 00111 const PDE& operator = (const PDE& pde) 00112 { 00113 __vectorPDEOperator=pde.__vectorPDEOperator; 00114 __secondMember = pde.__secondMember; 00115 return *this; 00116 } 00117 00126 friend std::ostream& 00127 operator << (std::ostream& os, 00128 const PDE& pde) 00129 { 00130 os << *(pde.__vectorPDEOperator) << " = " << "pde.secondMember" << '\n'; 00131 return os; 00132 } 00133 00140 PDE(ConstReferenceCounting<VectorialPDEOperator> A, 00141 ConstReferenceCounting<ScalarFunctionBase> f) 00142 : __vectorPDEOperator(A), 00143 __secondMember(f) 00144 { 00145 ; 00146 } 00147 00153 PDE(const PDE& pde) 00154 : __vectorPDEOperator(pde.__vectorPDEOperator), 00155 __secondMember(pde.__secondMember) 00156 { 00157 ; 00158 } 00159 00164 ~PDE() 00165 { 00166 ; 00167 } 00168 }; 00169 00170 #endif // PDE_HPP
1.5.6