24 const double*
const local_var,
25 double**
const global_var,
32 if ((*global_var) != NULL) {
33 fprintf(stderr,
"Error in IBAssembleGlobalFacetData()\n");
34 fprintf(stderr,
" global_var is not NULL on rank %d\n",
42 if ((nfacets_local == 0) && (local_var != NULL)) {
43 fprintf(stderr,
"Error in IBAssembleGlobalFacetData()\n");
44 fprintf(stderr,
" nfacets_local is 0 but local_var is not NULL!\n");
47 if ((nfacets_local > 0) && (local_var == NULL)) {
48 fprintf(stderr,
"Error in IBAssembleGlobalFacetData()\n");
49 fprintf(stderr,
" nfacets_local > 0 but local_var is NULL!\n");
62 *global_var = (
double*) calloc (nfacets_global*nvars,
sizeof(
double));
66 int *check = (
int*) calloc (nfacets_global,
sizeof(
int));
70 for (
int n = 0; n < nfacets_local; n++) {
71 _ArrayAXPY_((local_var+n), 1.0, ((*global_var)+fmap[n].index), nvars);
72 check[fmap[n].
index]++;
76 for (
int proc = 1; proc < mpi->
nproc; proc++) {
79 MPI_Recv(&nf_incoming, 1, MPI_INT, proc, 98927, MPI_COMM_WORLD, &status);
81 if (nf_incoming > 0) {
83 int *indices_incoming = (
int*) calloc(nf_incoming,
sizeof(
int));
84 double *var_incoming = (
double*) calloc(nf_incoming*nvars,
sizeof(
double));
86 MPI_Recv(indices_incoming, nf_incoming, MPI_INT, proc, 98928, mpi->
world, &status);
87 MPI_Recv(var_incoming, nf_incoming*nvars, MPI_DOUBLE, proc, 98929, mpi->
world, &status);
89 for (
int n = 0; n < nf_incoming; n++) {
90 _ArrayAXPY_((var_incoming+n), 1.0, ((*global_var)+indices_incoming[n]), nvars);
91 check[indices_incoming[n]]++;
94 free(indices_incoming);
100 for (
int n = 0; n < nfacets_global; n++) {
102 fprintf(stderr,
"Error in IBAssembleGlobalFacetData()\n");
103 fprintf(stderr,
" No data received for facet %d\n", n);
114 MPI_Send(&nfacets_local, 1, MPI_INT, 0, 98927, MPI_COMM_WORLD);
116 if (nfacets_local > 0) {
118 int i, *indices = (
int*) calloc (nfacets_local,
sizeof(
int));
119 for (i = 0; i < nfacets_local; i++) indices[i] = fmap[i].index;
121 MPI_Send(indices, nfacets_local, MPI_INT, 0, 98928, mpi->
world);
122 MPI_Send(local_var, nfacets_local*nvars, MPI_DOUBLE, 0, 98929, mpi->
world);
#define _ArraySetValue_(x, size, value)
Structure containing variables for immersed boundary implementation.
Structure defining a facet map.
Structures and function definitions for immersed boundaries.
int IBAssembleGlobalFacetData(void *, void *, const double *const, double **const, int)
MPI related function definitions.
#define _ArrayScale1D_(x, a, size)
Contains macros and function definitions for common array operations.
Structure of MPI-related variables.
#define _ArrayAXPY_(x, a, y, size)