/[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 3981 - (hide annotations)
Fri Sep 21 02:47:54 2012 UTC (7 years ago) by jfenwick
Original Path: trunk/dudley/src/ElementFile_setTags.c
File MIME type: text/plain
File size: 2366 byte(s)
First pass of updating copyright notices
1 gross 767
2 jfenwick 3981 /*****************************************************************************
3 ksteube 1811 *
4 jfenwick 3911 * Copyright (c) 2003-2012 by University of Queensland
5 jfenwick 3981 * http://www.uq.edu.au
6 ksteube 1811 *
7     * Primary Business: Queensland, Australia
8     * Licensed under the Open Software License version 3.0
9     * http://www.opensource.org/licenses/osl-3.0.php
10     *
11 jfenwick 3981 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12     * Development since 2012 by School of Earth Sciences
13     *
14     *****************************************************************************/
15 ksteube 1312
16 jfenwick 3981 /************************************************************************************/
17 gross 767
18 jfenwick 3086 /* Dudley: Mesh: ElementFile */
19 gross 767
20 gross 2748 /* set tags to newTag where mask>0 */
21 gross 767
22 jfenwick 3981 /************************************************************************************/
23 gross 767
24     #include "ElementFile.h"
25     #include "Util.h"
26 gross 1062 #include "Assemble.h"
27 gross 767
28 jfenwick 3981 /************************************************************************************/
29 gross 767
30 jfenwick 3224 void Dudley_ElementFile_setTags(Dudley_ElementFile * self, const int newTag, escriptDataC * mask)
31     {
32     register dim_t n, q;
33     dim_t numElements, numQuad;
34     register __const double *mask_array;
35     register bool_t check;
36     Dudley_resetError();
37     if (self == NULL)
38     return;
39     numElements = self->numElements;
40 gross 767
41 jfenwick 3224 numQuad = Dudley_Assemble_reducedIntegrationOrder(mask) ? 1 : (self->numDim + 1);
42     if (1 != getDataPointSize(mask))
43     {
44     Dudley_setError(TYPE_ERROR, "Dudley_ElementFile_setTags: number of components of mask is 1.");
45     }
46     else if (!numSamplesEqual(mask, numQuad, numElements))
47     {
48     Dudley_setError(TYPE_ERROR, "Dudley_ElementFile_setTags: illegal number of samples of mask Data object");
49     }
50 gross 767
51 jfenwick 3224 /* now we can start */
52 gross 767
53 jfenwick 3224 if (Dudley_noError())
54     {
55     if (isExpanded(mask))
56     {
57     #pragma omp parallel private(n,check,mask_array)
58     {
59     #pragma omp for schedule(static)
60     for (n = 0; n < numElements; n++)
61     {
62     mask_array = getSampleDataRO(mask, n);
63     if (mask_array[0] > 0)
64     self->Tag[n] = newTag;
65 gross 2748 }
66 jfenwick 3224 }
67 gross 2748 }
68 jfenwick 3224 else
69     {
70     #pragma omp parallel private(q,n,check,mask_array)
71     {
72     #pragma omp for schedule(static)
73     for (n = 0; n < numElements; n++)
74     {
75     mask_array = getSampleDataRO(mask, n);
76     check = FALSE;
77     for (q = 0; q < numQuad; q++)
78     check = check || mask_array[q];
79     if (check)
80     self->Tag[n] = newTag;
81     }
82     }
83     }
84     Dudley_ElementFile_setTagsInUse(self);
85     }
86 gross 767 }

  ViewVC Help
Powered by ViewVC 1.1.26