constants was changed from std::vector to fixed length array

This commit is contained in:
Ajinkya Hire
2024-05-02 18:58:26 -04:00
parent e55d77470b
commit 49181bfe8d
4 changed files with 55 additions and 29 deletions

View File

@ -36,9 +36,12 @@ uf3_bspline_basis2::uf3_bspline_basis2(LAMMPS *ulmp, const double *knots, double
(square(knots[0]) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2]));
c2 = coefficient *
(1.0 / (square(knots[0]) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2]));
constants.push_back(c0);
constants.push_back(c1);
constants.push_back(c2);
//constants.push_back(c0);
//constants.push_back(c1);
//constants.push_back(c2);
constants[0] = c0;
constants[1] = c1;
constants[2] = c2;
c0 = coefficient *
(-knots[1] * knots[3] /
(square(knots[1]) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) -
@ -56,9 +59,12 @@ uf3_bspline_basis2::uf3_bspline_basis2(LAMMPS *ulmp, const double *knots, double
c2 = coefficient *
(-1.0 / (square(knots[1]) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) -
1.0 / (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + square(knots[2])));
constants.push_back(c0);
constants.push_back(c1);
constants.push_back(c2);
//constants.push_back(c0);
//constants.push_back(c1);
//constants.push_back(c2);
constants[3] = c0;
constants[4] = c1;
constants[5] = c2;
c0 = coefficient *
(square(knots[3]) /
(knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + square(knots[3])));
@ -67,9 +73,12 @@ uf3_bspline_basis2::uf3_bspline_basis2(LAMMPS *ulmp, const double *knots, double
(knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + square(knots[3])));
c2 = coefficient *
(1.0 / (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + square(knots[3])));
constants.push_back(c0);
constants.push_back(c1);
constants.push_back(c2);
//constants.push_back(c0);
//constants.push_back(c1);
//constants.push_back(c2);
constants[6] = c0;
constants[7] = c1;
constants[8] = c2;
}
uf3_bspline_basis2::~uf3_bspline_basis2() {}
@ -96,7 +105,7 @@ double uf3_bspline_basis2::memory_usage()
{
double bytes = 0;
bytes += (double)constants.size()*sizeof(double);
bytes += (double)9*sizeof(double);
return bytes;
}

View File

@ -28,7 +28,8 @@ class uf3_bspline_basis2 {
public:
uf3_bspline_basis2(LAMMPS *ulmp, const double *knots, double coefficient);
~uf3_bspline_basis2();
std::vector<double> constants;
//std::vector<double> constants;
double constants[9] = {};
double eval0(double, double);
double eval1(double, double);
double eval2(double, double);

View File

@ -53,10 +53,14 @@ uf3_bspline_basis3::uf3_bspline_basis3(LAMMPS *ulmp, const double *knots, double
square(knots[0]) * knots[3] - knots[0] * knots[1] * knots[2] -
knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] +
knots[1] * knots[2] * knots[3]));
constants.push_back(c0);
constants.push_back(c1);
constants.push_back(c2);
constants.push_back(c3);
//constants.push_back(c0);
//constants.push_back(c1);
//constants.push_back(c2);
//constants.push_back(c3);
constants[0] = c0;
constants[1] = c1;
constants[2] = c2;
constants[3] = c3;
c0 = coefficient *
(square(knots[1]) * knots[4] /
(-cube(knots[1]) + square(knots[1]) * knots[2] + square(knots[1]) * knots[3] +
@ -161,10 +165,14 @@ uf3_bspline_basis3::uf3_bspline_basis3(LAMMPS *ulmp, const double *knots, double
knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] +
square(knots[1]) * knots[3] - knots[1] * knots[2] * knots[3] -
knots[1] * square(knots[3]) + knots[2] * square(knots[3])));
constants.push_back(c0);
constants.push_back(c1);
constants.push_back(c2);
constants.push_back(c3);
//constants.push_back(c0);
//constants.push_back(c1);
//constants.push_back(c2);
//constants.push_back(c3);
constants[4] = c0;
constants[5] = c1;
constants[6] = c2;
constants[7] = c3;
c0 = coefficient *
(-knots[0] * square(knots[3]) /
(-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] +
@ -269,10 +277,14 @@ uf3_bspline_basis3::uf3_bspline_basis3(LAMMPS *ulmp, const double *knots, double
knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] +
square(knots[2]) * knots[4] - knots[2] * knots[3] * knots[4] -
knots[2] * square(knots[4]) + knots[3] * square(knots[4])));
constants.push_back(c0);
constants.push_back(c1);
constants.push_back(c2);
constants.push_back(c3);
//constants.push_back(c0);
//constants.push_back(c1);
//constants.push_back(c2);
//constants.push_back(c3);
constants[8] = c0;
constants[9] = c1;
constants[10] = c2;
constants[11] = c3;
c0 = coefficient *
(cube(knots[4]) /
(-knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] +
@ -297,10 +309,14 @@ uf3_bspline_basis3::uf3_bspline_basis3(LAMMPS *ulmp, const double *knots, double
knots[1] * knots[3] * knots[4] - knots[1] * square(knots[4]) +
knots[2] * knots[3] * knots[4] - knots[2] * square(knots[4]) - knots[3] * square(knots[4]) +
cube(knots[4])));
constants.push_back(c0);
constants.push_back(c1);
constants.push_back(c2);
constants.push_back(c3);
//constants.push_back(c0);
//constants.push_back(c1);
//constants.push_back(c2);
//constants.push_back(c3);
constants[12] = c0;
constants[13] = c1;
constants[14] = c2;
constants[15] = c3;
}
uf3_bspline_basis3::~uf3_bspline_basis3() {}
@ -333,7 +349,7 @@ double uf3_bspline_basis3::memory_usage()
{
double bytes = 0;
bytes += (double)constants.size()*sizeof(double);
bytes += (double)16*sizeof(double);
return bytes;
}

View File

@ -29,7 +29,7 @@ class uf3_bspline_basis3 {
public:
uf3_bspline_basis3(LAMMPS *ulmp, const double *knots, double coefficient);
~uf3_bspline_basis3();
std::vector<double> constants;
double constants[16] = {};
double eval0(double, double, double);
double eval1(double, double, double);
double eval2(double, double, double);