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: FunctionExpressionSpectral.cpp,v 1.2 2007/04/29 19:19:36 yakoubix Exp $ 00019 00020 #include <FunctionExpressionSpectral.hpp> 00021 00022 #include <MeshExpression.hpp> 00023 #include <Information.hpp> 00024 00025 #include <SpectralFunction.hpp> 00026 #include <ScalarFunctionBase.hpp> 00027 00028 #include <Mesh.hpp> 00029 00030 #include <ErrorHandler.hpp> 00031 00032 void FunctionExpressionSpectral:: 00033 execute() 00034 { 00035 __mesh->execute(); 00036 00037 Information::instance().setMesh(__mesh->mesh()); 00038 00039 if (__mesh->mesh()->type() != Mesh::spectralMesh) { 00040 throw ErrorHandler(__FILE__,__LINE__, 00041 "cannot built spectral function on non spectral mesh", 00042 ErrorHandler::normal); 00043 } 00044 00045 const Mesh* mesh = __mesh->mesh(); 00046 ConstReferenceCounting<SpectralMesh> smesh 00047 = dynamic_cast<const SpectralMesh*>(mesh); 00048 00049 SpectralFunction* s = new SpectralFunction(smesh); 00050 if (__functionExpression != 0) { 00051 __functionExpression->execute(); 00052 00053 (*s) = *(__functionExpression->function()); 00054 } 00055 00056 00057 __scalarFunction = s; 00058 00059 // function has now been evaluated. 00060 __functionExpression = 0; 00061 Information::instance().unsetMesh(); 00062 } 00063 00064 FunctionExpressionSpectral:: 00065 FunctionExpressionSpectral(ReferenceCounting<MeshExpression> mesh, 00066 ReferenceCounting<FunctionExpression> function) 00067 : FunctionExpression(FunctionExpression::spectral), 00068 __mesh(mesh), 00069 __functionExpression(function) 00070 { 00071 ; 00072 } 00073 00074 FunctionExpressionSpectral:: 00075 FunctionExpressionSpectral(const FunctionExpressionSpectral& spectralFunction) 00076 : FunctionExpression(spectralFunction), 00077 __mesh(spectralFunction.__mesh), 00078 __functionExpression(spectralFunction.__functionExpression) 00079 { 00080 ; 00081 } 00082 00083 FunctionExpressionSpectral:: 00084 ~FunctionExpressionSpectral() 00085 { 00086 ; 00087 }
1.5.6