16 #include <xtl/xspan.hpp>
33 xtl::span<PetscScalar> x);
36 void petsc_error(
int error_code, std::string filename,
37 std::string petsc_function);
52 std::pair<std::reference_wrapper<const common::IndexMap>,
int>>& maps);
74 const std::vector<std::int64_t>& ghosts,
int bs);
80 std::pair<std::reference_wrapper<const common::IndexMap>,
int>>& maps);
84 Vec x,
const std::vector<xtl::span<const PetscScalar>>& x_b,
86 std::pair<std::reference_wrapper<const common::IndexMap>,
int>>& maps);
138 std::int64_t
size()
const;
This class represents the distribution index arrays across processes. An index array is a contiguous ...
Definition: IndexMap.h:49
A simple wrapper for a PETSc vector pointer (Vec). Its main purpose is to assist with memory/lifetime...
Definition: PETScVector.h:94
virtual ~PETScVector()
Destructor.
Definition: PETScVector.cpp:204
std::int32_t local_size() const
Return local size of vector (belonging to this process)
Definition: PETScVector.cpp:235
PETScVector(const common::IndexMap &map, int bs)
Create vector.
Definition: PETScVector.cpp:189
void set_from_options()
Call PETSc function VecSetFromOptions on the underlying Vec object.
Definition: PETScVector.cpp:305
std::string get_options_prefix() const
Returns the prefix used by PETSc when searching the options database.
Definition: PETScVector.cpp:296
void set_options_prefix(std::string options_prefix)
Sets the prefix used by PETSc when searching the options database.
Definition: PETScVector.cpp:289
PETScVector copy() const
Create a copy of the vector.
Definition: PETScVector.cpp:216
std::array< std::int64_t, 2 > local_range() const
Return ownership range for calling rank.
Definition: PETScVector.cpp:244
std::int64_t size() const
Return global size of vector.
Definition: PETScVector.cpp:226
MPI_Comm mpi_comm() const
Return MPI communicator.
Definition: PETScVector.cpp:254
PetscReal norm(la::Norm type) const
Compute norm of vector.
Definition: PETScVector.cpp:263
Vec vec() const
Return pointer to PETSc Vec object.
Definition: PETScVector.cpp:312
Miscellaneous classes, functions and types.
Linear algebra interface.
Definition: sparsitybuild.h:13
void scatter_local_vectors(Vec x, const std::vector< xtl::span< const PetscScalar >> &x_b, const std::vector< std::pair< std::reference_wrapper< const common::IndexMap >, int >> &maps)
Scatter local vectors to Vec.
Definition: PETScVector.cpp:145
std::vector< std::vector< PetscScalar > > get_local_vectors(const Vec x, const std::vector< std::pair< std::reference_wrapper< const common::IndexMap >, int >> &maps)
Copy blocks from Vec into local vectors.
Definition: PETScVector.cpp:102
std::vector< IS > create_petsc_index_sets(const std::vector< std::pair< std::reference_wrapper< const common::IndexMap >, int >> &maps)
Definition: PETScVector.cpp:44
Norm
Norm types.
Definition: utils.h:13
void petsc_error(int error_code, std::string filename, std::string petsc_function)
Print error message for PETSc calls that return an error.
Definition: PETScVector.cpp:26
Vec create_petsc_vector(const common::IndexMap &map, int bs)
Create a ghosted PETSc Vec.
Definition: PETScVector.cpp:77
Vec create_ghosted_vector(const common::IndexMap &map, int bs, xtl::span< PetscScalar > x)
Create a PETSc Vec that wraps the data in an array.
Definition: PETScVector.cpp:64