38 const std::vector<util::Point> &nodes) {
40 auto ders_ref = getDerShapes(mapPointToRefElem(p, nodes));
43 std::vector<std::vector<double>> J;
44 auto detJ = getJacobian(p, nodes, &J);
49 for (
size_t i=0; i<3; i++) {
51 ders[i][0] = (ders_ref[i][0] * J[1][1] - ders_ref[i][1] * J[0][1]) / detJ;
53 ders[i][1] = (-ders_ref[i][0] * J[1][0] + ders_ref[i][1] * J[0][0]) / detJ;
80 const std::vector<util::Point> &nodes) {
81 auto detB = 2. * elemSize(nodes);
82 auto xi = ((nodes[2].d_y - nodes[0].d_y) * (p.
d_x - nodes[0].d_x) -
83 (nodes[2].d_x - nodes[0].d_x) * (p.
d_y - nodes[0].d_y)) /
85 auto eta = (-(nodes[1].d_y - nodes[0].d_y) * (p.
d_x - nodes[0].d_x) +
86 (nodes[1].d_x - nodes[0].d_x) * (p.
d_y - nodes[0].d_y)) /
91 throw std::runtime_error(
93 <<
"Error: Trying to map point p = (" << p.
d_x <<
", " << p.
d_y
94 <<
") in triangle to reference triangle.\n"
95 <<
"But the point p does not belong to triangle = {("
96 << nodes[0].d_x <<
", " << nodes[0].d_y <<
"), (" << nodes[1].d_x
97 <<
"," << nodes[1].d_y <<
"), (" << nodes[2].d_x <<
","
98 << nodes[2].d_y <<
")}.\n"
99 <<
"Coordinates in reference triangle are: xi = " << xi
100 <<
", eta = " << eta <<
"\n");
108 return {xi, eta, 0.};
112 const std::vector<util::Point> &nodes,
113 std::vector<std::vector<double>> *J) {
117 (*J)[0] = std::vector<double>{nodes[1].d_x - nodes[0].d_x,
118 nodes[1].d_y - nodes[0].d_y};
119 (*J)[1] = std::vector<double>{nodes[2].d_x - nodes[0].d_x,
120 nodes[2].d_y - nodes[0].d_y};
122 return (*J)[0][0] * (*J)[1][1] - (*J)[0][1] * (*J)[1][0];
125 return (nodes[1].d_x - nodes[0].d_x) * (nodes[2].d_y - nodes[0].d_y)
126 - (nodes[1].d_y - nodes[0].d_y) * (nodes[2].d_x - nodes[0].d_x);
136 if (!d_quads.empty())
140 if (d_quadOrder == 0) {
145 std::vector<std::vector<double>> ident_mat;
146 ident_mat.push_back(std::vector<double>{1., 0.});
147 ident_mat.push_back(std::vector<double>{0., 1.});
152 if (d_quadOrder == 1) {
164 d_quads.push_back(qd);
170 if (d_quadOrder == 2) {
180 d_quads.push_back(qd);
188 d_quads.push_back(qd);
196 d_quads.push_back(qd);
202 if (d_quadOrder == 3) {
212 d_quads.push_back(qd);
220 d_quads.push_back(qd);
228 d_quads.push_back(qd);
236 d_quads.push_back(qd);
242 if (d_quadOrder == 4) {
246 qd.
d_w = 0.5 * 0.22338158967801;
252 d_quads.push_back(qd);
254 qd.
d_w = 0.5 * 0.22338158967801;
260 d_quads.push_back(qd);
262 qd.
d_w = 0.5 * 0.22338158967801;
268 d_quads.push_back(qd);
270 qd.
d_w = 0.5 * 0.10995174365532;
276 d_quads.push_back(qd);
278 qd.
d_w = 0.5 * 0.10995174365532;
284 d_quads.push_back(qd);
286 qd.
d_w = 0.5 * 0.10995174365532;
292 d_quads.push_back(qd);
298 if (d_quadOrder == 5) {
302 qd.
d_w = 0.5 * 0.22500000000000;
308 d_quads.push_back(qd);
310 qd.
d_w = 0.5 * 0.13239415278851;
316 d_quads.push_back(qd);
318 qd.
d_w = 0.5 * 0.13239415278851;
324 d_quads.push_back(qd);
326 qd.
d_w = 0.5 * 0.13239415278851;
332 d_quads.push_back(qd);
334 qd.
d_w = 0.5 * 0.12593918054483;
340 d_quads.push_back(qd);
342 qd.
d_w = 0.5 * 0.12593918054483;
348 d_quads.push_back(qd);
350 qd.
d_w = 0.5 * 0.12593918054483;
356 d_quads.push_back(qd);
double getJacobian(const util::Point &p, const std::vector< util::Point > &nodes, std::vector< std::vector< double > > *J) override
Computes the Jacobian of map .