/[escript]/trunk/dudley/src/ElementFile_setTags.cpp
ViewVC logotype

Diff of /trunk/dudley/src/ElementFile_setTags.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/finley/src/ElementFile_setTags.c revision 2271 by jfenwick, Mon Feb 16 05:08:29 2009 UTC branches/domexper/dudley/src/ElementFile_setTags.c revision 3224 by jfenwick, Wed Sep 29 05:19:37 2010 UTC
# Line 1  Line 1 
1    
2  /*******************************************************  /*******************************************************
3  *  *
4  * Copyright (c) 2003-2008 by University of Queensland  * Copyright (c) 2003-2010 by University of Queensland
5  * Earth Systems Science Computational Center (ESSCC)  * Earth Systems Science Computational Center (ESSCC)
6  * http://www.uq.edu.au/esscc  * http://www.uq.edu.au/esscc
7  *  *
# Line 11  Line 11 
11  *  *
12  *******************************************************/  *******************************************************/
13    
   
14  /**************************************************************/  /**************************************************************/
15    
16  /*   Finley: Mesh: ElementFile */  /*   Dudley: Mesh: ElementFile */
17    
18  /*  set tags to newTag where mask>0 */  /*  set tags to newTag where mask>0 */
19    
20  /**************************************************************/  /**************************************************************/
21    
# Line 26  Line 25 
25    
26  /**************************************************************/  /**************************************************************/
27    
28    void Dudley_ElementFile_setTags(Dudley_ElementFile * self, const int newTag, escriptDataC * mask)
29  void Finley_ElementFile_setTags(Finley_ElementFile* self,const int newTag, escriptDataC* mask) {  {
30      register dim_t n,q;      register dim_t n, q;
31      dim_t numElements, numQuad;      dim_t numElements, numQuad;
32      register __const double *mask_array;      register __const double *mask_array;
33      register bool_t check;      register bool_t check;
34      Finley_resetError();      Dudley_resetError();
35      if (self==NULL) return;      if (self == NULL)
36      numElements=self->numElements;      return;
37      if (Finley_Assemble_reducedIntegrationOrder(mask)) {      numElements = self->numElements;
38         numQuad=self->ReferenceElementReducedOrder->numQuadNodes;  
39      } else {      numQuad = Dudley_Assemble_reducedIntegrationOrder(mask) ? 1 : (self->numDim + 1);
40         numQuad=self->ReferenceElement->numQuadNodes;      if (1 != getDataPointSize(mask))
41        {
42        Dudley_setError(TYPE_ERROR, "Dudley_ElementFile_setTags: number of components of mask is 1.");
43      }      }
44        else if (!numSamplesEqual(mask, numQuad, numElements))
45      if (1!=getDataPointSize(mask)) {      {
46         Finley_setError(TYPE_ERROR,"Finley_ElementFile_setTags: number of components of mask is 1.");      Dudley_setError(TYPE_ERROR, "Dudley_ElementFile_setTags: illegal number of samples of mask Data object");
     } else if (!numSamplesEqual(mask,numQuad,numElements)) {  
        Finley_setError(TYPE_ERROR,"Finley_ElementFile_setTags: illegal number of samples of mask Data object");  
47      }      }
48    
49      /* now we can start */      /* now we can start */
50    
51      if (Finley_noError()) {      if (Dudley_noError())
52           if (isExpanded(mask)) {      {
53         void* buffer=allocSampleBuffer(mask);            if (isExpanded(mask))
54         #pragma omp parallel private(n,check,mask_array)      {
55         {  #pragma omp parallel private(n,check,mask_array)
56               #pragma omp for schedule(static)          {
57               for (n=0;n<numElements;n++) {  #pragma omp for schedule(static)
58                   mask_array=getSampleDataRO(mask,n,buffer);          for (n = 0; n < numElements; n++)
59                   if (mask_array[0]>0) self->Tag[n]=newTag;          {
60               }              mask_array = getSampleDataRO(mask, n);
61         }              if (mask_array[0] > 0)
62         freeSampleBuffer(buffer);              self->Tag[n] = newTag;
63           } else {          }
64         void* buffer=allocSampleBuffer(mask);          }
65         #pragma omp parallel private(q,n,check,mask_array)      }
66         {      else
67               #pragma omp for schedule(static)      {
68               for (n=0;n<numElements;n++) {  #pragma omp parallel private(q,n,check,mask_array)
69                   mask_array=getSampleDataRO(mask,n,buffer);          {
70                   check=FALSE;  #pragma omp for schedule(static)
71                   for (q=0;q<numQuad;q++) check=check || mask_array[q];          for (n = 0; n < numElements; n++)
72                   if (check) self->Tag[n]=newTag;          {
73               }              mask_array = getSampleDataRO(mask, n);
74         }              check = FALSE;
75         freeSampleBuffer(buffer);              for (q = 0; q < numQuad; q++)
76           }              check = check || mask_array[q];
77           Finley_ElementFile_setTagsInUse(self);              if (check)
78                self->Tag[n] = newTag;
79            }
80            }
81        }
82        Dudley_ElementFile_setTagsInUse(self);
83      }      }
84  }  }
 /*  
 * $Log$  
 *  
 */  

Legend:
Removed from v.2271  
changed lines
  Added in v.3224

  ViewVC Help
Powered by ViewVC 1.1.26