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

nonInertiaSW + some fixes

parent 8d85883f
Branches
Tags
No related merge requests found
...@@ -96,7 +96,7 @@ class functionNormals : public function { ...@@ -96,7 +96,7 @@ class functionNormals : public function {
static functionNormals *_instance; static functionNormals *_instance;
// constructor is private only 1 instance can exists, call get to // constructor is private only 1 instance can exists, call get to
// access the instance // access the instance
functionNormals() : function(1){} functionNormals() : function(0){}
public: public:
void call(dataCacheMap *m, fullMatrix<double> &sol) void call(dataCacheMap *m, fullMatrix<double> &sol)
{ {
...@@ -592,28 +592,28 @@ function *functionScaleNew(const function *f0, const double s) { ...@@ -592,28 +592,28 @@ function *functionScaleNew(const function *f0, const double s) {
// functionMean // functionMean
class functionMean : public function { class functionMeanP1 : public function {
fullMatrix<double> _f0; fullMatrix<double> _f, _df, _xyz;
public: public:
functionMean(const function *f0) : function(f0->getNbCol()) { functionMeanP1(const function *f, const function *df) : function(f->getNbCol()) {
setArgument (_f0, f0); setArgument (_f, f);
setArgument (_df, df);
setArgument (_xyz, function::getCoordinates());
} }
void call(dataCacheMap *m, fullMatrix<double> &val) void call(dataCacheMap *m, fullMatrix<double> &val)
{ {
double mean; SPoint3 center = m->getElement()->barycenter();
for(int j = 0; j < val.size2(); j++) { 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++) for(int i = 0; i < val.size1(); i++)
val(i, j) = mean; val(i, j) = _f(i, j)
} + _df(i, 3 * j + 0) * ( center.x() - _xyz(i, 0) )
+ _df(i, 3 * j + 1) * ( center.y() - _xyz(i, 1) )
+ _df(i, 3 * j + 2) * ( center.z() - _xyz(i, 2) );
} }
}; };
function *functionMeanNew(const function *f0) { function *functionMeanP1New(const function *f, const function *df) {
return new functionMean (f0); return new functionMeanP1 (f, df);
} }
// functionStructuredGridFile // functionStructuredGridFile
......
...@@ -298,5 +298,5 @@ function *functionProdNew (const function *f0, const function *f1); ...@@ -298,5 +298,5 @@ 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 *functionMeanP1New(const function *f, const function *df);
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment