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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2271 - (hide annotations)
Mon Feb 16 05:08:29 2009 UTC (10 years, 7 months ago) by jfenwick
Original Path: trunk/finley/src/ElementFile_setTags.c
File MIME type: text/plain
File size: 2574 byte(s)
Merging version 2269 to trunk

1 gross 767
2 ksteube 1312 /*******************************************************
3 ksteube 1811 *
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 ksteube 1312
14 ksteube 1811
15 gross 767 /**************************************************************/
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 gross 1062 #include "Assemble.h"
26 gross 767
27     /**************************************************************/
28    
29    
30     void Finley_ElementFile_setTags(Finley_ElementFile* self,const int newTag, escriptDataC* mask) {
31     register dim_t n,q;
32 gross 1028 dim_t numElements, numQuad;
33 jfenwick 2271 register __const double *mask_array;
34 gross 767 register bool_t check;
35     Finley_resetError();
36 gross 1028 if (self==NULL) return;
37     numElements=self->numElements;
38 gross 1062 if (Finley_Assemble_reducedIntegrationOrder(mask)) {
39     numQuad=self->ReferenceElementReducedOrder->numQuadNodes;
40     } else {
41     numQuad=self->ReferenceElement->numQuadNodes;
42     }
43 gross 767
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 jfenwick 2271 void* buffer=allocSampleBuffer(mask);
55     #pragma omp parallel private(n,check,mask_array)
56     {
57     #pragma omp for schedule(static)
58 gross 767 for (n=0;n<numElements;n++) {
59 jfenwick 2271 mask_array=getSampleDataRO(mask,n,buffer);
60 gross 767 if (mask_array[0]>0) self->Tag[n]=newTag;
61     }
62 jfenwick 2271 }
63     freeSampleBuffer(buffer);
64 gross 767 } else {
65 jfenwick 2271 void* buffer=allocSampleBuffer(mask);
66     #pragma omp parallel private(q,n,check,mask_array)
67     {
68     #pragma omp for schedule(static)
69 gross 767 for (n=0;n<numElements;n++) {
70 jfenwick 2271 mask_array=getSampleDataRO(mask,n,buffer);
71 gross 767 check=FALSE;
72     for (q=0;q<numQuad;q++) check=check || mask_array[q];
73     if (check) self->Tag[n]=newTag;
74     }
75 jfenwick 2271 }
76     freeSampleBuffer(buffer);
77 gross 767 }
78 gross 1716 Finley_ElementFile_setTagsInUse(self);
79 gross 767 }
80     }
81     /*
82     * $Log$
83     *
84     */

  ViewVC Help
Powered by ViewVC 1.1.26