From: ageay Date: Mon, 28 Jun 2010 13:20:30 +0000 (+0000) Subject: Permutation of parameters for normalization. X-Git-Tag: V5_1_main_FINAL~108 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=797eb26dc09d43b0b4a00bdcd441ef767d8054b2;p=tools%2Fmedcoupling.git Permutation of parameters for normalization. --- diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx index 5dde84961..90bd5e2c8 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx @@ -228,7 +228,7 @@ DecompositionInUnitBase ExprParser::evaluateUnit() const throw(INTERP_KERNEL::Ex return ret; } -void ExprParser::evaluateExpr(int szOfOutParam, double *outParam, const double *inParam) const throw(INTERP_KERNEL::Exception) +void ExprParser::evaluateExpr(int szOfOutParam, const double *inParam, double *outParam) const throw(INTERP_KERNEL::Exception) { Value *gen=new ValueDoubleExpr(szOfOutParam,inParam); ValueDoubleExpr *res=0; diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.hxx b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.hxx index 032f7070a..eceee0ad3 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.hxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.hxx @@ -80,7 +80,7 @@ namespace INTERP_KERNEL double evaluate() const throw(INTERP_KERNEL::Exception); DecompositionInUnitBase evaluateUnit() const throw(INTERP_KERNEL::Exception); void prepareExprEvaluation(const std::vector& vars) const throw(INTERP_KERNEL::Exception); - void evaluateExpr(int szOfOutParam, double *outParam, const double *inParam) const throw(INTERP_KERNEL::Exception); + void evaluateExpr(int szOfOutParam, const double *inParam, double *outParam) const throw(INTERP_KERNEL::Exception); void prepareExprEvaluationVec() const throw(INTERP_KERNEL::Exception); void getSetOfVars(std::set& vars) const; void getTrueSetOfVars(std::set& vars) const; diff --git a/src/INTERP_KERNELTest/ExprEvalInterpTest.cxx b/src/INTERP_KERNELTest/ExprEvalInterpTest.cxx index 947f8fa5c..b62b39e35 100644 --- a/src/INTERP_KERNELTest/ExprEvalInterpTest.cxx +++ b/src/INTERP_KERNELTest/ExprEvalInterpTest.cxx @@ -228,13 +228,13 @@ void ExprEvalInterpTest::testInterpreter2() double res1; std::vector vars; vars.push_back("x"); vars.push_back("y"); expr1.prepareExprEvaluation(vars); - expr1.evaluateExpr(1,&res1,xyValue); + expr1.evaluateExpr(1,xyValue,&res1); CPPUNIT_ASSERT_DOUBLES_EQUAL(33.833333333333336,res1,1e-13); xyValue[0]=-2.; - CPPUNIT_ASSERT_THROW(expr1.evaluateExpr(1,&res1,xyValue),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(expr1.evaluateExpr(1,xyValue,&res1),INTERP_KERNEL::Exception); double res2[2]; xyValue[0]=1.; - expr1.evaluateExpr(2,res2,xyValue); + expr1.evaluateExpr(2,xyValue,res2); CPPUNIT_ASSERT_DOUBLES_EQUAL(33.833333333333336,res2[0],1e-13); CPPUNIT_ASSERT_DOUBLES_EQUAL(33.833333333333336,res2[1],1e-13); INTERP_KERNEL::ExprParser expr2("3.5*tan(2.3*x)*IVec+(cos(1.2+y/x)*JVec)"); @@ -245,13 +245,13 @@ void ExprEvalInterpTest::testInterpreter2() expected.insert("x"); expected.insert("y"); expected.insert("IVec"); expected.insert("JVec"); CPPUNIT_ASSERT(std::equal(res.begin(),res.end(),expected.begin())); expr2.prepareExprEvaluation(vars); - expr2.evaluateExpr(2,res2,xyValue); + expr2.evaluateExpr(2,xyValue,res2); CPPUNIT_ASSERT_DOUBLES_EQUAL(-3.9172477460694637,res2[0],1e-14); CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.49026082134069943,res2[1],1e-14); INTERP_KERNEL::ExprParser expr3("3.5*u+u^2.4+2."); expr3.parse(); expr3.prepareExprEvaluationVec(); - expr3.evaluateExpr(2,res2,xyValue); + expr3.evaluateExpr(2,xyValue,res2); CPPUNIT_ASSERT_DOUBLES_EQUAL(6.5,res2[0],1e-14); CPPUNIT_ASSERT_DOUBLES_EQUAL(26.466610165238237,res2[1],1e-14); INTERP_KERNEL::ExprParser expr4("3.5*v+u^2.4+2."); diff --git a/src/MEDCoupling/MEDCouplingMesh.cxx b/src/MEDCoupling/MEDCouplingMesh.cxx index a552ea588..787e6b059 100644 --- a/src/MEDCoupling/MEDCouplingMesh.cxx +++ b/src/MEDCoupling/MEDCouplingMesh.cxx @@ -119,7 +119,7 @@ MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbO { try { - expr.evaluateExpr(nbOfComp,ptToFill,locPtr+nbCompIn*i); + expr.evaluateExpr(nbOfComp,locPtr+nbCompIn*i,ptToFill); } catch(INTERP_KERNEL::Exception& e) { diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx index a030e1b4c..dccfc4c93 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx @@ -277,7 +277,7 @@ void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const char *func) { try { - expr.evaluateExpr(nbOfComp,ptrToFill+i*nbOfComp,ptr+i*oldNbOfComp); + expr.evaluateExpr(nbOfComp,ptr+i*oldNbOfComp,ptrToFill+i*nbOfComp); } catch(INTERP_KERNEL::Exception& e) { @@ -308,7 +308,7 @@ void MEDCouplingTimeDiscretization::applyFunc(const char *func) { try { - expr.evaluateExpr(nbOfComp,ptrToFill+i*nbOfComp,ptr+i*nbOfComp); + expr.evaluateExpr(nbOfComp,ptr+i*nbOfComp,ptrToFill+i*nbOfComp); } catch(INTERP_KERNEL::Exception& e) {