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

Annotation of /trunk/finley/src/ElementFile_setTags.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1312 - (hide annotations)
Mon Sep 24 06:18:44 2007 UTC (12 years, 1 month ago) by ksteube
File MIME type: text/plain
File size: 2331 byte(s)
The MPI branch is hereby closed. All future work should be in trunk.

Previously in revision 1295 I merged the latest changes to trunk into trunk-mpi-branch.
In this revision I copied all files from trunk-mpi-branch over the corresponding
trunk files. I did not use 'svn merge', it was a copy.

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

  ViewVC Help
Powered by ViewVC 1.1.26