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: InsideExpression.hpp,v 1.2 2003/05/04 18:09:01 delpinux Exp $ 00019 00020 #ifndef INSIDE_EXPRESSION_HPP 00021 #define INSIDE_EXPRESSION_HPP 00022 00023 #include <Expression.hpp> 00024 #include <Vector3Expression.hpp> 00025 00026 #include <TinyVector.hpp> 00038 class InsideExpression 00039 : public Expression 00040 { 00041 private: 00042 ReferenceCounting<Vector3Expression> __reference; 00044 const bool __inside; 00053 std::ostream& put(std::ostream& os) const 00054 { 00055 if (__inside) { 00056 os << "inside("; 00057 } else { 00058 os << "outside("; 00059 } 00060 os << *__reference; 00061 os << ')'; 00062 00063 return os; 00064 } 00065 public: 00066 00073 const TinyVector<3> reference() const 00074 { 00075 TinyVector<3> x; 00076 for (size_t i=0; i<3; ++i) 00077 x[i] = (*__reference).value(i); 00078 00079 return x; 00080 } 00081 00086 void execute() 00087 { 00088 (*__reference).execute(); 00089 } 00090 00097 const bool& inside() const 00098 { 00099 return __inside; 00100 } 00101 00109 InsideExpression(const bool inside, 00110 ReferenceCounting<Vector3Expression> ref) 00111 : Expression(Expression::insideExpression), 00112 __reference(ref), 00113 __inside(inside) 00114 { 00115 ; 00116 } 00117 00124 InsideExpression(const InsideExpression& IE) 00125 : Expression(IE), 00126 __reference(IE.__reference), 00127 __inside(IE.__inside) 00128 { 00129 ; 00130 } 00131 00136 ~InsideExpression() 00137 { 00138 ; 00139 } 00140 }; 00141 00142 #endif // INSIDE_EXPRESSION_HPP
1.5.6