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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1140 - (show annotations)
Tue May 15 03:23:17 2007 UTC (13 years ago) by ksteube
File MIME type: text/plain
File size: 2581 byte(s)
MPI branch trunk-mpi-branch has been merged with trunk through revision
1125, so changes in trunk since 1125 are not reflected in
trunk-mpi-branch.

Originally we parallelized revision 989, but after this merge it's
as if we'd parallelized revision 1125.

run_simplesolve.py runs on 1, 2, 4 CPUs.

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: ElementFile */
16
17 /* set tags to newTag where mask>0 */
18
19 /**************************************************************/
20
21 /* Author: gross@access.edu.au */
22 /* Version: $Id$ */
23
24 /**************************************************************/
25
26 #include "ElementFile.h"
27 #include "Util.h"
28 #include "Assemble.h"
29
30 /**************************************************************/
31
32
33 void Finley_ElementFile_setTags(Finley_ElementFile* self,const int newTag, escriptDataC* mask) {
34 register dim_t n,q;
35 dim_t numElements, numQuad;
36 register double *mask_array;
37 register bool_t check;
38 Finley_resetError();
39 if (self==NULL) return;
40 numElements=self->numElements;
41 if (Finley_Assemble_reducedIntegrationOrder(mask)) {
42 numQuad=self->ReferenceElementReducedOrder->numQuadNodes;
43 } else {
44 numQuad=self->ReferenceElement->numQuadNodes;
45 }
46
47 if (1!=getDataPointSize(mask)) {
48 Finley_setError(TYPE_ERROR,"Finley_ElementFile_setTags: number of components of mask is 1.");
49 } else if (!numSamplesEqual(mask,numQuad,numElements)) {
50 Finley_setError(TYPE_ERROR,"Finley_ElementFile_setTags: illegal number of samples of mask Data object");
51 }
52
53 /* now we can start */
54
55 if (Finley_noError()) {
56 if (isExpanded(mask)) {
57 #pragma omp parallel for private(n,check,mask_array) schedule(static)
58 for (n=0;n<numElements;n++) {
59 mask_array=getSampleData(mask,n);
60 if (mask_array[0]>0) self->Tag[n]=newTag;
61 }
62 } else {
63 #pragma omp parallel for private(q,n,check,mask_array) schedule(static)
64 for (n=0;n<numElements;n++) {
65 mask_array=getSampleData(mask,n);
66 check=FALSE;
67 for (q=0;q<numQuad;q++) check=check || mask_array[q];
68 if (check) self->Tag[n]=newTag;
69 }
70 }
71 }
72 }
73 /*
74 * $Log$
75 *
76 */

  ViewVC Help
Powered by ViewVC 1.1.26