/[escript]/trunk/finley/src/NodeFile_setTags.c
ViewVC logotype

Contents of /trunk/finley/src/NodeFile_setTags.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2548 - (show annotations)
Mon Jul 20 06:20:06 2009 UTC (9 years, 11 months ago) by jfenwick
File MIME type: text/plain
File size: 1749 byte(s)
Updating copyright notices
1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2009 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
14
15 /**************************************************************/
16
17 /* Finley: Mesh: NodeFile */
18
19 /* set tags to newTag where mask>0 */
20
21 /**************************************************************/
22
23 #include "NodeFile.h"
24 #include "Util.h"
25
26 /**************************************************************/
27
28
29 void Finley_NodeFile_setTags(Finley_NodeFile* self,const int newTag, escriptDataC* mask) {
30 register dim_t n;
31 dim_t numNodes;
32 register __const double *mask_array;
33 Finley_resetError();
34
35 if (self==NULL) return;
36 numNodes=self->numNodes;
37 if (1!=getDataPointSize(mask)) {
38 Finley_setError(TYPE_ERROR,"Finley_NodeFile_setTags: number of components of mask is 1.");
39 } else if (!numSamplesEqual(mask,1,numNodes)) {
40 Finley_setError(TYPE_ERROR,"Finley_NodeFile_setTags: illegal number of samples of mask Data object");
41 }
42
43 /* now we can start */
44
45 if (Finley_noError()) {
46 void* buffer=allocSampleBuffer(mask);
47 #pragma omp parallel private(n,mask_array)
48 {
49 #pragma omp for schedule(static)
50 for (n=0;n<numNodes;n++) {
51 mask_array=getSampleDataRO(mask,n,buffer);
52 if (mask_array[0]>0) self->Tag[n]=newTag;
53 }
54 }
55 freeSampleBuffer(buffer);
56 Finley_NodeFile_setTagsInUse(self);
57 }
58 }
59 /*
60 * $Log$
61 *
62 */

  ViewVC Help
Powered by ViewVC 1.1.26