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

add L2 CG projection (and some spaces in the code)

parent f413339c
No related branches found
No related tags found
No related merge requests found
...@@ -384,6 +384,40 @@ function *functionSumNew(const function *f0, const function *f1) ...@@ -384,6 +384,40 @@ function *functionSumNew(const function *f0, const function *f1)
return new functionSum (f0, f1); return new functionSum (f0, f1);
} }
// functionMinus
class functionMinus : public function {
public:
fullMatrix<double> _f0, _f1;
void call(dataCacheMap *m, fullMatrix<double> &val)
{
if (_f0.size2() != _f1.size2()) {
Msg::Error("trying to substract 2 functions of different sizes: %d - %d\n",
_f0.size2(), _f1.size2());
throw;
}
for (int i = 0; i < val.size1(); i++)
for (int j = 0; j < val.size2(); j++)
val(i, j)= _f0(i, j) - _f1(i, j);
}
functionMinus(const function *f0, const function *f1) : function(f0->getNbCol())
{
/* if (f0->getNbCol() != f1->getNbCol()) {
Msg::Error("trying to substract 2 functions of different sizes: %d - %d\n",
f0->getNbCol(), f1->getNbCol());
throw;
}*/
setArgument (_f0, f0);
setArgument (_f1, f1);
}
};
function *functionMinusNew(const function *f0, const function *f1)
{
return new functionMinus (f0, f1);
}
// functionLevelset // functionLevelset
class functionLevelset : public function { class functionLevelset : public function {
......
...@@ -289,6 +289,7 @@ class functionC : public function { ...@@ -289,6 +289,7 @@ class functionC : public function {
function *functionLevelsetNew (const function *f0, const double valMin, const double valPlus); function *functionLevelsetNew (const function *f0, const double valMin, const double valPlus);
function *functionLevelsetSmoothNew (const function *f0, const double valMin, const double valPlus, const double E); function *functionLevelsetSmoothNew (const function *f0, const double valMin, const double valPlus, const double E);
function *functionSumNew (const function *f0, const function *f1); function *functionSumNew (const function *f0, const function *f1);
function *functionMinusNew (const function *f0, const function *f1);
function *functionProdNew (const function *f0, const function *f1); 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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment