/[escript]/trunk/dudley/src/ElementFile_setTags.cpp
ViewVC logotype

Annotation of /trunk/dudley/src/ElementFile_setTags.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3221 - (hide annotations)
Wed Sep 29 01:00:21 2010 UTC (8 years, 11 months ago) by jfenwick
Original Path: branches/domexper/dudley/src/ElementFile_setTags.c
File MIME type: text/plain
File size: 2071 byte(s)
Comment stripping

1 gross 767
2 ksteube 1312 /*******************************************************
3 ksteube 1811 *
4 jfenwick 2881 * Copyright (c) 2003-2010 by University of Queensland
5 ksteube 1811 * Earth Systems Science Computational Center (ESSCC)
6     * http://www.uq.edu.au/esscc
7     *
8     * Primary Business: Queensland, Australia
9     * Licensed under the Open Software License version 3.0
10     * http://www.opensource.org/licenses/osl-3.0.php
11     *
12     *******************************************************/
13 ksteube 1312
14 ksteube 1811
15 gross 767 /**************************************************************/
16    
17 jfenwick 3086 /* Dudley: Mesh: ElementFile */
18 gross 767
19 gross 2748 /* set tags to newTag where mask>0 */
20 gross 767
21     /**************************************************************/
22    
23     #include "ElementFile.h"
24     #include "Util.h"
25 gross 1062 #include "Assemble.h"
26 gross 767
27     /**************************************************************/
28    
29    
30 jfenwick 3086 void Dudley_ElementFile_setTags(Dudley_ElementFile* self,const int newTag, escriptDataC* mask) {
31 gross 2748 register dim_t n,q;
32     dim_t numElements, numQuad;
33     register __const double *mask_array;
34     register bool_t check;
35 jfenwick 3086 Dudley_resetError();
36 gross 2748 if (self==NULL) return;
37     numElements=self->numElements;
38 gross 767
39 jfenwick 3206 numQuad=Dudley_Assemble_reducedIntegrationOrder(mask)?1:(self->numDim+1);
40 gross 2748 if (1!=getDataPointSize(mask)) {
41 jfenwick 3086 Dudley_setError(TYPE_ERROR,"Dudley_ElementFile_setTags: number of components of mask is 1.");
42 gross 2748 } else if (!numSamplesEqual(mask,numQuad,numElements)) {
43 jfenwick 3086 Dudley_setError(TYPE_ERROR,"Dudley_ElementFile_setTags: illegal number of samples of mask Data object");
44 gross 2748 }
45 gross 767
46 gross 2748 /* now we can start */
47 gross 767
48 jfenwick 3086 if (Dudley_noError()) {
49 gross 2748 if (isExpanded(mask)) {
50     #pragma omp parallel private(n,check,mask_array)
51     {
52     #pragma omp for schedule(static)
53     for (n=0;n<numElements;n++) {
54 jfenwick 2770 mask_array=getSampleDataRO(mask,n);
55 gross 2748 if (mask_array[0]>0) self->Tag[n]=newTag;
56     }
57     }
58     } else {
59     #pragma omp parallel private(q,n,check,mask_array)
60     {
61     #pragma omp for schedule(static)
62     for (n=0;n<numElements;n++) {
63 jfenwick 2770 mask_array=getSampleDataRO(mask,n);
64 gross 2748 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 jfenwick 3086 Dudley_ElementFile_setTagsInUse(self);
71 gross 2748 }
72 gross 767 }
73 gross 2748

  ViewVC Help
Powered by ViewVC 1.1.26