Skip to content
Snippets Groups Projects
Commit 370dd86c authored by Thomas De Maet's avatar Thomas De Maet
Browse files

add fonctionalities

parent 78e178e4
No related branches found
No related tags found
No related merge requests found
...@@ -517,6 +517,33 @@ function *functionScaleNew(const function *f0, const double s) { ...@@ -517,6 +517,33 @@ function *functionScaleNew(const function *f0, const double s) {
return new functionScale (f0, s); return new functionScale (f0, s);
} }
// functionMean
class functionMean : public function {
fullMatrix<double> _f0;
public:
functionMean(const function *f0) : function(f0->getNbCol()) {
setArgument (_f0, f0);
}
void call(dataCacheMap *m, fullMatrix<double> &val)
{
double mean;
for(int j = 0; j < val.size2(); j++) {
mean = 0;
for(int i = 0; i < val.size1(); i++)
mean += _f0(i, j);
mean /= (double) val.size1();
for(int i = 0; i < val.size1(); i++)
val(i, j) = mean;
}
}
};
function *functionMeanNew(const function *f0) {
return new functionMean (f0);
}
// functionCoordinates (get XYZ coordinates) // functionCoordinates (get XYZ coordinates)
class functionCoordinates : public function { class functionCoordinates : public function {
......
...@@ -296,6 +296,7 @@ function *functionProdNew (const function *f0, const function *f1); ...@@ -296,6 +296,7 @@ function *functionProdNew (const function *f0, const function *f1);
function *functionScaleNew (const function *f0, const double s); function *functionScaleNew (const function *f0, const double s);
function *functionExtractCompNew (const function *f0, const int iComp); function *functionExtractCompNew (const function *f0, const int iComp);
function *functionCatCompNew(std::vector<const function *> fArray); function *functionCatCompNew(std::vector<const function *> fArray);
function *functionMeanNew(const function *f0);
function *getFunctionCoordinates(); function *getFunctionCoordinates();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment