fe_interface_inf_fe.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 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 // Local includes
21 #include "libmesh/libmesh_config.h"
22 
23 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
24 
25 #include "libmesh/fe_interface.h"
26 #include "libmesh/inf_fe.h"
27 
28 namespace libMesh
29 {
30 
31 
32 
33 
34 //------------------------------------------------------------
35 //FEInterface class members handling calls to InfFE
36 
37 
38 
39 unsigned int FEInterface::ifem_n_shape_functions(const unsigned int dim,
40  const FEType& fe_t,
41  const ElemType t)
42 {
43  switch (dim)
44  {
45  // 1D
46  case 1:
47  /*
48  * Since InfFE<Dim,T_radial,T_map>::n_shape_functions(...)
49  * is actually independent of T_radial and T_map, we can use
50  * just any T_radial and T_map
51  */
53 
54  // 2D
55  case 2:
57 
58  // 3D
59  case 3:
61 
62  default:
63  libmesh_error();
64  }
65 
66 
67  libmesh_error();
68  return 0;
69 }
70 
71 
72 
73 
74 
75 unsigned int FEInterface::ifem_n_dofs(const unsigned int dim,
76  const FEType& fe_t,
77  const ElemType t)
78 {
79  switch (dim)
80  {
81  // 1D
82  case 1:
83  /*
84  * Since InfFE<Dim,T_radial,T_map>::n_dofs(...)
85  * is actually independent of T_radial and T_map, we can use
86  * just any T_radial and T_map
87  */
89 
90  // 2D
91  case 2:
93 
94  // 3D
95  case 3:
97 
98  default:
99  libmesh_error();
100  }
101 
102 
103  libmesh_error();
104  return 0;
105 }
106 
107 
108 
109 
110 unsigned int FEInterface::ifem_n_dofs_at_node(const unsigned int dim,
111  const FEType& fe_t,
112  const ElemType t,
113  const unsigned int n)
114 {
115  switch (dim)
116  {
117  // 1D
118  case 1:
119  /*
120  * Since InfFE<Dim,T_radial,T_map>::n_dofs_at_node(...)
121  * is actually independent of T_radial and T_map, we can use
122  * just any T_radial and T_map
123  */
125 
126  // 2D
127  case 2:
129 
130  // 3D
131  case 3:
133 
134  default:
135  libmesh_error();
136  }
137 
138 
139  libmesh_error();
140  return 0;
141 }
142 
143 
144 
145 
146 
147 unsigned int FEInterface::ifem_n_dofs_per_elem(const unsigned int dim,
148  const FEType& fe_t,
149  const ElemType t)
150 {
151  switch (dim)
152  {
153  // 1D
154  case 1:
155  /*
156  * Since InfFE<Dim,T_radial,T_map>::n_dofs(...)
157  * is actually independent of T_radial and T_map, we can use
158  * just any T_radial and T_map
159  */
161 
162  // 2D
163  case 2:
165 
166  // 3D
167  case 3:
169 
170  default:
171  libmesh_error();
172  }
173 
174 
175  libmesh_error();
176  return 0;
177 }
178 
179 
180 
181 
182 void FEInterface::ifem_nodal_soln(const unsigned int dim,
183  const FEType& fe_t,
184  const Elem* elem,
185  const std::vector<Number>& elem_soln,
186  std::vector<Number>& nodal_soln)
187 {
188  switch (dim)
189  {
190 
191  // 1D
192  case 1:
193  {
194  switch (fe_t.radial_family)
195  {
196  case INFINITE_MAP:
197  {
198  libMesh::err << "ERROR: INFINTE_MAP is not a valid shape family for radial approximation." << std::endl;
199  libmesh_error();
200  break;
201  }
202 
203  case JACOBI_20_00:
204  {
205  switch (fe_t.inf_map)
206  {
207  case CARTESIAN:
208  {
209  InfFE<1,JACOBI_20_00,CARTESIAN>::nodal_soln(fe_t, elem, elem_soln, nodal_soln);
210  break;
211  }
212  default:
213  libMesh::err << "ERROR: Spherical & Ellipsoidal IFEMs not implemented." << std::endl;
214  libmesh_error();
215  }
216  break;
217  }
218 
219  case JACOBI_30_00:
220  {
221  switch (fe_t.inf_map)
222  {
223  case CARTESIAN:
224  {
225  InfFE<1,JACOBI_30_00,CARTESIAN>::nodal_soln(fe_t, elem, elem_soln, nodal_soln);
226  break;
227  }
228  default:
229  libMesh::err << "ERROR: Spherical & Ellipsoidal IFEMs not implemented." << std::endl;
230  libmesh_error();
231  }
232  break;
233  }
234 
235  case LEGENDRE:
236  {
237  switch (fe_t.inf_map)
238  {
239  case CARTESIAN:
240  {
241  InfFE<1,LEGENDRE,CARTESIAN>::nodal_soln(fe_t, elem, elem_soln, nodal_soln);
242  break;
243  }
244  default:
245  libMesh::err << "ERROR: Spherical & Ellipsoidal IFEMs not implemented." << std::endl;
246  libmesh_error();
247  }
248  break;
249  }
250 
251  case LAGRANGE:
252  {
253  switch (fe_t.inf_map)
254  {
255  case CARTESIAN:
256  {
257  InfFE<1,LAGRANGE,CARTESIAN>::nodal_soln(fe_t, elem, elem_soln, nodal_soln);
258  break;
259  }
260  default:
261  libMesh::err << "ERROR: Spherical & Ellipsoidal IFEMs not implemented." << std::endl;
262  libmesh_error();
263  }
264  break;
265  }
266 
267 
268 
269  default:
270  libMesh::err << "ERROR: Bad FEType.radial_family= " << fe_t.radial_family << std::endl;
271  libmesh_error();
272  break;
273  }
274 
275  break;
276  }
277 
278 
279 
280 
281  // 2D
282  case 2:
283  {
284  switch (fe_t.radial_family)
285  {
286  case INFINITE_MAP:
287  {
288  libMesh::err << "ERROR: INFINTE_MAP is not a valid shape family for radial approximation." << std::endl;
289  libmesh_error();
290  break;
291  }
292 
293  case JACOBI_20_00:
294  {
295  switch (fe_t.inf_map)
296  {
297  case CARTESIAN:
298  {
299  InfFE<2,JACOBI_20_00,CARTESIAN>::nodal_soln(fe_t, elem, elem_soln, nodal_soln);
300  break;
301  }
302  default:
303  libMesh::err << "ERROR: Spherical & Ellipsoidal IFEMs not implemented." << std::endl;
304  libmesh_error();
305  }
306  break;
307  }
308 
309  case JACOBI_30_00:
310  {
311  switch (fe_t.inf_map)
312  {
313  case CARTESIAN:
314  {
315  InfFE<2,JACOBI_30_00,CARTESIAN>::nodal_soln(fe_t, elem, elem_soln, nodal_soln);
316  break;
317  }
318  default:
319  libMesh::err << "ERROR: Spherical & Ellipsoidal IFEMs not implemented." << std::endl;
320  libmesh_error();
321  }
322  break;
323  }
324 
325  case LEGENDRE:
326  {
327  switch (fe_t.inf_map)
328  {
329  case CARTESIAN:
330  {
331  InfFE<2,LEGENDRE,CARTESIAN>::nodal_soln(fe_t, elem, elem_soln, nodal_soln);
332  break;
333  }
334  default:
335  libMesh::err << "ERROR: Spherical & Ellipsoidal IFEMs not implemented." << std::endl;
336  libmesh_error();
337  }
338  break;
339  }
340 
341  case LAGRANGE:
342  {
343  switch (fe_t.inf_map)
344  {
345  case CARTESIAN:
346  {
347  InfFE<2,LAGRANGE,CARTESIAN>::nodal_soln(fe_t, elem, elem_soln, nodal_soln);
348  break;
349  }
350  default:
351  libMesh::err << "ERROR: Spherical & Ellipsoidal IFEMs not implemented." << std::endl;
352  libmesh_error();
353  }
354  break;
355  }
356 
357 
358 
359  default:
360  libMesh::err << "ERROR: Bad FEType.radial_family= " << fe_t.radial_family << std::endl;
361  libmesh_error();
362  break;
363  }
364 
365  break;
366  }
367 
368 
369 
370 
371  // 3D
372  case 3:
373  {
374  switch (fe_t.radial_family)
375  {
376  case INFINITE_MAP:
377  {
378  libMesh::err << "ERROR: INFINTE_MAP is not a valid shape family for radial approximation." << std::endl;
379  libmesh_error();
380  break;
381  }
382 
383  case JACOBI_20_00:
384  {
385  switch (fe_t.inf_map)
386  {
387  case CARTESIAN:
388  {
389  InfFE<3,JACOBI_20_00,CARTESIAN>::nodal_soln(fe_t, elem, elem_soln, nodal_soln);
390  break;
391  }
392  default:
393  libMesh::err << "ERROR: Spherical & Ellipsoidal IFEMs not implemented." << std::endl;
394  libmesh_error();
395  }
396  break;
397  }
398 
399  case JACOBI_30_00:
400  {
401  switch (fe_t.inf_map)
402  {
403  case CARTESIAN:
404  {
405  InfFE<3,JACOBI_30_00,CARTESIAN>::nodal_soln(fe_t, elem, elem_soln, nodal_soln);
406  break;
407  }
408  default:
409  libMesh::err << "ERROR: Spherical & Ellipsoidal IFEMs not implemented." << std::endl;
410  libmesh_error();
411  }
412  break;
413  }
414 
415  case LEGENDRE:
416  {
417  switch (fe_t.inf_map)
418  {
419  case CARTESIAN:
420  {
421  InfFE<3,LEGENDRE,CARTESIAN>::nodal_soln(fe_t, elem, elem_soln, nodal_soln);
422  break;
423  }
424  default:
425  libMesh::err << "ERROR: Spherical & Ellipsoidal IFEMs not implemented." << std::endl;
426  libmesh_error();
427  }
428  break;
429  }
430 
431  case LAGRANGE:
432  {
433  switch (fe_t.inf_map)
434  {
435  case CARTESIAN:
436  {
437  InfFE<3,LAGRANGE,CARTESIAN>::nodal_soln(fe_t, elem, elem_soln, nodal_soln);
438  break;
439  }
440  default:
441  libMesh::err << "ERROR: Spherical & Ellipsoidal IFEMs not implemented." << std::endl;
442  libmesh_error();
443  }
444  break;
445  }
446 
447 
448 
449  default:
450  libMesh::err << "ERROR: Bad FEType.radial_family= " << fe_t.radial_family << std::endl;
451  libmesh_error();
452  break;
453  }
454 
455  break;
456  }
457 
458  default:
459  libmesh_error();
460  }
461  return;
462 }
463 
464 
465 
466 
467 
468 
469 
471  const FEType& fe_t,
472  const Elem* elem,
473  const Point& p,
474  const Real tolerance,
475  const bool secure)
476 {
477  switch (dim)
478  {
479  // 1D
480  case 1:
481  {
482  switch (fe_t.inf_map)
483  {
484  case CARTESIAN:
485  return InfFE<1,JACOBI_20_00,CARTESIAN>::inverse_map(elem, p, tolerance, secure);
486 
487  case SPHERICAL:
488  case ELLIPSOIDAL:
489  {
490  libMesh::err << "ERROR: Spherical and Ellipsoidal IFEMs not (yet) " << std::endl
491  << "implemented." << std::endl;
492  libmesh_error();
493  }
494 
495 /*
496  case SPHERICAL:
497  return InfFE<1,JACOBI_20_00,SPHERICAL>::inverse_map(elem, p, tolerance);
498 
499  case ELLIPSOIDAL:
500  return InfFE<1,JACOBI_20_00,ELLIPSOIDAL>::inverse_map(elem, p, tolerance);
501 */
502 
503  default:
504  libmesh_error();
505  }
506  }
507 
508 
509  // 2D
510  case 2:
511  {
512  switch (fe_t.inf_map)
513  {
514  case CARTESIAN:
515  return InfFE<2,JACOBI_20_00,CARTESIAN>::inverse_map(elem, p, tolerance, secure);
516 
517  case SPHERICAL:
518  case ELLIPSOIDAL:
519  {
520  libMesh::err << "ERROR: Spherical and Ellipsoidal IFEMs not (yet) " << std::endl
521  << "implemented." << std::endl;
522  libmesh_error();
523  }
524 
525 /*
526  case SPHERICAL:
527  return InfFE<2,JACOBI_20_00,SPHERICAL>::inverse_map(elem, p, tolerance);
528 
529  case ELLIPSOIDAL:
530  return InfFE<2,JACOBI_20_00,ELLIPSOIDAL>::inverse_map(elem, p, tolerance);
531 */
532 
533  default:
534  libmesh_error();
535  }
536 
537  }
538 
539 
540  // 3D
541  case 3:
542  {
543  switch (fe_t.inf_map)
544  {
545  case CARTESIAN:
546  return InfFE<3,JACOBI_20_00,CARTESIAN>::inverse_map(elem, p, tolerance, secure);
547 
548  case SPHERICAL:
549  case ELLIPSOIDAL:
550  {
551  libMesh::err << "ERROR: Spherical and Ellipsoidal IFEMs not (yet) " << std::endl
552  << "implemented." << std::endl;
553  libmesh_error();
554  }
555 
556 /*
557  case SPHERICAL:
558  return InfFE<3,JACOBI_20_00,SPHERICAL>::inverse_map(elem, p, tolerance);
559 
560  case ELLIPSOIDAL:
561  return InfFE<3,JACOBI_20_00,ELLIPSOIDAL>::inverse_map(elem, p, tolerance);
562 */
563 
564  default:
565  libmesh_error();
566  }
567 
568  }
569 
570 
571  default:
572  libmesh_error();
573  }
574 
575 
576  libmesh_error();
577  Point pt;
578  return pt;
579 }
580 
581 
582 
583 void FEInterface::ifem_inverse_map (const unsigned int dim,
584  const FEType& fe_t,
585  const Elem* elem,
586  const std::vector<Point>& physical_points,
587  std::vector<Point>& reference_points,
588  const Real tolerance,
589  const bool secure)
590 {
591  switch (dim)
592  {
593  // 1D
594  case 1:
595  {
596  switch (fe_t.inf_map)
597  {
598  case CARTESIAN:
599  InfFE<1,JACOBI_20_00,CARTESIAN>::inverse_map(elem, physical_points, reference_points, tolerance, secure);
600  return;
601 
602  default:
603  libmesh_error();
604  }
605  }
606 
607 
608  // 2D
609  case 2:
610  {
611  switch (fe_t.inf_map)
612  {
613  case CARTESIAN:
614  InfFE<2,JACOBI_20_00,CARTESIAN>::inverse_map(elem, physical_points, reference_points, tolerance, secure);
615  return;
616 
617  default:
618  libmesh_error();
619  }
620 
621  }
622 
623 
624  // 3D
625  case 3:
626  {
627  switch (fe_t.inf_map)
628  {
629  case CARTESIAN:
630  InfFE<3,JACOBI_20_00,CARTESIAN>::inverse_map(elem, physical_points, reference_points, tolerance, secure);
631  return;
632 
633  default:
634  libmesh_error();
635  }
636 
637  }
638 
639 
640  default:
641  libmesh_error();
642  }
643 
644  libmesh_error();
645  return;
646 }
647 
648 
649 
650 
652  const ElemType t,
653  const Real eps)
654 {
655  return FEBase::on_reference_element(p,t,eps);
656 }
657 
658 
659 
660 
661 Real FEInterface::ifem_shape(const unsigned int dim,
662  const FEType& fe_t,
663  const ElemType t,
664  const unsigned int i,
665  const Point& p)
666 {
667  switch (dim)
668  {
669  // 1D
670  case 1:
671  {
672  switch (fe_t.radial_family)
673  {
674  /*
675  * For no derivatives (and local coordinates, as
676  * given in \p p) the infinite element shapes
677  * are independent of mapping type
678  */
679  case INFINITE_MAP:
680  return InfFE<1,INFINITE_MAP,CARTESIAN>::shape(fe_t, t, i, p);
681 
682  case JACOBI_20_00:
683  return InfFE<1,JACOBI_20_00,CARTESIAN>::shape(fe_t, t, i, p);
684 
685  case JACOBI_30_00:
686  return InfFE<1,JACOBI_30_00,CARTESIAN>::shape(fe_t, t, i, p);
687 
688  case LEGENDRE:
689  return InfFE<1,LEGENDRE,CARTESIAN>::shape(fe_t, t, i, p);
690 
691  case LAGRANGE:
692  return InfFE<1,LAGRANGE,CARTESIAN>::shape(fe_t, t, i, p);
693 
694  default:
695  libmesh_error();
696  }
697  }
698 
699 
700  // 2D
701  case 2:
702  {
703  switch (fe_t.radial_family)
704  {
705  case INFINITE_MAP:
706  return InfFE<2,INFINITE_MAP,CARTESIAN>::shape(fe_t, t, i, p);
707 
708  case JACOBI_20_00:
709  return InfFE<2,JACOBI_20_00,CARTESIAN>::shape(fe_t, t, i, p);
710 
711  case JACOBI_30_00:
712  return InfFE<2,JACOBI_30_00,CARTESIAN>::shape(fe_t, t, i, p);
713 
714  case LEGENDRE:
715  return InfFE<2,LEGENDRE,CARTESIAN>::shape(fe_t, t, i, p);
716 
717  case LAGRANGE:
718  return InfFE<2,LAGRANGE,CARTESIAN>::shape(fe_t, t, i, p);
719 
720  default:
721  libmesh_error();
722  }
723 
724  }
725 
726 
727  // 3D
728  case 3:
729  {
730  switch (fe_t.radial_family)
731  {
732  case INFINITE_MAP:
733  return InfFE<3,INFINITE_MAP,CARTESIAN>::shape(fe_t, t, i, p);
734 
735  case JACOBI_20_00:
736  return InfFE<3,JACOBI_20_00,CARTESIAN>::shape(fe_t, t, i, p);
737 
738  case JACOBI_30_00:
739  return InfFE<3,JACOBI_30_00,CARTESIAN>::shape(fe_t, t, i, p);
740 
741  case LEGENDRE:
742  return InfFE<3,LEGENDRE,CARTESIAN>::shape(fe_t, t, i, p);
743 
744  case LAGRANGE:
745  return InfFE<3,LAGRANGE,CARTESIAN>::shape(fe_t, t, i, p);
746 
747  default:
748  libmesh_error();
749  }
750 
751  }
752 
753 
754  default:
755  libmesh_error();
756  }
757 
758 
759  libmesh_error();
760  return 0.;
761 }
762 
763 
764 
765 
766 Real FEInterface::ifem_shape(const unsigned int dim,
767  const FEType& fe_t,
768  const Elem* elem,
769  const unsigned int i,
770  const Point& p)
771 {
772  switch (dim)
773  {
774  // 1D
775  case 1:
776  {
777  switch (fe_t.radial_family)
778  {
779  /*
780  * For no derivatives (and local coordinates, as
781  * given in \p p) the infinite element shapes
782  * are independent of mapping type
783  */
784  case INFINITE_MAP:
785  return InfFE<1,INFINITE_MAP,CARTESIAN>::shape(fe_t, elem, i, p);
786 
787  case JACOBI_20_00:
788  return InfFE<1,JACOBI_20_00,CARTESIAN>::shape(fe_t, elem, i, p);
789 
790  case JACOBI_30_00:
791  return InfFE<1,JACOBI_30_00,CARTESIAN>::shape(fe_t, elem, i, p);
792 
793  case LEGENDRE:
794  return InfFE<1,LEGENDRE,CARTESIAN>::shape(fe_t, elem, i, p);
795 
796  case LAGRANGE:
797  return InfFE<1,LAGRANGE,CARTESIAN>::shape(fe_t, elem, i, p);
798 
799  default:
800  libmesh_error();
801  }
802  }
803 
804 
805  // 2D
806  case 2:
807  {
808  switch (fe_t.radial_family)
809  {
810  case INFINITE_MAP:
811  return InfFE<2,INFINITE_MAP,CARTESIAN>::shape(fe_t, elem, i, p);
812 
813  case JACOBI_20_00:
814  return InfFE<2,JACOBI_20_00,CARTESIAN>::shape(fe_t, elem, i, p);
815 
816  case JACOBI_30_00:
817  return InfFE<2,JACOBI_30_00,CARTESIAN>::shape(fe_t, elem, i, p);
818 
819  case LEGENDRE:
820  return InfFE<2,LEGENDRE,CARTESIAN>::shape(fe_t, elem, i, p);
821 
822  case LAGRANGE:
823  return InfFE<2,LAGRANGE,CARTESIAN>::shape(fe_t, elem, i, p);
824 
825  default:
826  libmesh_error();
827  }
828 
829  }
830 
831 
832  // 3D
833  case 3:
834  {
835  switch (fe_t.radial_family)
836  {
837  case INFINITE_MAP:
838  return InfFE<3,INFINITE_MAP,CARTESIAN>::shape(fe_t, elem, i, p);
839 
840  case JACOBI_20_00:
841  return InfFE<3,JACOBI_20_00,CARTESIAN>::shape(fe_t, elem, i, p);
842 
843  case JACOBI_30_00:
844  return InfFE<3,JACOBI_30_00,CARTESIAN>::shape(fe_t, elem, i, p);
845 
846  case LEGENDRE:
847  return InfFE<3,LEGENDRE,CARTESIAN>::shape(fe_t, elem, i, p);
848 
849  case LAGRANGE:
850  return InfFE<3,LAGRANGE,CARTESIAN>::shape(fe_t, elem, i, p);
851 
852  default:
853  libmesh_error();
854  }
855 
856  }
857 
858 
859  default:
860  libmesh_error();
861  }
862 
863 
864  libmesh_error();
865  return 0.;
866 }
867 
868 
869 
870 
871 void FEInterface::ifem_compute_data(const unsigned int dim,
872  const FEType& fe_t,
873  const Elem* elem,
875 {
876  switch (dim)
877  {
878  // 1D
879  case 1:
880  {
881  switch (fe_t.radial_family)
882  {
883  /*
884  * For no derivatives (and local coordinates, as
885  * given in \p p) the infinite element shapes
886  * are independent of mapping type
887  */
888  case INFINITE_MAP:
890  break;
891 
892  case JACOBI_20_00:
894  break;
895 
896  case JACOBI_30_00:
898  break;
899 
900  case LEGENDRE:
902  break;
903 
904  case LAGRANGE:
906  break;
907 
908  default:
909  libmesh_error();
910  }
911 
912  break;
913  }
914 
915 
916  // 2D
917  case 2:
918  {
919  switch (fe_t.radial_family)
920  {
921  case INFINITE_MAP:
923  break;
924 
925  case JACOBI_20_00:
927  break;
928 
929  case JACOBI_30_00:
931  break;
932 
933  case LEGENDRE:
935  break;
936 
937  case LAGRANGE:
939  break;
940 
941  default:
942  libmesh_error();
943  }
944 
945  break;
946  }
947 
948 
949  // 3D
950  case 3:
951  {
952  switch (fe_t.radial_family)
953  {
954  case INFINITE_MAP:
956  break;
957 
958  case JACOBI_20_00:
960  break;
961 
962  case JACOBI_30_00:
964  break;
965 
966  case LEGENDRE:
968  break;
969 
970  case LAGRANGE:
972  break;
973 
974  default:
975  libmesh_error();
976  }
977 
978  break;
979  }
980 
981 
982  default:
983  libmesh_error();
984  break;
985  }
986 
987  return;
988 }
989 
990 } // namespace libMesh
991 
992 #endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:05 UTC

Hosted By:
SourceForge.net Logo