/[escript]/branches/domexper/dudley/src/ElementFile_setTags.c
ViewVC logotype

Contents of /branches/domexper/dudley/src/ElementFile_setTags.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3221 - (show annotations)
Wed Sep 29 01:00:21 2010 UTC (8 years, 6 months ago) by jfenwick
File MIME type: text/plain
File size: 2071 byte(s)
Comment stripping

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_Assemble_reducedIntegrationOrder(mask)?1:(self->numDim+1);
40 if (1!=getDataPointSize(mask)) {
41 Dudley_setError(TYPE_ERROR,"Dudley_ElementFile_setTags: number of components of mask is 1.");
42 } else if (!numSamplesEqual(mask,numQuad,numElements)) {
43 Dudley_setError(TYPE_ERROR,"Dudley_ElementFile_setTags: illegal number of samples of mask Data object");
44 }
45
46 /* now we can start */
47
48 if (Dudley_noError()) {
49 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 mask_array=getSampleDataRO(mask,n);
55 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 mask_array=getSampleDataRO(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 Dudley_ElementFile_setTagsInUse(self);
71 }
72 }
73

  ViewVC Help
Powered by ViewVC 1.1.26