-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// Author : Anthony Geay (CEA/DEN)
#include "InterpKernelFunction.hxx"
#include "InterpKernelValue.hxx"
const char TanFunction::REPR[]="tan";
+const char ACosFunction::REPR[]="acos";
+
+const char ASinFunction::REPR[]="asin";
+
+const char ATanFunction::REPR[]="atan";
+
+const char CoshFunction::REPR[]="cosh";
+
+const char SinhFunction::REPR[]="sinh";
+
+const char TanhFunction::REPR[]="tanh";
+
const char SqrtFunction::REPR[]="sqrt";
const char AbsFunction::REPR[]="abs";
const char IfFunction::REPR[]="if";
-Function *FunctionsFactory::buildFuncFromString(const char *type, int nbOfParams) throw(INTERP_KERNEL::Exception)
+Function *FunctionsFactory::buildFuncFromString(const char *type, int nbOfParams)
{
switch(nbOfParams)
{
}
}
-Function *FunctionsFactory::buildUnaryFuncFromString(const char *type) throw(INTERP_KERNEL::Exception)
+Function *FunctionsFactory::buildUnaryFuncFromString(const char *type)
{
std::string tmp(type);
if(tmp.empty())
return new SinFunction;
if(tmp==TanFunction::REPR)
return new TanFunction;
+ if(tmp==ACosFunction::REPR)
+ return new ACosFunction;
+ if(tmp==ASinFunction::REPR)
+ return new ASinFunction;
+ if(tmp==ATanFunction::REPR)
+ return new ATanFunction;
+ if(tmp==CoshFunction::REPR)
+ return new CoshFunction;
+ if(tmp==SinhFunction::REPR)
+ return new SinhFunction;
+ if(tmp==TanhFunction::REPR)
+ return new TanhFunction;
if(tmp==SqrtFunction::REPR)
return new SqrtFunction;
if(tmp==AbsFunction::REPR)
throw INTERP_KERNEL::Exception(msg.c_str());
}
-Function *FunctionsFactory::buildBinaryFuncFromString(const char *type) throw(INTERP_KERNEL::Exception)
+Function *FunctionsFactory::buildBinaryFuncFromString(const char *type)
{
std::string tmp(type);
if(tmp==PositiveFunction::REPR)
throw INTERP_KERNEL::Exception(msg.c_str());
}
-Function *FunctionsFactory::buildTernaryFuncFromString(const char *type) throw(INTERP_KERNEL::Exception)
+Function *FunctionsFactory::buildTernaryFuncFromString(const char *type)
{
std::string tmp(type);
if(tmp==IfFunction::REPR)
throw INTERP_KERNEL::Exception(msg.c_str());
}
-Function *FunctionsFactory::buildBinaryFuncFromString(char type) throw(INTERP_KERNEL::Exception)
+Function *FunctionsFactory::buildBinaryFuncFromString(char type)
{
char tmp[2]; tmp[0]=type; tmp[1]='\0';
return buildBinaryFuncFromString(tmp);
{
}
-void IdentityFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void IdentityFunction::operate(std::vector<Value *>& stack) const
{
}
-void IdentityFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void IdentityFunction::operateX86(std::vector<std::string>& asmb) const
{
}
return 1;
}
-void PositiveFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void PositiveFunction::operate(std::vector<Value *>& stack) const
{
}
-void PositiveFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void PositiveFunction::operateX86(std::vector<std::string>& asmb) const
{
}
{
}
-void NegateFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void NegateFunction::operate(std::vector<Value *>& stack) const
{
Value *val=stack.back();
val->negate();
}
-void NegateFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void NegateFunction::operateX86(std::vector<std::string>& asmb) const
{
asmb.push_back("fchs");
}
{
}
-void CosFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void CosFunction::operate(std::vector<Value *>& stack) const
{
Value *val=stack.back();
val->cos();
}
-void CosFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void CosFunction::operateX86(std::vector<std::string>& asmb) const
{
asmb.push_back("fcos");
}
{
}
-void SinFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void SinFunction::operate(std::vector<Value *>& stack) const
{
Value *val=stack.back();
val->sin();
}
-void SinFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void SinFunction::operateX86(std::vector<std::string>& asmb) const
{
asmb.push_back("fsin");
}
{
}
-void TanFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void TanFunction::operate(std::vector<Value *>& stack) const
{
Value *val=stack.back();
val->tan();
}
-void TanFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void TanFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
return true;
}
+ACosFunction::~ACosFunction()
+{
+}
+
+void ACosFunction::operate(std::vector<Value *>& stack) const
+{
+ Value *val=stack.back();
+ val->acos();
+}
+
+void ACosFunction::operateX86(std::vector<std::string>& asmb) const
+{
+ throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
+}
+
+const char *ACosFunction::getRepr() const
+{
+ return REPR;
+}
+
+bool ACosFunction::isACall() const
+{
+ return true;
+}
+
+ASinFunction::~ASinFunction()
+{
+}
+
+void ASinFunction::operate(std::vector<Value *>& stack) const
+{
+ Value *val=stack.back();
+ val->asin();
+}
+
+void ASinFunction::operateX86(std::vector<std::string>& asmb) const
+{
+ throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
+}
+
+const char *ASinFunction::getRepr() const
+{
+ return REPR;
+}
+
+bool ASinFunction::isACall() const
+{
+ return true;
+}
+
+ATanFunction::~ATanFunction()
+{
+}
+
+void ATanFunction::operate(std::vector<Value *>& stack) const
+{
+ Value *val=stack.back();
+ val->atan();
+}
+
+void ATanFunction::operateX86(std::vector<std::string>& asmb) const
+{
+ throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
+}
+
+const char *ATanFunction::getRepr() const
+{
+ return REPR;
+}
+
+bool ATanFunction::isACall() const
+{
+ return true;
+}
+
+CoshFunction::~CoshFunction()
+{
+}
+
+void CoshFunction::operate(std::vector<Value *>& stack) const
+{
+ Value *val=stack.back();
+ val->cosh();
+}
+
+void CoshFunction::operateX86(std::vector<std::string>& asmb) const
+{
+ throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
+}
+
+const char *CoshFunction::getRepr() const
+{
+ return REPR;
+}
+
+bool CoshFunction::isACall() const
+{
+ return true;
+}
+
+SinhFunction::~SinhFunction()
+{
+}
+
+void SinhFunction::operate(std::vector<Value *>& stack) const
+{
+ Value *val=stack.back();
+ val->sinh();
+}
+
+void SinhFunction::operateX86(std::vector<std::string>& asmb) const
+{
+ throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
+}
+
+const char *SinhFunction::getRepr() const
+{
+ return REPR;
+}
+
+bool SinhFunction::isACall() const
+{
+ return true;
+}
+
+TanhFunction::~TanhFunction()
+{
+}
+
+void TanhFunction::operate(std::vector<Value *>& stack) const
+{
+ Value *val=stack.back();
+ val->tanh();
+}
+
+void TanhFunction::operateX86(std::vector<std::string>& asmb) const
+{
+ throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
+}
+
+const char *TanhFunction::getRepr() const
+{
+ return REPR;
+}
+
+bool TanhFunction::isACall() const
+{
+ return true;
+}
+
SqrtFunction::~SqrtFunction()
{
}
-void SqrtFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void SqrtFunction::operate(std::vector<Value *>& stack) const
{
Value *val=stack.back();
val->sqrt();
}
-void SqrtFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void SqrtFunction::operateX86(std::vector<std::string>& asmb) const
{
asmb.push_back("fsqrt");
}
{
}
-void AbsFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void AbsFunction::operate(std::vector<Value *>& stack) const
{
Value *val=stack.back();
val->abs();
}
-void AbsFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void AbsFunction::operateX86(std::vector<std::string>& asmb) const
{
asmb.push_back("fabs");
}
return false;
}
-void ExpFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void ExpFunction::operate(std::vector<Value *>& stack) const
{
Value *val=stack.back();
val->exp();
}
-void ExpFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void ExpFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
{
}
-void LnFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void LnFunction::operate(std::vector<Value *>& stack) const
{
Value *val=stack.back();
val->ln();
}
-void LnFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void LnFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
{
}
-void LogFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void LogFunction::operate(std::vector<Value *>& stack) const
{
Value *val=stack.back();
val->ln();
}
-void LogFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void LogFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly for log Not implemented yet !");
}
{
}
-void Log10Function::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void Log10Function::operate(std::vector<Value *>& stack) const
{
Value *val=stack.back();
val->log10();
}
-void Log10Function::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void Log10Function::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly for log Not implemented yet !");
}
{
}
-void PlusFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void PlusFunction::operate(std::vector<Value *>& stack) const
{
Value *val1=stack.back();
stack.pop_back();
val2=val3;
}
-void PlusFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void PlusFunction::operateX86(std::vector<std::string>& asmb) const
{
asmb.push_back("faddp st1");
}
{
}
-void MinusFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void MinusFunction::operate(std::vector<Value *>& stack) const
{
Value *val1=stack.back();
stack.pop_back();
val2=val3;
}
-void MinusFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void MinusFunction::operateX86(std::vector<std::string>& asmb) const
{
asmb.push_back("fsubp st1");
}
{
}
-void MultFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void MultFunction::operate(std::vector<Value *>& stack) const
{
Value *val1=stack.back();
stack.pop_back();
val2=val3;
}
-void MultFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void MultFunction::operateX86(std::vector<std::string>& asmb) const
{
asmb.push_back("fmulp st1");
}
{
}
-void DivFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void DivFunction::operate(std::vector<Value *>& stack) const
{
Value *val1=stack.back();
stack.pop_back();
val2=val3;
}
-void DivFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void DivFunction::operateX86(std::vector<std::string>& asmb) const
{
asmb.push_back("fdivp st1");
}
{
}
-void PowFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void PowFunction::operate(std::vector<Value *>& stack) const
{
Value *val1=stack.back();
stack.pop_back();
val2=val3;
}
-void PowFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void PowFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
{
}
-void MaxFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void MaxFunction::operate(std::vector<Value *>& stack) const
{
Value *val1=stack.back();
stack.pop_back();
val2=val3;
}
-void MaxFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void MaxFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
{
}
-void MinFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void MinFunction::operate(std::vector<Value *>& stack) const
{
Value *val1=stack.back();
stack.pop_back();
val2=val3;
}
-void MinFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void MinFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
{
}
-void GreaterThanFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void GreaterThanFunction::operate(std::vector<Value *>& stack) const
{
Value *val1=stack.back();
stack.pop_back();
val2=val3;
}
-void GreaterThanFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void GreaterThanFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
{
}
-void LowerThanFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void LowerThanFunction::operate(std::vector<Value *>& stack) const
{
Value *val1=stack.back();
stack.pop_back();
val2=val3;
}
-void LowerThanFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void LowerThanFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}
{
}
-void IfFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+void IfFunction::operate(std::vector<Value *>& stack) const
{
Value *val1=stack.back();
stack.pop_back();
val3=val4;
}
-void IfFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+void IfFunction::operateX86(std::vector<std::string>& asmb) const
{
throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
}