CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

Square.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: Square.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $
00003 #include "CLHEP/GenericFunctions/Square.hh"
00004 #include "CLHEP/GenericFunctions/Variable.hh"
00005 #include <assert.h>
00006 
00007 namespace Genfun {
00008 FUNCTION_OBJECT_IMP(Square)
00009 
00010 Square::Square()
00011 {}
00012 
00013 Square::Square(const Square & right) : AbsFunction(right)
00014 {
00015 }
00016 
00017 Square::~Square() {
00018 }
00019 
00020 double Square::operator() (double x) const {
00021   return x*x;
00022 }
00023 
00024 // don't generate warnings about unused parameter inside assert
00025 #if defined __GNUC__ 
00026   #if __GNUC__ > 3 && __GNUC_MINOR__ > 6
00027     #pragma GCC diagnostic push
00028     #pragma GCC diagnostic ignored "-Wunused-parameter"
00029   #endif
00030 #endif
00031 #ifdef __clang__
00032   #pragma clang diagnostic push
00033   #pragma clang diagnostic ignored "-Wunused-parameter"
00034 #endif
00035 Derivative Square::partial(unsigned int index) const {
00036   assert(index==0);
00037   Variable x;
00038   const AbsFunction & fPrime = 2*x;
00039   return Derivative(&fPrime);
00040 }
00041 #if defined __GNUC__ 
00042   #if __GNUC__ > 3 && __GNUC_MINOR__ > 6
00043     #pragma GCC diagnostic pop
00044   #endif
00045 #endif
00046 #ifdef __clang__
00047   #pragma clang diagnostic pop
00048 #endif
00049 
00050 } // namespace Genfun

Generated on 2 Dec 2014 for CLHEP by  doxygen 1.6.1