/[escript]/branches/doubleplusgood/finley/src/CPPAdapter/MeshAdapter.cpp
ViewVC logotype

Diff of /branches/doubleplusgood/finley/src/CPPAdapter/MeshAdapter.cpp

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

revision 4331 by jfenwick, Wed Feb 27 06:09:33 2013 UTC revision 4332 by jfenwick, Thu Mar 21 04:21:14 2013 UTC
# Line 119  Finley_Mesh* MeshAdapter::getFinley_Mesh Line 119  Finley_Mesh* MeshAdapter::getFinley_Mesh
119    
120  void MeshAdapter::write(const string& fileName) const  void MeshAdapter::write(const string& fileName) const
121  {  {
122     char *fName = (fileName.size()+1>0) ? TMPMEMALLOC(fileName.size()+1,char) : (char*)NULL;     char *fName = (fileName.size()+1>0) ? new char[fileName.size()+1] : (char*)NULL;
123     strcpy(fName,fileName.c_str());     strcpy(fName,fileName.c_str());
124     Finley_Mesh_write(m_finleyMesh.get(),fName);     Finley_Mesh_write(m_finleyMesh.get(),fName);
125     checkFinleyError();     checkFinleyError();
126     TMPMEMFREE(fName);     delete[] fName;
127  }  }
128    
129  void MeshAdapter::Print_Mesh_Info(const bool full) const  void MeshAdapter::Print_Mesh_Info(const bool full) const
# Line 491  void MeshAdapter::dump(const string& fil Line 491  void MeshAdapter::dump(const string& fil
491     if (num_Tags>0) {     if (num_Tags>0) {
492    
493        // Temp storage to gather node IDs        // Temp storage to gather node IDs
494        int *Tags_keys = TMPMEMALLOC(num_Tags, int);        int *Tags_keys = new  int[num_Tags];
495        char name_temp[4096];        char name_temp[4096];
496    
497        /* Copy tag data into temp arrays */        /* Copy tag data into temp arrays */
# Line 527  void MeshAdapter::dump(const string& fil Line 527  void MeshAdapter::dump(const string& fil
527           }           }
528        }        }
529    
530        TMPMEMFREE(Tags_keys);        delete[] Tags_keys;
531     }     }
532    
533  /* Send token to next MPI process so he can take his turn */  /* Send token to next MPI process so he can take his turn */
# Line 2419  void MeshAdapter:: addDiracPoints(const Line 2419  void MeshAdapter:: addDiracPoints(const
2419        if  ( (numTags > 0) && ( numPoints !=  numTags ) )        if  ( (numTags > 0) && ( numPoints !=  numTags ) )
2420       throw FinleyAdapterException("Error - if tags are given number of tags and points must match.");       throw FinleyAdapterException("Error - if tags are given number of tags and points must match.");
2421                
2422        double* points_ptr=TMPMEMALLOC(numPoints * dim, double);        double* points_ptr=new  double[numPoints * dim];
2423        int*    tags_ptr= TMPMEMALLOC(numPoints, int);        int*    tags_ptr= new  int[numPoints];
2424                
2425        for (int i=0;i<numPoints;++i) {        for (int i=0;i<numPoints;++i) {
2426         points_ptr[ i * dim     ] = points[i * dim ];         points_ptr[ i * dim     ] = points[i * dim ];
# Line 2432  void MeshAdapter:: addDiracPoints(const Line 2432  void MeshAdapter:: addDiracPoints(const
2432        Finley_Mesh_addPoints(mesh, numPoints, points_ptr, tags_ptr);        Finley_Mesh_addPoints(mesh, numPoints, points_ptr, tags_ptr);
2433        checkFinleyError();        checkFinleyError();
2434                
2435        TMPMEMFREE(points_ptr);        delete[] points_ptr;
2436        TMPMEMFREE(tags_ptr);        delete[] tags_ptr;
2437  }  }
2438    
2439    

Legend:
Removed from v.4331  
changed lines
  Added in v.4332

  ViewVC Help
Powered by ViewVC 1.1.26