1 |
|
2 |
/* $Id$ */ |
3 |
|
4 |
/******************************************************* |
5 |
* |
6 |
* Copyright 2003-2007 by ACceSS MNRF |
7 |
* Copyright 2007 by University of Queensland |
8 |
* |
9 |
* http://esscc.uq.edu.au |
10 |
* Primary Business: Queensland, Australia |
11 |
* Licensed under the Open Software License version 3.0 |
12 |
* http://www.opensource.org/licenses/osl-3.0.php |
13 |
* |
14 |
*******************************************************/ |
15 |
|
16 |
/**************************************************************/ |
17 |
|
18 |
/* Finley: ElementFile */ |
19 |
|
20 |
/* gathers the ElementFile out from the ElementFile in using index[0:out->numElements-1]. */ |
21 |
/* index has to be between 0 and in->numElements-1. */ |
22 |
/* a conservative assumtion on the coloring is made */ |
23 |
|
24 |
/**************************************************************/ |
25 |
|
26 |
#include "ElementFile.h" |
27 |
|
28 |
/**************************************************************/ |
29 |
|
30 |
void Finley_ElementFile_gather(index_t* index, Finley_ElementFile* in, Finley_ElementFile* out) { |
31 |
index_t k; |
32 |
dim_t e,j; |
33 |
dim_t NN_in=in->numNodes; |
34 |
dim_t NN_out=out->numNodes; |
35 |
if (in!=NULL) { |
36 |
/*OMP */ |
37 |
#pragma omp parallel for private(e,k,j) schedule(static) |
38 |
for (e=0;e<out->numElements;e++) { |
39 |
k=index[e]; |
40 |
out->Id[e]=in->Id[k]; |
41 |
out->Tag[e]=in->Tag[k]; |
42 |
out->Owner[e]=in->Owner[k]; |
43 |
out->Color[e]=in->Color[k]+out->maxColor+1; |
44 |
for(j=0;j<MIN(NN_out,NN_in);j++) out->Nodes[INDEX2(j,e,NN_out)]=in->Nodes[INDEX2(j,k,NN_in)]; |
45 |
} |
46 |
out->minColor=MIN(out->minColor,in->minColor+out->maxColor+1); |
47 |
out->maxColor=MAX(out->maxColor,in->maxColor+out->maxColor+1); |
48 |
} |
49 |
} |