/[escript]/trunk-mpi-branch/finley/src/NodeFile_scatter.c
ViewVC logotype

Contents of /trunk-mpi-branch/finley/src/NodeFile_scatter.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1223 - (show annotations)
Fri Aug 3 02:40:39 2007 UTC (11 years, 8 months ago) by gross
File MIME type: text/plain
File size: 2601 byte(s)
first attemt towards an improved MPI version.  

1 /*
2 ************************************************************
3 * Copyright 2006 by ACcESS MNRF *
4 * *
5 * http://www.access.edu.au *
6 * Primary Business: Queensland, Australia *
7 * Licensed under the Open Software License version 3.0 *
8 * http://www.opensource.org/licenses/osl-3.0.php *
9 * *
10 ************************************************************
11 */
12
13 /**************************************************************/
14
15 /* Finley: Mesh: NodeFile */
16
17 /* scatters the NodeFile in into NodeFile out using index[0:in->numNodes-1]. */
18 /* index has to be between 0 and out->numNodes-1. */
19 /* coloring is choosen for the worst case */
20
21 /**************************************************************/
22
23 /* Author: gross@access.edu.au */
24 /* Version: $Id$ */
25
26 /**************************************************************/
27
28 #include "NodeFile.h"
29
30 /**************************************************************/
31
32 void Finley_NodeFile_scatterEntries(dim_t n, index_t* index, index_t min_index, index_t max_index,
33 index_t* Id_out, index_t* Id_in,
34 index_t* Tag_out, index_t* Tag_in,
35 index_t* globalDegreesOfFreedom_out, index_t* globalDegreesOfFreedom_in,
36 dim_t numDim, double* Coordinates_out, double* Coordinates_in)
37 {
38 dim_t i;
39 register index_t k;
40 register const index_t range=max_index-min_index;
41 const size_t numDim_size=(size_t)numDim*sizeof(double);
42
43 #pragma omp parallel for private(i,k) schedule(static)
44 for (i=0;i<n;i++) {
45 k=index[i]-min_index;
46 if ((k>=0) && (k <range)) {
47 Id_out[k]=Id_in[i];
48 Tag_out[k]=Tag_in[i];
49 globalDegreesOfFreedom_out[k]=globalDegreesOfFreedom_in[i];
50 memcpy(&(Coordinates_out[INDEX2(0,k,numDim)]), &(Coordinates_in[INDEX2(0,i,numDim)]), numDim_size);
51 }
52 }
53 }
54
55 void Finley_NodeFile_scatter(index_t* index, Finley_NodeFile* in, Finley_NodeFile* out)
56 {
57 Finley_NodeFile_scatterEntries(out->numNodes, index, 0, in->numNodes,
58 out->Id, in->Id,
59 out->Tag, in->Tag,
60 out->globalDegreesOfFreedom, in->globalDegreesOfFreedom,
61 out->numDim, out->Coordinates, in->Coordinates);
62 out->isPrepared=FINLEY_UNPREPARED;
63 }

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26