Ignore:
Timestamp:
07/04/16 19:21:28 (8 years ago)
Author:
oabramkina
Message:

Commit for UGRID norms: bad allocations have been taken care of.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/mesh.cpp

    r879 r881  
    2626  } 
    2727 
    28   std::map <StdString, CMesh*> CMesh::meshList = std::map <StdString, CMesh*>(); 
    29   CMesh* CMesh::getMesh; 
     28  std::map <StdString, CMesh> CMesh::meshList = std::map <StdString, CMesh>(); 
     29  //CMesh* CMesh::getMesh; 
    3030 
    3131///--------------------------------------------------------------- 
    3232/*! 
    33  * \fn bool CMesh::isWritten (StdString meshName) 
    34  * Checks if a mesh has been written, updates the list of meshes stored in meshList 
     33 * \fn bool CMesh::getMesh (StdString meshName) 
     34 * Returns a pointer to a mesh. If a mesh has not been created, creates it and adds its name to the list of meshes meshList. 
    3535 * \param [in] meshName  The name of a mesh ("name" attribute of a domain). 
    3636 */ 
    37   bool CMesh::isWritten (StdString meshName) 
    38   { 
    39     if ( CMesh::meshList.begin() != CMesh::meshList.end() ) 
    40     { 
    41       if ( CMesh::meshList.find(meshName) != CMesh::meshList.end() ) 
    42       { 
    43         CMesh::getMesh = meshList[meshName]; 
    44         return true; 
    45       } 
    46       else 
    47       { 
    48         CMesh::meshList.insert( make_pair(meshName, this) ); 
    49         return false; 
    50       } 
    51     } 
    52     else 
    53     { 
    54       CMesh::meshList.insert( make_pair(meshName, this) ); 
    55       return false; 
    56     } 
     37  CMesh::CMesh* CMesh::getMesh (StdString meshName) 
     38  { 
     39    if ( CMesh::meshList.find(meshName) == CMesh::meshList.end() ) 
     40    { 
     41      CMesh::CMesh newMesh; 
     42      CMesh::meshList.insert( make_pair(meshName, newMesh) ); 
     43 
     44    } 
     45    return &meshList[meshName]; 
    5746  } 
    5847 
     
    7160 * Precision check is implemented with two hash values for each dimension, longitude and latitude. 
    7261 * \param [in] lon Node longitude in degrees. 
    73  * \param [in] lat Node latitude in degress ranged from 0 to 360. 
     62 * \param [in] lat Node latitude in degrees ranged from 0 to 360. 
    7463 * \return node index if a node exists; -1 otherwise 
    7564 */ 
     
    145134 * Creates two hash values for each dimension, longitude and latitude. 
    146135 * \param [in] lon Node longitude in degrees. 
    147  * \param [in] lat Node latitude in degress ranged from 0 to 360. 
     136 * \param [in] lat Node latitude in degrees ranged from 0 to 360. 
    148137 */ 
     138 
    149139  void hashDblDbl (double lon, double lat) 
    150140  { 
     
    217207 * \param [in] latvalue  Array of latitudes. 
    218208 * \param [in] bounds_lon Array of boundary longitudes. Its size depends on the element type. 
    219  * \param [in] bounds_lat Array of boundarry latitudes. Its size depends on the element type. 
     209 * \param [in] bounds_lat Array of boundary latitudes. Its size depends on the element type. 
    220210 */ 
    221211  void CMesh::createMesh(const CArray<double, 1>& lonvalue, const CArray<double, 1>& latvalue, 
     
    357347 * \param [in] latvalue  Array of latitudes. 
    358348 * \param [in] bounds_lon Array of boundary longitudes. Its size depends on the element type. 
    359  * \param [in] bounds_lat Array of boundarry latitudes. Its size depends on the element type. 
     349 * \param [in] bounds_lat Array of boundary latitudes. Its size depends on the element type. 
    360350 */ 
    361351  void CMesh::createMeshEpsilon(const CArray<double, 1>& lonvalue, const CArray<double, 1>& latvalue, 
Note: See TracChangeset for help on using the changeset viewer.