/[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 4261 by jfenwick, Wed Feb 27 06:09:33 2013 UTC revision 4324 by jfenwick, Wed Mar 20 00:55:44 2013 UTC
# Line 46  Paso_SharedComponents* Paso_SharedCompon Line 46  Paso_SharedComponents* Paso_SharedCompon
46    register index_t itmp;    register index_t itmp;
47    Paso_SharedComponents* out=NULL;    Paso_SharedComponents* out=NULL;
48    Esys_resetError();    Esys_resetError();
49    out=MEMALLOC(1,Paso_SharedComponents);    out=new Paso_SharedComponents;
50    if (!Esys_checkPtr(out)) {    if (!Esys_checkPtr(out)) {
51        out->local_length=local_length*m;        out->local_length=local_length*m;
52        out->mpi_info = Esys_MPIInfo_getReference(mpi_info);        out->mpi_info = Esys_MPIInfo_getReference(mpi_info);
53        out->numNeighbors=numNeighbors;        out->numNeighbors=numNeighbors;
54        out->neighbor=MEMALLOC(out->numNeighbors,Esys_MPI_rank);        out->neighbor=new Esys_MPI_rank[out->numNeighbors];
55        if (offsetInShared == NULL) {        if (offsetInShared == NULL) {
56            out->numSharedComponents=0;            out->numSharedComponents=0;
57        } else {        } else {
58            out->numSharedComponents=offsetInShared[numNeighbors]*m;            out->numSharedComponents=offsetInShared[numNeighbors]*m;
59        }        }
60        out->shared=MEMALLOC(out->numSharedComponents,index_t);        out->shared=new index_t[out->numSharedComponents];
61        out->offsetInShared=MEMALLOC(out->numNeighbors+1,index_t);        out->offsetInShared=new index_t[out->numNeighbors+1];
62        out->reference_counter=1;        out->reference_counter=1;
63        if (! (Esys_checkPtr(out->neighbor) ||        if (! (Esys_checkPtr(out->neighbor) ||
64               Esys_checkPtr(out->shared) ||               Esys_checkPtr(out->shared) ||
# Line 109  void Paso_SharedComponents_free(Paso_Sha Line 109  void Paso_SharedComponents_free(Paso_Sha
109    if (in!=NULL) {    if (in!=NULL) {
110       in->reference_counter--;       in->reference_counter--;
111       if (in->reference_counter<=0) {       if (in->reference_counter<=0) {
112          MEMFREE(in->neighbor);          delete[] in->neighbor;
113          MEMFREE(in->shared);          delete[] in->shared;
114          MEMFREE(in->offsetInShared);          delete[] in->offsetInShared;
115          Esys_MPIInfo_free(in->mpi_info);          Esys_MPIInfo_free(in->mpi_info);
116          MEMFREE(in);          delete in;
117          #ifdef Paso_TRACE          #ifdef Paso_TRACE
118          printf("Paso_SharedComponents_dealloc: system matrix pattern has been deallocated.\n");          printf("Paso_SharedComponents_dealloc: system matrix pattern has been deallocated.\n");
119          #endif          #endif

Legend:
Removed from v.4261  
changed lines
  Added in v.4324

  ViewVC Help
Powered by ViewVC 1.1.26