55 for(
int i=0; i<matA.GetRows(); ++i )
64 for(
int i=0; i<int(matA.GetRows()); ++i )
81 int rows = matA.GetRows(), columns = matA.GetColumns();
88 for(
int j=0; j<columns; ++j )
98 int rows = matA.GetRows(), columns = matA.GetColumns();
101 for(
int i=0; i<rows; ++i )
103 for(
int j=0; j<columns; ++j )
105 matX(j,i) = matA(i,j);
111 int GetSize(
const ConstArray<OneD, NekDouble> & x)
113 return x.num_elements();
136 for(
int i=0; i<size; ++i )
148 for(
int i=0; i<size; ++i )
150 z[i] = pow( x[i], p );
160 s << setprecision(precision);
161 int M = int(A.GetRows()), N =
int(A.GetColumns());
163 for(
int i=0; i<M; ++i )
165 for(
int j=0; j<N; ++j)
168 s << setw(7) << right << a;
186 s << setprecision(precision) <<
"[ ";
188 for(
int j=0; j<N; ++j )
191 s << setw(7) << right << x;
204 return (degree+1) * (degree+2) / 2;
209 int degree = int(
MakeRound((-3.0 + sqrt(1.0 + 8.0*nBasisFunctions))/2.0));
212 ASSERTL1(
GetTriNumPoints(degree) == nBasisFunctions,
"The number of points defines an expansion of fractional degree, which is not supported." );
218 return (degree+1) * (degree+2) * (degree+3) / 6;
224 NekDouble eq = pow( 81.0 * nBasisFunc + 3.0 * sqrt(-3.0 + 729.0 * nBasisFunc * nBasisFunc), 1.0/3.0);
225 int degree = int(
MakeRound(eq/3.0 + 1.0/eq - 1.0)) - 1;
227 ASSERTL1(
GetTetNumPoints(degree) == nBasisFunc,
"The number of points defines an expansion of fractional degree, which is not supported." );
233 return floor(x + 0.5);
239 int cols = (degree + 1)*(degree + 2)/2;
242 for(
int d=0, n=0; d <= degree; ++d)
244 for(
int p=0;
p <= d; ++
p, ++n)
248 for(
int i=0; i<rows; ++i)
250 matV(i, n) = pow(x[i], p) * pow(y[i], q);
261 int cols = (degree + 1) * (degree + 2) * (degree + 3)/6;
265 for(
int d=0, n=0; d<=degree; ++d)
267 for(
int p=0;
p <= d; ++
p)
269 for(
int q=0; q <= d -
p; ++q, ++n)
274 for(
int i=0; i<rows; ++i)
276 matV(i,n) = pow(x[i],p) * pow(y[i],q) * pow(z[i],r);
301 int cols = (degree + 1) * (degree + 2) / 2;
304 for(
int d=0, n=0; d <= degree; ++d)
306 for(
int p=0;
p <= d; ++
p, ++n)
312 for(
int i=0; i<rows; ++i)
314 matVx(i, n) = p * pow(x[i], p-1.0) * pow(y[i],q);
319 for(
int j=0; j<rows; ++j)
340 int cols = (degree + 1) * (degree + 2) * (degree + 3) / 6;
342 for(
int d=0, n=0; d<=degree; ++d)
344 for(
int p=0;
p <= d; ++
p)
346 for(
int q=0; q <= d -
p; ++q, ++n)
352 for(
int i=0; i<rows; ++i)
354 matVx(i,n) = p * pow(x[i],p-1.0) * pow(y[i],q) * pow(z[i],r);
358 for(
int j=0; j<rows; ++j)
381 int cols = (degree + 1) * (degree + 2) * (degree + 3) / 6;
383 for(
int d=0, n=0; d<=degree; ++d)
385 for(
int p=0;
p <= d; ++
p)
387 for(
int q=0; q <= d -
p; ++q, ++n)
393 for(
int i=0; i<rows; ++i)
395 matVy(i,n) = q * pow(x[i],p) * pow(y[i],q-1.0) * pow(z[i],r);
400 for(
int j=0; j<rows; ++j)
423 int cols = (degree + 1) * (degree + 2) * (degree + 3) / 6;
425 for(
int d=0, n=0; d<=degree; ++d)
427 for(
int p=0;
p <= d; ++
p)
429 for(
int q=0; q <= d -
p; ++q, ++n)
435 for(
int i=0; i<rows; ++i)
437 matVz(i,n) = r * pow(x[i],p) * pow(y[i],q) * pow(z[i],r-1.0);
441 for(
int j=0; j<rows; ++j)
463 int cols = (degree + 1) * (degree + 2) / 2;
466 for(
int d=0, n=0; d <= degree; ++d)
468 for(
int p=0;
p <= d; ++
p, ++n)
473 for(
int i=0; i<rows; ++i)
475 matVy(i, n) = q * pow(x[i], p) * pow(y[i], q-1.0);
480 for(
int j=0; j<rows; ++j)
499 int cols = (degree + 1) * (degree + 2) / 2;
502 for(
int d=0, n=0; d <= degree; ++d)
504 for(
int p=0;
p <= d; ++
p, ++n)
507 int sp = 1 - 2 * (p % 2);
508 int sq = 1 - 2 * (q % 2);
510 integralMVandermonde(n) =
NekDouble(sp * (p+1) + sq * (q+1) + sp * sq * (p+q+2)) / ((p+1) * (q+1) * (p+q+2));
513 return integralMVandermonde;
NekDouble MakeRound(NekDouble x)
std::string MatrixToString(const NekMatrix< NekDouble > &A, int precision, NekDouble expSigFigs)
NekMatrix< NekDouble > & SetColumn(NekMatrix< NekDouble > &matA, int n, const NekVector< NekDouble > &x)
NekMatrix< NekDouble > GetTetYDerivativeOfMonomialVandermonde(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y, const NekVector< NekDouble > &z, int degree)
Array< OneD, NekDouble > ToArray(const NekVector< NekDouble > &x)
NekMatrix< NekDouble > GetYDerivativeOfMonomialVandermonde(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y, int degree)
NekVector< NekDouble > GetE(int rows, int n)
NekVector< NekDouble > GetIntegralOfMonomialVandermonde(int degree)
int GetDegree(int nBasisFunctions)
int GetTetDegree(int nBasisFunc)
NekVector< NekDouble > Hadamard(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y)
NekMatrix< NekDouble > GetTetXDerivativeOfMonomialVandermonde(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y, const NekVector< NekDouble > &z, int degree)
RawType< VectorType >::type Solve(const VectorType &b)
NekVector< NekDouble > VectorPower(const NekVector< NekDouble > &x, NekDouble p)
NekMatrix< NekDouble > GetTetZDerivativeOfMonomialVandermonde(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y, const NekVector< NekDouble > &z, int degree)
NekVector< NekDouble > ToVector(const ConstArray< OneD, NekDouble > &x)
int GetSize(const ConstArray< OneD, NekDouble > &x)
NekMatrix< NekDouble > GetTranspose(const NekMatrix< NekDouble > &matA)
NekMatrix< NekDouble > Invert(const NekMatrix< NekDouble > &matA)
NekVector< T > GetColumn(const NekMatrix< T > &matA, int n)
NekMatrix< NekDouble > GetMonomialVandermonde(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y, int degree)
unsigned int GetRows() const
std::string VectorToString(const NekVector< NekDouble > &v, int precision, NekDouble expSigFigs)
int GetTetNumPoints(int degree)
boost::shared_ptr< NekMatrix< NekDouble, StandardMatrixTag > > SharedNekMatrixPtr
NekMatrix< NekDouble > GetXDerivativeOfMonomialVandermonde(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y, int degree)
int GetTriNumPoints(int degree)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Array< OneD, DataType > & GetPtr()