71 #include "Intrepid_HGRAD_LINE_Cn_FEM.hpp"
80 #include "Epetra_Time.h"
81 #include "Epetra_Map.h"
82 #include "Epetra_FECrsMatrix.h"
83 #include "Epetra_FEVector.h"
84 #include "Epetra_SerialComm.h"
87 #include "Teuchos_oblackholestream.hpp"
88 #include "Teuchos_RCP.hpp"
89 #include "Teuchos_BLAS.hpp"
92 #include "Shards_CellTopology.hpp"
95 #include "EpetraExt_RowMatrixOut.h"
96 #include "EpetraExt_MultiVectorOut.h"
99 using namespace Intrepid;
101 int main(
int argc,
char *argv[]) {
105 std::cout <<
"\n>>> ERROR: Invalid number of arguments.\n\n";
106 std::cout <<
"Usage:\n\n";
107 std::cout <<
" ./Intrepid_example_Drivers_Example_05.exe min_deg max_deg verbose\n\n";
108 std::cout <<
" where \n";
109 std::cout <<
" int min_deg - beginning polynomial degree to check \n";
110 std::cout <<
" int max_deg - final polynomial degree to check \n";
111 std::cout <<
" verbose (optional) - any character, indicates verbose output \n\n";
117 int iprint = argc - 1;
118 Teuchos::RCP<std::ostream> outStream;
119 Teuchos::oblackholestream bhs;
121 outStream = Teuchos::rcp(&std::cout,
false);
123 outStream = Teuchos::rcp(&bhs,
false);
126 Teuchos::oblackholestream oldFormatState;
127 oldFormatState.copyfmt(std::cout);
130 <<
"===============================================================================\n" \
132 <<
"| Example: Check diagonalization of reference mass matrix |\n" \
133 <<
"| on line, quad, and hex |\n" \
135 <<
"| Questions? Contact Pavel Bochev (pbboche@sandia.gov), |\n" \
136 <<
"| Denis Ridzal (dridzal@sandia.gov), |\n" \
137 <<
"| Kara Peterson (kjpeter@sandia.gov). |\n" \
139 <<
"| Intrepid's website: http://trilinos.sandia.gov/packages/intrepid |\n" \
140 <<
"| Trilinos website: http://trilinos.sandia.gov |\n" \
142 <<
"===============================================================================\n";
146 int min_degree = atoi(argv[1]);
147 int max_degree = atoi(argv[2]);
153 typedef shards::CellTopology CellTopology;
154 CellTopology line_2(shards::getCellTopologyData<shards::Line<2> >() );
155 CellTopology quad_4(shards::getCellTopologyData<shards::Quadrilateral<4> >() );
156 CellTopology hex_8(shards::getCellTopologyData<shards::Hexahedron<8> >() );
158 std::vector<CellTopology> cts(3);
161 for (
int deg=min_degree;deg<=max_degree;deg++) {
162 std::vector<Teuchos::RCP<Basis<double,FieldContainer<double> > > > bases;
175 for (
int sd=1;sd<=3;sd++) {
177 cub_to_tensor.push_back( glcub );
180 int cubDim = cubcur.getDimension();
181 int numCubPoints = cubcur.getNumPoints();
186 cubcur.getCubature(cubPoints, cubWeights);
189 Teuchos::RCP<Basis<double,FieldContainer<double> > > basis_cur = bases[sd-1];
190 const int numFields = basis_cur->getCardinality();
194 basis_cur->getValues( bf_at_cub_pts , cubPoints , OPERATOR_VALUE );
197 FunctionSpaceTools::HGRADtransformVALUE<double>( trans_bf_at_cub_pts ,
199 cubWeights.resize(1,numCubPoints);
200 FunctionSpaceTools::multiplyMeasure<double>( w_trans_bf_at_cub_pts ,
202 trans_bf_at_cub_pts );
203 cubWeights.resize(numCubPoints);
206 FunctionSpaceTools::integrate<double>( mass_matrix ,
207 trans_bf_at_cub_pts ,
208 w_trans_bf_at_cub_pts ,
212 double max_offdiag = 0.0;
213 for (
int i=0;i<numFields;i++) {
214 for (
int j=0;j<numFields;j++) {
216 if ( abs(mass_matrix(0,i,j)) >= max_offdiag) {
217 max_offdiag = abs(mass_matrix(0,i,j));
222 double min_diag = mass_matrix(0,0,0);
223 for (
int i=0;i<numFields;i++) {
224 if ( mass_matrix(0,i,i) <= min_diag ) {
225 min_diag = mass_matrix(0,i,i);
228 *outStream <<
"Degree = " << deg <<
" and dimension = " << sd <<
"; Max offdiagonal"
229 <<
" element is " << max_offdiag <<
" and min diagonal element is " << min_diag
236 std::cout <<
"End Result: TEST PASSED\n";
238 std::cout.copyfmt(oldFormatState);
Implementation of the locally H(grad)-compatible FEM basis of variable order on the [-1...
Header file for utility class to provide multidimensional containers.
Header file for the Intrepid::CubatureTensor class.
Header file for the Intrepid::HGRAD_HEX_Cn_FEM class.
Utilizes cubature (integration) rules contained in the library Polylib (Spencer Sherwin, Aeronautics, Imperial College London) within Intrepid.
Implementation of the default H(grad)-compatible FEM basis of degree 2 on Hexahedron cell...
Header file for the Intrepid::HGRAD_QUAD_Cn_FEM class.
Header file for the Intrepid::CubaturePolylib class.
Defines tensor-product cubature (integration) rules in Intrepid.