/[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 1312 by ksteube, Mon Sep 24 06:18:44 2007 UTC branches/doubleplusgood/dudley/src/ElementFile_setTags.c revision 4257 by jfenwick, Wed Feb 27 03:42:40 2013 UTC
# Line 1  Line 1 
1    
2  /* $Id$ */  /*****************************************************************************
3    *
4  /*******************************************************  * Copyright (c) 2003-2013 by University of Queensland
5   *  * http://www.uq.edu.au
6   *           Copyright 2003-2007 by ACceSS MNRF  *
7   *       Copyright 2007 by University of Queensland  * Primary Business: Queensland, Australia
8   *  * Licensed under the Open Software License version 3.0
9   *                http://esscc.uq.edu.au  * http://www.opensource.org/licenses/osl-3.0.php
10   *        Primary Business: Queensland, Australia  *
11   *  Licensed under the Open Software License version 3.0  * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12   *     http://www.opensource.org/licenses/osl-3.0.php  * Development since 2012 by School of Earth Sciences
13   *  *
14   *******************************************************/  *****************************************************************************/
15    
16  /**************************************************************/  /************************************************************************************/
17    
18  /*   Finley: Mesh: ElementFile */  /*   Dudley: Mesh: ElementFile */
19    
20  /*  set tags to newTag where mask>0 */  /*  set tags to newTag where mask>0 */
21    
22  /**************************************************************/  /************************************************************************************/
23    
24  #include "ElementFile.h"  #include "ElementFile.h"
25  #include "Util.h"  #include "Util.h"
26  #include "Assemble.h"  #include "Assemble.h"
27    
28  /**************************************************************/  /************************************************************************************/
   
29    
30  void Finley_ElementFile_setTags(Finley_ElementFile* self,const int newTag, escriptDataC* mask) {  void Dudley_ElementFile_setTags(Dudley_ElementFile * self, const int newTag, escriptDataC * mask)
31      register dim_t n,q;  {
32        register dim_t n, q;
33      dim_t numElements, numQuad;      dim_t numElements, numQuad;
34      register double *mask_array;      register __const double *mask_array;
35      register bool_t check;      register bool_t check;
36      Finley_resetError();      Dudley_resetError();
37      if (self==NULL) return;      if (self == NULL)
38      numElements=self->numElements;      return;
39      if (Finley_Assemble_reducedIntegrationOrder(mask)) {      numElements = self->numElements;
40         numQuad=self->ReferenceElementReducedOrder->numQuadNodes;  
41      } else {      numQuad = Dudley_Assemble_reducedIntegrationOrder(mask) ? 1 : (self->numDim + 1);
42         numQuad=self->ReferenceElement->numQuadNodes;      if (1 != getDataPointSize(mask))
43        {
44        Dudley_setError(TYPE_ERROR, "Dudley_ElementFile_setTags: number of components of mask is 1.");
45      }      }
46        else if (!numSamplesEqual(mask, numQuad, numElements))
47      if (1!=getDataPointSize(mask)) {      {
48         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");  
49      }      }
50    
51      /* now we can start */      /* now we can start */
52    
53      if (Finley_noError()) {      if (Dudley_noError())
54           if (isExpanded(mask)) {      {
55               #pragma omp parallel for private(n,check,mask_array) schedule(static)      if (isExpanded(mask))
56               for (n=0;n<numElements;n++) {      {
57                   mask_array=getSampleData(mask,n);  #pragma omp parallel private(n,check,mask_array)
58                   if (mask_array[0]>0) self->Tag[n]=newTag;          {
59               }  #pragma omp for schedule(static)
60           } else {          for (n = 0; n < numElements; n++)
61               #pragma omp parallel for private(q,n,check,mask_array) schedule(static)          {
62               for (n=0;n<numElements;n++) {              mask_array = getSampleDataRO(mask, n);
63                   mask_array=getSampleData(mask,n);              if (mask_array[0] > 0)
64                   check=FALSE;              self->Tag[n] = newTag;
65                   for (q=0;q<numQuad;q++) check=check || mask_array[q];          }
66                   if (check) self->Tag[n]=newTag;          }
67               }      }
68           }      else
69        {
70    #pragma omp parallel private(q,n,check,mask_array)
71            {
72    #pragma omp for schedule(static)
73            for (n = 0; n < numElements; n++)
74            {
75                mask_array = getSampleDataRO(mask, n);
76                check = FALSE;
77                for (q = 0; q < numQuad; q++)
78                check = check || mask_array[q];
79                if (check)
80                self->Tag[n] = newTag;
81            }
82            }
83        }
84        Dudley_ElementFile_setTagsInUse(self);
85      }      }
86  }  }
 /*  
 * $Log$  
 *  
 */  

Legend:
Removed from v.1312  
changed lines
  Added in v.4257

  ViewVC Help
Powered by ViewVC 1.1.26