GLAMERDOC++
Gravitational Lensing Code Library
Loading...
Searching...
No Matches
isop.h
1#pragma once
2
3#include "source.h"
6namespace ISOP
7{
8 namespace detail
9 {
11 template<int N> double shape_fun(double xi, double eta);
12
13 template<> inline double shape_fun<0>(double xi, double eta) { return -0.25*(1-xi)*(1-eta)*(1+xi+eta); }
14 template<> inline double shape_fun<1>(double xi, double eta) { return 0.5*(1-xi)*(1+xi)*(1-eta); }
15 template<> inline double shape_fun<2>(double xi, double eta) { return -0.25*(1+xi)*(1-eta)*(1-xi+eta); }
16 template<> inline double shape_fun<3>(double xi, double eta) { return 0.5*(1+xi)*(1+eta)*(1-eta); }
17 template<> inline double shape_fun<4>(double xi, double eta) { return -0.25*(1+xi)*(1+eta)*(1-xi-eta); }
18 template<> inline double shape_fun<5>(double xi, double eta) { return 0.5*(1-xi)*(1+xi)*(1+eta); }
19 template<> inline double shape_fun<6>(double xi, double eta) { return -0.25*(1-xi)*(1+eta)*(1+xi-eta); }
20 template<> inline double shape_fun<7>(double xi, double eta) { return 0.5*(1-xi)*(1+eta)*(1-eta); }
21
23 template<int N = 8>
24 inline double isop(const double nodes[], double xi, double eta)
25 {
26 return isop<N-1>(nodes, xi, eta) + nodes[N-1]*shape_fun<N-1>(xi, eta);
27 }
28
29 template<>
30 inline double isop<0>(const double[], double, double)
31 {
32 return 0;
33 }
34 }
35
37 inline double isop(
38 const double nodes[]
39 , double xi
40 , double eta
41 )
42 {
43 return detail::isop(nodes, xi, eta);
44 }
45
47 template<typename Function>
48 struct isop_map
49 {
50 isop_map(Function f, const double* x, const double* y) : f(f), x(x), y(y) {}
51
52 double operator()(double xi, double eta)
53 {
54 return f(isop(x, xi, eta), isop(y, xi, eta));
55 }
56
57 Function f;
58 const double* x;
59 const double* y;
60 };
61
63 template<typename Function>
64 isop_map<Function> make_isop_map(Function f, const double* x, const double* y)
65 {
66 return isop_map<Function>(f, x, y);
67 }
68
100 double isop_render(
101 Source& source
102 ,const double nodx[]
103 ,const double nody[]
104 ,double a_xi
105 ,double b_xi
106 ,double a_eta
107 ,double b_eta
108 );
109}
Base class for all sources.
Definition source.h:44
ISOP namespace is for functions related to isoparametric interpolation.
Definition isop.h:7
double isop_render(Source &source, const double nodx[], const double nody[], double a_xi, double b_xi, double a_eta, double b_eta)
Integrate source flux using the isoparameterized lens.
Definition isop_render.cpp:5
isop_map< Function > make_isop_map(Function f, const double *x, const double *y)
Creates an isoparametric mapping functor.
Definition isop.h:64
double isop(const double nodes[], double xi, double eta)
Do the isoparametric interpolation given a list of 8 nodes. See notes for isop_render().
Definition isop.h:37
Functor to transparently map [-1,1]x[-1,1] to interpolation space.
Definition isop.h:49