libMesh
Loading...
Searching...
No Matches
fe_boundary.C
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18
19
20// C++ includes
21#include <cstdlib> // *must* precede <cmath> for proper std:abs() on PGI, Sun Studio CC
22#include <cmath> // for std::sqrt
23
24
25// Local includes
26#include "libmesh/libmesh_common.h"
27#include "libmesh/fe.h"
28#include "libmesh/fe_interface.h"
29#include "libmesh/quadrature.h"
30#include "libmesh/elem.h"
31#include "libmesh/libmesh_logging.h"
32#include "libmesh/tensor_value.h" // May be necessary if destructors
33// get instantiated here
34
35namespace libMesh
36{
37
38//-------------------------------------------------------
39// Full specializations for useless methods in 0D, 1D
40#define REINIT_ERROR(_dim, _type, _func) \
41 template <> \
42 void FE<_dim,_type>::_func(const Elem *, \
43 const unsigned int, \
44 const Real, \
45 const std::vector<Point> * const, \
46 const std::vector<Real> * const)
47
48#define SIDEMAP_ERROR(_dim, _type, _func) \
49 template <> \
50 void FE<_dim,_type>::_func(const Elem *, \
51 const Elem *, \
52 const unsigned int, \
53 const std::vector<Point> &, \
54 std::vector<Point> &)
55
56#define FACE_EDGE_SHAPE_ERROR(_dim, _func) \
57 template <> \
58 void FEMap::_func<_dim>(const std::vector<Point> &, \
59 const Elem *) \
60 { \
61 libmesh_error_msg("ERROR: This method makes no sense for low-D elements!"); \
62 }
63
64// 0D error instantiations
65#define LIBMESH_ERRORS_IN_LOW_D(_type) \
66REINIT_ERROR(0, _type, reinit) { libmesh_error_msg("ERROR: Cannot reinit 0D " #_type " elements!"); } \
67REINIT_ERROR(0, _type, edge_reinit) { libmesh_error_msg("ERROR: Cannot edge_reinit 0D " #_type " elements!"); } \
68SIDEMAP_ERROR(0, _type, side_map) { libmesh_error_msg("ERROR: Cannot side_map 0D " #_type " elements!"); } \
69SIDEMAP_ERROR(0, _type, edge_map) { libmesh_error_msg("ERROR: Cannot edge_map 0D " #_type " elements!"); } \
70REINIT_ERROR(1, _type, edge_reinit) { libmesh_error_msg("ERROR: Cannot edge_reinit 1D " #_type " elements!"); } \
71SIDEMAP_ERROR(1, _type, edge_map) { libmesh_error_msg("ERROR: Cannot edge_map 1D " #_type " elements!"); }
72
102SIDEMAP_ERROR(1, NEDELEC_ONE, side_map) { libmesh_error_msg("ERROR: Cannot side_map 1D NEDELEC_ONE elements!"); }
103REINIT_ERROR(1, RAVIART_THOMAS, reinit) { libmesh_error_msg("ERROR: Cannot reinit 1D RAVIART_THOMAS elements!"); }
104SIDEMAP_ERROR(1, RAVIART_THOMAS, side_map) { libmesh_error_msg("ERROR: Cannot side_map 1D RAVIART_THOMAS elements!"); }
105REINIT_ERROR(1, L2_RAVIART_THOMAS, reinit) { libmesh_error_msg("ERROR: Cannot reinit 1D L2_RAVIART_THOMAS elements!"); }
106SIDEMAP_ERROR(1, L2_RAVIART_THOMAS, side_map) { libmesh_error_msg("ERROR: Cannot side_map 1D L2_RAVIART_THOMAS elements!"); }
107
108//-------------------------------------------------------
109// Methods for 2D, 3D
110template <unsigned int Dim, FEFamily T>
111void FE<Dim,T>::reinit(const Elem * elem,
112 const unsigned int s,
113 const Real /* tolerance */,
114 const std::vector<Point> * const pts,
115 const std::vector<Real> * const weights)
116{
117 libmesh_assert(elem);
118 libmesh_assert (this->qrule != nullptr || pts != nullptr);
119 // We now do this for 1D elements!
120 // libmesh_assert_not_equal_to (Dim, 1);
121
122 // If we called this function redundantly (e.g. in an FEMContext
123 // that is asked not to do any side calculations) then let's skip the
124 // whole inverse_map process that calculates side points
125 if (this->calculating_nothing())
126 {
127 this->calculations_started = true; // Ironic
128 return;
129 }
130
131 // We're (possibly re-) calculating now! FIXME - we currently
132 // expect to be able to use side_map and JxW later, but we could
133 // optimize further here.
134 this->_fe_map->add_calculations();
135 this->_fe_map->get_JxW();
136 this->_fe_map->get_xyz();
137 this->determine_calculations();
138
139 // Build the side of interest
140 const std::unique_ptr<const Elem> side(elem->build_side_ptr(s));
141
142 // Find the max p_level to select
143 // the right quadrature rule for side integration
144 unsigned int side_p_level = elem->p_level();
145 if (elem->neighbor_ptr(s) != nullptr)
146 side_p_level = std::max(side_p_level, elem->neighbor_ptr(s)->p_level());
147
148 // Initialize the shape functions at the user-specified
149 // points
150 if (pts != nullptr)
151 {
152 // The shape functions do not correspond to the qrule
153 this->shapes_on_quadrature = false;
154
155 // Initialize the face shape functions
156 this->_fe_map->template init_face_shape_functions<Dim>(*pts, side.get());
157
158 // Compute the Jacobian*Weight on the face for integration
159 if (weights != nullptr)
160 {
161 this->_fe_map->compute_face_map (Dim, *weights, side.get());
162 }
163 else
164 {
165 std::vector<Real> dummy_weights (pts->size(), 1.);
166 this->_fe_map->compute_face_map (Dim, dummy_weights, side.get());
167 }
168 }
169 // If there are no user specified points, we use the
170 // quadrature rule
171 else
172 {
173 // initialize quadrature rule
174 this->qrule->init(*side, side_p_level);
175
176 if (this->qrule->shapes_need_reinit())
177 this->shapes_on_quadrature = false;
178
179 // FIXME - could this break if the same FE object was used
180 // for both volume and face integrals? - RHS
181 // We might not need to reinitialize the shape functions
182 if ((this->get_type() != elem->type()) ||
183 (elem->runtime_topology() &&
184 this->_elem != elem) ||
185 (side->type() != last_side) ||
186 (this->_elem_p_level != side_p_level) ||
187 this->shapes_need_reinit() ||
188 !this->shapes_on_quadrature)
189 {
190 // Set the element
191 this->_elem = elem;
192 this->_elem_type = elem->type();
193
194 // Set the last_side
195 last_side = side->type();
196
197 // Set the last p level
198 this->_p_level = this->_add_p_level_in_reinit * side_p_level;
199
200 // Initialize the face shape functions
201 this->_fe_map->template init_face_shape_functions<Dim>(this->qrule->get_points(), side.get());
202 }
203 else
204 this->_elem = elem;
205
206 // Compute the Jacobian*Weight on the face for integration
207 this->_fe_map->compute_face_map (Dim, this->qrule->get_weights(), side.get());
208
209 // The shape functions correspond to the qrule
210 this->shapes_on_quadrature = true;
211 }
212
213 // make a copy of the Jacobian for integration
214 const std::vector<Real> JxW_int(this->_fe_map->get_JxW());
215
216 // make a copy of shape on quadrature info
217 bool shapes_on_quadrature_side = this->shapes_on_quadrature;
218
219 // Find where the integration points are located on the
220 // full element.
221 const std::vector<Point> * ref_qp;
222 if (pts != nullptr)
223 ref_qp = pts;
224 else
225 ref_qp = &this->qrule->get_points();
226
227 std::vector<Point> qp;
228 this->side_map(elem, side.get(), s, *ref_qp, qp);
229
230 // compute the shape function and derivative values
231 // at the points qp
232 this->reinit (elem, &qp);
233
234 this->shapes_on_quadrature = shapes_on_quadrature_side;
235
236 this->_elem_p_level = side_p_level;
237
238 // copy back old data
239 this->_fe_map->get_JxW() = JxW_int;
240}
241
242
243
244template <unsigned int Dim, FEFamily T>
245void FE<Dim,T>::edge_reinit(const Elem * elem,
246 const unsigned int e,
247 const Real /* tolerance */,
248 const std::vector<Point> * const pts,
249 const std::vector<Real> * const weights)
250{
251 libmesh_assert(elem);
252 libmesh_assert (this->qrule != nullptr || pts != nullptr);
253 // We don't do this for 1D elements!
254 libmesh_assert_not_equal_to (Dim, 1);
255
256 // We're (possibly re-) calculating now! Time to determine what.
257 // FIXME - we currently just assume that we're using JxW and calling
258 // edge_map later.
259 this->_fe_map->add_calculations();
260 this->_fe_map->get_JxW();
261 this->_fe_map->get_xyz();
262 this->determine_calculations();
263
264 // Build the side of interest
265 const std::unique_ptr<const Elem> edge(elem->build_edge_ptr(e));
266
267 // Initialize the shape functions at the user-specified
268 // points
269 if (pts != nullptr)
270 {
271 // The shape functions do not correspond to the qrule
272 this->shapes_on_quadrature = false;
273
274 // Initialize the edge shape functions
275 this->_fe_map->template init_edge_shape_functions<Dim> (*pts, edge.get());
276
277 // Compute the Jacobian*Weight on the face for integration
278 if (weights != nullptr)
279 {
280 this->_fe_map->compute_edge_map (Dim, *weights, edge.get());
281 }
282 else
283 {
284 std::vector<Real> dummy_weights (pts->size(), 1.);
285 this->_fe_map->compute_edge_map (Dim, dummy_weights, edge.get());
286 }
287 }
288 // If there are no user specified points, we use the
289 // quadrature rule
290 else
291 {
292 // initialize quadrature rule
293 this->qrule->init(*edge, elem->p_level());
294
295 if (this->qrule->shapes_need_reinit())
296 this->shapes_on_quadrature = false;
297
298 // We might not need to reinitialize the shape functions
299 if ((this->get_type() != elem->type()) ||
300 (elem->runtime_topology() &&
301 this->_elem != elem) ||
302 (edge->type() != last_edge) ||
303 this->shapes_need_reinit() ||
304 !this->shapes_on_quadrature)
305 {
306 // Set the element
307 this->_elem = elem;
308 this->_elem_type = elem->type();
309
310 // Set the last_edge
311 last_edge = edge->type();
312
313 // Initialize the edge shape functions
314 this->_fe_map->template init_edge_shape_functions<Dim> (this->qrule->get_points(), edge.get());
315 }
316 else
317 this->_elem = elem;
318
319 // Compute the Jacobian*Weight on the face for integration
320 this->_fe_map->compute_edge_map (Dim, this->qrule->get_weights(), edge.get());
321
322 // The shape functions correspond to the qrule
323 this->shapes_on_quadrature = true;
324 }
325
326 // make a copy of the Jacobian for integration
327 const std::vector<Real> JxW_int(this->_fe_map->get_JxW());
328
329 // Find where the integration points are located on the
330 // full element.
331 const std::vector<Point> * ref_qp;
332 if (pts != nullptr)
333 ref_qp = pts;
334 else
335 ref_qp = & this->qrule->get_points();
336
337 std::vector<Point> qp;
338 this->edge_map(elem, edge.get(), e, *ref_qp, qp);
339
340 // compute the shape function and derivative values
341 // at the points qp
342 this->reinit (elem, &qp);
343
344 // copy back old data
345 this->_fe_map->get_JxW() = JxW_int;
346}
347
348template <unsigned int Dim, FEFamily T>
349void FE<Dim,T>::side_map (const Elem * elem,
350 const Elem * side,
351 const unsigned int s,
352 const std::vector<Point> & reference_side_points,
353 std::vector<Point> & reference_points)
354{
355 // We're calculating mappings - we need at least first order info
356 this->calculate_phi = true;
357 this->determine_calculations();
358
359 unsigned int side_p_level = elem->p_level();
360 if (elem->neighbor_ptr(s) != nullptr)
361 side_p_level = std::max(side_p_level, elem->neighbor_ptr(s)->p_level());
362
363 if (side->type() != last_side ||
364 (elem->runtime_topology() &&
365 this->_elem != elem) ||
366 side_p_level != this->_elem_p_level ||
367 !this->shapes_on_quadrature)
368 {
369 // Set the element type
370 this->_elem = elem;
371 this->_elem_type = elem->type();
372 this->_elem_p_level = side_p_level;
373 this->_p_level = this->_add_p_level_in_reinit * side_p_level;
374
375 // Set the last_side
376 last_side = side->type();
377
378 // Initialize the face shape functions
379 this->_fe_map->template init_face_shape_functions<Dim>(reference_side_points, side);
380 }
381 else
382 this->_elem = elem;
383
384 const unsigned int n_points =
385 cast_int<unsigned int>(reference_side_points.size());
386 reference_points.resize(n_points);
387 for (unsigned int i = 0; i < n_points; i++)
388 reference_points[i].zero();
389
390 std::vector<Point> refspace_nodes;
391 this->get_refspace_nodes(elem->type(), refspace_nodes);
392
393 const std::vector<std::vector<Real>> & psi_map = this->_fe_map->get_psi();
394
395 // sum over the nodes
396 for (auto i : index_range(psi_map))
397 {
398 const Point & side_node = refspace_nodes[elem->local_side_node(s,i)];
399 for (unsigned int p=0; p<n_points; p++)
400 reference_points[p].add_scaled (side_node, psi_map[i][p]);
401 }
402}
403
404template <unsigned int Dim, FEFamily T>
405void FE<Dim,T>::edge_map (const Elem * elem,
406 const Elem * edge,
407 const unsigned int e,
408 const std::vector<Point> & reference_edge_points,
409 std::vector<Point> & reference_points)
410{
411 // We're calculating mappings - we need at least first order info
412 this->calculate_phi = true;
413 this->determine_calculations();
414
415 unsigned int edge_p_level = elem->p_level();
416
417 if (edge->type() != last_edge ||
418 (elem->runtime_topology() &&
419 this->_elem != elem) ||
420 edge_p_level != this->_elem_p_level ||
421 !this->shapes_on_quadrature)
422 {
423 // Set the element type
424 this->_elem = elem;
425 this->_elem_type = elem->type();
426 this->_elem_p_level = edge_p_level;
427 this->_p_level = this->_add_p_level_in_reinit * edge_p_level;
428
429 // Set the last_edge
430 last_edge = edge->type();
431
432 // Initialize the edge shape functions
433 this->_fe_map->template init_edge_shape_functions<Dim>(reference_edge_points, edge);
434 }
435 else
436 this->_elem = elem;
437
438 const unsigned int n_points =
439 cast_int<unsigned int>(reference_edge_points.size());
440 reference_points.resize(n_points);
441 for (unsigned int i = 0; i < n_points; i++)
442 reference_points[i].zero();
443
444 std::vector<Point> refspace_nodes;
445 this->get_refspace_nodes(elem->type(), refspace_nodes);
446
447 const std::vector<std::vector<Real>> & psi_map = this->_fe_map->get_psi();
448
449 // sum over the nodes
450 for (auto i : index_range(psi_map))
451 {
452 const Point & edge_node = refspace_nodes[elem->local_edge_node(e,i)];
453 for (unsigned int p=0; p<n_points; p++)
454 reference_points[p].add_scaled (edge_node, psi_map[i][p]);
455 }
456}
457
458
459template<unsigned int Dim>
460void FEMap::init_face_shape_functions(const std::vector<Point> & qp,
461 const Elem * side)
462{
463 // Start logging the shape function initialization
464 LOG_SCOPE("init_face_shape_functions()", "FEMap");
465
466 libmesh_assert(side);
467
468 // We're calculating now!
470
471 // The element type and order to use in
472 // the map
473 const FEFamily mapping_family = FEMap::map_fe_type(*side);
474 const FEType map_fe_type(side->default_order(), mapping_family);
475
476 // The number of quadrature points.
477 const unsigned int n_qp = cast_int<unsigned int>(qp.size());
478
479 // Do not use the p_level(), if any, that is inherited by the side.
480 const unsigned int n_mapping_shape_functions =
481 FEInterface::n_shape_functions(map_fe_type, /*extra_order=*/0, side);
482
483 // resize the vectors to hold current data
484 // Psi are the shape functions used for the FE mapping
485 if (calculate_xyz)
486 this->psi_map.resize (n_mapping_shape_functions);
487
488 if (Dim > 1)
489 {
490 if (calculate_dxyz)
491 this->dpsidxi_map.resize (n_mapping_shape_functions);
492#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
493 if (calculate_d2xyz)
494 this->d2psidxi2_map.resize (n_mapping_shape_functions);
495#endif
496 }
497
498 if (Dim == 3)
499 {
500 if (calculate_dxyz)
501 this->dpsideta_map.resize (n_mapping_shape_functions);
502#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
503 if (calculate_d2xyz)
504 {
505 this->d2psidxideta_map.resize (n_mapping_shape_functions);
506 this->d2psideta2_map.resize (n_mapping_shape_functions);
507 }
508#endif
509 }
510
511 FEInterface::shape_ptr shape_ptr =
513
514 FEInterface::shape_deriv_ptr shape_deriv_ptr =
516
517#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
518 FEInterface::shape_second_deriv_ptr shape_second_deriv_ptr =
520#endif
521
522 for (unsigned int i=0; i<n_mapping_shape_functions; i++)
523 {
524 // Allocate space to store the values of the shape functions
525 // and their first and second derivatives at the quadrature points.
526 if (calculate_xyz)
527 this->psi_map[i].resize (n_qp);
528 if (Dim > 1)
529 {
530 if (calculate_dxyz)
531 this->dpsidxi_map[i].resize (n_qp);
532#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
533 if (calculate_d2xyz)
534 this->d2psidxi2_map[i].resize (n_qp);
535#endif
536 }
537 if (Dim == 3)
538 {
539 if (calculate_dxyz)
540 this->dpsideta_map[i].resize (n_qp);
541#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
542 if (calculate_d2xyz)
543 {
544 this->d2psidxideta_map[i].resize (n_qp);
545 this->d2psideta2_map[i].resize (n_qp);
546 }
547#endif
548 }
549
550
551 // Compute the value of mapping shape function i, and its first
552 // and second derivatives at quadrature point p
553 for (unsigned int p=0; p<n_qp; p++)
554 {
555 if (calculate_xyz)
556 this->psi_map[i][p] = shape_ptr (map_fe_type, side, i, qp[p], false);
557 if (Dim > 1)
558 {
559 if (calculate_dxyz)
560 this->dpsidxi_map[i][p] = shape_deriv_ptr (map_fe_type, side, i, 0, qp[p], false);
561#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
562 if (calculate_d2xyz)
563 this->d2psidxi2_map[i][p] = shape_second_deriv_ptr(map_fe_type, side, i, 0, qp[p], false);
564#endif
565 }
566 // libMesh::out << "this->d2psidxi2_map["<<i<<"][p]=" << d2psidxi2_map[i][p] << std::endl;
567
568 // If we are in 3D, then our sides are 2D faces.
569 // For the second derivatives, we must also compute the cross
570 // derivative d^2() / dxi deta
571 if (Dim == 3)
572 {
573 if (calculate_dxyz)
574 this->dpsideta_map[i][p] = shape_deriv_ptr (map_fe_type, side, i, 1, qp[p], false);
575#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
576 if (calculate_d2xyz)
577 {
578 this->d2psidxideta_map[i][p] = shape_second_deriv_ptr(map_fe_type, side, i, 1, qp[p], false);
579 this->d2psideta2_map[i][p] = shape_second_deriv_ptr(map_fe_type, side, i, 2, qp[p], false);
580 }
581#endif
582 }
583 }
584 }
585}
586
587template<unsigned int Dim>
588void FEMap::init_edge_shape_functions(const std::vector<Point> & qp,
589 const Elem * edge)
590{
591 // Start logging the shape function initialization
592 LOG_SCOPE("init_edge_shape_functions()", "FEMap");
593
594 libmesh_assert(edge);
595
596 // We're calculating now!
598
599 // The element type and order to use in
600 // the map
601 const FEFamily mapping_family = FEMap::map_fe_type(*edge);
602 const FEType map_fe_type(edge->default_order(), mapping_family);
603
604 // The number of quadrature points.
605 const unsigned int n_qp = cast_int<unsigned int>(qp.size());
607 // Do not use the p_level(), if any, that is inherited by the side.
608 const unsigned int n_mapping_shape_functions =
609 FEInterface::n_shape_functions(map_fe_type, /*extra_order=*/0, edge);
610
611 // resize the vectors to hold current data
612 // Psi are the shape functions used for the FE mapping
613 if (calculate_xyz)
614 this->psi_map.resize (n_mapping_shape_functions);
615 if (calculate_dxyz)
616 this->dpsidxi_map.resize (n_mapping_shape_functions);
617#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
618 if (calculate_d2xyz)
619 this->d2psidxi2_map.resize (n_mapping_shape_functions);
620#endif
621
622 FEInterface::shape_ptr shape_ptr =
624
625 FEInterface::shape_deriv_ptr shape_deriv_ptr =
627
628#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
629 FEInterface::shape_second_deriv_ptr shape_second_deriv_ptr =
631#endif // LIBMESH_ENABLE_SECOND_DERIVATIVES
632
633 for (unsigned int i=0; i<n_mapping_shape_functions; i++)
634 {
635 // Allocate space to store the values of the shape functions
636 // and their first and second derivatives at the quadrature points.
637 if (calculate_xyz)
638 this->psi_map[i].resize (n_qp);
639 if (calculate_dxyz)
640 this->dpsidxi_map[i].resize (n_qp);
641#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
642 if (calculate_d2xyz)
643 this->d2psidxi2_map[i].resize (n_qp);
644#endif
645
646 // Compute the value of mapping shape function i, and its first
647 // and second derivatives at quadrature point p
648 for (unsigned int p=0; p<n_qp; p++)
649 {
650 if (calculate_xyz)
651 this->psi_map[i][p] = shape_ptr (map_fe_type, edge, i, qp[p], false);
652 if (calculate_dxyz)
653 this->dpsidxi_map[i][p] = shape_deriv_ptr (map_fe_type, edge, i, 0, qp[p], false);
654#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
655 if (calculate_d2xyz)
656 this->d2psidxi2_map[i][p] = shape_second_deriv_ptr(map_fe_type, edge, i, 0, qp[p], false);
657#endif
658 }
659 }
660}
661
662
663
664void FEMap::compute_face_map(int dim, const std::vector<Real> & qw,
665 const Elem * side)
666{
667 libmesh_assert(side);
668
669 // We're calculating now!
671
672 LOG_ONE_ENTITY_SCOPE("compute_face_map()", "FEMap");
673
674 // The number of quadrature points.
675 const unsigned int n_qp = cast_int<unsigned int>(qw.size());
676
677 const FEFamily mapping_family = FEMap::map_fe_type(*side);
678 const Order mapping_order (side->default_order());
679 const FEType map_fe_type(mapping_order, mapping_family);
680
681 // Do not use the p_level(), if any, that is inherited by the side.
682 const unsigned int n_mapping_shape_functions =
683 FEInterface::n_shape_functions(map_fe_type, /*extra_order=*/0, side);
684
685 switch (dim)
686 {
687 case 1:
688 {
689 // A 1D finite element, potentially in 2D or 3D space.
690 // This means the boundary is a "0D finite element", a
691 // NODEELEM.
692
693 // Resize the vectors to hold data at the quadrature points
694 {
695 if (calculate_xyz)
696 this->xyz.resize(n_qp);
697 if (calculate_dxyz)
698 normals.resize(n_qp);
699
700 if (calculate_dxyz)
701 this->JxW.resize(n_qp);
702 }
703
704 // If we have no quadrature points, there's nothing else to do
705 if (!n_qp)
706 break;
707
708 // We need to look back at the full edge to figure out the normal
709 // vector
710 const Elem * elem = side->interior_parent();
711 libmesh_assert (elem);
712 if (calculate_dxyz)
713 {
714 if (side->node_id(0) == elem->node_id(0))
715 {
716 const Point reference_point = Point(-1.);
717 Point dx_dxi = FEMap::map_deriv (1, elem, 0, reference_point);
718 normals[0] = -dx_dxi.unit();
719 }
720 else
721 {
722 libmesh_assert_equal_to (side->node_id(0),
723 elem->node_id(1));
724 const Point reference_point = Point(1.);
725 Point dx_dxi = FEMap::map_deriv (1, elem, 0, reference_point);
726 normals[0] = dx_dxi.unit();
727 }
728 }
729
730 // Calculate x at the point
731 if (calculate_xyz)
732 libmesh_assert_equal_to (this->psi_map.size(), 1);
733 // In the unlikely event we have multiple quadrature
734 // points, they'll be in the same place
735 for (unsigned int p=0; p<n_qp; p++)
736 {
737 if (calculate_xyz)
738 {
739 this->xyz[p].zero();
740 this->xyz[p].add_scaled (side->point(0), this->psi_map[0][p]);
741 }
742 if (calculate_dxyz)
743 {
744 normals[p] = normals[0];
745 this->JxW[p] = 1.0*qw[p];
746 }
747 }
748
749 // done computing the map
750 break;
751 }
752
753 case 2:
754 {
755 // A 2D finite element living in either 2D or 3D space.
756 // This means the boundary is a 1D finite element, i.e.
757 // and EDGE2 or EDGE3.
758 // Resize the vectors to hold data at the quadrature points
759 {
760 if (calculate_xyz)
761 this->xyz.resize(n_qp);
762 if (calculate_dxyz)
763 {
764 this->dxyzdxi_map.resize(n_qp);
765 this->tangents.resize(n_qp);
766 this->normals.resize(n_qp);
767
768 this->JxW.resize(n_qp);
769 }
770
771#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
772 if (calculate_d2xyz)
773 {
774 this->d2xyzdxi2_map.resize(n_qp);
775 this->curvatures.resize(n_qp);
776 }
777#endif
778 }
779
780 // Clear the entities that will be summed
781 // Compute the tangent & normal at the quadrature point
782 for (unsigned int p=0; p<n_qp; p++)
783 {
784 if (calculate_xyz)
785 this->xyz[p].zero();
786 if (calculate_dxyz)
787 {
788 this->tangents[p].resize(LIBMESH_DIM-1); // 1 Tangent in 2D, 2 in 3D
789 this->dxyzdxi_map[p].zero();
790 }
791#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
792 if (calculate_d2xyz)
793 this->d2xyzdxi2_map[p].zero();
794#endif
795 }
796
797 // compute x, dxdxi at the quadrature points
798 for (unsigned int i=0; i<n_mapping_shape_functions; i++) // sum over the nodes
799 {
800 const Point & side_point = side->point(i);
801
802 for (unsigned int p=0; p<n_qp; p++) // for each quadrature point...
803 {
804 if (calculate_xyz)
805 this->xyz[p].add_scaled (side_point, this->psi_map[i][p]);
806 if (calculate_dxyz)
807 this->dxyzdxi_map[p].add_scaled (side_point, this->dpsidxi_map[i][p]);
808#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
809 if (calculate_d2xyz)
810 this->d2xyzdxi2_map[p].add_scaled(side_point, this->d2psidxi2_map[i][p]);
811#endif
812 }
813 }
814
815 // Compute the tangent & normal at the quadrature point
816 if (calculate_dxyz)
817 {
818 for (unsigned int p=0; p<n_qp; p++)
819 {
820 // The first tangent comes from just the edge's Jacobian
821 this->tangents[p][0] = this->dxyzdxi_map[p].unit();
822
823#if LIBMESH_DIM == 2
824 // For a 2D element living in 2D, the normal is given directly
825 // from the entries in the edge Jacobian.
826 this->normals[p] = (Point(this->dxyzdxi_map[p](1), -this->dxyzdxi_map[p](0), 0.)).unit();
827
828#elif LIBMESH_DIM == 3
829 // For a 2D element living in 3D, there is a second tangent.
830 // For the second tangent, we need to refer to the full
831 // element's (not just the edge's) Jacobian.
832 const Elem * elem = side->interior_parent();
833 libmesh_assert(elem);
834
835 // Inverse map xyz[p] to a reference point on the parent...
836 Point reference_point = FEMap::inverse_map(2, elem, this->xyz[p]);
837
838 // Get dxyz/dxi and dxyz/deta from the parent map.
839 Point dx_dxi = FEMap::map_deriv (2, elem, 0, reference_point);
840 Point dx_deta = FEMap::map_deriv (2, elem, 1, reference_point);
841
842 // The second tangent vector is formed by crossing these vectors.
843 tangents[p][1] = dx_dxi.cross(dx_deta).unit();
844
845 // Finally, the normal in this case is given by crossing these
846 // two tangents.
847 normals[p] = tangents[p][0].cross(tangents[p][1]).unit();
848#endif
849
850
851#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
852 // The curvature is computed via the familiar Frenet formula:
853 // curvature = [d^2(x) / d (xi)^2] dot [normal]
854 // For a reference, see:
855 // F.S. Merritt, Mathematics Manual, 1962, McGraw-Hill, p. 310
856 //
857 // Note: The sign convention here is different from the
858 // 3D case. Concave-upward curves (smiles) have a positive
859 // curvature. Concave-downward curves (frowns) have a
860 // negative curvature. Be sure to take that into account!
861 if (calculate_d2xyz)
862 {
863 const Real numerator = this->d2xyzdxi2_map[p] * this->normals[p];
864 const Real denominator = this->dxyzdxi_map[p].norm_sq();
865 libmesh_assert_not_equal_to (denominator, 0);
866 curvatures[p] = numerator / denominator;
867 }
868#endif
869 }
870
871 // compute the jacobian at the quadrature points
872 for (unsigned int p=0; p<n_qp; p++)
873 {
874 const Real the_jac = this->dxyzdxi_map[p].norm();
875
876 libmesh_assert_greater (the_jac, 0.);
877
878 this->JxW[p] = the_jac*qw[p];
879 }
880 }
881
882 // done computing the map
883 break;
884 }
885
886
887
888 case 3:
889 {
890 // A 3D finite element living in 3D space.
891 // Resize the vectors to hold data at the quadrature points
892 {
893 if (calculate_xyz)
894 this->xyz.resize(n_qp);
895 if (calculate_dxyz)
896 {
897 this->dxyzdxi_map.resize(n_qp);
898 this->dxyzdeta_map.resize(n_qp);
899 this->tangents.resize(n_qp);
900 this->normals.resize(n_qp);
901 this->JxW.resize(n_qp);
902 }
903#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
904 if (calculate_d2xyz)
905 {
906 this->d2xyzdxi2_map.resize(n_qp);
907 this->d2xyzdxideta_map.resize(n_qp);
908 this->d2xyzdeta2_map.resize(n_qp);
909 this->curvatures.resize(n_qp);
910 }
911#endif
912 }
913
914 // Clear the entities that will be summed
915 for (unsigned int p=0; p<n_qp; p++)
916 {
917 if (calculate_xyz)
918 this->xyz[p].zero();
919 if (calculate_dxyz)
920 {
921 this->tangents[p].resize(LIBMESH_DIM-1); // 1 Tangent in 2D, 2 in 3D
922 this->dxyzdxi_map[p].zero();
923 this->dxyzdeta_map[p].zero();
924 }
925#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
926 if (calculate_d2xyz)
927 {
928 this->d2xyzdxi2_map[p].zero();
929 this->d2xyzdxideta_map[p].zero();
930 this->d2xyzdeta2_map[p].zero();
931 }
932#endif
933 }
934
935 // compute x, dxdxi at the quadrature points
936 for (unsigned int i=0; i<n_mapping_shape_functions; i++) // sum over the nodes
937 {
938 const Point & side_point = side->point(i);
939
940 for (unsigned int p=0; p<n_qp; p++) // for each quadrature point...
941 {
942 if (calculate_xyz)
943 this->xyz[p].add_scaled (side_point, this->psi_map[i][p]);
944 if (calculate_dxyz)
945 {
946 this->dxyzdxi_map[p].add_scaled (side_point, this->dpsidxi_map[i][p]);
947 this->dxyzdeta_map[p].add_scaled(side_point, this->dpsideta_map[i][p]);
948 }
949#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
950 if (calculate_d2xyz)
951 {
952 this->d2xyzdxi2_map[p].add_scaled (side_point, this->d2psidxi2_map[i][p]);
953 this->d2xyzdxideta_map[p].add_scaled(side_point, this->d2psidxideta_map[i][p]);
954 this->d2xyzdeta2_map[p].add_scaled (side_point, this->d2psideta2_map[i][p]);
955 }
956#endif
957 }
958 }
959
960 // Compute the tangents, normal, and curvature at the quadrature point
961 if (calculate_dxyz)
962 {
963 for (unsigned int p=0; p<n_qp; p++)
964 {
965 const Point n = this->dxyzdxi_map[p].cross(this->dxyzdeta_map[p]);
966 this->normals[p] = n.unit();
967 this->tangents[p][0] = this->dxyzdxi_map[p].unit();
968 this->tangents[p][1] = n.cross(this->dxyzdxi_map[p]).unit();
969
970#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
971 if (calculate_d2xyz)
972 {
973 // Compute curvature using the typical nomenclature
974 // of the first and second fundamental forms.
975 // For reference, see:
976 // 1) http://mathworld.wolfram.com/MeanCurvature.html
977 // (note -- they are using inward normal)
978 // 2) F.S. Merritt, Mathematics Manual, 1962, McGraw-Hill
979 const Real L = -this->d2xyzdxi2_map[p] * this->normals[p];
980 const Real M = -this->d2xyzdxideta_map[p] * this->normals[p];
981 const Real N = -this->d2xyzdeta2_map[p] * this->normals[p];
982 const Real E = this->dxyzdxi_map[p].norm_sq();
983 const Real F = this->dxyzdxi_map[p] * this->dxyzdeta_map[p];
984 const Real G = this->dxyzdeta_map[p].norm_sq();
985
986 const Real numerator = E*N -2.*F*M + G*L;
987 const Real denominator = E*G - F*F;
988 libmesh_assert_not_equal_to (denominator, 0.);
989 curvatures[p] = 0.5*numerator/denominator;
990 }
991#endif
992 }
993
994 // compute the jacobian at the quadrature points, see
995 // http://sp81.msi.umn.edu:999/fluent/fidap/help/theory/thtoc.htm
996 for (unsigned int p=0; p<n_qp; p++)
997 {
998 const Real g11 = (dxdxi_map(p)*dxdxi_map(p) +
999 dydxi_map(p)*dydxi_map(p) +
1000 dzdxi_map(p)*dzdxi_map(p));
1001
1002 const Real g12 = (dxdxi_map(p)*dxdeta_map(p) +
1003 dydxi_map(p)*dydeta_map(p) +
1004 dzdxi_map(p)*dzdeta_map(p));
1005
1006 const Real g21 = g12;
1007
1008 const Real g22 = (dxdeta_map(p)*dxdeta_map(p) +
1009 dydeta_map(p)*dydeta_map(p) +
1010 dzdeta_map(p)*dzdeta_map(p));
1011
1012
1013 const Real the_jac = std::sqrt(g11*g22 - g12*g21);
1014
1015 libmesh_assert_greater (the_jac, 0.);
1016
1017 this->JxW[p] = the_jac*qw[p];
1018 }
1019 }
1020
1021 // done computing the map
1022 break;
1023 }
1024
1025
1026 default:
1027 libmesh_error_msg("Invalid dimension dim = " << dim);
1028 }
1029}
1030
1031
1032
1033
1035 const std::vector<Real> & qw,
1036 const Elem * edge)
1037{
1038 libmesh_assert(edge);
1039
1040 if (dim == 2)
1041 {
1042 // A 2D finite element living in either 2D or 3D space.
1043 // The edges here are the sides of the element, so the
1044 // (misnamed) compute_face_map function does what we want
1045 this->compute_face_map(dim, qw, edge);
1046 return;
1047 }
1048
1049 libmesh_assert_equal_to (dim, 3); // 1D is unnecessary and currently unsupported
1050
1051 LOG_ONE_ENTITY_SCOPE("compute_edge_map()", "FEMap");
1052
1053 // We're calculating now!
1054 this->determine_calculations();
1055
1056 // The number of quadrature points.
1057 const unsigned int n_qp = cast_int<unsigned int>(qw.size());
1058
1059 // Resize the vectors to hold data at the quadrature points
1060 if (calculate_xyz)
1061 this->xyz.resize(n_qp);
1062 if (calculate_dxyz)
1063 {
1064 this->dxyzdxi_map.resize(n_qp);
1065 this->dxyzdeta_map.resize(n_qp);
1066 this->tangents.resize(n_qp);
1067 this->normals.resize(n_qp);
1068 this->JxW.resize(n_qp);
1069 }
1070#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
1071 if (calculate_d2xyz)
1072 {
1073 this->d2xyzdxi2_map.resize(n_qp);
1074 this->d2xyzdxideta_map.resize(n_qp);
1075 this->d2xyzdeta2_map.resize(n_qp);
1076 this->curvatures.resize(n_qp);
1077 }
1078#endif
1079
1080 // Clear the entities that will be summed
1081 for (unsigned int p=0; p<n_qp; p++)
1082 {
1083 if (calculate_xyz)
1084 this->xyz[p].zero();
1085 if (calculate_dxyz)
1086 {
1087 this->tangents[p].resize(1);
1088 this->dxyzdxi_map[p].zero();
1089 this->dxyzdeta_map[p].zero();
1090 }
1091#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
1092 if (calculate_d2xyz)
1093 {
1094 this->d2xyzdxi2_map[p].zero();
1095 this->d2xyzdxideta_map[p].zero();
1096 this->d2xyzdeta2_map[p].zero();
1097 }
1098#endif
1099 }
1100
1101 // compute x, dxdxi at the quadrature points
1102 for (unsigned int i=0,
1103 psi_map_size=cast_int<unsigned int>(psi_map.size());
1104 i != psi_map_size; i++) // sum over the nodes
1105 {
1106 const Point & edge_point = edge->point(i);
1107
1108 for (unsigned int p=0; p<n_qp; p++) // for each quadrature point...
1109 {
1110 if (calculate_xyz)
1111 this->xyz[p].add_scaled (edge_point, this->psi_map[i][p]);
1112 if (calculate_dxyz)
1113 this->dxyzdxi_map[p].add_scaled (edge_point, this->dpsidxi_map[i][p]);
1114#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
1115 if (calculate_d2xyz)
1116 this->d2xyzdxi2_map[p].add_scaled (edge_point, this->d2psidxi2_map[i][p]);
1117#endif
1118 }
1119 }
1120
1121 // Compute the tangents at the quadrature point
1122 // FIXME: normals (plural!) and curvatures are uncalculated
1123 if (calculate_dxyz)
1124 for (unsigned int p=0; p<n_qp; p++)
1125 {
1126 // const Point n = this->dxyzdxi_map[p].cross(this->dxyzdeta_map[p]);
1127 this->tangents[p][0] = this->dxyzdxi_map[p].unit();
1128
1129 // compute the jacobian at the quadrature points
1130 const Real the_jac = std::sqrt(this->dxdxi_map(p)*this->dxdxi_map(p) +
1131 this->dydxi_map(p)*this->dydxi_map(p) +
1132 this->dzdxi_map(p)*this->dzdxi_map(p));
1133
1134 libmesh_assert_greater (the_jac, 0.);
1135
1136 this->JxW[p] = the_jac*qw[p];
1137 }
1138}
1139
1140
1141// Explicit FEMap Instantiations
1142FACE_EDGE_SHAPE_ERROR(0,init_face_shape_functions)
1143template LIBMESH_EXPORT void FEMap::init_face_shape_functions<1>(const std::vector<Point> &, const Elem *);
1144template LIBMESH_EXPORT void FEMap::init_face_shape_functions<2>(const std::vector<Point> &, const Elem *);
1145template LIBMESH_EXPORT void FEMap::init_face_shape_functions<3>(const std::vector<Point> &, const Elem *);
1146
1147FACE_EDGE_SHAPE_ERROR(0,init_edge_shape_functions)
1148template LIBMESH_EXPORT void FEMap::init_edge_shape_functions<1>(const std::vector<Point> &, const Elem *);
1149template LIBMESH_EXPORT void FEMap::init_edge_shape_functions<2>(const std::vector<Point> &, const Elem *);
1150template LIBMESH_EXPORT void FEMap::init_edge_shape_functions<3>(const std::vector<Point> &, const Elem *);
1151
1152//--------------------------------------------------------------
1153// Explicit FE instantiations
1154#define REINIT_AND_SIDE_MAPS(_type) \
1155template LIBMESH_EXPORT void FE<1,_type>::reinit(Elem const *, unsigned int, Real, const std::vector<Point> * const, const std::vector<Real> * const); \
1156template LIBMESH_EXPORT void FE<1,_type>::side_map(Elem const *, Elem const *, const unsigned int, const std::vector<Point> &, std::vector<Point> &); \
1157template LIBMESH_EXPORT void FE<2,_type>::reinit(Elem const *, unsigned int, Real, const std::vector<Point> * const, const std::vector<Real> * const); \
1158template LIBMESH_EXPORT void FE<2,_type>::side_map(Elem const *, Elem const *, const unsigned int, const std::vector<Point> &, std::vector<Point> &); \
1159template LIBMESH_EXPORT void FE<2,_type>::edge_map(Elem const *, Elem const *, const unsigned int, const std::vector<Point> &, std::vector<Point> &); \
1160template LIBMESH_EXPORT void FE<2,_type>::edge_reinit(Elem const *, unsigned int, Real, const std::vector<Point> * const, const std::vector<Real> * const); \
1161template LIBMESH_EXPORT void FE<3,_type>::reinit(Elem const *, unsigned int, Real, const std::vector<Point> * const, const std::vector<Real> * const); \
1162template LIBMESH_EXPORT void FE<3,_type>::side_map(Elem const *, Elem const *, const unsigned int, const std::vector<Point> &, std::vector<Point> &); \
1163template LIBMESH_EXPORT void FE<3,_type>::edge_map(Elem const *, Elem const *, const unsigned int, const std::vector<Point> &, std::vector<Point> &); \
1164template LIBMESH_EXPORT void FE<3,_type>::edge_reinit(Elem const *, unsigned int, Real, const std::vector<Point> * const, const std::vector<Real> * const)
1165
1166REINIT_AND_SIDE_MAPS(LAGRANGE);
1167REINIT_AND_SIDE_MAPS(LAGRANGE_VEC);
1168REINIT_AND_SIDE_MAPS(L2_LAGRANGE);
1169REINIT_AND_SIDE_MAPS(L2_LAGRANGE_GLL);
1170REINIT_AND_SIDE_MAPS(LAGRANGE_GLL);
1171REINIT_AND_SIDE_MAPS(L2_LAGRANGE_VEC);
1172REINIT_AND_SIDE_MAPS(HIERARCHIC);
1173REINIT_AND_SIDE_MAPS(HIERARCHIC_VEC);
1174REINIT_AND_SIDE_MAPS(L2_HIERARCHIC);
1175REINIT_AND_SIDE_MAPS(L2_HIERARCHIC_VEC);
1176REINIT_AND_SIDE_MAPS(SIDE_HIERARCHIC);
1177REINIT_AND_SIDE_MAPS(CLOUGH);
1178REINIT_AND_SIDE_MAPS(HERMITE);
1179REINIT_AND_SIDE_MAPS(MONOMIAL);
1180REINIT_AND_SIDE_MAPS(MONOMIAL_VEC);
1181REINIT_AND_SIDE_MAPS(SCALAR);
1182REINIT_AND_SIDE_MAPS(XYZ);
1183
1184#ifdef LIBMESH_ENABLE_HIGHER_ORDER_SHAPES
1185REINIT_AND_SIDE_MAPS(BERNSTEIN);
1186REINIT_AND_SIDE_MAPS(SZABAB);
1187REINIT_AND_SIDE_MAPS(RATIONAL_BERNSTEIN);
1188#endif
1189
1190template LIBMESH_EXPORT void FE<2,SUBDIVISION>::reinit(Elem const *, unsigned int, Real, const std::vector<Point> * const, const std::vector<Real> * const);
1191template LIBMESH_EXPORT void FE<2,SUBDIVISION>::edge_map(Elem const *, Elem const *, const unsigned int, const std::vector<Point> &, std::vector<Point> &);
1192
1193template LIBMESH_EXPORT void FE<2,NEDELEC_ONE>::reinit(Elem const *, unsigned int, Real, const std::vector<Point> * const, const std::vector<Real> * const);
1194template LIBMESH_EXPORT void FE<2,NEDELEC_ONE>::side_map(Elem const *, Elem const *, const unsigned int, const std::vector<Point> &, std::vector<Point> &);
1195template LIBMESH_EXPORT void FE<2,NEDELEC_ONE>::edge_map(Elem const *, Elem const *, const unsigned int, const std::vector<Point> &, std::vector<Point> &);
1196template LIBMESH_EXPORT void FE<2,NEDELEC_ONE>::edge_reinit(Elem const *, unsigned int, Real, const std::vector<Point> * const, const std::vector<Real> * const);
1197
1198template LIBMESH_EXPORT void FE<2,RAVIART_THOMAS>::reinit(Elem const *, unsigned int, Real, const std::vector<Point> * const, const std::vector<Real> * const);
1199template LIBMESH_EXPORT void FE<2,RAVIART_THOMAS>::side_map(Elem const *, Elem const *, const unsigned int, const std::vector<Point> &, std::vector<Point> &);
1200template LIBMESH_EXPORT void FE<2,RAVIART_THOMAS>::edge_map(Elem const *, Elem const *, const unsigned int, const std::vector<Point> &, std::vector<Point> &);
1201template LIBMESH_EXPORT void FE<2,RAVIART_THOMAS>::edge_reinit(Elem const *, unsigned int, Real, const std::vector<Point> * const, const std::vector<Real> * const);
1202
1203template LIBMESH_EXPORT void FE<2,L2_RAVIART_THOMAS>::reinit(Elem const *, unsigned int, Real, const std::vector<Point> * const, const std::vector<Real> * const);
1204template LIBMESH_EXPORT void FE<2,L2_RAVIART_THOMAS>::side_map(Elem const *, Elem const *, const unsigned int, const std::vector<Point> &, std::vector<Point> &);
1205template LIBMESH_EXPORT void FE<2,L2_RAVIART_THOMAS>::edge_map(Elem const *, Elem const *, const unsigned int, const std::vector<Point> &, std::vector<Point> &);
1206template LIBMESH_EXPORT void FE<2,L2_RAVIART_THOMAS>::edge_reinit(Elem const *, unsigned int, Real, const std::vector<Point> * const, const std::vector<Real> * const);
1207
1208template LIBMESH_EXPORT void FE<3,NEDELEC_ONE>::reinit(Elem const *, unsigned int, Real, const std::vector<Point> * const, const std::vector<Real> * const);
1209template LIBMESH_EXPORT void FE<3,NEDELEC_ONE>::side_map(Elem const *, Elem const *, const unsigned int, const std::vector<Point> &, std::vector<Point> &);
1210template LIBMESH_EXPORT void FE<3,NEDELEC_ONE>::edge_map(Elem const *, Elem const *, const unsigned int, const std::vector<Point> &, std::vector<Point> &);
1211template LIBMESH_EXPORT void FE<3,NEDELEC_ONE>::edge_reinit(Elem const *, unsigned int, Real, const std::vector<Point> * const, const std::vector<Real> * const);
1212
1213template LIBMESH_EXPORT void FE<3,RAVIART_THOMAS>::reinit(Elem const *, unsigned int, Real, const std::vector<Point> * const, const std::vector<Real> * const);
1214template LIBMESH_EXPORT void FE<3,RAVIART_THOMAS>::side_map(Elem const *, Elem const *, const unsigned int, const std::vector<Point> &, std::vector<Point> &);
1215template LIBMESH_EXPORT void FE<3,RAVIART_THOMAS>::edge_map(Elem const *, Elem const *, const unsigned int, const std::vector<Point> &, std::vector<Point> &);
1216template LIBMESH_EXPORT void FE<3,RAVIART_THOMAS>::edge_reinit(Elem const *, unsigned int, Real, const std::vector<Point> * const, const std::vector<Real> * const);
1217
1218template LIBMESH_EXPORT void FE<3,L2_RAVIART_THOMAS>::reinit(Elem const *, unsigned int, Real, const std::vector<Point> * const, const std::vector<Real> * const);
1219template LIBMESH_EXPORT void FE<3,L2_RAVIART_THOMAS>::side_map(Elem const *, Elem const *, const unsigned int, const std::vector<Point> &, std::vector<Point> &);
1220template LIBMESH_EXPORT void FE<3,L2_RAVIART_THOMAS>::edge_map(Elem const *, Elem const *, const unsigned int, const std::vector<Point> &, std::vector<Point> &);
1221template LIBMESH_EXPORT void FE<3,L2_RAVIART_THOMAS>::edge_reinit(Elem const *, unsigned int, Real, const std::vector<Point> * const, const std::vector<Real> * const);
1222
1223// Intel 9.1 complained it needed this in devel mode.
1224//template LIBMESH_EXPORT void FE<2,XYZ>::init_face_shape_functions(const std::vector<Point> &, const Elem *);
1225//template LIBMESH_EXPORT void FE<3,XYZ>::init_face_shape_functions(const std::vector<Point> &, const Elem *);
1226
1227} // namespace libMesh
unsigned int dim
This is the base class from which all geometric element types are derived.
Definition elem.h:96
const Point & point(const unsigned int i) const
Definition elem.h:2583
virtual unsigned int local_side_node(unsigned int side, unsigned int side_node) const =0
virtual Order default_order() const =0
virtual unsigned int local_edge_node(unsigned int edge, unsigned int edge_node) const =0
Similar to Elem::local_side_node(), but instead of a side id, takes an edge id and a node id on that ...
virtual bool runtime_topology() const
Definition elem.h:254
virtual std::unique_ptr< Elem > build_edge_ptr(const unsigned int i)=0
virtual ElemType type() const =0
const Elem * interior_parent() const
Definition elem.C:1100
dof_id_type node_id(const unsigned int i) const
Definition elem.h:2605
unsigned int p_level() const
Definition elem.h:3246
const Elem * neighbor_ptr(unsigned int i) const
Definition elem.h:2736
virtual std::unique_ptr< Elem > build_side_ptr(const unsigned int i)=0
Real(* shape_second_deriv_ptr)(const FEType fet, const Elem *elem, const unsigned int i, const unsigned int j, const Point &p, const bool add_p_level)
Typedef for pointer to a function that returns FE shape function second derivative values.
static shape_deriv_ptr shape_deriv_function(const unsigned int dim, const FEType &fe_t, const ElemType t)
Real(* shape_deriv_ptr)(const FEType fet, const Elem *elem, const unsigned int i, const unsigned int j, const Point &p, const bool add_p_level)
Typedef for pointer to a function that returns FE shape function derivative values.
static shape_second_deriv_ptr shape_second_deriv_function(const unsigned int dim, const FEType &fe_t, const ElemType t)
Real(* shape_ptr)(const FEType fe_t, const Elem *elem, const unsigned int i, const Point &p, const bool add_p_level)
Typedef for pointer to a function that returns FE shape function values.
static shape_ptr shape_function(const unsigned int dim, const FEType &fe_t, const ElemType t)
static unsigned int n_shape_functions(const unsigned int dim, const FEType &fe_t, const ElemType t)
virtual void compute_face_map(int dim, const std::vector< Real > &qw, const Elem *side)
Same as compute_map, but for a side.
Real dzdxi_map(const unsigned int p) const
Used in FEMap::compute_map(), which should be be usable in derived classes, and therefore protected.
Definition fe_map.h:687
Real dxdxi_map(const unsigned int p) const
Used in FEMap::compute_map(), which should be be usable in derived classes, and therefore protected.
Definition fe_map.h:671
std::vector< RealGradient > dxyzdeta_map
Vector of partial derivatives: d(x)/d(eta), d(y)/d(eta), d(z)/d(eta)
Definition fe_map.h:752
std::vector< Real > curvatures
The mean curvature (= one half the sum of the principal curvatures) on the boundary at the quadrature...
Definition fe_map.h:988
std::vector< std::vector< Real > > dpsidxi_map
Map for the derivative of the side functions, d(psi)/d(xi).
Definition fe_map.h:939
std::vector< Point > xyz
The spatial locations of the quadrature points.
Definition fe_map.h:740
static FEFamily map_fe_type(const Elem &elem)
Definition fe_map.C:46
std::vector< RealGradient > d2xyzdeta2_map
Vector of second partial derivatives in eta: d^2(x)/d(eta)^2.
Definition fe_map.h:778
std::vector< std::vector< Real > > d2psideta2_map
Map for the second derivatives (in eta) of the side shape functions.
Definition fe_map.h:968
bool calculate_d2xyz
Should we calculate mapping hessians?
Definition fe_map.h:1023
static Point map_deriv(const unsigned int dim, const Elem *elem, const unsigned int j, const Point &reference_point)
Definition fe_map.C:1988
void init_face_shape_functions(const std::vector< Point > &qp, const Elem *side)
Initializes the reference to physical element map for a side.
Real dzdeta_map(const unsigned int p) const
Used in FEMap::compute_map(), which should be be usable in derived classes, and therefore protected.
Definition fe_map.h:711
Real dydeta_map(const unsigned int p) const
Used in FEMap::compute_map(), which should be be usable in derived classes, and therefore protected.
Definition fe_map.h:703
Real dxdeta_map(const unsigned int p) const
Used in FEMap::compute_map(), which should be be usable in derived classes, and therefore protected.
Definition fe_map.h:695
bool calculate_xyz
Should we calculate physical point locations?
Definition fe_map.h:1011
std::vector< RealGradient > d2xyzdxi2_map
Vector of second partial derivatives in xi: d^2(x)/d(xi)^2, d^2(y)/d(xi)^2, d^2(z)/d(xi)^2.
Definition fe_map.h:766
bool calculate_dxyz
Should we calculate mapping gradients?
Definition fe_map.h:1016
std::vector< std::vector< Real > > psi_map
Map for the side shape functions, psi.
Definition fe_map.h:933
static Point inverse_map(const unsigned int dim, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true, const bool extra_checks=true)
Definition fe_map.C:1512
std::vector< RealGradient > dxyzdxi_map
Vector of partial derivatives: d(x)/d(xi), d(y)/d(xi), d(z)/d(xi)
Definition fe_map.h:746
std::vector< Real > JxW
Jacobian*Weight values at quadrature points.
Definition fe_map.h:1000
std::vector< std::vector< Real > > d2psidxi2_map
Map for the second derivatives (in xi) of the side shape functions.
Definition fe_map.h:954
Real dydxi_map(const unsigned int p) const
Used in FEMap::compute_map(), which should be be usable in derived classes, and therefore protected.
Definition fe_map.h:679
std::vector< std::vector< Real > > d2psidxideta_map
Map for the second (cross) derivatives in xi, eta of the side shape functions.
Definition fe_map.h:961
std::vector< RealGradient > d2xyzdxideta_map
Vector of mixed second partial derivatives in xi-eta: d^2(x)/d(xi)d(eta) d^2(y)/d(xi)d(eta) d^2(z)/d(...
Definition fe_map.h:772
void init_edge_shape_functions(const std::vector< Point > &qp, const Elem *edge)
Same as before, but for an edge.
void compute_edge_map(int dim, const std::vector< Real > &qw, const Elem *side)
Same as before, but for an edge.
std::vector< Point > normals
Normal vectors on boundary at quadrature points.
Definition fe_map.h:980
std::vector< std::vector< Point > > tangents
Tangent vectors on boundary at quadrature points.
Definition fe_map.h:975
void determine_calculations()
Determine which values are to be calculated.
Definition fe_map.h:648
std::vector< std::vector< Real > > dpsideta_map
Map for the derivative of the side function, d(psi)/d(eta).
Definition fe_map.h:945
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
Definition fe_type.h:197
virtual void edge_reinit(const Elem *elem, const unsigned int edge, const Real tolerance=TOLERANCE, const std::vector< Point > *const pts=nullptr, const std::vector< Real > *const weights=nullptr) override
Reinitializes all the physical element-dependent data based on the edge.
virtual void reinit(const Elem *elem, const std::vector< Point > *const pts=nullptr, const std::vector< Real > *const weights=nullptr) override
This is at the core of this class.
Definition fe.C:197
virtual void side_map(const Elem *elem, const Elem *side, const unsigned int s, const std::vector< Point > &reference_side_points, std::vector< Point > &reference_points) override
Computes the reference space quadrature points on the side of an element based on the side quadrature...
virtual void edge_map(const Elem *elem, const Elem *edge, const unsigned int e, const std::vector< Point > &reference_edge_points, std::vector< Point > &reference_points)
Computes the reference space quadrature points on the side of an element based on the edge quadrature...
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition point.h:41
TypeVector< typename CompareTypes< T, T2 >::supertype > cross(const TypeVector< T2 > &v) const
LIBMESH_DEVICE_INLINE TypeVector< T > unit() const
LIBMESH_DEVICE_INLINE void add_scaled(const TypeVector< T2 > &, const T &)
Add a scaled value to this vector without creating a temporary.
The libMesh namespace provides an interface to certain functionality in the library.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition int_range.h:153
libmesh_assert(ctx)
LIBMESH_ERRORS_IN_LOW_D(CLOUGH)
Definition fe_boundary.C:73
const Number zero
.
Definition libmesh.h:297
REINIT_ERROR(1, RAVIART_THOMAS, reinit)
@ L2_RAVIART_THOMAS
@ L2_HIERARCHIC_VEC
@ RATIONAL_BERNSTEIN
SIDEMAP_ERROR(1, NEDELEC_ONE, side_map)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real