Salome HOME
Merge branch 'abn/fix_intersec' into V7_main
[tools/medcoupling.git] / src / INTERP_KERNEL / ExprEval / InterpKernelFunction.cxx
index 4979adc058beda2963ace8dd2ba1d9fc5cee44a8..5c8e395ef94fcac5f525f7b0ccd02fc0ffefde5d 100644 (file)
@@ -1,9 +1,9 @@
-// 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
@@ -16,6 +16,7 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+// Author : Anthony Geay (CEA/DEN)
 
 #include "InterpKernelFunction.hxx"
 #include "InterpKernelValue.hxx"
@@ -36,6 +37,18 @@ const char SinFunction::REPR[]="sin";
 
 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";
@@ -68,7 +81,7 @@ const char LowerThanFunction::REPR[]="<";
 
 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)
     {
@@ -83,7 +96,7 @@ Function *FunctionsFactory::buildFuncFromString(const char *type, int nbOfParams
     }
 }
 
-Function *FunctionsFactory::buildUnaryFuncFromString(const char *type) throw(INTERP_KERNEL::Exception)
+Function *FunctionsFactory::buildUnaryFuncFromString(const char *type)
 {
   std::string tmp(type);
   if(tmp.empty())
@@ -94,6 +107,18 @@ Function *FunctionsFactory::buildUnaryFuncFromString(const char *type) throw(INT
     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)
@@ -116,7 +141,7 @@ Function *FunctionsFactory::buildUnaryFuncFromString(const char *type) throw(INT
   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)
@@ -142,7 +167,7 @@ Function *FunctionsFactory::buildBinaryFuncFromString(const char *type) throw(IN
   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)
@@ -152,7 +177,7 @@ Function *FunctionsFactory::buildTernaryFuncFromString(const char *type) throw(I
   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);
@@ -166,11 +191,11 @@ IdentityFunction::~IdentityFunction()
 {
 }
 
-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
 {
 }
 
@@ -193,11 +218,11 @@ int UnaryFunction::getNbInputParams() 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
 {
 }
 
@@ -215,13 +240,13 @@ NegateFunction::~NegateFunction()
 {
 }
 
-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");
 }
@@ -240,13 +265,13 @@ CosFunction::~CosFunction()
 {
 }
 
-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");
 }
@@ -265,13 +290,13 @@ SinFunction::~SinFunction()
 {
 }
 
-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");
 }
@@ -290,13 +315,13 @@ TanFunction::~TanFunction()
 {
 }
 
-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 !");
 }
@@ -311,17 +336,167 @@ bool TanFunction::isACall() const
   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");
 }
@@ -340,13 +515,13 @@ AbsFunction::~AbsFunction()
 {
 }
 
-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");
 }
@@ -361,13 +536,13 @@ bool AbsFunction::isACall() const
   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 !");
 }
@@ -386,13 +561,13 @@ LnFunction::~LnFunction()
 {
 }
 
-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 !");
 }
@@ -411,13 +586,13 @@ LogFunction::~LogFunction()
 {
 }
 
-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 !");
 }
@@ -436,13 +611,13 @@ Log10Function::~Log10Function()
 {
 }
 
-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 !");
 }
@@ -466,7 +641,7 @@ PlusFunction::~PlusFunction()
 {
 }
 
-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();
@@ -486,7 +661,7 @@ void PlusFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNE
   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");
 }
@@ -505,7 +680,7 @@ MinusFunction::~MinusFunction()
 {
 }
 
-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();
@@ -525,7 +700,7 @@ void MinusFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERN
   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");
 }
@@ -544,7 +719,7 @@ MultFunction::~MultFunction()
 {
 }
 
-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();
@@ -555,7 +730,7 @@ void MultFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNE
   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");
 }
@@ -574,7 +749,7 @@ DivFunction::~DivFunction()
 {
 }
 
-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();
@@ -594,7 +769,7 @@ void DivFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL
   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");
 }
@@ -613,7 +788,7 @@ PowFunction::~PowFunction()
 {
 }
 
-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();
@@ -633,7 +808,7 @@ void PowFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL
   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 !");
 }
@@ -656,7 +831,7 @@ MaxFunction::~MaxFunction()
 {
 }
 
-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();
@@ -676,7 +851,7 @@ void MaxFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL
   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 !");
 }
@@ -695,7 +870,7 @@ MinFunction::~MinFunction()
 {
 }
 
-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();
@@ -715,7 +890,7 @@ void MinFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL
   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 !");
 }
@@ -734,7 +909,7 @@ GreaterThanFunction::~GreaterThanFunction()
 {
 }
 
-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();
@@ -754,7 +929,7 @@ void GreaterThanFunction::operate(std::vector<Value *>& stack) const throw(INTER
   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 !");
 }
@@ -773,7 +948,7 @@ LowerThanFunction::~LowerThanFunction()
 {
 }
 
-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();
@@ -793,7 +968,7 @@ void LowerThanFunction::operate(std::vector<Value *>& stack) const throw(INTERP_
   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 !");
 }
@@ -817,7 +992,7 @@ IfFunction::~IfFunction()
 {
 }
 
-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();
@@ -841,7 +1016,7 @@ void IfFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL:
   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 !");
 }