Intrepid2
Intrepid2_CubatureDirectLineGaussJacobi20Def.hpp
Go to the documentation of this file.
1// @HEADER
2// ************************************************************************
3//
4// Intrepid2 Package
5// Copyright (2007) Sandia Corporation
6//
7// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8// license for use of this work by or on behalf of the U.S. Government.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// Questions? Contact Kyungjoo Kim (kyukim@sandia.gov), or
38// Mauro Perego (mperego@sandia.gov)
39//
40// ************************************************************************
41// @HEADER
42
49namespace Intrepid2 {
50
51 template <typename DT, typename PT, typename WT>
53 CubatureDirectLineGaussJacobi20(const ordinal_type degree)
54 : CubatureDirect<DT>(degree, 1) {
55
56 INTREPID2_TEST_FOR_EXCEPTION( degree < 0 ||
57 degree > static_cast<ordinal_type>(Parameters::MaxCubatureDegreePyr), std::out_of_range,
58 ">>> ERROR (CubatureDirectLineGaussJacobi20): No cubature rule implemented for the desired polynomial degree.");
59
60 typedef Kokkos::DynRankView<PT,Kokkos::LayoutRight,Kokkos::HostSpace> pointViewHostType;
61 typedef Kokkos::DynRankView<WT,Kokkos::LayoutRight,Kokkos::HostSpace> weightViewHostType;
62
64 const Kokkos::pair<ordinal_type,ordinal_type> pointRange(0, this->cubatureData_.numPoints_);
65 {
66 // src
67 const pointViewHostType points_host(const_cast<PT*>( &(cubatureDataStatic_[this->degree_].points_[0][0]) ),
68 pointRange.second,
70
71 auto points = Kokkos::create_mirror_view(typename DT::memory_space(), points_host);
72
73 Kokkos::deep_copy(points,points_host);
74
75 // dst
76 this->cubatureData_.points_ = Kokkos::DynRankView<PT,DT>("CubatureDirectLineGaussJacobi20::cubatureData_::points_",
77 pointRange.second,
79 // copy
80 Kokkos::deep_copy(this->cubatureData_.points_ , points );
81 }
82 {
83 // src
84 const weightViewHostType weights(const_cast<PT*>( &(cubatureDataStatic_[this->degree_].weights_[0]) ),
85 pointRange.second);
86
87 // dst
88 this->cubatureData_.weights_ = Kokkos::DynRankView<WT,DT>("CubatureDirectLineGaussJacobi20::cubatureData_::weights_",
89 pointRange.second);
90 // copy
91 Kokkos::deep_copy(Kokkos::subdynrankview(this->cubatureData_.weights_, Kokkos::ALL()) , Kokkos::subdynrankview(weights, Kokkos::ALL()));
92 }
93 }
94
95
96 //-------------------------------------------------------------------------------------//
97 // Definition of cubature templates //
98 //-------------------------------------------------------------------------------------//
99
100 /*
101 Cubature templates for lines are defined the reference cell:
102
103 Line -> (-1,0,0),(1,0,0)
104 */
105
106 /*
107 This static const member contains templates for GaussJacobi20(-Legendre) rules.
108 */
109 template<typename DT, typename PT, typename WT>
112 cubatureDataStatic_[cubatureDataStaticSize] = {
113 // Collection of GaussJacobi20 rules on [-1,1]
114 // The rule with array index i is exact for polynomials up to order i
115 {
116 1,
117 {{-0.5, 0.0, 0.0}},
118 {2.66666666666666666666666666}
119 },
120 {
121 1,
122 {{-0.5, 0.0, 0.0}},
123 {2.66666666666666666666666666}
124 },
125 {
126 2,
127 {{-7.549703546891172e-1, 0.0, 0.0},
128 {8.830368802245062e-2, 0.0, 0.0}},
129 {1.860379610028064,
130 8.062870566386037e-01}
131 },
132 {
133 2,
134 {{-7.549703546891172e-1, 0.0, 0.0},
135 {8.830368802245062e-2, 0.0, 0.0}},
136 {1.860379610028064,
137 8.062870566386037e-01}
138 },
139 {
140 3,
141 {{-8.540119518537008e-01, 0.0, 0.0},
142 {-3.059924679232963e-01, 0.0, 0.0},
143 { 4.100044197769969e-01, 0.0, 0.0}},
144 {1.257090888519093e+00,
145 1.169970154078928e+00,
146 2.396056240686456e-01}
147 },
148 {
149 3,
150 {{-8.540119518537008e-01, 0.0, 0.0},
151 {-3.059924679232963e-01, 0.0, 0.0},
152 { 4.100044197769969e-01, 0.0, 0.0}},
153 {1.257090888519093e+00,
154 1.169970154078928e+00,
155 2.396056240686456e-01}
156 },
157 {
158 4,
159 {{-9.029989011060054e-01, 0.0, 0.0},
160 {-5.227985248962754e-01, 0.0, 0.0},
161 {3.409459020873505e-02, 0.0, 0.0},
162 {5.917028357935457e-01, 0.0, 0.0}},
163 {8.871073248902235e-01,
164 1.147670318393715e+00,
165 5.490710973833849e-01,
166 8.281792599934450e-02}
167 },
168 {
169 4,
170 {{-9.029989011060054e-01, 0.0, 0.0},
171 {-5.227985248962754e-01, 0.0, 0.0},
172 {3.409459020873505e-02, 0.0, 0.0},
173 {5.917028357935457e-01, 0.0, 0.0}},
174 {8.871073248902235e-01,
175 1.147670318393715e+00,
176 5.490710973833849e-01,
177 8.281792599934450e-02}
178 },
179 {
180 5,
181 {{-9.308421201635699e-01, 0.0, 0.0},
182 {-6.530393584566085e-01, 0.0, 0.0},
183 {-2.202272258689614e-01, 0.0, 0.0},
184 {2.686669452617736e-01, 0.0, 0.0},
185 {7.021084258940329e-01, 0.0, 0.0}},
186 {6.541182742861678e-01,
187 1.009591695199292e+00,
188 7.136012897727201e-01,
189 2.564448057836956e-01,
190 3.291060162479211e-02}
191 },
192 {
193 5,
194 {{-9.308421201635699e-01, 0.0, 0.0},
195 {-6.530393584566085e-01, 0.0, 0.0},
196 {-2.202272258689614e-01, 0.0, 0.0},
197 {2.686669452617736e-01, 0.0, 0.0},
198 {7.021084258940329e-01, 0.0, 0.0}},
199 {6.541182742861678e-01,
200 1.009591695199292e+00,
201 7.136012897727201e-01,
202 2.564448057836956e-01,
203 3.291060162479211e-02}
204 },
205 {
206 6,
207 {{-9.481908898126656e-01, 0.0, 0.0},
208 {-7.368721166840297e-01, 0.0, 0.0},
209 {-3.951261639542174e-01, 0.0, 0.0},
210 {1.807282632950432e-02, 0.0, 0.0},
211 {4.313622546234276e-01, 0.0, 0.0},
212 {7.736112323551237e-01, 0.0, 0.0}},
213 {5.003096218126469e-01,
214 8.590119978942462e-01,
215 7.566174939883307e-01,
216 4.103165690369299e-01,
217 1.257623774795603e-01,
218 1.464860645495425e-02}
219 },
220 {
221 6,
222 {{-9.481908898126656e-01, 0.0, 0.0},
223 {-7.368721166840297e-01, 0.0, 0.0},
224 {-3.951261639542174e-01, 0.0, 0.0},
225 {1.807282632950432e-02, 0.0, 0.0},
226 {4.313622546234276e-01, 0.0, 0.0},
227 {7.736112323551237e-01, 0.0, 0.0}},
228 {5.003096218126469e-01,
229 8.590119978942462e-01,
230 7.566174939883307e-01,
231 4.103165690369299e-01,
232 1.257623774795603e-01,
233 1.464860645495425e-02}
234 } // end GaussJacobi20
235
236 };
237
238} // end namespace Intrepid2
Defines GaussJacobi20 integration rules on a line used for Pyramid only.
CubatureDirectLineGaussJacobi20(const ordinal_type degree=0)
Constructor.
static const CubatureDataStatic cubatureDataStatic_[cubatureDataStaticSize]
Complete set of data defining line Gauss(-Legendre) rules.
Defines direct cubature (integration) rules in Intrepid.
CubatureData cubatureData_
Cubature data on device.
ordinal_type degree_
The degree of polynomials that are integrated exactly by this cubature rule.
static constexpr ordinal_type MaxCubatureDegreePyr
The maximum degree of the polynomial that can be integrated exactly by a direct pyramid rule.
static constexpr ordinal_type MaxDimension
The maximum ambient space dimension.
Cubature data is defined on the host space and is static.
ordinal_type numPoints_
Number of cubature points stored in the template.
Kokkos::DynRankView< pointValueType, DeviceType > points_
Array with the (X,Y,Z) coordinates of the cubature points.
ordinal_type numPoints_
Number of cubature points stored in the template.
Kokkos::DynRankView< weightValueType, DeviceType > weights_
Array with the associated cubature weights.