Ignore:
Timestamp:
11/02/15 11:46:25 (8 years ago)
Author:
mhnguyen
Message:

Implementing the reading of attributes of an axis from a file

+) 3d grid can be read directly from a file
+) Clean some redundant codes
+) Add new attribute declaration that allows to output only desired attributes

Test
+) On Curie
+) test_remap passes and result is correct

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/transformation/grid_generate.cpp

    r687 r775  
    1717: gridSource_(source), gridDestination_(destination), algoTypes_() 
    1818{ 
    19   //Verify the compatibity between two grids 
    20   int numElement = gridDestination_->axis_domain_order.numElements(); 
    21   if (numElement != gridSource_->axis_domain_order.numElements()) 
    22     ERROR("CGridGenerate::CGridGenerate(CGrid* destination, CGrid* source)", 
    23        << "Two grids have different number of elements" 
    24        << "Number of elements of grid source " <<gridSource_->getId() << " is " << gridSource_->axis_domain_order.numElements()  << std::endl 
    25        << "Number of elements of grid destination " <<gridDestination_->getId() << " is " << numElement); 
    26  
    27   for (int i = 0; i < numElement; ++i) 
    28   { 
    29     if (gridDestination_->axis_domain_order(i) != gridSource_->axis_domain_order(i)) 
     19  if (0 != source) 
     20  { 
     21    //Verify the compatibity between two grids 
     22    int numElement = gridDestination_->axis_domain_order.numElements(); 
     23    if (numElement != gridSource_->axis_domain_order.numElements()) 
    3024      ERROR("CGridGenerate::CGridGenerate(CGrid* destination, CGrid* source)", 
    31          << "Transformed grid and its grid source have incompatible elements" 
    32          << "Grid source " <<gridSource_->getId() << std::endl 
    33          << "Grid destination " <<gridDestination_->getId()); 
     25         << "Two grids have different number of elements" 
     26         << "Number of elements of grid source " <<gridSource_->getId() << " is " << gridSource_->axis_domain_order.numElements()  << std::endl 
     27         << "Number of elements of grid destination " <<gridDestination_->getId() << " is " << numElement); 
     28 
     29    for (int i = 0; i < numElement; ++i) 
     30    { 
     31      if (gridDestination_->axis_domain_order(i) != gridSource_->axis_domain_order(i)) 
     32        ERROR("CGridGenerate::CGridGenerate(CGrid* destination, CGrid* source)", 
     33           << "Transformed grid and its grid source have incompatible elements" 
     34           << "Grid source " <<gridSource_->getId() << std::endl 
     35           << "Grid destination " <<gridDestination_->getId()); 
     36    } 
    3437  } 
    3538 
     
    179182{ 
    180183  std::vector<CAxis*> axisListDestP = gridDestination_->getAxis(); 
    181   std::vector<CAxis*> axisListSrcP = gridSource_->getAxis(); 
    182184 
    183185  int axisIndex =  elementPosition2AxisPositionInGrid_[elementPositionInGrid]; 
     
    207209{ 
    208210  std::vector<CDomain*> domainListDestP = gridDestination_->getDomains(); 
    209   std::vector<CDomain*> domainListSrcP = gridSource_->getDomains(); 
     211  std::vector<CDomain*> domainListSrcP(domainListDestP.size()); 
     212  if (0 != gridSource_) domainListSrcP = gridSource_->getDomains(); 
    210213 
    211214  int domainIndex =  elementPosition2DomainPositionInGrid_[elementPositionInGrid]; 
     
    223226      { 
    224227        genRectDomain = dynamic_cast<CGenerateRectilinearDomain*> (it->second); 
    225         algo = new CDomainAlgorithmGenerateRectilinear(domainListDestP[domainIndex], domainListSrcP[domainIndex], gridSource_, genRectDomain); 
     228        algo = new CDomainAlgorithmGenerateRectilinear(domainListDestP[domainIndex], domainListSrcP[domainIndex], 
     229                                                       gridDestination_, gridSource_, genRectDomain); 
    226230      } 
    227231      else 
Note: See TracChangeset for help on using the changeset viewer.