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: ScalarFunctionMaxComputer.cpp,v 1.3 2007/04/25 22:13:12 delpinux Exp $ 00019 00020 #include <ScalarFunctionMaxComputer.hpp> 00021 00022 #include <Mesh.hpp> 00023 #include <ScalarFunctionBase.hpp> 00024 00025 #include <limits> 00026 00027 ScalarFunctionMaxComputer:: 00028 ScalarFunctionMaxComputer(ConstReferenceCounting<Mesh> mesh, 00029 ConstReferenceCounting<ScalarFunctionBase> function) 00030 : __mesh(mesh), 00031 __function(function) 00032 { 00033 __maxValue = std::numeric_limits<real_t>::min(); 00034 00035 const Mesh& m = *__mesh; 00036 const ScalarFunctionBase& f = *__function; 00037 00038 for (size_t i=0; i<m.numberOfVertices(); ++i) { 00039 const Vertex& X = m.vertex(i); 00040 const real_t value = f(X); 00041 __maxValue = std::max(__maxValue,value); 00042 } 00043 } 00044 00045 ScalarFunctionMaxComputer:: 00046 ScalarFunctionMaxComputer(const ScalarFunctionMaxComputer& c) 00047 : __maxValue(c.__maxValue), 00048 __mesh(c.__mesh), 00049 __function(c.__function) 00050 { 00051 ; 00052 } 00053 00054 ScalarFunctionMaxComputer:: 00055 ~ScalarFunctionMaxComputer() 00056 { 00057 ; 00058 }
1.5.6