55 #include "Teuchos_oblackholestream.hpp" 56 #include "Teuchos_RCP.hpp" 57 #include "Teuchos_GlobalMPISession.hpp" 62 int main(
int argc,
char *argv[]) {
64 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
68 int iprint = argc - 1;
69 Teuchos::RCP<std::ostream> outStream;
70 Teuchos::oblackholestream bhs;
72 outStream = Teuchos::rcp(&std::cout,
false);
74 outStream = Teuchos::rcp(&bhs,
false);
77 Teuchos::oblackholestream oldFormatState;
78 oldFormatState.copyfmt(std::cout);
81 <<
"===============================================================================\n" \
83 <<
"| Unit Test (FunctionSpaceTools) |\n" \
85 <<
"| 1) basic operator transformations and integration in HCURL |\n" \
87 <<
"| Questions? Contact Pavel Bochev (pbboche@sandia.gov) or |\n" \
88 <<
"| Denis Ridzal (dridzal@sandia.gov). |\n" \
90 <<
"| Intrepid's website: http://trilinos.sandia.gov/packages/intrepid |\n" \
91 <<
"| Trilinos website: http://trilinos.sandia.gov |\n" \
93 <<
"===============================================================================\n";
102 <<
"===============================================================================\n"\
103 <<
"| TEST 1: correctness of math operations |\n"\
104 <<
"===============================================================================\n";
106 outStream->precision(20);
109 shards::CellTopology cellType = shards::getCellTopologyData< shards::Hexahedron<> >();
114 Teuchos::RCP<Cubature<double> > myCub = cubFactory.
create(cellType, cubDegree);
115 int spaceDim = myCub->getDimension();
116 int numCubPoints = myCub->getNumPoints();
125 int numCellData = numCells*numNodes*spaceDim;
126 int numSignData = numCells*numFields;
128 double hexnodes[] = {
167 short edgesigns[] = {
168 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
169 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1,
170 -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1,
171 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1
185 FieldContainer<double> transformed_curl_of_basis_at_cub_points(numCells, numFields, numCubPoints, spaceDim);
186 FieldContainer<double> weighted_transformed_curl_of_basis_at_cub_points(numCells, numFields, numCubPoints, spaceDim);
190 FieldContainer<double> transformed_value_of_basis_at_cub_points(numCells, numFields, numCubPoints, spaceDim);
191 FieldContainer<double> weighted_transformed_value_of_basis_at_cub_points(numCells, numFields, numCubPoints, spaceDim);
197 myCub->getCubature(cub_points, cub_weights);
200 cell_nodes.setValues(hexnodes, numCellData);
203 field_signs.setValues(edgesigns, numSignData);
211 fst::computeCellMeasure<double>(weighted_measure, jacobian_det, cub_weights);
215 hexBasis.
getValues(curl_of_basis_at_cub_points, cub_points, OPERATOR_CURL);
218 fst::HCURLtransformCURL<double>(transformed_curl_of_basis_at_cub_points,
221 curl_of_basis_at_cub_points);
224 fst::multiplyMeasure<double>(weighted_transformed_curl_of_basis_at_cub_points,
226 transformed_curl_of_basis_at_cub_points);
229 fst::applyFieldSigns<double>(transformed_curl_of_basis_at_cub_points, field_signs);
230 fst::applyFieldSigns<double>(weighted_transformed_curl_of_basis_at_cub_points, field_signs);
233 fst::integrate<double>(stiffness_matrices,
234 transformed_curl_of_basis_at_cub_points,
235 weighted_transformed_curl_of_basis_at_cub_points,
240 hexBasis.
getValues(value_of_basis_at_cub_points, cub_points, OPERATOR_VALUE);
243 fst::HCURLtransformVALUE<double>(transformed_value_of_basis_at_cub_points,
245 value_of_basis_at_cub_points);
248 fst::multiplyMeasure<double>(weighted_transformed_value_of_basis_at_cub_points,
250 transformed_value_of_basis_at_cub_points);
253 fst::integrate<double>(mass_matrices,
254 transformed_value_of_basis_at_cub_points,
255 weighted_transformed_value_of_basis_at_cub_points,
259 fst::applyLeftFieldSigns<double>(mass_matrices, field_signs);
260 fst::applyRightFieldSigns<double>(mass_matrices, field_signs);
266 string basedir =
"./testdata";
267 for (
int cell_id = 0; cell_id < numCells-1; cell_id++) {
269 stringstream namestream;
271 namestream << basedir <<
"/mass_HCURL_HEX_I1_FEM" <<
"_" <<
"0" << cell_id+1 <<
".dat";
272 namestream >> filename;
274 ifstream massfile(&filename[0]);
275 if (massfile.is_open()) {
276 if (compareToAnalytic<double>(&mass_matrices(cell_id, 0, 0), massfile, 1e-10, iprint) > 0)
282 std::cout <<
"End Result: TEST FAILED\n";
287 namestream << basedir <<
"/stiff_HCURL_HEX_I1_FEM" <<
"_" <<
"0" << cell_id+1 <<
".dat";
288 namestream >> filename;
290 ifstream stifffile(&filename[0]);
291 if (stifffile.is_open())
293 if (compareToAnalytic<double>(&stiffness_matrices(cell_id, 0, 0), stifffile, 1e-10, iprint) > 0)
299 std::cout <<
"End Result: TEST FAILED\n";
304 for (
int cell_id = 3; cell_id < numCells; cell_id++) {
306 stringstream namestream;
308 namestream << basedir <<
"/mass_fp_HCURL_HEX_I1_FEM" <<
"_" <<
"0" << cell_id+1 <<
".dat";
309 namestream >> filename;
311 ifstream massfile(&filename[0]);
312 if (massfile.is_open()) {
313 if (compareToAnalytic<double>(&mass_matrices(cell_id, 0, 0), massfile, 1e-4, iprint, INTREPID_UTILS_SCALAR) > 0)
319 std::cout <<
"End Result: TEST FAILED\n";
324 namestream << basedir <<
"/stiff_fp_HCURL_HEX_I1_FEM" <<
"_" <<
"0" << cell_id+1 <<
".dat";
325 namestream >> filename;
327 ifstream stifffile(&filename[0]);
328 if (stifffile.is_open())
330 if (compareToAnalytic<double>(&stiffness_matrices(cell_id, 0, 0), stifffile, 1e-4, iprint, INTREPID_UTILS_SCALAR) > 0)
336 std::cout <<
"End Result: TEST FAILED\n";
345 catch (std::logic_error err) {
346 *outStream <<
"UNEXPECTED ERROR !!! ----------------------------------------------------------\n";
347 *outStream << err.what() <<
'\n';
348 *outStream <<
"-------------------------------------------------------------------------------" <<
"\n\n";
354 std::cout <<
"End Result: TEST FAILED\n";
356 std::cout <<
"End Result: TEST PASSED\n";
359 std::cout.copyfmt(oldFormatState);
int main(int argc, char *argv[])
outdated tests for orthogonal bases
virtual int getCardinality() const
Returns cardinality of the basis.
Header file for utility class to provide multidimensional containers.
void getValues(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const EOperator operatorType) const
Evaluation of a FEM basis on a reference Hexahedron cell.
Header file for the abstract base class Intrepid::DefaultCubatureFactory.
Implementation of the default H(curl)-compatible FEM basis of degree 1 on Hexahedron cell...
A factory class that generates specific instances of cubatures.
Teuchos::RCP< Cubature< Scalar, ArrayPoint, ArrayWeight > > create(const shards::CellTopology &cellTopology, const std::vector< int > °ree)
Factory method.
Header file for the Intrepid::HCURL_HEX_I1_FEM class.