36#ifndef _PETSCVECTOOLS_HPP_
37#define _PETSCVECTOOLS_HPP_
128 static void Scale(
Vec vector,
double scaleFactor);
150 template<
size_t VECTOR_SIZE>
153 PetscInt indices_owned[VECTOR_SIZE];
159 for (
unsigned row = 0; row<VECTOR_SIZE; row++)
161 global_row = vectorIndices[row];
162 if (global_row >=lo && global_row <hi)
164 indices_owned[num_indices_owned++] = global_row;
168 if (num_indices_owned == VECTOR_SIZE)
182 double values[VECTOR_SIZE];
183 unsigned num_values_owned = 0;
185 for (
unsigned row = 0; row<VECTOR_SIZE; row++)
187 global_row = vectorIndices[row];
188 if (global_row >= lo && global_row < hi)
190 values[num_values_owned++] = smallVector(row);
221 static void DoInterleavedVecScatter(
Vec interleavedVec, VecScatter firstVariableScatterContext,
Vec firstVariableVec, VecScatter secondVariableScatterContext,
Vec secondVariableVec);
232 static void DoInterleavedVecGather(
Vec interleavedVec, VecScatter firstVariableScatterContext,
Vec firstVariableVec, VecScatter secondVariableScatterContext,
Vec secondVariableVec);