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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4346 - (show annotations)
Tue Apr 2 04:46:45 2013 UTC (6 years, 4 months ago) by jfenwick
File size: 2366 byte(s)
Bringing the changes from doubleplusgood branch.
Can't merge directly because svn doesn't transfer changes to renamed files (mutter grumble).
1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2013 by University of Queensland
5 * http://www.uq.edu.au
6 *
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 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15
16 /************************************************************************************/
17
18 /* Dudley: Mesh: ElementFile */
19
20 /* set tags to newTag where mask>0 */
21
22 /************************************************************************************/
23
24 #include "ElementFile.h"
25 #include "Util.h"
26 #include "Assemble.h"
27
28 /************************************************************************************/
29
30 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
41 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
51 /* now we can start */
52
53 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 }
66 }
67 }
68 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 }

Properties

Name Value
svn:mergeinfo /branches/lapack2681/finley/src/ElementFile_setTags.cpp:2682-2741 /branches/pasowrap/dudley/src/ElementFile_setTags.cpp:3661-3674 /branches/py3_attempt2/dudley/src/ElementFile_setTags.cpp:3871-3891 /branches/restext/finley/src/ElementFile_setTags.cpp:2610-2624 /branches/ripleygmg_from_3668/dudley/src/ElementFile_setTags.cpp:3669-3791 /branches/stage3.0/finley/src/ElementFile_setTags.cpp:2569-2590 /branches/symbolic_from_3470/dudley/src/ElementFile_setTags.cpp:3471-3974 /branches/symbolic_from_3470/ripley/test/python/dudley/src/ElementFile_setTags.cpp:3517-3974 /release/3.0/finley/src/ElementFile_setTags.cpp:2591-2601 /trunk/dudley/src/ElementFile_setTags.cpp:4257-4344 /trunk/ripley/test/python/dudley/src/ElementFile_setTags.cpp:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26