21 #ifdef HAVE_FEI_AZTECOO
27 #define fei_file "test_Vector.cpp"
64 false,
false, (
const char*)0, factory);
68 throw std::runtime_error(
"test_Vector::create_vector: ERROR, failed to create valid fei::VectorSpace.");
83 FEI_COUT <<
" vector_test1: testing fei::Vector with type '"
88 std::vector<int> 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");
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");
virtual fei::SharedPtr< fei::VectorSpace > getVectorSpace() const =0
virtual int copyIn(int numValues, const int *indices, const double *values, int vectorIndex=0)=0
test_Vector(MPI_Comm comm)
fei::SharedPtr< fei::Vector > create_vector(fei::SharedPtr< fei::Factory > factory)
virtual int putScalar(double scalar)=0
virtual fei::SharedPtr< fei::Vector > createVector(fei::SharedPtr< fei::VectorSpace > vecSpace, int numVectors=1)=0
virtual const char * typeName() const =0
void getGlobalIndexOffsets(std::vector< int > &globalOffsets) const
void vector_test1(fei::SharedPtr< fei::Vector > fei_vec)
virtual int copyOut(int numValues, const int *indices, double *values, int vectorIndex=0) const =0
static fei::SharedPtr< fei::VectorSpace > create_VectorSpace(MPI_Comm comm)