Main Page   Namespace List   Class Hierarchy   Compound List   File List   Header Files   Sources   Namespace Members   Compound Members   File Members  

func.cpp

00001 //$Header: /home/ben/Mapper/c++/RCS/func.cpp,v 6.3 2002/06/14 22:28:47 ben Exp $
00002 // Copyright Benedict Adamson 2002.
00003 // This file is part of Mapper.
00004 
00005 // Mapper is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 2 of the License, or
00008 // (at your option) any later version.
00009 
00010 // Mapper is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 
00015 // You should have received a copy of the GNU General Public License
00016 // along with Mapper; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00027 #include "func.h"
00028 #include "vector_math.h"
00029 
00030 
00031 
00032 func::projection::projection(
00033    const vector<double> &ix0,
00034    const vector<double> &idxdt,
00035    const multi_dimensional *f
00036    )
00037    :
00038    x0( ix0 ),
00039    dxdt( idxdt ),
00040    multi_dimensional_function( f )
00041 {
00042    {//postconditions:
00043       assert( this->x0 == ix0 );
00044       assert( this->dxdt == idxdt );
00045       assert( this->multi_dimensional_function == f );
00046    };
00047 }
00048 
00049 
00050 
00051 func::projection::~projection(void)
00052 {
00053    //Do nothing
00054 }
00055 
00056 
00057 
00058 vector< double > func::projection::line(
00059    const double t
00060    ) const
00061 {
00062    return x0 + t*dxdt;
00063 }
00064 
00065 
00066 
00067 
00068 double func::projection::operator() (
00069    const double t
00070    ) const
00071 {
00072    {//preconditions:
00073       assert( this->multi_dimensional_function );
00074    };
00075    //(*this)( t ) == (*(this->multi_dimensional_function))( x0 + t*dxdt );
00076    const multi_dimensional &f(
00077       *(this->multi_dimensional_function)
00078       );
00079    vector<double> xt( this->line( t ) );
00080    return f( xt );
00081 }

Generated at Sun Jul 14 20:38:08 2002 for Mapper by doxygen 1.0.0 written by Dimitri van Heesch, © 1997-1999