1#include <libmesh/petsc_vector.h>
3#ifdef LIBMESH_HAVE_PETSC
35 unsigned int min_block_size = 2;
39 unsigned int local_size = (min_block_size + my_p);
41 unsigned int my_offset = 0;
45 const unsigned int p_size =
46 (min_block_size +
static_cast<unsigned int>(p));
78 CPPUNIT_ASSERT_EQUAL(read_only_values,
const_cast<const PetscScalar *
>(values));
84 v.
set(my_offset + i, i * 2.0);
93 LIBMESH_ASSERT_FP_EQUAL(i * 2.0, std::abs(read_only_values[i]),
TOLERANCE *
TOLERANCE);
101 auto v2 = v1.
clone();
115 auto v_working_ptr = v1.
clone();
116 auto & v_working = *v_working_ptr;
118 v_working.pointwise_mult(v1, *v2);
121 LIBMESH_ASSERT_NUMBERS_EQUAL
125 v_working.pointwise_divide(v1, *v2);
128 LIBMESH_ASSERT_NUMBERS_EQUAL
std::string libmesh_suite_name
libMesh::Parallel::Communicator * my_comm
void testSubvectorsBase()
NUMERICVECTORTEST CPPUNIT_TEST(testGetArray)
void testPetscOperations()
CPPUNIT_TEST(testSubvectorsBase)
CPPUNIT_TEST_SUITE(PetscVectorTest)
CPPUNIT_TEST(testSubvectors)
CPPUNIT_TEST(testPetscOperations)
processor_id_type size() const
processor_id_type rank() const
bool summarized_logs_enabled()
This class provides a nice interface to PETSc's Vec object.
virtual void set(const numeric_index_type i, const T value) override
Sets v(i) = value.
virtual void close() override
Calls the NumericVector's internal assembly routines, ensuring that the values are consistent across ...
virtual numeric_index_type first_local_index() const override
void restore_array()
Restore the data array.
virtual numeric_index_type last_local_index() const override
virtual std::unique_ptr< NumericVector< T > > clone() const override
const PetscScalar * get_array_read() const
Get read only access to the raw PETSc Vector data array.
PetscScalar * get_array()
Get read/write access to the raw PETSc Vector data array.
libMesh::PerfLog * unitlog
The libMesh namespace provides an interface to certain functionality in the library.
static constexpr Real TOLERANCE
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
uint8_t processor_id_type
CPPUNIT_TEST_SUITE_REGISTRATION(PetscVectorTest)