/[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 2770 - (hide annotations)
Wed Nov 25 01:24:51 2009 UTC (9 years, 9 months ago) by jfenwick
Original Path: trunk/finley/src/ElementFile_setTags.c
File MIME type: text/plain
File size: 2163 byte(s)
Removed buffer implementation of Lazy.
Removed supporting Alloc/Free Sample buffer calls.
1 gross 767
2 ksteube 1312 /*******************************************************
3 ksteube 1811 *
4 jfenwick 2548 * Copyright (c) 2003-2009 by University of Queensland
5 ksteube 1811 * 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 gross 2748 /* Finley: Mesh: ElementFile */
18 gross 767
19 gross 2748 /* set tags to newTag where mask>0 */
20 gross 767
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 gross 2748 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 gross 767
39 gross 2748 numQuad= Finley_ReferenceElementSet_borrowReferenceElement(self->referenceElementSet,Finley_Assemble_reducedIntegrationOrder(mask))->Parametrization->numQuadNodes;
40    
41     if (1!=getDataPointSize(mask)) {
42     Finley_setError(TYPE_ERROR,"Finley_ElementFile_setTags: number of components of mask is 1.");
43     } else if (!numSamplesEqual(mask,numQuad,numElements)) {
44     Finley_setError(TYPE_ERROR,"Finley_ElementFile_setTags: illegal number of samples of mask Data object");
45     }
46 gross 767
47 gross 2748 /* now we can start */
48 gross 767
49 gross 2748 if (Finley_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 jfenwick 2770 mask_array=getSampleDataRO(mask,n);
56 gross 2748 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 jfenwick 2770 mask_array=getSampleDataRO(mask,n);
65 gross 2748 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     Finley_ElementFile_setTagsInUse(self);
72     }
73 gross 767 }
74 gross 2748

  ViewVC Help
Powered by ViewVC 1.1.26