/[escript]/trunk/finley/src/ElementFile_setTags.c
ViewVC logotype

Contents of /trunk/finley/src/ElementFile_setTags.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1811 - (show annotations)
Thu Sep 25 23:11:13 2008 UTC (10 years, 11 months ago) by ksteube
File MIME type: text/plain
File size: 2344 byte(s)
Copyright updated in all files

1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2008 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 /* Finley: 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 Finley_ElementFile_setTags(Finley_ElementFile* self,const int newTag, escriptDataC* mask) {
31 register dim_t n,q;
32 dim_t numElements, numQuad;
33 register double *mask_array;
34 register bool_t check;
35 Finley_resetError();
36 if (self==NULL) return;
37 numElements=self->numElements;
38 if (Finley_Assemble_reducedIntegrationOrder(mask)) {
39 numQuad=self->ReferenceElementReducedOrder->numQuadNodes;
40 } else {
41 numQuad=self->ReferenceElement->numQuadNodes;
42 }
43
44 if (1!=getDataPointSize(mask)) {
45 Finley_setError(TYPE_ERROR,"Finley_ElementFile_setTags: number of components of mask is 1.");
46 } else if (!numSamplesEqual(mask,numQuad,numElements)) {
47 Finley_setError(TYPE_ERROR,"Finley_ElementFile_setTags: illegal number of samples of mask Data object");
48 }
49
50 /* now we can start */
51
52 if (Finley_noError()) {
53 if (isExpanded(mask)) {
54 #pragma omp parallel for private(n,check,mask_array) schedule(static)
55 for (n=0;n<numElements;n++) {
56 mask_array=getSampleData(mask,n);
57 if (mask_array[0]>0) self->Tag[n]=newTag;
58 }
59 } else {
60 #pragma omp parallel for private(q,n,check,mask_array) schedule(static)
61 for (n=0;n<numElements;n++) {
62 mask_array=getSampleData(mask,n);
63 check=FALSE;
64 for (q=0;q<numQuad;q++) check=check || mask_array[q];
65 if (check) self->Tag[n]=newTag;
66 }
67 }
68 Finley_ElementFile_setTagsInUse(self);
69 }
70 }
71 /*
72 * $Log$
73 *
74 */

  ViewVC Help
Powered by ViewVC 1.1.26