/[escript]/branches/doubleplusgood/paso/src/SharedComponents.cpp
ViewVC logotype

Diff of /branches/doubleplusgood/paso/src/SharedComponents.cpp

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

revision 2881 by jfenwick, Thu Jan 28 02:03:15 2010 UTC revision 3259 by jfenwick, Mon Oct 11 01:48:14 2010 UTC
# Line 24  Line 24 
24  /**************************************************************/  /**************************************************************/
25    
26  #include "SharedComponents.h"  #include "SharedComponents.h"
27    #include "esysUtils/error.h"
28    
29  /**************************************************************/  /**************************************************************/
30    
# Line 34  Line 35 
35    
36  Paso_SharedComponents* Paso_SharedComponents_alloc(dim_t local_length,  Paso_SharedComponents* Paso_SharedComponents_alloc(dim_t local_length,
37                                                     dim_t numNeighbors,                                                     dim_t numNeighbors,
38                                                     Paso_MPI_rank* neighbor,                                                     Esys_MPI_rank* neighbor,
39                                                     index_t* shared,                                                     index_t* shared,
40                                                     index_t* offsetInShared,                                                     index_t* offsetInShared,
41                                                     index_t m, index_t b,                                                     index_t m, index_t b,
42                                                     Paso_MPIInfo *mpi_info)                                                     Esys_MPIInfo *mpi_info)
43  {  {
44    dim_t i,j;    dim_t i,j;
45    register index_t itmp;    register index_t itmp;
46    Paso_SharedComponents* out=NULL;    Paso_SharedComponents* out=NULL;
47    Paso_resetError();    Esys_resetError();
48    out=MEMALLOC(1,Paso_SharedComponents);    out=MEMALLOC(1,Paso_SharedComponents);
49    if (!Paso_checkPtr(out)) {    if (!Esys_checkPtr(out)) {
50        out->local_length=local_length*m;        out->local_length=local_length*m;
51        out->mpi_info = Paso_MPIInfo_getReference(mpi_info);        out->mpi_info = Esys_MPIInfo_getReference(mpi_info);
52        out->numNeighbors=numNeighbors;        out->numNeighbors=numNeighbors;
53        out->neighbor=MEMALLOC(out->numNeighbors,Paso_MPI_rank);        out->neighbor=MEMALLOC(out->numNeighbors,Esys_MPI_rank);
54        if (offsetInShared == NULL) {        if (offsetInShared == NULL) {
55            out->numSharedComponents=0;            out->numSharedComponents=0;
56        } else {        } else {
# Line 58  Paso_SharedComponents* Paso_SharedCompon Line 59  Paso_SharedComponents* Paso_SharedCompon
59        out->shared=MEMALLOC(out->numSharedComponents,index_t);        out->shared=MEMALLOC(out->numSharedComponents,index_t);
60        out->offsetInShared=MEMALLOC(out->numNeighbors+1,index_t);        out->offsetInShared=MEMALLOC(out->numNeighbors+1,index_t);
61        out->reference_counter=1;        out->reference_counter=1;
62        if (! (Paso_checkPtr(out->neighbor) ||        if (! (Esys_checkPtr(out->neighbor) ||
63               Paso_checkPtr(out->shared) ||               Esys_checkPtr(out->shared) ||
64               Paso_checkPtr(out->offsetInShared) ) ) {               Esys_checkPtr(out->offsetInShared) ) ) {
65    
66    
67           if ((out->numNeighbors>0) && (offsetInShared!=NULL) ) {           if ((out->numNeighbors>0) && (offsetInShared!=NULL) ) {
# Line 84  Paso_SharedComponents* Paso_SharedCompon Line 85  Paso_SharedComponents* Paso_SharedCompon
85        }        }
86    
87    }    }
88    if (Paso_noError()) {    if (Esys_noError()) {
89       return out;       return out;
90    } else {    } else {
91       Paso_SharedComponents_free(out);       Paso_SharedComponents_free(out);
# Line 110  void Paso_SharedComponents_free(Paso_Sha Line 111  void Paso_SharedComponents_free(Paso_Sha
111          MEMFREE(in->neighbor);          MEMFREE(in->neighbor);
112          MEMFREE(in->shared);          MEMFREE(in->shared);
113          MEMFREE(in->offsetInShared);          MEMFREE(in->offsetInShared);
114          Paso_MPIInfo_free(in->mpi_info);          Esys_MPIInfo_free(in->mpi_info);
115          MEMFREE(in);          MEMFREE(in);
116          #ifdef Paso_TRACE          #ifdef Paso_TRACE
117          printf("Paso_SharedComponents_dealloc: system matrix pattern as been deallocated.\n");          printf("Paso_SharedComponents_dealloc: system matrix pattern as been deallocated.\n");

Legend:
Removed from v.2881  
changed lines
  Added in v.3259

  ViewVC Help
Powered by ViewVC 1.1.26