Skip to content
Snippets Groups Projects
Commit ab9d7155 authored by Jean-François Remacle's avatar Jean-François Remacle
Browse files

added missing files

parent e364cc21
No related branches found
No related tags found
No related merge requests found
#include "approximationError.h"
#include "MElement.h"
double approximationError (simpleFunction<double> &f, MElement *e)
{
double VALS [e->getNumVertices()];
for (int i=0;i<e->getNumVertices();i++){
MVertex *v = e->getVertex(i);
VALS[i] = f(v->x(),v->y(),v->z());
}
int npts; IntPt *pts;
e->getIntegrationPoints (2*e->getPolynomialOrder() + 2 , &npts, &pts);
double errSqr = 0.0;
for (int k=0;k<npts;k++){
const double u = pts[k].pt[0];
const double v = pts[k].pt[1];
const double w = pts[k].pt[2];
SPoint3 p; e->pnt(u, v, w, p);
const double Jac = e->getJacobianDeterminant(u,v,w);
const double C = e->interpolate(VALS,u,v,w);
const double F = f(p.x(),p.y(),p.z());
const double DIFF = C-F;
errSqr += pts[k].weight * Jac * (DIFF*DIFF);
}
return sqrt(errSqr);
}
#ifndef _APPROXIMATION_ERROR_
#define _APPROXIMATION_ERROR_
#include <map>
#include "simpleFunction.h"
class MElement;
// computes E such as
// E^2 = \int_e [C_e(f) - f]^2 de
// where C_e(f) is clement's interpolation operator of f on e
double approximationError (simpleFunction<double> &f, MElement *e) ;
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment