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: PDEOperatorSumExpression.hpp,v 1.2 2003/05/04 18:09:01 delpinux Exp $ 00019 00020 #ifndef _PDEOPERATORSUM_EXPRESSION_HPP_ 00021 #define _PDEOPERATORSUM_EXPRESSION_HPP_ 00022 00023 #include <list> 00024 00025 #include <Expression.hpp> 00026 #include <PDEOperatorExpression.hpp> 00027 00028 class VectorialPDEOperator; 00029 class PDEOperatorSumExpression 00030 : public Expression 00031 { 00032 protected: 00033 ReferenceCounting<VectorialPDEOperator> __vectorPDEOperator; 00034 00035 typedef std::list<ReferenceCounting<PDEOperatorExpression> > 00036 PDEOperatorExpressionList; 00037 00038 ReferenceCounting<PDEOperatorExpressionList> __sumList; 00039 00040 ReferenceCounting<PDEOperatorExpressionList> __differenceList; 00041 00042 private: 00043 std::ostream& put(std::ostream& os) const 00044 { 00045 for(PDEOperatorExpressionList::const_iterator i = (*__sumList).begin(); 00046 i != (*__sumList).end(); ++i) { 00047 if (i != (*__sumList).begin()) 00048 os << " + "; 00049 os << (*(*i)); 00050 } 00051 for(PDEOperatorExpressionList::const_iterator i = (*__differenceList).begin(); 00052 i != (*__differenceList).end(); ++i) { 00053 os << " - " << (*(*i)); 00054 } 00055 return os; 00056 } 00057 public: 00058 ReferenceCounting<VectorialPDEOperator> vectorPDEOperator(); 00059 00060 void execute(); 00061 00062 void add(ReferenceCounting<PDEOperatorExpression> p) 00063 { 00064 (*__sumList).push_back(p); 00065 } 00066 00067 void minus(ReferenceCounting<PDEOperatorExpression> p) 00068 { 00069 (*__differenceList).push_back(p); 00070 } 00071 00072 void unaryMinus() 00073 { 00074 std::swap(__differenceList,__sumList); 00075 } 00076 00077 void add(ReferenceCounting<PDEOperatorSumExpression> p); 00078 00079 void minus(ReferenceCounting<PDEOperatorSumExpression> p); 00080 00081 PDEOperatorSumExpression(const PDEOperatorSumExpression& e); 00082 00083 PDEOperatorSumExpression(); 00084 00085 virtual ~PDEOperatorSumExpression(); 00086 }; 00087 00088 #endif // _PDEOPERATORSUM_EXPRESSION_HPP_ 00089
1.5.6