/[escript]/branches/domexper/dudley/src/ElementFile_markNodes.c
ViewVC logotype

Diff of /branches/domexper/dudley/src/ElementFile_markNodes.c

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

trunk/finley/src/ElementFile_markNodes.c revision 751 by bcumming, Mon Jun 26 01:46:34 2006 UTC branches/domexper/dudley/src/ElementFile_markNodes.c revision 3086 by jfenwick, Thu Aug 5 05:07:58 2010 UTC
# Line 1  Line 1 
 /*  
  ************************************************************  
  *          Copyright 2006 by ACcESS MNRF                   *  
  *                                                          *  
  *              http://www.access.edu.au                    *  
  *       Primary Business: Queensland, Australia            *  
  *  Licensed under the Open Software License version 3.0    *  
  *     http://www.opensource.org/licenses/osl-3.0.php       *  
  *                                                          *  
  ************************************************************  
 */  
1    
2  /**************************************************************/  /*******************************************************
3    *
4  /*   Finley: ElementFile */  * Copyright (c) 2003-2010 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    
 /*   mark the used nodes with offeset: */  
14    
15  /**************************************************************/  /**************************************************************/
16    
17  /*  Copyrights by ACcESS Australia 2003,2004,2005 */  /*   Dudley: ElementFile */
18  /*  Author: gross@access.edu.au */  
19  /*  Version: $Id$ */  /*   mark the used nodes with offeset: */
20    
21  /**************************************************************/  /**************************************************************/
22    
# Line 28  Line 24 
24    
25  /**************************************************************/  /**************************************************************/
26    
27  void Finley_ElementFile_markNodes(index_t* mask,index_t offset,Finley_ElementFile* in,bool_t useLinear) {  void Dudley_ElementFile_markNodes(index_t* mask,index_t offset,dim_t numNodes,Dudley_ElementFile* in,bool_t useLinear) {
28     dim_t i,NN,NN2,e;     dim_t i,NN,NN2,e;
29     index_t color,*lin_node;     index_t *lin_nodes;
30       Dudley_ReferenceElement* refElement=NULL;
31      
32     if (in!=NULL) {     if (in!=NULL) {
33       index_t id[in->ReferenceElement->Type->numNodes];           refElement=Dudley_ReferenceElementSet_borrowReferenceElement(in->referenceElementSet, FALSE);    
34       for (i=0;i<in->ReferenceElement->Type->numNodes;i++) id[i]=i;           NN2=in->numNodes;
35       if (useLinear) {           if (useLinear) {
36          NN=in->LinearReferenceElement->Type->numNodes;               NN=refElement->numLinearNodes;
37          lin_node=in->ReferenceElement->Type->linearNodes;               lin_nodes=refElement->Type->linearNodes;
38       } else {               #pragma omp parallel for private(e,i) schedule(static)
39          NN=in->ReferenceElement->Type->numNodes;               for (e=0;e<in->numElements;e++) {
40          lin_node=id;                   for (i=0;i<NN;i++) {
41       }                         mask[in->Nodes[INDEX2(lin_nodes[i],e,NN2)]-offset]=1;
42       NN2=in->ReferenceElement->Type->numNodes;                   }
43  /* knock out the OpenMP directives for the MPI version, get the OpenMP running               }
44     after the MPI is working satisfactorily */           } else {
45  #ifndef PASO_MPI               NN=refElement->Type->numNodes;
46       if ((in->maxColor-in->minColor+1)*NN<in->numElements) {               #pragma omp parallel for private(e,i) schedule(static)
47          #pragma omp parallel private(color)               for (e=0;e<in->numElements;e++) {
48          {                   for (i=0;i<NN;i++) {
49             for (color=in->minColor;color<=in->maxColor;color++) {                       mask[in->Nodes[INDEX2(i,e,NN2)]-offset]=1;
50               #pragma omp for private(e,i) schedule(static)                   }
51               for (e=0;e<in->numElements;e++) {               }
52                 if (in->Color[e]==color) {           }
53                    for (i=0;i<NN;i++)      }
                     mask[in->Nodes[INDEX2(lin_node[i],e,NN2)]-offset]=1;  
                }  
              }  
            }  
            #pragma omp barrier  
         }  
       } else {  
         #pragma omp parallel for private(e,i) schedule(static)  
 #endif  
         for (e=0;e<in->numElements;e++) {  
            for (i=0;i<NN;i++)  
              mask[in->Nodes[INDEX2(lin_node[i],e,NN2)]-offset]=1;  
         }  
 #ifndef PASO_MPI  
       }  
 #endif  
    }  
 }  
   
 #ifdef PASO_MPI  
   
 /* these have been trimmed down from the colors-based scheme for simplicity of testing  
    in the MPI scheme. */  
 void Finley_ElementFile_markBoundaryElementNodes(index_t* mask,index_t offset,Finley_ElementFile* in,bool_t useLinear) {  
    dim_t i,NN,NN2,e;  
    index_t color,*lin_node;  
    if (in!=NULL&& in->numElements>0) {  
      index_t id[in->ReferenceElement->Type->numNodes];  
      for (i=0;i<in->ReferenceElement->Type->numNodes;i++) id[i]=i;  
      if (useLinear) {  
         NN=in->LinearReferenceElement->Type->numNodes;  
         lin_node=in->ReferenceElement->Type->linearNodes;  
      } else {  
         NN=in->ReferenceElement->Type->numNodes;  
         lin_node=id;  
      }  
      NN2=in->ReferenceElement->Type->numNodes;  
      for (e=0;e<in->elementDistribution->numBoundary;e++)  
        for (i=0;i<NN;i++)  
          mask[in->Nodes[INDEX2(lin_node[i],e+in->elementDistribution->numInternal,NN2)]-offset]=1;  
    }  
 }  
   
 void Finley_ElementFile_markInternalElementNodes(index_t* mask,index_t offset,Finley_ElementFile* in,bool_t useLinear) {  
    dim_t i,NN,NN2,e;  
    index_t color,*lin_node;  
    if (in!=NULL && in->numElements>0) {  
      index_t id[in->ReferenceElement->Type->numNodes];  
      for (i=0;i<in->ReferenceElement->Type->numNodes;i++) id[i]=i;  
      if (useLinear) {  
         NN=in->LinearReferenceElement->Type->numNodes;  
         lin_node=in->ReferenceElement->Type->linearNodes;  
      } else {  
         NN=in->ReferenceElement->Type->numNodes;  
         lin_node=id;  
      }  
      NN2=in->ReferenceElement->Type->numNodes;  
   
      for (e=0;e<in->elementDistribution->numInternal;e++)  
        for (i=0;i<NN;i++)  
          mask[in->Nodes[INDEX2(lin_node[i],e,NN2)]-offset]=1;  
    }  
54  }  }
55    
56  void Finley_ElementFile_markBoundaryElementDOF(index_t* mask,index_t offset,index_t *degreeOfFreedom,Finley_ElementFile* in,bool_t useLinear) {  void Dudley_ElementFile_markDOFsConnectedToRange(index_t* mask,index_t offset,index_t marker,index_t firstDOF,index_t lastDOF,index_t *dofIndex,Dudley_ElementFile*in ,bool_t useLinear)
57     dim_t i,NN,NN2,e;  {
58     index_t color,*lin_node;     dim_t i,NN,NN2,e,j;
59     if (in!=NULL&& in->numElements>0) {     index_t color,*lin_nodes;
60       index_t id[in->ReferenceElement->Type->numNodes];     Dudley_ReferenceElement* refElement=NULL;
61       for (i=0;i<in->ReferenceElement->Type->numNodes;i++) id[i]=i;     register index_t k;
62       if (useLinear) {    
63          NN=in->LinearReferenceElement->Type->numNodes;     if (in!=NULL) {
64          lin_node=in->ReferenceElement->Type->linearNodes;           refElement=Dudley_ReferenceElementSet_borrowReferenceElement(in->referenceElementSet, FALSE);    
65       } else {           NN2=in->numNodes;
66          NN=in->ReferenceElement->Type->numNodes;           if (useLinear) {
67          lin_node=id;               NN=refElement->numLinearNodes;
68       }               lin_nodes=refElement->Type->linearNodes;
69       NN2=in->ReferenceElement->Type->numNodes;               for (color=in->minColor;color<=in->maxColor;color++) {
70       for (e=0;e<in->elementDistribution->numBoundary;e++)                   #pragma omp parallel for private(e,i,j,k) schedule(static)
71         for (i=0;i<NN;i++)                   for (e=0;e<in->numElements;e++) {
72           mask[degreeOfFreedom[in->Nodes[INDEX2(lin_node[i],e+in->elementDistribution->numInternal,NN2)]]-offset]=1;                       if (in->Color[e]==color) {
73     }                           for (i=0;i<NN;i++) {
74  }                               k=dofIndex[in->Nodes[INDEX2(lin_nodes[i],e,NN2)]];
75                                 if ( (firstDOF<=k) && (k<lastDOF) ) {
76  void Finley_ElementFile_markInternalElementDOF(index_t* mask,index_t offset,index_t *degreeOfFreedom, Finley_ElementFile* in,bool_t useLinear) {                                   for (j=0;j<NN;j++) mask[dofIndex[in->Nodes[INDEX2(lin_nodes[j],e,NN2)]]-offset]=marker;
77     dim_t i,NN,NN2,e;                                   break;
78     index_t color,*lin_node;                               }
79     if (in!=NULL && in->numElements>0) {                           }
80       index_t id[in->ReferenceElement->Type->numNodes];                       }
81       for (i=0;i<in->ReferenceElement->Type->numNodes;i++) id[i]=i;                   }
82       if (useLinear) {               }
83          NN=in->LinearReferenceElement->Type->numNodes;           } else {
84          lin_node=in->ReferenceElement->Type->linearNodes;               NN=refElement->Type->numNodes;
85       } else {               for (color=in->minColor;color<=in->maxColor;color++) {
86          NN=in->ReferenceElement->Type->numNodes;                   #pragma omp parallel for private(e,i,j,k) schedule(static)
87          lin_node=id;                   for (e=0;e<in->numElements;e++) {
88       }                       if (in->Color[e]==color) {
89       NN2=in->ReferenceElement->Type->numNodes;                           for (i=0;i<NN;i++) {
90                                 k=dofIndex[in->Nodes[INDEX2(i,e,NN2)]];
91       for (e=0;e<in->elementDistribution->numInternal;e++)                               if ( (firstDOF<=k) && (k<lastDOF) ) {
92         for (i=0;i<NN;i++)                                   for (j=0;j<NN;j++) mask[dofIndex[in->Nodes[INDEX2(j,e,NN2)]]-offset]=marker;
93           mask[degreeOfFreedom[in->Nodes[INDEX2(lin_node[i],e,NN2)]]-offset]=1;                                   break;
94     }                               }
95                             }
96                         }
97                     }
98                 }
99             }
100        }      
101  }  }
 #endif  
102    
 /*  
 * $Log$  
 * Revision 1.4  2005/09/15 03:44:22  jgs  
 * Merge of development branch dev-02 back to main trunk on 2005-09-15  
 *  
 * Revision 1.3.2.1  2005/09/07 06:26:18  gross  
 * the solver from finley are put into the standalone package paso now  
 *  
 * Revision 1.3  2005/07/22 03:53:08  jgs  
 * Merge of development branch back to main trunk on 2005-07-22  
 *  
 * Revision 1.2  2005/07/08 04:07:50  jgs  
 * Merge of development branch back to main trunk on 2005-07-08  
 *  
 * Revision 1.1.1.1.2.2  2005/07/18 10:34:54  gross  
 * some informance improvements when reading meshes  
 *  
 * Revision 1.1.1.1.2.1  2005/06/29 02:34:49  gross  
 * some changes towards 64 integers in finley  
 *  
 * Revision 1.1.1.1  2004/10/26 06:53:57  jgs  
 * initial import of project esys2  
 *  
 * Revision 1.1.1.1  2004/06/24 04:00:40  johng  
 * Initial version of eys using boost-python.  
 *  
 *  
 */  

Legend:
Removed from v.751  
changed lines
  Added in v.3086

  ViewVC Help
Powered by ViewVC 1.1.26