50 #include "Teuchos_GlobalMPISession.hpp"
53 using namespace Intrepid;
55 int main(
int argc,
char *argv[]) {
57 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
60 <<
"===============================================================================\n" \
62 <<
"| Example use of the FieldContainer class |\n" \
64 <<
"| 1) using FieldContainer in DEBUG mode: |\n" \
65 <<
"| requires intrepid to be configured with --enable-intrepid-debug |\n" \
66 <<
"| See /test/FieldContainer/test_02.cpp for more examples |\n" \
68 <<
"| Questions? Contact Pavel Bochev (pbboche@sandia.gov) or |\n" \
69 <<
"| Denis Ridzal (dridzal@sandia.gov). |\n" \
71 <<
"| Intrepid's website: http://trilinos.sandia.gov/packages/intrepid |\n" \
72 <<
"| Trilinos website: http://trilinos.sandia.gov |\n" \
74 <<
"===============================================================================\n\n";
77 Teuchos::Array<int> dimensions;
78 Teuchos::Array<int> multiIndex;
91 <<
"===============================================================================\n"\
92 <<
"| EXAMPLE 1: Debug mode |\n"\
93 <<
"===============================================================================\n\n";
98 <<
"===============================================================================\n"\
99 <<
" Trying to get enumeration using multi-index with the wrong rank: \n\n";
101 multiIndex.resize(5);
107 myContainer.getEnumeration(multiIndex);
109 catch(std::logic_error err){
110 cout << err.what() <<
"\n";
115 <<
"===============================================================================\n"\
116 <<
" Trying to get enumeration using multi-index that is out of bounds: \n\n";
118 multiIndex.resize(4);
123 myContainer.getEnumeration(multiIndex);
125 catch(std::logic_error err){
126 cout << err.what() <<
"\n\n";
131 <<
"===============================================================================\n"\
132 <<
" Trying to set values from array whose size is less than FieldContainer's size: \n\n";
138 Teuchos::Array<double> dataTeuchosArray(4*3*2*7);
142 for(
int i=0; i < dimensions[0]; i++){
143 for(
int j=0; j < dimensions[1]; j++){
144 for(
int k=0; k < dimensions[2]; k++){
145 for(
int l = 0; l < dimensions[3]; l++){
146 dataTeuchosArray[counter] = (double)counter;
155 myContainer.setValues(dataTeuchosArray);
157 catch(std::logic_error err){
158 cout << err.what() <<
"\n";
163 <<
"===============================================================================\n"\
164 <<
" Trying to set values from array whose size is greater than FieldContainer's size: \n\n";
171 dataTeuchosArray.resize(5*3*3*7);
175 for(
int i=0; i < dimensions[0]; i++){
176 for(
int j=0; j < dimensions[1]; j++){
177 for(
int k=0; k < dimensions[2]; k++){
178 for(
int l = 0; l < dimensions[3]; l++){
179 dataTeuchosArray[counter] = (double)counter;
188 myContainer.setValues(dataTeuchosArray);
190 catch(std::logic_error err){
191 cout << err.what() <<
"\n";
197 <<
"===============================================================================\n"\
198 <<
" Trying to use [] with enumeration that is out of range: \n\n";
202 catch(std::logic_error err){
203 cout << err.what() <<
"\n\n";
212 <<
"===============================================================================\n"\
213 <<
" Trying to create FieldContainer using incompatible data array and dimensions: \n\n";
222 catch(std::logic_error err){
223 cout << err.what() << endl;
Header file for utility class to provide multidimensional containers.