]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Implementation of P2 TETRA10 barycentric_coords.
authorageay <ageay>
Fri, 18 Mar 2011 17:40:19 +0000 (17:40 +0000)
committerageay <ageay>
Fri, 18 Mar 2011 17:40:19 +0000 (17:40 +0000)
src/INTERP_KERNEL/InterpolationUtils.hxx

index 39683eaf3fbbe8889b60a77536b82af3aba7f149..c0c8bf9c2657eb0d9898d20ac39736798b317f2b 100644 (file)
@@ -228,6 +228,23 @@ namespace INTERP_KERNEL
     weightedPos[5]=4.*refCoo[1]*(1.-refCoo[0]-refCoo[1]);
   }
 
+  /*!
+   * Given 10 coeffs of a Tetra10 returns the corresponding value of a given pos
+   */
+  inline double computeTetra10RefBase(const double *coeffs, const double *pos)
+  {
+    return coeffs[0]+coeffs[1]*pos[0]+coeffs[2]*pos[1]+coeffs[3]*pos[2]+
+      coeffs[4]*pos[0]*pos[0]+coeffs[5]*pos[0]*pos[1]+coeffs[6]*pos[0]*pos[2]+
+      coeffs[7]*pos[1]*pos[1]+coeffs[8]*pos[1]*pos[2]+coeffs[9]*pos[2]*pos[2];
+  }
+
+  /*!
+   * Given xsi,eta,z in refCoo (length==3) return 10 coeffs in weightedPos.
+   */
+  inline void computeWeightedCoeffsInTetra10FromRefBase(const double *refCoo, double *bc)
+  {
+  }
+
   /*!
    * \brief Solve system equation in matrix form using Gaussian elimination algorithm
    *  \param M - N x N+1 matrix
@@ -458,6 +475,39 @@ namespace INTERP_KERNEL
           computeWeightedCoeffsInTria6FromRefBase(refCoo,bc);
           break;
         }
+      case 10:
+        {//TETRA10
+          double matrix2[130]={1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
+                               1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 
+                               1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1.,
+                               1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.5, 0.,
+                               1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.5, 0.5,
+                               1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,0.5,
+                               1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1.,
+                               1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.5, 0.,
+                               1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.5, 0.5,
+                               1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,0.5};
+          for(int i=0;i<10;i++)
+            {
+              matrix2[13*i+1]=n[i][0];
+              matrix2[13*i+2]=n[i][1];
+              matrix2[13*i+3]=n[i][2];
+              matrix2[13*i+4]=n[i][0]*n[i][0];
+              matrix2[13*i+5]=n[i][0]*n[i][1];
+              matrix2[13*i+6]=n[i][0]*n[i][2];
+              matrix2[13*i+7]=n[i][1]*n[i][1];
+              matrix2[13*i+8]=n[i][1]*n[i][2];
+              matrix2[13*i+9]=n[i][2]*n[i][2];
+            }
+          double res[30];
+          solveSystemOfEquations2<10,3>(matrix2,res,std::numeric_limits<double>::min());
+          double refCoo[3];
+          refCoo[0]=computeTetra10RefBase(res,p);
+          refCoo[1]=computeTetra10RefBase(res+10,p);
+          refCoo[2]=computeTetra10RefBase(res+20,p);
+          computeWeightedCoeffsInTetra10FromRefBase(refCoo,bc);
+          break;
+        }
       default:
         throw INTERP_KERNEL::Exception("INTERP_KERNEL::barycentric_coords : unrecognized simplex !");
       }