70 CepsReal h = 1.0 / (numberOfPoints - 1);
72 CepsUInt Ny = (dim > 1 ? numberOfPoints : 1);
73 CepsUInt Nz = (dim > 2 ? numberOfPoints : 1);
76 geomCellIndex.clear();
77 points .reserve(Nx*Ny*Nz);
78 geomCellIndex.reserve(Nx*Ny*Nz);
87 if((i==0 or i==Nx-1) and (j==0 or j==Ny-1) and (k==0 or k==Nz-1))
89 toPush = geomCellIndex.size()==0 ? 0 : dim-count;
92 geomCellIndex.push_back(toPush);
104 CepsInt Ny = (dim > 1 ? numberOfPoints: 1);
105 CepsInt Nz = (dim > 2 ? numberOfPoints: 1);
110 if (i+j+k < (
CepsInt)numberOfPoints)
115 (a[0] >= a[1] and a[0] >= a[2] ? 0U : (a[1] >= a[0] and a[1] >= a[2] ? 1U : 2U));
117 (b[0] >= b[1] and b[0] >= b[2] ? 0U : (b[1] >= b[0] and b[1] >= b[2] ? 1U : 2U));
119 const CepsInt &as = a[0] + a[1] + a[2];
120 const CepsInt &bs = b[0] + b[1] + b[2];
137 std::sort (expos.begin(),expos.end(),compare);
153 const CepsUInt &numberOfPoints = order + 1;
155 pointBuilder(dim,numberOfPoints,points,geomCellIndex);
159 exponents.resize(np);
163 mono[i].setExponents(exponents[i]);
166 using mat_t = Eigen::Matrix<
CepsReal,-1,-1>;
170 A.coeffRef(i,j) = mono[j](points[i]);
177 Eigen::PartialPivLU<mat_t> solver(A);
178 decltype(A) coeffs = solver.solve(I);
184 polys[i].add(coeffs.col(i),exponents);
185 polys[i].pruneZeroCoeffs();
std::vector< _Type, _Alloc > CepsVector
C++ vector.
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
float CepsReal
Need single precision floating point.
CepsArray< _Type, 3U > CepsArray3
C++ array, 3 elements.
CepsArray3< CepsReal > CepsReal3D
Three real scalars, used like this for compatibility in polynomials.
int32_t CepsInt
Need 32 bit integer.
CepsVector< CepsArray3< CepsInt > > buildBasisFunctionExponents(CepsUInt dim, CepsUInt numberOfPoints)
Constructs the list of ordered exponents for a given number of points, typically constructed x^i y^j ...
void buildPolysBasisFunction(CepsUInt dim, CepsUInt order, CepsVector< CepsReal3D > &points, CepsVector< CepsInt > &geomCellIndex, CepsVector< Polynomial< 3U >> &polys, void(*pointBuilder)(CepsUInt, CepsUInt, CepsVector< CepsReal3D > &, CepsVector< CepsInt > &))
Constructs the list of base functions in the form of Polynomials.
void buildSimplexUniformPoints(CepsUInt dim, CepsUInt numberOfPoints, CepsVector< CepsReal3D > &points, CepsVector< CepsInt > &geomCellIndex)
Constructs the list of uniform points of the simplex of given dimension.
A class to represent polynomials, as a collection of Monomial and coefficients.
void sort(CepsVector< _Type, _Alloc > &vec, _Compare compare)
Sort whole vector with specified comparator.