Intrepid
test_01.cpp
Go to the documentation of this file.
1// @HEADER
2// ************************************************************************
3//
4// Intrepid 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 Pavel Bochev (pbboche@sandia.gov)
38// Denis Ridzal (dridzal@sandia.gov), or
39// Kara Peterson (kjpeter@sandia.gov)
40//
41// ************************************************************************
42// @HEADER
43
44
51#include "Teuchos_oblackholestream.hpp"
52#include "Teuchos_RCP.hpp"
53#include "Teuchos_GlobalMPISession.hpp"
56#include "Shards_CellTopology.hpp"
57
58#include <iostream>
59using namespace Intrepid;
60
65int main(int argc, char *argv[]) {
66
67 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
68
69 // This little trick lets us print to std::cout only if a (dummy) command-line argument is provided.
70 int iprint = argc - 1;
71
72 Teuchos::RCP<std::ostream> outStream;
73 Teuchos::oblackholestream bhs; // outputs nothing
74
75 if (iprint > 0)
76 outStream = Teuchos::rcp(&std::cout, false);
77 else
78 outStream = Teuchos::rcp(&bhs, false);
79
80 // Save the format state of the original std::cout.
81 Teuchos::oblackholestream oldFormatState;
82 oldFormatState.copyfmt(std::cout);
83
84 *outStream \
85 << "===============================================================================\n" \
86 << "| |\n" \
87 << "| Unit Test HDIV_TET_In_FEM |\n" \
88 << "| |\n" \
89 << "| 1) Tests tetrahedral Raviart-Thomas basis |\n" \
90 << "| |\n" \
91 << "| Questions? Contact Pavel Bochev (pbboche@sandia.gov) or |\n" \
92 << "| Denis Ridzal (dridzal@sandia.gov) or |\n" \
93 << "| Robert Kirby (robert.c.kirby@ttu.edu) |\n" \
94 << "| |\n" \
95 << "| Intrepid's website: http://trilinos.sandia.gov/packages/intrepid |\n" \
96 << "| Trilinos website: http://trilinos.sandia.gov |\n" \
97 << "| |\n" \
98 << "===============================================================================\n";
99
100 int errorFlag = 0;
101
102 // test for basis values, compare against fiat
103 try {
104 const int deg = 2;
105 Basis_HDIV_TET_In_FEM<double,FieldContainer<double> > myBasis( deg , POINTTYPE_EQUISPACED );
106
107 // Get a lattice
108 const int np_lattice = PointTools::getLatticeSize( myBasis.getBaseCellTopology() , deg , 0 );
109 FieldContainer<double> lattice( np_lattice , 3 );
110 FieldContainer<double> myBasisValues( myBasis.getCardinality() , np_lattice , 3 );
111 PointTools::getLattice<double,FieldContainer<double> >( lattice ,
112 myBasis.getBaseCellTopology() ,
113 deg ,
114 0 ,
115 POINTTYPE_EQUISPACED );
116
117 myBasis.getValues( myBasisValues , lattice , OPERATOR_VALUE );
118
119
120 const double fiat_vals[] = {
121 0.000000000000000e+00, -6.000000000000000e+00, 0.000000000000000e+00,
122 1.000000000000000e+00, -2.000000000000000e+00, 0.000000000000000e+00,
123 -2.000000000000000e+00, 2.000000000000000e+00, 0.000000000000000e+00,
124 0.000000000000000e+00, -1.000000000000000e+00, 0.000000000000000e+00,
125 -1.000000000000000e+00, 1.000000000000000e+00, 0.000000000000000e+00,
126 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
127 0.000000000000000e+00, -2.000000000000000e+00, 1.000000000000000e+00,
128 -1.000000000000000e+00, 2.000000000000000e+00, -1.000000000000000e+00,
129 0.000000000000000e+00, 1.000000000000000e+00, -1.000000000000000e+00,
130 0.000000000000000e+00, 2.000000000000000e+00, -2.000000000000000e+00,
131 0.000000000000000e+00, 2.000000000000000e+00, 0.000000000000000e+00,
132 1.000000000000000e+00, -2.000000000000000e+00, 0.000000000000000e+00,
133 6.000000000000000e+00, -6.000000000000000e+00, 0.000000000000000e+00,
134 0.000000000000000e+00, 1.000000000000000e+00, 0.000000000000000e+00,
135 1.000000000000000e+00, -1.000000000000000e+00, 0.000000000000000e+00,
136 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
137 0.000000000000000e+00, 2.000000000000000e+00, -1.000000000000000e+00,
138 1.000000000000000e+00, -2.000000000000000e+00, 1.000000000000000e+00,
139 0.000000000000000e+00, 1.000000000000000e+00, -1.000000000000000e+00,
140 0.000000000000000e+00, 2.000000000000000e+00, -2.000000000000000e+00,
141 0.000000000000000e+00, 2.000000000000000e+00, 0.000000000000000e+00,
142 -1.000000000000000e+00, 2.000000000000000e+00, 0.000000000000000e+00,
143 -2.000000000000000e+00, 2.000000000000000e+00, 0.000000000000000e+00,
144 0.000000000000000e+00, 1.000000000000000e+00, 0.000000000000000e+00,
145 -1.000000000000000e+00, 1.000000000000000e+00, 0.000000000000000e+00,
146 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
147 0.000000000000000e+00, -2.000000000000000e+00, 1.000000000000000e+00,
148 1.000000000000000e+00, -2.000000000000000e+00, 1.000000000000000e+00,
149 0.000000000000000e+00, -1.000000000000000e+00, 1.000000000000000e+00,
150 0.000000000000000e+00, -6.000000000000000e+00, 6.000000000000000e+00,
151 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
152 1.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
153 6.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
154 0.000000000000000e+00, -1.000000000000000e+00, 0.000000000000000e+00,
155 1.000000000000000e+00, 1.000000000000000e+00, 0.000000000000000e+00,
156 0.000000000000000e+00, -2.000000000000000e+00, 0.000000000000000e+00,
157 0.000000000000000e+00, 0.000000000000000e+00, -1.000000000000000e+00,
158 1.000000000000000e+00, 0.000000000000000e+00, 1.000000000000000e+00,
159 0.000000000000000e+00, -1.000000000000000e+00, -1.000000000000000e+00,
160 0.000000000000000e+00, 0.000000000000000e+00, -2.000000000000000e+00,
161 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
162 -1.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
163 -2.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
164 0.000000000000000e+00, 1.000000000000000e+00, 0.000000000000000e+00,
165 1.000000000000000e+00, 1.000000000000000e+00, 0.000000000000000e+00,
166 0.000000000000000e+00, 6.000000000000000e+00, 0.000000000000000e+00,
167 0.000000000000000e+00, 0.000000000000000e+00, -1.000000000000000e+00,
168 -1.000000000000000e+00, 0.000000000000000e+00, -1.000000000000000e+00,
169 0.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00,
170 0.000000000000000e+00, 0.000000000000000e+00, -2.000000000000000e+00,
171 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
172 -1.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
173 -2.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
174 0.000000000000000e+00, -1.000000000000000e+00, 0.000000000000000e+00,
175 -1.000000000000000e+00, -1.000000000000000e+00, 0.000000000000000e+00,
176 0.000000000000000e+00, -2.000000000000000e+00, 0.000000000000000e+00,
177 0.000000000000000e+00, 0.000000000000000e+00, 1.000000000000000e+00,
178 1.000000000000000e+00, 0.000000000000000e+00, 1.000000000000000e+00,
179 0.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00,
180 0.000000000000000e+00, 0.000000000000000e+00, 6.000000000000000e+00,
181 -6.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
182 -1.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
183 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
184 -2.000000000000000e+00, 1.000000000000000e+00, 0.000000000000000e+00,
185 1.000000000000000e+00, -1.000000000000000e+00, 0.000000000000000e+00,
186 2.000000000000000e+00, -2.000000000000000e+00, 0.000000000000000e+00,
187 -2.000000000000000e+00, 0.000000000000000e+00, 1.000000000000000e+00,
188 1.000000000000000e+00, 0.000000000000000e+00, -1.000000000000000e+00,
189 2.000000000000000e+00, -1.000000000000000e+00, -1.000000000000000e+00,
190 2.000000000000000e+00, 0.000000000000000e+00, -2.000000000000000e+00,
191 2.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
192 1.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
193 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
194 2.000000000000000e+00, -1.000000000000000e+00, 0.000000000000000e+00,
195 1.000000000000000e+00, -1.000000000000000e+00, 0.000000000000000e+00,
196 2.000000000000000e+00, -2.000000000000000e+00, 0.000000000000000e+00,
197 -2.000000000000000e+00, 0.000000000000000e+00, 1.000000000000000e+00,
198 -1.000000000000000e+00, 0.000000000000000e+00, 1.000000000000000e+00,
199 -2.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00,
200 -6.000000000000000e+00, 0.000000000000000e+00, 6.000000000000000e+00,
201 2.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
202 1.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
203 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
204 -2.000000000000000e+00, 1.000000000000000e+00, 0.000000000000000e+00,
205 -1.000000000000000e+00, 1.000000000000000e+00, 0.000000000000000e+00,
206 -6.000000000000000e+00, 6.000000000000000e+00, 0.000000000000000e+00,
207 2.000000000000000e+00, 0.000000000000000e+00, -1.000000000000000e+00,
208 1.000000000000000e+00, 0.000000000000000e+00, -1.000000000000000e+00,
209 -2.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00,
210 2.000000000000000e+00, 0.000000000000000e+00, -2.000000000000000e+00,
211 0.000000000000000e+00, 0.000000000000000e+00, -6.000000000000000e+00,
212 1.000000000000000e+00, 0.000000000000000e+00, -2.000000000000000e+00,
213 -2.000000000000000e+00, 0.000000000000000e+00, 2.000000000000000e+00,
214 0.000000000000000e+00, 1.000000000000000e+00, -2.000000000000000e+00,
215 -1.000000000000000e+00, -1.000000000000000e+00, 2.000000000000000e+00,
216 0.000000000000000e+00, -2.000000000000000e+00, 2.000000000000000e+00,
217 0.000000000000000e+00, 0.000000000000000e+00, -1.000000000000000e+00,
218 -1.000000000000000e+00, 0.000000000000000e+00, 1.000000000000000e+00,
219 0.000000000000000e+00, -1.000000000000000e+00, 1.000000000000000e+00,
220 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
221 0.000000000000000e+00, 0.000000000000000e+00, 2.000000000000000e+00,
222 -1.000000000000000e+00, 0.000000000000000e+00, 2.000000000000000e+00,
223 -2.000000000000000e+00, 0.000000000000000e+00, 2.000000000000000e+00,
224 0.000000000000000e+00, 1.000000000000000e+00, -2.000000000000000e+00,
225 1.000000000000000e+00, 1.000000000000000e+00, -2.000000000000000e+00,
226 0.000000000000000e+00, 6.000000000000000e+00, -6.000000000000000e+00,
227 0.000000000000000e+00, 0.000000000000000e+00, 1.000000000000000e+00,
228 -1.000000000000000e+00, 0.000000000000000e+00, 1.000000000000000e+00,
229 0.000000000000000e+00, 1.000000000000000e+00, -1.000000000000000e+00,
230 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
231 0.000000000000000e+00, 0.000000000000000e+00, 2.000000000000000e+00,
232 1.000000000000000e+00, 0.000000000000000e+00, -2.000000000000000e+00,
233 6.000000000000000e+00, 0.000000000000000e+00, -6.000000000000000e+00,
234 0.000000000000000e+00, -1.000000000000000e+00, 2.000000000000000e+00,
235 1.000000000000000e+00, 1.000000000000000e+00, -2.000000000000000e+00,
236 0.000000000000000e+00, -2.000000000000000e+00, 2.000000000000000e+00,
237 0.000000000000000e+00, 0.000000000000000e+00, 1.000000000000000e+00,
238 1.000000000000000e+00, 0.000000000000000e+00, -1.000000000000000e+00,
239 0.000000000000000e+00, -1.000000000000000e+00, 1.000000000000000e+00,
240 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
241 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
242 2.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
243 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
244 0.000000000000000e+00, 1.000000000000000e+00, 0.000000000000000e+00,
245 1.000000000000000e+00, -1.000000000000000e+00, 0.000000000000000e+00,
246 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
247 0.000000000000000e+00, 0.000000000000000e+00, 1.000000000000000e+00,
248 1.000000000000000e+00, 0.000000000000000e+00, -1.000000000000000e+00,
249 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
250 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
251 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
252 1.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
253 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
254 0.000000000000000e+00, 2.000000000000000e+00, 0.000000000000000e+00,
255 -1.000000000000000e+00, 1.000000000000000e+00, 0.000000000000000e+00,
256 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
257 0.000000000000000e+00, 0.000000000000000e+00, 1.000000000000000e+00,
258 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
259 0.000000000000000e+00, 1.000000000000000e+00, -1.000000000000000e+00,
260 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
261 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
262 1.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
263 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
264 0.000000000000000e+00, 1.000000000000000e+00, 0.000000000000000e+00,
265 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
266 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
267 0.000000000000000e+00, 0.000000000000000e+00, 2.000000000000000e+00,
268 -1.000000000000000e+00, 0.000000000000000e+00, 1.000000000000000e+00,
269 0.000000000000000e+00, -1.000000000000000e+00, 1.000000000000000e+00,
270 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00
271
272 };
273
274 int cur=0;
275 for (int i=0;i<myBasisValues.dimension(0);i++) {
276 for (int j=0;j<myBasisValues.dimension(1);j++) {
277 for (int k=0;k<myBasisValues.dimension(2);k++) {
278 if (std::abs( myBasisValues(i,j,k) - fiat_vals[cur] ) > 10.0*INTREPID_TOL ) {
279 errorFlag++;
280 *outStream << std::setw(70) << "^^^^----FAILURE!" << "\n";
281
282 // Output the multi-index of the value where the error is:
283 *outStream << " At multi-index { ";
284 *outStream << i << " " << j << " " << k;
285 *outStream << "} computed value: " << myBasisValues(i,j,k)
286 << " but correct value: " << fiat_vals[cur] << "\n";
287 *outStream << "Difference: " << std::abs( myBasisValues(i,j,k) - fiat_vals[cur] ) << "\n";
288 }
289 cur++;
290 }
291 }
292 }
293 }
294 catch (const std::exception & err) {
295 *outStream << err.what() << "\n\n";
296 errorFlag = -1000;
297 }
298 try {
299 const int deg = 2;
300 Basis_HDIV_TET_In_FEM<double,FieldContainer<double> > myBasis( deg , POINTTYPE_EQUISPACED );
301
302 // Get a lattice
303 const int np_lattice = PointTools::getLatticeSize( myBasis.getBaseCellTopology() , deg , 0 );
304 FieldContainer<double> lattice( np_lattice , 3 );
305 FieldContainer<double> myBasisDivs( myBasis.getCardinality() , np_lattice );
306 PointTools::getLattice<double,FieldContainer<double> >( lattice ,
307 myBasis.getBaseCellTopology() ,
308 deg ,
309 0 ,
310 POINTTYPE_EQUISPACED );
311
312 myBasis.getValues( myBasisDivs , lattice , OPERATOR_DIV );
313
314 const double fiat_divs[] = {
315 2.600000000000000e+01,
316 1.000000000000000e+01,
317 -6.000000000000000e+00,
318 1.000000000000000e+01,
319 -6.000000000000000e+00,
320 -6.000000000000000e+00,
321 1.000000000000000e+01,
322 -6.000000000000000e+00,
323 -6.000000000000000e+00,
324 -6.000000000000000e+00,
325 -6.000000000000000e+00,
326 1.000000000000000e+01,
327 2.600000000000000e+01,
328 -6.000000000000000e+00,
329 1.000000000000000e+01,
330 -6.000000000000000e+00,
331 -6.000000000000000e+00,
332 1.000000000000000e+01,
333 -6.000000000000000e+00,
334 -6.000000000000000e+00,
335 -6.000000000000000e+00,
336 -6.000000000000000e+00,
337 -6.000000000000000e+00,
338 -6.000000000000000e+00,
339 -6.000000000000000e+00,
340 -6.000000000000000e+00,
341 1.000000000000000e+01,
342 1.000000000000000e+01,
343 1.000000000000000e+01,
344 2.600000000000000e+01,
345 -6.000000000000000e+00,
346 1.000000000000000e+01,
347 2.600000000000000e+01,
348 -6.000000000000000e+00,
349 1.000000000000000e+01,
350 -6.000000000000000e+00,
351 -6.000000000000000e+00,
352 1.000000000000000e+01,
353 -6.000000000000000e+00,
354 -6.000000000000000e+00,
355 -6.000000000000000e+00,
356 -6.000000000000000e+00,
357 -6.000000000000000e+00,
358 1.000000000000000e+01,
359 1.000000000000000e+01,
360 2.600000000000000e+01,
361 -6.000000000000000e+00,
362 -6.000000000000000e+00,
363 1.000000000000000e+01,
364 -6.000000000000000e+00,
365 -6.000000000000000e+00,
366 -6.000000000000000e+00,
367 -6.000000000000000e+00,
368 -6.000000000000000e+00,
369 -6.000000000000000e+00,
370 -6.000000000000000e+00,
371 1.000000000000000e+01,
372 1.000000000000000e+01,
373 1.000000000000000e+01,
374 2.600000000000000e+01,
375 2.600000000000000e+01,
376 1.000000000000000e+01,
377 -6.000000000000000e+00,
378 1.000000000000000e+01,
379 -6.000000000000000e+00,
380 -6.000000000000000e+00,
381 1.000000000000000e+01,
382 -6.000000000000000e+00,
383 -6.000000000000000e+00,
384 -6.000000000000000e+00,
385 -6.000000000000000e+00,
386 -6.000000000000000e+00,
387 -6.000000000000000e+00,
388 -6.000000000000000e+00,
389 -6.000000000000000e+00,
390 -6.000000000000000e+00,
391 1.000000000000000e+01,
392 1.000000000000000e+01,
393 1.000000000000000e+01,
394 2.600000000000000e+01,
395 -6.000000000000000e+00,
396 -6.000000000000000e+00,
397 -6.000000000000000e+00,
398 1.000000000000000e+01,
399 1.000000000000000e+01,
400 2.600000000000000e+01,
401 -6.000000000000000e+00,
402 -6.000000000000000e+00,
403 1.000000000000000e+01,
404 -6.000000000000000e+00,
405 2.600000000000000e+01,
406 1.000000000000000e+01,
407 -6.000000000000000e+00,
408 1.000000000000000e+01,
409 -6.000000000000000e+00,
410 -6.000000000000000e+00,
411 1.000000000000000e+01,
412 -6.000000000000000e+00,
413 -6.000000000000000e+00,
414 -6.000000000000000e+00,
415 -6.000000000000000e+00,
416 -6.000000000000000e+00,
417 -6.000000000000000e+00,
418 1.000000000000000e+01,
419 1.000000000000000e+01,
420 2.600000000000000e+01,
421 -6.000000000000000e+00,
422 -6.000000000000000e+00,
423 1.000000000000000e+01,
424 -6.000000000000000e+00,
425 -6.000000000000000e+00,
426 1.000000000000000e+01,
427 2.600000000000000e+01,
428 -6.000000000000000e+00,
429 1.000000000000000e+01,
430 -6.000000000000000e+00,
431 -6.000000000000000e+00,
432 1.000000000000000e+01,
433 -6.000000000000000e+00,
434 -6.000000000000000e+00,
435 1.600000000000000e+01,
436 0.000000000000000e+00,
437 -1.600000000000000e+01,
438 8.000000000000000e+00,
439 -8.000000000000000e+00,
440 0.000000000000000e+00,
441 8.000000000000000e+00,
442 -8.000000000000000e+00,
443 0.000000000000000e+00,
444 0.000000000000000e+00,
445 1.600000000000000e+01,
446 8.000000000000000e+00,
447 0.000000000000000e+00,
448 0.000000000000000e+00,
449 -8.000000000000000e+00,
450 -1.600000000000000e+01,
451 8.000000000000000e+00,
452 0.000000000000000e+00,
453 -8.000000000000000e+00,
454 0.000000000000000e+00,
455 1.600000000000000e+01,
456 8.000000000000000e+00,
457 0.000000000000000e+00,
458 8.000000000000000e+00,
459 0.000000000000000e+00,
460 0.000000000000000e+00,
461 0.000000000000000e+00,
462 -8.000000000000000e+00,
463 -8.000000000000000e+00,
464 -1.600000000000000e+01
465
466 };
467
468 int cur=0;
469 for (int i=0;i<myBasisDivs.dimension(0);i++) {
470 for (int j=0;j<myBasisDivs.dimension(1);j++) {
471 if (std::abs( myBasisDivs(i,j) - fiat_divs[cur] ) > 10.0 * INTREPID_TOL ) {
472 errorFlag++;
473 *outStream << std::setw(70) << "^^^^----FAILURE!" << "\n";
474
475 // Output the multi-index of the value where the error is:
476 *outStream << " At multi-index { ";
477 *outStream << i << " " << j;
478 *outStream << "} computed value: " << myBasisDivs(i,j)
479 << " but correct value: " << fiat_divs[cur] << "\n";
480 *outStream << "Difference: " << std::abs( myBasisDivs(i,j) - fiat_divs[cur] ) << "\n";
481 }
482 cur++;
483 }
484 }
485 }
486 catch (const std::exception & err) {
487 *outStream << err.what() << "\n\n";
488 errorFlag = -1000;
489 }
490
491
492 if (errorFlag != 0)
493 std::cout << "End Result: TEST FAILED\n";
494 else
495 std::cout << "End Result: TEST PASSED\n";
496
497 // reset format state of std::cout
498 std::cout.copyfmt(oldFormatState);
499
500 return errorFlag;
501}
int main(int argc, char *argv[])
Performs a code-code comparison to FIAT for Raviart-Thomas bases on tets (values and divs)
Definition: test_01.cpp:65
Header file for utility class to provide multidimensional containers.
Header file for the Intrepid::HDIV_TET_In_FEM class.
Header file for utility class to provide point tools, such as barycentric coordinates,...
Implementation of the default H(div)-compatible Raviart-Thomas basis of arbitrary degree on Tetrahedr...
void getValues(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const EOperator operatorType) const
Evaluation of a FEM basis on a reference Tetrahedron cell.
virtual const shards::CellTopology getBaseCellTopology() const
Returns the base cell topology for which the basis is defined. See Shards documentation http://trilin...
virtual int getCardinality() const
Returns cardinality of the basis.
Implementation of a templated lexicographical container for a multi-indexed scalar quantity....
int dimension(const int whichDim) const
Returns the specified dimension.
static int getLatticeSize(const shards::CellTopology &cellType, const int order, const int offset=0)
Computes the number of points in a lattice of a given order on a simplex (currently disabled for othe...