/*
    C++ Mesh Generation Library
    Copyright (c) 2000echet <eric at bechet dot ca>

    This file is part of the C++ Mesh Generation Library.

    See the NOTICE & LICENSE files for conditions.
*/
#include "functionals.h"

#include <cmath>


#pragma warning ( disable : 4786 4068 4804 4503 )


Gaussian::Gaussian ( double sigma,double center )
{
  sqsig=2*sigma*sigma;
  cst= ( 1./ ( sqrt ( 2*PI ) *sigma ) );
  cent=center;
}

double Gaussian::operator () ( double x )
{
  double xmcenter= ( x-cent );
  return cst*exp ( -xmcenter*xmcenter/sqsig );
}

Pulse::Pulse ( double sigma,double center )
{
  sig=sigma;
  cent=center;
}

double Pulse::operator () ( double x )
{
  if ( fabs ( x-cent ) <= ( sqrt ( PI/2 ) *sig ) )
  {
    return ( 1./ ( sqrt ( 2*PI ) *sig ) );
  }
  else
  {
    return ( 0. );
  }
}


 
