-----------------------------------------------------------------------------
| 102 | } |
| 103 | //----------------------------------------------------------------------------- |
| 104 | Vec la::petsc::create_vector_wrap(const common::IndexMap& map, int bs, |
| 105 | std::span<const PetscScalar> x) |
| 106 | { |
| 107 | const std::int32_t size_local = bs * map.size_local(); |
| 108 | const std::int64_t size_global = bs * map.size_global(); |
| 109 | const std::vector<PetscInt> ghosts(map.ghosts().begin(), map.ghosts().end()); |
| 110 | Vec vec; |
| 111 | PetscErrorCode ierr; |
| 112 | if (bs == 1) |
| 113 | { |
| 114 | ierr |
| 115 | = VecCreateGhostWithArray(map.comm(), size_local, size_global, |
| 116 | ghosts.size(), ghosts.data(), x.data(), &vec); |
| 117 | CHECK_ERROR("VecCreateGhostWithArray"); |
| 118 | } |
| 119 | else |
| 120 | { |
| 121 | ierr = VecCreateGhostBlockWithArray(map.comm(), bs, size_local, size_global, |
| 122 | ghosts.size(), ghosts.data(), x.data(), |
| 123 | &vec); |
| 124 | CHECK_ERROR("VecCreateGhostBlockWithArray"); |
| 125 | } |
| 126 | |
| 127 | assert(vec); |
| 128 | return vec; |
| 129 | } |
| 130 | //----------------------------------------------------------------------------- |
| 131 | std::vector<IS> la::petsc::create_index_sets( |
| 132 | const std::vector< |
nothing calls this directly
no test coverage detected