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: Problem.hpp,v 1.7 2007/11/02 20:03:18 delpinux Exp $ 00019 00020 #ifndef PROBLEM_HPP 00021 #define PROBLEM_HPP 00022 00023 #include <ReferenceCounting.hpp> 00024 #include <Domain.hpp> 00025 00026 class ScalarFunctionBase; 00027 class BoundaryConditionSet; 00028 00037 class Problem 00038 { 00039 public: 00040 enum Type { 00041 pde, 00042 variational 00043 }; 00044 00045 private: 00046 ConstReferenceCounting<Domain> 00047 __omega; 00049 const Problem::Type 00050 __type; 00052 public: 00058 void setDomain(ReferenceCounting<Domain> omega) 00059 { 00060 __omega = omega; 00061 } 00062 00068 const Problem::Type& 00069 type() const 00070 { 00071 return __type; 00072 } 00073 00074 std::string typeName() const 00075 { 00076 switch(__type) { 00077 case pde: { 00078 return "PDE"; 00079 } 00080 case variational: { 00081 return "Variational"; 00082 } 00083 default: { 00084 throw ErrorHandler(__FILE__,__LINE__, 00085 "Unknown problem type name", 00086 ErrorHandler::unexpected); 00087 } 00088 } 00089 return ""; 00090 } 00091 00097 ConstReferenceCounting<Domain> 00098 domain() const 00099 { 00100 return __omega; 00101 } 00102 00108 virtual size_t numberOfUnknown() const = 0; 00109 00117 virtual ReferenceCounting<Problem> 00118 operator*(const ConstReferenceCounting<ScalarFunctionBase>& c) const=0; 00119 00127 virtual const BoundaryConditionSet& 00128 boundaryConditionSet(const size_t& i) const = 0; 00129 00136 Problem(const Problem::Type& t, 00137 ConstReferenceCounting<Domain> omega) 00138 : __omega(omega), 00139 __type(t) 00140 { 00141 ; 00142 } 00143 00149 Problem(const Problem& P) 00150 : __omega(P.__omega), 00151 __type(P.__type) 00152 { 00153 ; 00154 } 00155 00160 virtual ~Problem() 00161 { 00162 ; 00163 } 00164 }; 00165 00166 #endif // PROBLEM_HPP 00167
1.5.6