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: FunctionExpressionVariable.cpp,v 1.8 2007/08/14 14:37:44 delpinux Exp $ 00019 00020 #include <FunctionExpressionVariable.hpp> 00021 #include <ScalarFunctionBase.hpp> 00022 00023 #include <VariableRepository.hpp> 00024 00025 std::ostream& 00026 FunctionExpressionVariable:: 00027 put(std::ostream& os) const 00028 { 00029 os << __functionName; 00030 if (StreamCenter::instance().getDebugLevel() > 3) { 00031 os << '{' << (*__scalarFunction) << '}'; 00032 } 00033 return os; 00034 } 00035 00036 ConstReferenceCounting<FunctionVariable> 00037 FunctionExpressionVariable:: 00038 variable() const 00039 { 00040 return __functionVariable; 00041 } 00042 00043 ReferenceCounting<FunctionVariable> 00044 FunctionExpressionVariable:: 00045 variable() 00046 { 00047 return __functionVariable; 00048 } 00049 00050 void FunctionExpressionVariable:: 00051 execute() 00052 { 00053 __functionVariable = VariableRepository::instance().findVariable<FunctionVariable>(__functionName); 00054 __functionVariable->expression()->execute(); 00055 00056 __scalarFunction = __functionVariable->expression()->function(); 00057 00058 ScalarFunctionBase& function 00059 = const_cast<ScalarFunctionBase&>(*__scalarFunction); 00060 function.setName(__functionVariable->name()); 00061 } 00062 00063 FunctionExpressionVariable:: 00064 FunctionExpressionVariable(const std::string& functionName, 00065 const ScalarDiscretizationTypeBase::Type& discretizationType) 00066 : FunctionExpression(FunctionExpression::variable), 00067 __functionName(functionName), 00068 __functionVariable(0), 00069 __discretizationType(discretizationType) 00070 { 00071 ; 00072 } 00073 00074 FunctionExpressionVariable:: 00075 FunctionExpressionVariable(const FunctionExpressionVariable& f) 00076 : FunctionExpression(f), 00077 __functionName(f.__functionName), 00078 __functionVariable(f.__functionVariable), 00079 __discretizationType(f.__discretizationType) 00080 { 00081 ; 00082 } 00083 00084 FunctionExpressionVariable:: 00085 ~FunctionExpressionVariable() 00086 { 00087 ; 00088 }
1.5.6