/[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 2748 - (hide annotations)
Tue Nov 17 07:32:59 2009 UTC (9 years, 10 months ago) by gross
Original Path: trunk/finley/src/ElementFile_setTags.c
File MIME type: text/plain
File size: 2321 byte(s)
Macro elements are implemented now. VTK writer for macro elements still needs testing.
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     void* buffer=allocSampleBuffer(mask);
52     #pragma omp parallel private(n,check,mask_array)
53     {
54     #pragma omp for schedule(static)
55     for (n=0;n<numElements;n++) {
56     mask_array=getSampleDataRO(mask,n,buffer);
57     if (mask_array[0]>0) self->Tag[n]=newTag;
58     }
59     }
60     freeSampleBuffer(buffer);
61     } else {
62     void* buffer=allocSampleBuffer(mask);
63     #pragma omp parallel private(q,n,check,mask_array)
64     {
65     #pragma omp for schedule(static)
66     for (n=0;n<numElements;n++) {
67     mask_array=getSampleDataRO(mask,n,buffer);
68     check=FALSE;
69     for (q=0;q<numQuad;q++) check=check || mask_array[q];
70     if (check) self->Tag[n]=newTag;
71     }
72     }
73     freeSampleBuffer(buffer);
74     }
75     Finley_ElementFile_setTagsInUse(self);
76     }
77 gross 767 }
78 gross 2748

  ViewVC Help
Powered by ViewVC 1.1.26