/[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 767 - (show annotations)
Fri Jun 30 07:29:08 2006 UTC (13 years, 2 months ago) by gross
File MIME type: text/plain
File size: 2395 byte(s)
new FunctionSpace method setTags added
1 /*
2 ************************************************************
3 * Copyright 2006 by ACcESS MNRF *
4 * *
5 * http://www.access.edu.au *
6 * Primary Business: Queensland, Australia *
7 * Licensed under the Open Software License version 3.0 *
8 * http://www.opensource.org/licenses/osl-3.0.php *
9 * *
10 ************************************************************
11 */
12
13 /**************************************************************/
14
15 /* Finley: Mesh: ElementFile */
16
17 /* set tags to newTag where mask>0 */
18
19 /**************************************************************/
20
21 /* Author: gross@access.edu.au */
22 /* Version: $Id$ */
23
24 /**************************************************************/
25
26 #include "ElementFile.h"
27 #include "Util.h"
28
29 /**************************************************************/
30
31
32 void Finley_ElementFile_setTags(Finley_ElementFile* self,const int newTag, escriptDataC* mask) {
33 if (self==NULL) return;
34 register dim_t n,q;
35 dim_t numElements=self->numElements;
36 dim_t numQuad=self->ReferenceElement->numQuadNodes;
37 register double *mask_array;
38 register bool_t check;
39 Finley_resetError();
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
47 /* now we can start */
48
49 if (Finley_noError()) {
50 if (isExpanded(mask)) {
51 #pragma omp parallel for private(n,check,mask_array) schedule(static)
52 for (n=0;n<numElements;n++) {
53 mask_array=getSampleData(mask,n);
54 if (mask_array[0]>0) self->Tag[n]=newTag;
55 }
56 } else {
57 #pragma omp parallel for private(q,n,check,mask_array) schedule(static)
58 for (n=0;n<numElements;n++) {
59 mask_array=getSampleData(mask,n);
60 check=FALSE;
61 for (q=0;q<numQuad;q++) check=check || mask_array[q];
62 if (check) self->Tag[n]=newTag;
63 }
64 }
65 }
66 }
67 /*
68 * $Log$
69 *
70 */

  ViewVC Help
Powered by ViewVC 1.1.26