Skip to content
Snippets Groups Projects
Commit 773b544e authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Add a 'const' function decorator to the X_abc() functions to help optimization

parent 4d9fb864
No related branches found
No related tags found
No related merge requests found
......@@ -46,7 +46,8 @@
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_000(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_000(
const double v[3]) {
return 1.;
}
......@@ -60,7 +61,8 @@ __attribute__((always_inline)) INLINE static double X_000(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_100(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_100(
const double v[3]) {
return v[0];
}
......@@ -70,7 +72,8 @@ __attribute__((always_inline)) INLINE static double X_100(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_010(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_010(
const double v[3]) {
return v[1];
}
......@@ -80,7 +83,8 @@ __attribute__((always_inline)) INLINE static double X_010(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_001(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_001(
const double v[3]) {
return v[2];
}
......@@ -94,7 +98,8 @@ __attribute__((always_inline)) INLINE static double X_001(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_200(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_200(
const double v[3]) {
return 0.5 * v[0] * v[0];
}
......@@ -104,7 +109,8 @@ __attribute__((always_inline)) INLINE static double X_200(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_020(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_020(
const double v[3]) {
return 0.5 * v[1] * v[1];
}
......@@ -114,7 +120,8 @@ __attribute__((always_inline)) INLINE static double X_020(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_002(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_002(
const double v[3]) {
return 0.5 * v[2] * v[2];
}
......@@ -124,7 +131,8 @@ __attribute__((always_inline)) INLINE static double X_002(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_110(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_110(
const double v[3]) {
return v[0] * v[1];
}
......@@ -134,7 +142,8 @@ __attribute__((always_inline)) INLINE static double X_110(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_101(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_101(
const double v[3]) {
return v[0] * v[2];
}
......@@ -144,7 +153,8 @@ __attribute__((always_inline)) INLINE static double X_101(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_011(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_011(
const double v[3]) {
return v[1] * v[2];
}
......@@ -158,7 +168,8 @@ __attribute__((always_inline)) INLINE static double X_011(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_300(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_300(
const double v[3]) {
return 0.1666666666666667 * v[0] * v[0] * v[0];
}
......@@ -168,7 +179,8 @@ __attribute__((always_inline)) INLINE static double X_300(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_030(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_030(
const double v[3]) {
return 0.1666666666666667 * v[1] * v[1] * v[1];
}
......@@ -178,7 +190,8 @@ __attribute__((always_inline)) INLINE static double X_030(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_003(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_003(
const double v[3]) {
return 0.1666666666666667 * v[2] * v[2] * v[2];
}
......@@ -188,7 +201,8 @@ __attribute__((always_inline)) INLINE static double X_003(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_210(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_210(
const double v[3]) {
return 0.5 * v[0] * v[0] * v[1];
}
......@@ -198,7 +212,8 @@ __attribute__((always_inline)) INLINE static double X_210(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_201(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_201(
const double v[3]) {
return 0.5 * v[0] * v[0] * v[2];
}
......@@ -208,7 +223,8 @@ __attribute__((always_inline)) INLINE static double X_201(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_120(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_120(
const double v[3]) {
return 0.5 * v[0] * v[1] * v[1];
}
......@@ -218,7 +234,8 @@ __attribute__((always_inline)) INLINE static double X_120(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_021(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_021(
const double v[3]) {
return 0.5 * v[1] * v[1] * v[2];
}
......@@ -228,7 +245,8 @@ __attribute__((always_inline)) INLINE static double X_021(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_102(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_102(
const double v[3]) {
return 0.5 * v[0] * v[2] * v[2];
}
......@@ -238,7 +256,8 @@ __attribute__((always_inline)) INLINE static double X_102(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_012(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_012(
const double v[3]) {
return 0.5 * v[1] * v[2] * v[2];
}
......@@ -248,7 +267,8 @@ __attribute__((always_inline)) INLINE static double X_012(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_111(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_111(
const double v[3]) {
return v[0] * v[1] * v[2];
}
......@@ -262,7 +282,8 @@ __attribute__((always_inline)) INLINE static double X_111(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_400(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_400(
const double v[3]) {
const double vv = v[0] * v[0];
return 0.041666666666666667 * vv * vv;
......@@ -273,7 +294,8 @@ __attribute__((always_inline)) INLINE static double X_400(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_040(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_040(
const double v[3]) {
const double vv = v[1] * v[1];
return 0.041666666666666667 * vv * vv;
......@@ -284,7 +306,8 @@ __attribute__((always_inline)) INLINE static double X_040(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_004(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_004(
const double v[3]) {
const double vv = v[2] * v[2];
return 0.041666666666666667 * vv * vv;
......@@ -295,7 +318,8 @@ __attribute__((always_inline)) INLINE static double X_004(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_310(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_310(
const double v[3]) {
return 0.1666666666666667 * v[0] * v[0] * v[0] * v[1];
}
......@@ -305,7 +329,8 @@ __attribute__((always_inline)) INLINE static double X_310(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_301(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_301(
const double v[3]) {
return 0.1666666666666667 * v[0] * v[0] * v[0] * v[2];
}
......@@ -315,7 +340,8 @@ __attribute__((always_inline)) INLINE static double X_301(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_130(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_130(
const double v[3]) {
return 0.1666666666666667 * v[0] * v[1] * v[1] * v[1];
}
......@@ -325,7 +351,8 @@ __attribute__((always_inline)) INLINE static double X_130(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_031(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_031(
const double v[3]) {
return 0.1666666666666667 * v[1] * v[1] * v[1] * v[2];
}
......@@ -335,7 +362,8 @@ __attribute__((always_inline)) INLINE static double X_031(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_103(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_103(
const double v[3]) {
return 0.1666666666666667 * v[0] * v[2] * v[2] * v[2];
}
......@@ -345,7 +373,8 @@ __attribute__((always_inline)) INLINE static double X_103(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_013(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_013(
const double v[3]) {
return 0.1666666666666667 * v[1] * v[2] * v[2] * v[2];
}
......@@ -355,7 +384,8 @@ __attribute__((always_inline)) INLINE static double X_013(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_220(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_220(
const double v[3]) {
return 0.25 * v[0] * v[0] * v[1] * v[1];
}
......@@ -365,7 +395,8 @@ __attribute__((always_inline)) INLINE static double X_220(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_202(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_202(
const double v[3]) {
return 0.25 * v[0] * v[0] * v[2] * v[2];
}
......@@ -375,7 +406,8 @@ __attribute__((always_inline)) INLINE static double X_202(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_022(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_022(
const double v[3]) {
return 0.25 * v[1] * v[1] * v[2] * v[2];
}
......@@ -385,7 +417,8 @@ __attribute__((always_inline)) INLINE static double X_022(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_211(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_211(
const double v[3]) {
return 0.5 * v[0] * v[0] * v[1] * v[2];
}
......@@ -395,7 +428,8 @@ __attribute__((always_inline)) INLINE static double X_211(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_121(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_121(
const double v[3]) {
return 0.5 * v[0] * v[1] * v[1] * v[2];
}
......@@ -405,7 +439,8 @@ __attribute__((always_inline)) INLINE static double X_121(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_112(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_112(
const double v[3]) {
return 0.5 * v[0] * v[1] * v[2] * v[2];
}
......@@ -422,7 +457,8 @@ __attribute__((always_inline)) INLINE static double X_112(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_005(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_005(
const double v[3]) {
return 8.333333333333333e-03 * v[2] * v[2] * v[2] * v[2] * v[2];
}
......@@ -435,7 +471,8 @@ __attribute__((always_inline)) INLINE static double X_005(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_014(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_014(
const double v[3]) {
return 4.166666666666666e-02 * v[1] * v[2] * v[2] * v[2] * v[2];
}
......@@ -448,7 +485,8 @@ __attribute__((always_inline)) INLINE static double X_014(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_023(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_023(
const double v[3]) {
return 8.333333333333333e-02 * v[1] * v[1] * v[2] * v[2] * v[2];
}
......@@ -461,7 +499,8 @@ __attribute__((always_inline)) INLINE static double X_023(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_032(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_032(
const double v[3]) {
return 8.333333333333333e-02 * v[1] * v[1] * v[1] * v[2] * v[2];
}
......@@ -474,7 +513,8 @@ __attribute__((always_inline)) INLINE static double X_032(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_041(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_041(
const double v[3]) {
return 4.166666666666666e-02 * v[1] * v[1] * v[1] * v[1] * v[2];
}
......@@ -487,7 +527,8 @@ __attribute__((always_inline)) INLINE static double X_041(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_050(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_050(
const double v[3]) {
return 8.333333333333333e-03 * v[1] * v[1] * v[1] * v[1] * v[1];
}
......@@ -500,7 +541,8 @@ __attribute__((always_inline)) INLINE static double X_050(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_104(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_104(
const double v[3]) {
return 4.166666666666666e-02 * v[0] * v[2] * v[2] * v[2] * v[2];
}
......@@ -513,7 +555,8 @@ __attribute__((always_inline)) INLINE static double X_104(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_113(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_113(
const double v[3]) {
return 1.666666666666667e-01 * v[0] * v[1] * v[2] * v[2] * v[2];
}
......@@ -526,7 +569,8 @@ __attribute__((always_inline)) INLINE static double X_113(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_122(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_122(
const double v[3]) {
return 2.500000000000000e-01 * v[0] * v[1] * v[1] * v[2] * v[2];
}
......@@ -539,7 +583,8 @@ __attribute__((always_inline)) INLINE static double X_122(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_131(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_131(
const double v[3]) {
return 1.666666666666667e-01 * v[0] * v[1] * v[1] * v[1] * v[2];
}
......@@ -552,7 +597,8 @@ __attribute__((always_inline)) INLINE static double X_131(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_140(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_140(
const double v[3]) {
return 4.166666666666666e-02 * v[0] * v[1] * v[1] * v[1] * v[1];
}
......@@ -565,7 +611,8 @@ __attribute__((always_inline)) INLINE static double X_140(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_203(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_203(
const double v[3]) {
return 8.333333333333333e-02 * v[0] * v[0] * v[2] * v[2] * v[2];
}
......@@ -578,7 +625,8 @@ __attribute__((always_inline)) INLINE static double X_203(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_212(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_212(
const double v[3]) {
return 2.500000000000000e-01 * v[0] * v[0] * v[1] * v[2] * v[2];
}
......@@ -591,7 +639,8 @@ __attribute__((always_inline)) INLINE static double X_212(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_221(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_221(
const double v[3]) {
return 2.500000000000000e-01 * v[0] * v[0] * v[1] * v[1] * v[2];
}
......@@ -604,7 +653,8 @@ __attribute__((always_inline)) INLINE static double X_221(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_230(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_230(
const double v[3]) {
return 8.333333333333333e-02 * v[0] * v[0] * v[1] * v[1] * v[1];
}
......@@ -617,7 +667,8 @@ __attribute__((always_inline)) INLINE static double X_230(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_302(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_302(
const double v[3]) {
return 8.333333333333333e-02 * v[0] * v[0] * v[0] * v[2] * v[2];
}
......@@ -630,7 +681,8 @@ __attribute__((always_inline)) INLINE static double X_302(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_311(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_311(
const double v[3]) {
return 1.666666666666667e-01 * v[0] * v[0] * v[0] * v[1] * v[2];
}
......@@ -643,7 +695,8 @@ __attribute__((always_inline)) INLINE static double X_311(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_320(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_320(
const double v[3]) {
return 8.333333333333333e-02 * v[0] * v[0] * v[0] * v[1] * v[1];
}
......@@ -656,7 +709,8 @@ __attribute__((always_inline)) INLINE static double X_320(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_401(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_401(
const double v[3]) {
return 4.166666666666666e-02 * v[0] * v[0] * v[0] * v[0] * v[2];
}
......@@ -669,7 +723,8 @@ __attribute__((always_inline)) INLINE static double X_401(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_410(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_410(
const double v[3]) {
return 4.166666666666666e-02 * v[0] * v[0] * v[0] * v[0] * v[1];
}
......@@ -682,7 +737,8 @@ __attribute__((always_inline)) INLINE static double X_410(const double v[3]) {
*
* @param v vector (\f$ v \f$).
*/
__attribute__((always_inline)) INLINE static double X_500(const double v[3]) {
__attribute__((always_inline, const)) INLINE static double X_500(
const double v[3]) {
return 8.333333333333333e-03 * v[0] * v[0] * v[0] * v[0] * v[0];
}
......
......@@ -41,7 +41,7 @@ for i in range(order+1):
print "*"
print "* @param v vector (\\f$ v \\f$)."
print "*/"
print "__attribute__((always_inline)) INLINE static double X_%d%d%d(const double v[3]) {"%(i,j,k)
print "__attribute__((always_inline, const)) INLINE static double X_%d%d%d(const double v[3]) {"%(i,j,k)
print ""
print " return",
if fact != 1:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment