/[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 2548 - (show annotations)
Mon Jul 20 06:20:06 2009 UTC (9 years, 11 months ago) by jfenwick
File MIME type: text/plain
File size: 2574 byte(s)
Updating copyright notices
1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2009 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 __const 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 void* buffer=allocSampleBuffer(mask);
55 #pragma omp parallel private(n,check,mask_array)
56 {
57 #pragma omp for schedule(static)
58 for (n=0;n<numElements;n++) {
59 mask_array=getSampleDataRO(mask,n,buffer);
60 if (mask_array[0]>0) self->Tag[n]=newTag;
61 }
62 }
63 freeSampleBuffer(buffer);
64 } else {
65 void* buffer=allocSampleBuffer(mask);
66 #pragma omp parallel private(q,n,check,mask_array)
67 {
68 #pragma omp for schedule(static)
69 for (n=0;n<numElements;n++) {
70 mask_array=getSampleDataRO(mask,n,buffer);
71 check=FALSE;
72 for (q=0;q<numQuad;q++) check=check || mask_array[q];
73 if (check) self->Tag[n]=newTag;
74 }
75 }
76 freeSampleBuffer(buffer);
77 }
78 Finley_ElementFile_setTagsInUse(self);
79 }
80 }
81 /*
82 * $Log$
83 *
84 */

  ViewVC Help
Powered by ViewVC 1.1.26