63 using Teuchos::ArrayRCP;
79 ArrayRCP<value_t> input1(
new value_t [12], 0, 12,
true);
80 for (
int i=0; i < 12; i++)
81 input1[i] = (i+1) * 5;
83 RCP<stridedInput_t> s1;
86 s1 = rcp<stridedInput_t>(
new stridedInput_t(input1, 1));
88 catch (std::exception &e){
93 std::cout << std::endl;
94 std::cout <<
"Test 1, input: " << input1 << std::endl;
95 std::cout <<
"[] test: ";
96 for (
int i=0; i < 12; i++)
97 std::cout << (*s1)[i] <<
" ";
98 std::cout << std::endl;
100 ArrayRCP<const value_t> fromS1;
101 s1->getInputArray(fromS1);
102 std::cout <<
"getInputArray test: ";
103 for (
int i=0; i < 12; i++)
104 std::cout << fromS1[i] <<
" ";
105 std::cout << std::endl;
107 stridedInput_t s1Copy;
110 std::cout <<
"assignment operator test: ";
111 for (
int i=0; i < 12; i++)
112 std::cout << s1Copy[i] <<
" ";
113 std::cout << std::endl;
118 ArrayRCP<value_t> input2(
new value_t [12], 0, 12,
true);
119 for (
int i=0; i < 12; i+=3)
120 input2[i] = (i+1) * -5.0;
122 RCP<stridedInput_t> s2;
125 s2 = rcp<stridedInput_t>(
new stridedInput_t(input2, 3));
127 catch (std::exception &e){
132 std::cout << std::endl;
133 std::cout <<
"Test 2, input: " << input2 << std::endl;
134 std::cout <<
"[] test: ";
135 for (
int i=0; i < 4; i++)
136 std::cout << (*s2)[i] <<
" ";
137 std::cout << std::endl;
139 ArrayRCP<const value_t> fromS2;
140 s2->getInputArray(fromS2);
141 std::cout <<
"getInputArray test: ";
142 for (
int i=0; i < 4; i++)
143 std::cout << fromS2[i] <<
" ";
144 std::cout << std::endl;
146 stridedInput_t s2Copy;
149 std::cout <<
"assignment operator test: ";
150 for (
int i=0; i < 4; i++)
151 std::cout << s2Copy[i] <<
" ";
152 std::cout << std::endl;
155 int main(
int narg,
char *arg[])
157 Tpetra::ScopeGuard tscope(&narg, &arg);
158 Teuchos::RCP<const Teuchos::Comm<int> > tcomm = Tpetra::getDefaultComm();
163 if (tcomm->getRank() > 0)
166 Teuchos::SerialComm<int> comm;
170 std::cout <<
"PASS" << std::endl;