Changeset 902


Ignore:
Timestamp:
07/18/16 08:58:58 (5 years ago)
Author:
oabramkina
Message:

Sequential version of new functionalities for mesh connectivity:

edge_faces
face_edges
face_face.

Compilation error of version 900 resolved.

File:
1 edited

Legend:

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

    r887 r902  
    450450      StdString domainName = domain->name; 
    451451      domain->assignMesh(domainName); 
    452       //domain->mesh->createMesh(domain->lonvalue_srv, domain->latvalue_srv, domain->bounds_lon_srv, domain->bounds_lat_srv); 
    453       domain->mesh->createMeshEpsilon(domain->lonvalue_srv, domain->latvalue_srv, domain->bounds_lon_srv, domain->bounds_lat_srv); 
     452      domain->mesh->createMesh(domain->lonvalue_srv, domain->latvalue_srv, domain->bounds_lon_srv, domain->bounds_lat_srv); 
     453      //domain->mesh->createMeshEpsilon(server->intraComm, domain->lonvalue_srv, domain->latvalue_srv, domain->bounds_lon_srv, domain->bounds_lat_srv); 
    454454 
    455455      StdString node_x = domainName + "_node_x"; 
     
    463463      StdString face_y = domainName + "_face_y"; 
    464464      StdString face_nodes = domainName + "_face_nodes"; 
     465      StdString face_edges = domainName + "_face_edges"; 
     466      StdString edge_faces = domainName + "_edge_face_links"; 
     467      StdString face_faces = domainName + "_face_links"; 
    465468 
    466469      StdString dimNode = "n" + domainName + "_node"; 
     
    487490            // Adding nodes 
    488491            if (domain->nvertex == 1) 
     492            { 
     493              if (!SuperClassWriter::varExist(node_x) || !SuperClassWriter::varExist(node_y)) 
     494              { 
     495                SuperClassWriter::addDimension(dimNode, domain->ni_glo); 
     496                dim0.clear(); 
     497                dim0.push_back(dimNode); 
     498                SuperClassWriter::addVariable(node_x, NC_FLOAT, dim0); 
     499                SuperClassWriter::addAttribute("standard_name", StdString("longitude"), &node_x); 
     500                SuperClassWriter::addAttribute("longname_name", StdString("Longitude of mesh nodes."), &node_x); 
     501                SuperClassWriter::addAttribute("units", StdString("degrees_east"), &node_x); 
     502                SuperClassWriter::addVariable(node_y, NC_FLOAT, dim0); 
     503                SuperClassWriter::addAttribute("standard_name", StdString("latitude"), &node_y); 
     504                SuperClassWriter::addAttribute("longname_name", StdString("Latitude of mesh nodes."), &node_y); 
     505                SuperClassWriter::addAttribute("units", StdString("degrees_north"), &node_y); 
     506              } 
     507            } // domain->nvertex == 1 
     508 
     509            // Adding edges and nodes, if nodes have not been defined previously 
     510            if (domain->nvertex == 2) 
    489511            { 
    490512              if (!SuperClassWriter::varExist(node_x) || !SuperClassWriter::varExist(node_y)) 
     
    502524                SuperClassWriter::addAttribute("units", StdString("degrees_north"), &node_y); 
    503525              } 
    504             } // domain->nvertex == 1 
    505  
    506             // Adding edges and nodes, if nodes have not been defined previously 
    507             if (domain->nvertex == 2) 
    508             { 
    509               // Nodes 
    510               if (!SuperClassWriter::varExist(node_x) || !SuperClassWriter::varExist(node_y)) 
    511               { 
    512                 SuperClassWriter::addDimension(dimNode, domain->mesh->nbNodes); 
    513                 dim0.clear(); 
    514                 dim0.push_back(dimNode); 
    515                 SuperClassWriter::addVariable(node_x, NC_FLOAT, dim0); 
    516                 SuperClassWriter::addAttribute("standard_name", StdString("longitude"), &node_x); 
    517                 SuperClassWriter::addAttribute("longname_name", StdString("Longitude of mesh nodes."), &node_x); 
    518                 SuperClassWriter::addAttribute("units", StdString("degrees_east"), &node_x); 
    519                 SuperClassWriter::addVariable(node_y, NC_FLOAT, dim0); 
    520                 SuperClassWriter::addAttribute("standard_name", StdString("latitude"), &node_y); 
    521                 SuperClassWriter::addAttribute("longname_name", StdString("Latitude of mesh nodes."), &node_y); 
    522                 SuperClassWriter::addAttribute("units", StdString("degrees_north"), &node_y); 
    523               } 
    524               // Edges 
    525526              if (!SuperClassWriter::varExist(edge_x) || !SuperClassWriter::varExist(edge_y)) 
    526527              { 
     
    566567                SuperClassWriter::addAttribute("units", StdString("degrees_north"), &node_y); 
    567568              } 
    568               // Edges 
    569569              if (!SuperClassWriter::varExist(edge_x) || !SuperClassWriter::varExist(edge_y)) 
    570570              { 
     
    590590                SuperClassWriter::addAttribute("start_index", 0, &edge_nodes); 
    591591              } 
    592               // Faces 
    593592                SuperClassWriter::addAttribute("face_coordinates", face_x + " " + face_y, &domainName); 
    594593                SuperClassWriter::addAttribute("face_node_connectivity", face_nodes, &domainName); 
     
    612611                SuperClassWriter::addAttribute("long_name", StdString("Maps every face to its corner nodes."), &face_nodes); 
    613612                SuperClassWriter::addAttribute("start_index", 0, &face_nodes); 
     613                dim0.clear(); 
     614                dim0.push_back(dimFace); 
     615                dim0.push_back(dimVertex); 
     616                SuperClassWriter::addVariable(face_edges, NC_INT, dim0); 
     617                SuperClassWriter::addAttribute("cf_role", StdString("face_edge_connectivity"), &face_edges); 
     618                SuperClassWriter::addAttribute("long_name", StdString("Maps every face to its edges."), &face_edges); 
     619                SuperClassWriter::addAttribute("start_index", 0, &face_edges); 
     620                dim0.clear(); 
     621                dim0.push_back(dimEdge); 
     622                dim0.push_back(dimTwo); 
     623                SuperClassWriter::addVariable(edge_faces, NC_INT, dim0); 
     624                SuperClassWriter::addAttribute("cf_role", StdString("edge_face connectivity"), &edge_faces); 
     625                SuperClassWriter::addAttribute("long_name", StdString("neighbor faces for edges"), &edge_faces); 
     626                SuperClassWriter::addAttribute("start_index", 0, &edge_faces); 
     627                SuperClassWriter::addAttribute("_FillValue", -999, &edge_faces); 
     628                SuperClassWriter::addAttribute("comment", StdString("missing neighbor faces are indicated using _FillValue"), &edge_faces); 
     629                dim0.clear(); 
     630                dim0.push_back(dimFace); 
     631                dim0.push_back(dimVertex); 
     632                SuperClassWriter::addVariable(face_faces, NC_INT, dim0); 
     633                SuperClassWriter::addAttribute("cf_role", StdString("face_face connectivity"), &face_faces); 
     634                SuperClassWriter::addAttribute("long_name", StdString("Indicates which other faces neighbor each face"), &face_faces); 
     635                SuperClassWriter::addAttribute("start_index", 0, &face_faces); 
     636                SuperClassWriter::addAttribute("flag_values", -1, &face_faces); 
     637                SuperClassWriter::addAttribute("flag_meanings", StdString("out_of_mesh"), &face_faces); 
    614638            } // domain->nvertex > 2 
    615639 
    616640            SuperClassWriter::definition_end(); 
     641 
     642            std::vector<StdSize> start(1) ; 
     643            std::vector<StdSize> count(1) ; 
     644            if (domain->isEmpty()) 
     645             { 
     646               start[0]=0 ; 
     647               count[0]=0 ; 
     648             } 
     649             else 
     650             { 
     651               start[0]=domain->zoom_ibegin_srv-domain->global_zoom_ibegin; 
     652               count[0]=domain->zoom_ni_srv ; 
     653             } 
    617654 
    618655            if (!isWrittenDomain(domid)) 
     
    620657              if (domain->nvertex == 1) 
    621658              { 
    622                 SuperClassWriter::writeData(domain->mesh->node_lat, node_y, isCollective, 0); 
    623                 SuperClassWriter::writeData(domain->mesh->node_lon, node_x, isCollective, 0); 
     659                SuperClassWriter::writeData(domain->mesh->node_lat, node_y, isCollective, 0, &start, &count); 
     660                SuperClassWriter::writeData(domain->mesh->node_lon, node_x, isCollective, 0, &start, &count); 
    624661              } 
    625662              else if (domain->nvertex == 2) 
     
    641678                SuperClassWriter::writeData(domain->mesh->face_lon, face_x, isCollective, 0); 
    642679                SuperClassWriter::writeData(domain->mesh->face_nodes, face_nodes); 
     680                SuperClassWriter::writeData(domain->mesh->face_edges, face_edges); 
     681                SuperClassWriter::writeData(domain->mesh->edge_faces, edge_faces); 
     682                SuperClassWriter::writeData(domain->mesh->face_faces, face_faces); 
    643683              } 
    644684              setWrittenDomain(domid); 
     
    684724                SuperClassWriter::writeData(domain->mesh->face_lon, face_x, isCollective, 0); 
    685725                SuperClassWriter::writeData(domain->mesh->face_nodes, face_nodes); 
     726                SuperClassWriter::writeData(domain->mesh->face_edges, face_edges); 
     727                SuperClassWriter::writeData(domain->mesh->edge_faces, edge_faces); 
     728                SuperClassWriter::writeData(domain->mesh->face_faces, face_faces); 
    686729              } 
    687730            }// isWrittenDomain 
     
    736779 
    737780         StdString appendDomid  = (singleDomain) ? "" : "_"+domid ; 
    738  
    739781 
    740782         StdString dimXid = StdString("cell").append(appendDomid); 
Note: See TracChangeset for help on using the changeset viewer.