/[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

temp/finley/src/ElementFile_setTags.c revision 1387 by trankine, Fri Jan 11 07:45:26 2008 UTC branches/domexper/dudley/src/ElementFile_setTags.c revision 3221 by jfenwick, Wed Sep 29 01:00:21 2010 UTC
# Line 1  Line 1 
1    
 /* $Id$ */  
   
2  /*******************************************************  /*******************************************************
3   *  *
4   *           Copyright 2003-2007 by ACceSS MNRF  * Copyright (c) 2003-2010 by University of Queensland
5   *       Copyright 2007 by University of Queensland  * Earth Systems Science Computational Center (ESSCC)
6   *  * http://www.uq.edu.au/esscc
7   *                http://esscc.uq.edu.au  *
8   *        Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
9   *  Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
10   *     http://www.opensource.org/licenses/osl-3.0.php  * http://www.opensource.org/licenses/osl-3.0.php
11   *  *
12   *******************************************************/  *******************************************************/
13    
14    
15  /**************************************************************/  /**************************************************************/
16    
17  /*   Finley: Mesh: ElementFile */  /*   Dudley: Mesh: ElementFile */
18    
19  /*  set tags to newTag where mask>0 */  /*  set tags to newTag where mask>0 */
20    
21  /**************************************************************/  /**************************************************************/
22    
# Line 28  Line 27 
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;      register dim_t n,q;
32      dim_t numElements, numQuad;      dim_t numElements, numQuad;
33      register double *mask_array;      register __const double *mask_array;
34      register bool_t check;      register bool_t check;
35      Finley_resetError();      Dudley_resetError();
36      if (self==NULL) return;      if (self==NULL) return;
37      numElements=self->numElements;      numElements=self->numElements;
38      if (Finley_Assemble_reducedIntegrationOrder(mask)) {  
39         numQuad=self->ReferenceElementReducedOrder->numQuadNodes;      numQuad=Dudley_Assemble_reducedIntegrationOrder(mask)?1:(self->numDim+1);
40      } else {      if (1!=getDataPointSize(mask)) {
41         numQuad=self->ReferenceElement->numQuadNodes;         Dudley_setError(TYPE_ERROR,"Dudley_ElementFile_setTags: number of components of mask is 1.");
42      }      } else if (!numSamplesEqual(mask,numQuad,numElements)) {
43           Dudley_setError(TYPE_ERROR,"Dudley_ElementFile_setTags: illegal number of samples of mask Data object");
44      if (1!=getDataPointSize(mask)) {      }
45         Finley_setError(TYPE_ERROR,"Finley_ElementFile_setTags: number of components of mask is 1.");  
46      } else if (!numSamplesEqual(mask,numQuad,numElements)) {      /* now we can start */
47         Finley_setError(TYPE_ERROR,"Finley_ElementFile_setTags: illegal number of samples of mask Data object");  
48      }      if (Dudley_noError()) {
49            if (isExpanded(mask)) {
50      /* now we can start */              #pragma omp parallel private(n,check,mask_array)
51                {
52      if (Finley_noError()) {                  #pragma omp for schedule(static)
53           if (isExpanded(mask)) {                  for (n=0;n<numElements;n++) {
54               #pragma omp parallel for private(n,check,mask_array) schedule(static)                      mask_array=getSampleDataRO(mask,n);
55               for (n=0;n<numElements;n++) {                      if (mask_array[0]>0) self->Tag[n]=newTag;
56                   mask_array=getSampleData(mask,n);                  }
57                   if (mask_array[0]>0) self->Tag[n]=newTag;              }
58               }          } else {
59           } else {              #pragma omp parallel private(q,n,check,mask_array)
60               #pragma omp parallel for private(q,n,check,mask_array) schedule(static)              {
61               for (n=0;n<numElements;n++) {                  #pragma omp for schedule(static)
62                   mask_array=getSampleData(mask,n);                  for (n=0;n<numElements;n++) {
63                   check=FALSE;                      mask_array=getSampleDataRO(mask,n);
64                   for (q=0;q<numQuad;q++) check=check || mask_array[q];                      check=FALSE;
65                   if (check) self->Tag[n]=newTag;                      for (q=0;q<numQuad;q++) check=check || mask_array[q];
66               }                      if (check) self->Tag[n]=newTag;
67           }                  }
68      }              }
69            }
70            Dudley_ElementFile_setTagsInUse(self);
71        }
72  }  }
73  /*  
 * $Log$  
 *  
 */  

Legend:
Removed from v.1387  
changed lines
  Added in v.3221

  ViewVC Help
Powered by ViewVC 1.1.26