83 FEI_COUT <<
" vector_test1: testing fei::Vector with type '"
84 << fei_vec->typeName() <<
"':"<<
FEI_ENDL;
88 std::vector<int> global_offsets;
89 vspace->getGlobalIndexOffsets(global_offsets);
91 int i, my_first_offset = global_offsets[
localProc_];
92 int my_last_offset = global_offsets[
localProc_+1]-1;
93 int num_local_indices = my_last_offset - my_first_offset + 1;
95 std::vector<double> coefs(num_local_indices, 1.0);
96 std::vector<double> check_coefs(num_local_indices);
97 std::vector<int> indices(num_local_indices);
98 for(i=0; i<num_local_indices; ++i) {
99 indices[i] = my_first_offset + i;
103 FEI_COUT <<
" testing fei::Vector::copyIn/copyOut...";
105 int errcode = fei_vec->copyIn(num_local_indices, &indices[0], &coefs[0]);
107 throw std::runtime_error(
"nonzero errcode from fei_vec->copyIn");
110 errcode = fei_vec->copyOut(num_local_indices, &indices[0], &check_coefs[0]);
112 throw std::runtime_error(
"nonzero errcode from fei_vec->copyOut");
115 if (coefs != check_coefs) {
116 throw std::runtime_error(
"fei_vec->copyOut didn't produce the right coefs");
122 errcode = fei_vec->putScalar(0.0);
125 throw std::runtime_error(
"nonzero errcode from fei_vec->putScalar");
128 errcode = fei_vec->copyOut(num_local_indices, &indices[0], &check_coefs[0]);
130 throw std::runtime_error(
"nonzero errcode from fei_vec->copyOut");
133 for(i=0; i<num_local_indices; ++i) {
134 if (std::abs(check_coefs[i]) > 1.e-38) {
135 throw std::runtime_error(
"fei_vec->putScalar(0.0) didn't zero the vector");