MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / create_vector_wrap

Method create_vector_wrap

cpp/dolfinx/la/petsc.cpp:104–129  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

102}
103//-----------------------------------------------------------------------------
104Vec 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//-----------------------------------------------------------------------------
131std::vector<IS> la::petsc::create_index_sets(
132 const std::vector<

Callers

nothing calls this directly

Calls 6

size_localMethod · 0.80
size_globalMethod · 0.80
ghostsMethod · 0.80
dataMethod · 0.80
commMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected