Changeset 999 for XIOS/trunk


Ignore:
Timestamp:
11/21/16 15:31:49 (7 years ago)
Author:
mhnguyen
Message:

Correcting a minor bug on writing a field in file

+) Make sure each element of grid exist before using them

Test
+) On Curie
+) Work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/io/nc4_data_output.cpp

    r993 r999  
    14701470        std::vector<StdString> domainList = grid->getDomainList(); 
    14711471        std::vector<StdString> axisList   = grid->getAxisList(); 
    1472         std::vector<StdString> scalarList = grid->getScalarList(); 
    1473  
    1474         CDomain* domain = CDomain::get(domainList[idxDomain]); 
     1472        std::vector<StdString> scalarList = grid->getScalarList();         
    14751473 
    14761474        StdString timeid  = getTimeCounterName(); 
     
    14851483          if (2 == axisDomainOrder(i)) 
    14861484          { 
     1485            CDomain* domain = CDomain::get(domainList[idxDomain]); 
    14871486            StdString domId = domain->getDomainOutputName(); 
    14881487            StdString appendDomId  = singleDomain ? "" : "_" + domId ; 
     
    16541653           if (!SuperClassWriter::useCFConvention) 
    16551654           { 
    1656              StdString mesh = domain->name; 
    1657              SuperClassWriter::addAttribute("mesh", mesh, &fieldid); 
    1658              StdString location; 
    1659              if (domain->nvertex == 1) 
    1660                location = "node"; 
    1661              else if (domain->nvertex == 2) 
    1662                location = "edge"; 
    1663              else if (domain->nvertex > 2) 
    1664                location = "face"; 
    1665              SuperClassWriter::addAttribute("location", location, &fieldid); 
     1655            if (!domainList.empty()) 
     1656            { 
     1657              CDomain* domain = CDomain::get(domainList[0]); // Suppose that we have only domain 
     1658              StdString mesh = domain->name; 
     1659              SuperClassWriter::addAttribute("mesh", mesh, &fieldid); 
     1660              StdString location; 
     1661              if (domain->nvertex == 1) 
     1662                location = "node"; 
     1663              else if (domain->nvertex == 2) 
     1664                location = "edge"; 
     1665              else if (domain->nvertex > 2) 
     1666                location = "face"; 
     1667              SuperClassWriter::addAttribute("location", location, &fieldid); 
     1668            } 
     1669 
    16661670           } 
    16671671 
Note: See TracChangeset for help on using the changeset viewer.