/[escript]/trunk-mpi-branch/finley/src/DOFMap.c
ViewVC logotype

Diff of /trunk-mpi-branch/finley/src/DOFMap.c

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

trunk-mpi-branch/finley/src/ElementFile.c revision 1188 by ksteube, Tue May 15 03:23:17 2007 UTC trunk-mpi-branch/finley/src/DOFMap.c revision 1223 by gross, Fri Aug 3 02:40:39 2007 UTC
# Line 9  Line 9 
9   *                                                          *   *                                                          *
10   ************************************************************   ************************************************************
11  */  */
   
 /**************************************************************/  
   
 /*   Finley: ElementFile */  
   
 /*   allocates an element file to hold elements of type id and with integration order order. */  
 /*   use Finley_Mesh_allocElementTable to allocate the element table (Id,Nodes,Tag). */  
   
12  /**************************************************************/  /**************************************************************/
13    
14  /*   Author: gross@access.edu.au */  /*   Author: gross@access.edu.au */
# Line 24  Line 16 
16    
17  /**************************************************************/  /**************************************************************/
18    
19  #include "ElementFile.h"  #include "DOFMap.h"
   
 /**************************************************************/  
20    
21  #ifndef PASO_MPI  Finley_DOFMap* Finley_DOFMap_alloc(dim_t numNodes, index_t* globalID, Paso_Distribution* distribution)
 Finley_ElementFile* Finley_ElementFile_alloc(ElementTypeId id, index_t order, index_t reduced_order)  
 #else  
 Finley_ElementFile* Finley_ElementFile_alloc(ElementTypeId id, index_t order, index_t reduced_order, Paso_MPIInfo *MPIInfo)  
 #endif  
22  {  {
23    extern Finley_RefElementInfo Finley_RefElement_InfoList[];    Finley_DOFMap* out=NULL;
   dim_t NQ, reduced_NQ;  
   Finley_ElementFile *out;  
     
   /*   get the number of quadrature nodes needed to achieve integration order order: */  
     
   if (order<0) order=MAX(2*Finley_RefElement_InfoList[id].numOrder,0);  
   if (reduced_order<0) reduced_order=MAX(2*(Finley_RefElement_InfoList[id].numOrder-1),0);  
   NQ= Finley_RefElement_InfoList[id].getNumQuadNodes(order);  
   reduced_NQ= Finley_RefElement_InfoList[id].getNumQuadNodes(reduced_order);  
   if (! Finley_noError()) return NULL;  
     
24    /*  allocate the return value */    /*  allocate the return value */
25        out=MEMALLOC(1,Finley_DOFMap);
   out=MEMALLOC(1,Finley_ElementFile);  
26    if (Finley_checkPtr(out)) return NULL;    if (Finley_checkPtr(out)) return NULL;
   out->order = order;  
   out->reduced_order = reduced_order;  
   out->ReferenceElement=NULL;  
   out->LinearReferenceElement=NULL;  
   out->ReferenceElementReducedOrder=NULL;  
   out->LinearReferenceElementReducedOrder=NULL;  
   out->isPrepared=FINLEY_UNKNOWN;  
   out->numElements=0;  
   out->Id=NULL;  
   out->Nodes=NULL;  
   out->Tag=NULL;  
   out->Color=NULL;  
   out->minColor=0;  
   out->maxColor=-1;  
   out->jacobeans=NULL;  
   out->jacobeans_reducedQ=NULL;  
   out->jacobeans_reducedS=NULL;  
   out->jacobeans_reducedS_reducedQ=NULL;  
   
 #ifdef PASO_MPI  
   out->Dom=NULL;                  
   out->MPIInfo = Paso_MPIInfo_getReference( MPIInfo );  
   out->elementDistribution = Finley_ElementDistribution_alloc( MPIInfo );  
 #endif  
   
   /*  allocate the reference element: */  
     
   out->ReferenceElement=Finley_RefElement_alloc(id,NQ);  
   out->jacobeans=Finley_ElementFile_Jacobeans_alloc(out->ReferenceElement);  
   out->ReferenceElementReducedOrder=Finley_RefElement_alloc(id,reduced_NQ);  
   out->jacobeans_reducedQ=Finley_ElementFile_Jacobeans_alloc(out->ReferenceElementReducedOrder);  
   
   out->LinearReferenceElement=Finley_RefElement_alloc(Finley_RefElement_InfoList[id].LinearTypeId,NQ);  
   out->jacobeans_reducedS=Finley_ElementFile_Jacobeans_alloc(out->LinearReferenceElement);  
   out->LinearReferenceElementReducedOrder=Finley_RefElement_alloc(Finley_RefElement_InfoList[id].LinearTypeId,reduced_NQ);  
   out->jacobeans_reducedS_reducedQ=Finley_ElementFile_Jacobeans_alloc(out->LinearReferenceElementReducedOrder);  
   if (! Finley_noError()) {  
      Finley_ElementFile_dealloc(out);  
      return NULL;  
   }  
   return out;  
 }  
27    
28  /*  deallocates an element file: */    out->distribution=Paso_Distribution_getReference(distribution);
29      out->MPIInfo=Paso_MPIInfo_getReference(distribution->mpi_info);
30      out->numNodes=0;
31      out->ID=NULL;
32      out->myNumDOFs=0;
33      out->numDOFs=0;
34      out->numRemotes=0;
35      out->remoteID=NULL;
36      out->remoteProcessor=NULL;
37      out->offsetInRemoteID=NULL;
38      out->numNeighbours=0;  
39      out->neighbours=NULL;  
40      out->reference_counter=1;
41    }
42    
43  void Finley_ElementFile_dealloc(Finley_ElementFile* in) {  void Finley_DOFMap_free(Finley_DOFMap* in) {
44    if (in!=NULL) {    if ( in ) {
45       #ifdef Finley_TRACE        in->reference_counter--;
46       if (in->ReferenceElement!=NULL) printf("element file for %s is deallocated.\n",in->ReferenceElement->Type->Name);        if (in->reference_counter<=0) {
47       #endif           Paso_Distribution_free(in->distribution);
48       Finley_RefElement_dealloc(in->ReferenceElement);           Paso_MPIInfo_free(in->MPIInfo);
49       Finley_RefElement_dealloc(in->ReferenceElementReducedOrder);           MEMFREE(in->ID);
50       Finley_RefElement_dealloc(in->LinearReferenceElement);           MEMFREE(in->remoteID);
51       Finley_RefElement_dealloc(in->LinearReferenceElementReducedOrder);           MEMFREE(in->remoteProcessor);
52       Finley_ElementFile_deallocTable(in);             MEMFREE(in->offsetInRemoteID);
53       Finley_ElementFile_Jacobeans_dealloc(in->jacobeans);           MEMFREE(in->neighbours);  
54       Finley_ElementFile_Jacobeans_dealloc(in->jacobeans_reducedS);           MEMFREE(in);  
55       Finley_ElementFile_Jacobeans_dealloc(in->jacobeans_reducedQ);       }
      Finley_ElementFile_Jacobeans_dealloc(in->jacobeans_reducedS_reducedQ);  
 #ifdef PASO_MPI  
      MEMFREE(in->Dom);      
      Paso_MPIInfo_dealloc( in->MPIInfo );  
      Finley_ElementDistribution_dealloc( in->elementDistribution );  
 #endif            
      MEMFREE(in);        
56    }    }
57  }  }
58  /*  Finley_DOFMap* DOFMap_getReference(Finley_DOFMap *in )
59  * $Log$  {
60  * Revision 1.6  2005/09/15 03:44:21  jgs    if ( in )
61  * Merge of development branch dev-02 back to main trunk on 2005-09-15      in->reference_counter++;
62  *    return in;
63  * Revision 1.5.2.1  2005/09/07 06:26:18  gross  }
 * the solver from finley are put into the standalone package paso now  
 *  
 * Revision 1.5  2005/07/08 04:07:48  jgs  
 * Merge of development branch back to main trunk on 2005-07-08  
 *  
 * Revision 1.4  2004/12/15 07:08:32  jgs  
 * *** empty log message ***  
 * Revision 1.1.1.1.2.2  2005/06/29 02:34:49  gross  
 * some changes towards 64 integers in finley  
 *  
 * Revision 1.1.1.1.2.1  2004/11/24 01:37:13  gross  
 * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now  
 *  
 *  
 *  
 */  

Legend:
Removed from v.1188  
changed lines
  Added in v.1223

  ViewVC Help
Powered by ViewVC 1.1.26