Move implementation of vector_zero() to central location.

There is no need for each file to contain a separate, though
trivial, implementation of this feature.
This commit is contained in:
Bård Skaflestad 2010-10-14 13:58:47 +02:00
parent 2985200ad5
commit 4a2b5e4e0e
4 changed files with 19 additions and 24 deletions

View File

@ -1054,19 +1054,6 @@ define_csr_sparsity(size_t nc, size_t m, struct bf_asm_data *bf_asm)
}
/* ---------------------------------------------------------------------- */
/* v = zeros([n, 1]) */
/* ---------------------------------------------------------------------- */
static void
vector_zero(size_t n, double *v)
/* ---------------------------------------------------------------------- */
{
size_t i;
for (i = 0; i < n; i++) { v[i] = 0.0; }
}
/* ---------------------------------------------------------------------- */
/* Assemble system of linear equations corresponding to local
* discretisation of flow problem on domain connected to coarse face

View File

@ -348,17 +348,6 @@ ifsh_ms_impl_construct(grid_t *G ,
}
/* ---------------------------------------------------------------------- */
static void
vector_zero(size_t m, double *v)
/* ---------------------------------------------------------------------- */
{
size_t i;
for (i = 0; i < m; i++) { v[i] = 0.0; }
}
/* ---------------------------------------------------------------------- */
static void
average_flux(size_t nf, const int *N, double *flux) /* Poor name */

View File

@ -192,3 +192,16 @@ csrmatrix_zero(struct CSRMatrix *A)
for (i = 0; i < A->nnz; i++) { A->sa[i] = 0.0; }
}
/* ---------------------------------------------------------------------- */
/* v = zeros([n, 1]) */
/* ---------------------------------------------------------------------- */
void
vector_zero(size_t n, double *v)
/* ---------------------------------------------------------------------- */
{
size_t i;
for (i = 0; i < n; i++) { v[i] = 0.0; }
}

View File

@ -72,6 +72,12 @@ csrmatrix_delete(struct CSRMatrix *A);
void
csrmatrix_zero(struct CSRMatrix *A);
/* ---------------------------------------------------------------------- */
/* v = zeros([n, 1]) */
/* ---------------------------------------------------------------------- */
void
vector_zero(size_t n, double *v);
#ifdef __cplusplus
}
#endif