/[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 1716 - (show annotations)
Thu Aug 21 05:03:49 2008 UTC (11 years, 3 months ago) by gross
File MIME type: text/plain
File size: 2379 byte(s)
getListOfTags method added to FunctionSpace class
1
2 /* $Id$ */
3
4 /*******************************************************
5 *
6 * Copyright 2003-2007 by ACceSS MNRF
7 * Copyright 2007 by University of Queensland
8 *
9 * http://esscc.uq.edu.au
10 * Primary Business: Queensland, Australia
11 * Licensed under the Open Software License version 3.0
12 * http://www.opensource.org/licenses/osl-3.0.php
13 *
14 *******************************************************/
15
16 /**************************************************************/
17
18 /* Finley: Mesh: ElementFile */
19
20 /* set tags to newTag where mask>0 */
21
22 /**************************************************************/
23
24 #include "ElementFile.h"
25 #include "Util.h"
26 #include "Assemble.h"
27
28 /**************************************************************/
29
30
31 void Finley_ElementFile_setTags(Finley_ElementFile* self,const int newTag, escriptDataC* mask) {
32 register dim_t n,q;
33 dim_t numElements, numQuad;
34 register double *mask_array;
35 register bool_t check;
36 Finley_resetError();
37 if (self==NULL) return;
38 numElements=self->numElements;
39 if (Finley_Assemble_reducedIntegrationOrder(mask)) {
40 numQuad=self->ReferenceElementReducedOrder->numQuadNodes;
41 } else {
42 numQuad=self->ReferenceElement->numQuadNodes;
43 }
44
45 if (1!=getDataPointSize(mask)) {
46 Finley_setError(TYPE_ERROR,"Finley_ElementFile_setTags: number of components of mask is 1.");
47 } else if (!numSamplesEqual(mask,numQuad,numElements)) {
48 Finley_setError(TYPE_ERROR,"Finley_ElementFile_setTags: illegal number of samples of mask Data object");
49 }
50
51 /* now we can start */
52
53 if (Finley_noError()) {
54 if (isExpanded(mask)) {
55 #pragma omp parallel for private(n,check,mask_array) schedule(static)
56 for (n=0;n<numElements;n++) {
57 mask_array=getSampleData(mask,n);
58 if (mask_array[0]>0) self->Tag[n]=newTag;
59 }
60 } else {
61 #pragma omp parallel for private(q,n,check,mask_array) schedule(static)
62 for (n=0;n<numElements;n++) {
63 mask_array=getSampleData(mask,n);
64 check=FALSE;
65 for (q=0;q<numQuad;q++) check=check || mask_array[q];
66 if (check) self->Tag[n]=newTag;
67 }
68 }
69 Finley_ElementFile_setTagsInUse(self);
70 }
71 }
72 /*
73 * $Log$
74 *
75 */

  ViewVC Help
Powered by ViewVC 1.1.26