/[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 3152 - (show annotations)
Fri Sep 3 05:48:31 2010 UTC (9 years, 1 month ago) by jfenwick
Original Path: branches/domexper/dudley/src/ElementFile_setTags.c
File MIME type: text/plain
File size: 2162 byte(s)
Collapsed duplicate fields
1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2010 by University of Queensland
5 * 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
14
15 /**************************************************************/
16
17 /* Dudley: Mesh: ElementFile */
18
19 /* set tags to newTag where mask>0 */
20
21 /**************************************************************/
22
23 #include "ElementFile.h"
24 #include "Util.h"
25 #include "Assemble.h"
26
27 /**************************************************************/
28
29
30 void Dudley_ElementFile_setTags(Dudley_ElementFile* self,const int newTag, escriptDataC* mask) {
31 register dim_t n,q;
32 dim_t numElements, numQuad;
33 register __const double *mask_array;
34 register bool_t check;
35 Dudley_resetError();
36 if (self==NULL) return;
37 numElements=self->numElements;
38
39 numQuad= Dudley_ReferenceElementSet_borrowReferenceElement(self->referenceElementSet,Dudley_Assemble_reducedIntegrationOrder(mask))->BasisFunctions->numQuadNodes;
40
41 if (1!=getDataPointSize(mask)) {
42 Dudley_setError(TYPE_ERROR,"Dudley_ElementFile_setTags: number of components of mask is 1.");
43 } else if (!numSamplesEqual(mask,numQuad,numElements)) {
44 Dudley_setError(TYPE_ERROR,"Dudley_ElementFile_setTags: illegal number of samples of mask Data object");
45 }
46
47 /* now we can start */
48
49 if (Dudley_noError()) {
50 if (isExpanded(mask)) {
51 #pragma omp parallel private(n,check,mask_array)
52 {
53 #pragma omp for schedule(static)
54 for (n=0;n<numElements;n++) {
55 mask_array=getSampleDataRO(mask,n);
56 if (mask_array[0]>0) self->Tag[n]=newTag;
57 }
58 }
59 } else {
60 #pragma omp parallel private(q,n,check,mask_array)
61 {
62 #pragma omp for schedule(static)
63 for (n=0;n<numElements;n++) {
64 mask_array=getSampleDataRO(mask,n);
65 check=FALSE;
66 for (q=0;q<numQuad;q++) check=check || mask_array[q];
67 if (check) self->Tag[n]=newTag;
68 }
69 }
70 }
71 Dudley_ElementFile_setTagsInUse(self);
72 }
73 }
74

  ViewVC Help
Powered by ViewVC 1.1.26