63 using Teuchos::ArrayRCP;
80 ArrayRCP<value_t> input1(
new value_t [12], 0, 12,
true);
81 for (
int i=0; i < 12; i++)
82 input1[i] = (i+1) * 5;
84 RCP<stridedInput_t> s1;
87 s1 = rcp<stridedInput_t>(
new stridedInput_t(input1, 1));
89 catch (std::exception &e){
94 std::cout << std::endl;
95 std::cout <<
"Test 1, input: " << input1 << std::endl;
96 std::cout <<
"[] test: ";
97 for (
int i=0; i < 12; i++)
98 std::cout << (*s1)[i] <<
" ";
99 std::cout << std::endl;
101 ArrayRCP<const value_t> fromS1;
102 s1->getInputArray(fromS1);
103 std::cout <<
"getInputArray test: ";
104 for (
int i=0; i < 12; i++)
105 std::cout << fromS1[i] <<
" ";
106 std::cout << std::endl;
108 stridedInput_t s1Copy;
111 std::cout <<
"assignment operator test: ";
112 for (
int i=0; i < 12; i++)
113 std::cout << s1Copy[i] <<
" ";
114 std::cout << std::endl;
119 ArrayRCP<value_t> input2(
new value_t [12], 0, 12,
true);
120 for (
int i=0; i < 12; i+=3)
121 input2[i] = (i+1) * -5.0;
123 RCP<stridedInput_t> s2;
126 s2 = rcp<stridedInput_t>(
new stridedInput_t(input2, 3));
128 catch (std::exception &e){
133 std::cout << std::endl;
134 std::cout <<
"Test 2, input: " << input2 << std::endl;
135 std::cout <<
"[] test: ";
136 for (
int i=0; i < 4; i++)
137 std::cout << (*s2)[i] <<
" ";
138 std::cout << std::endl;
140 ArrayRCP<const value_t> fromS2;
141 s2->getInputArray(fromS2);
142 std::cout <<
"getInputArray test: ";
143 for (
int i=0; i < 4; i++)
144 std::cout << fromS2[i] <<
" ";
145 std::cout << std::endl;
147 stridedInput_t s2Copy;
150 std::cout <<
"assignment operator test: ";
151 for (
int i=0; i < 4; i++)
152 std::cout << s2Copy[i] <<
" ";
153 std::cout << std::endl;
156 int main(
int argc,
char *argv[])
158 Teuchos::GlobalMPISession session(&argc, &argv);
159 Teuchos::RCP<const Teuchos::Comm<int> > mpicomm =
160 Teuchos::DefaultComm<int>::getComm();
165 if (mpicomm->getRank() > 0)
168 Teuchos::SerialComm<int> comm;
172 std::cout <<
"PASS" << std::endl;
#define TEST_FAIL_AND_EXIT(comm, ok, s, code)
common code used by tests
The StridedData class manages lists of weights or coordinates.
int main(int argc, char *argv[])
void StridedDataTest(const Teuchos::SerialComm< int > &comm)
This file defines the StridedData class.