1 /*
2 XLiFE++ is an extended library of finite elements written in C++
3     Copyright (C) 2014  Lunéville, Eric; Kielbasiewicz, Nicolas; Lafranche, Yvon; Nguyen, Manh-Ha; Chambeyron, Colin
4 
5     This program is free software: you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation, either version 3 of the License, or
8     (at your option) any later version.
9     This program 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
12     GNU General Public License for more details.
13     You should have received a copy of the GNU General Public License
14     along with this program.  If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 /*!
18   \file RefPrism.cpp
19   \authors D. Martin, N. Kielbasiewicz
20   \since 16 dec 2002
21   \date 19 sep 2012
22 
23   \brief Implementation of xlifepp::RefPrism members and related functions
24 */
25 
26 #include "RefPrism.hpp"
27 #include "LagrangePrism.hpp"
28 #include "utils.h"
29 
30 namespace xlifepp
31 {
32 
33 //! selectRefPrism construction of a prismatic Reference Element by interpolation subtype and number
selectRefPrism(const Interpolation * interp_p)34 RefElement* selectRefPrism(const Interpolation* interp_p)
35 {
36   switch (interp_p->type)
37   {
38     case _Lagrange:
39       switch ( interp_p->subtype)
40       {
41         case _standard: return prismLagrangeStd(interp_p); break;
42         default: interp_p->badSubType(_prism); break;
43       }
44     default: break;
45   }
46 
47   // Throw error messages
48   trace_p->push("selectRefPrism");
49   interp_p->badType(_prism);
50   trace_p->pop();
51   return 0;
52 }
53 
54 //! prismLagrangeStd construction of a prismatic Lagrange Reference Element by interpolation number
prismLagrangeStd(const Interpolation * interp_p)55 RefElement* prismLagrangeStd(const Interpolation* interp_p)
56 {
57   switch ( interp_p->numtype )
58   {
59     case _P0: return new LagrangeStdPrism<_P0>(interp_p);
60       break;
61     case _P1: return new LagrangeStdPrism<_P1>(interp_p);
62       break;
63     case _P2: return new LagrangeStdPrism<_P2>(interp_p);
64       break;
65     default:
66       trace_p->push("prismLagrangeStd");
67       interp_p->badDegree(_prism);
68       trace_p->pop();
69       break;
70   }
71   return 0;
72 }
73 
74 } // end of namespace xlifepp
75