Ignore:
Timestamp:
01/25/17 16:25:17 (7 years ago)
Author:
yushan
Message:

initialize the branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_yushan/src/node/interpolate_domain.cpp

    r1014 r1037  
    4848    } 
    4949 
    50     if (this->mode.isEmpty()) this->mode.setValue(mode_attr::compute); 
    51     if (this->write_weight.isEmpty()) this->write_weight.setValue(false); 
     50    StdString weightFile = "interpolation_weights_" + domainSrc->getDomainOutputName(); 
    5251 
    53     StdString weightFile; 
    54     switch (this->mode) 
    55     { 
    56       case mode_attr::read: 
    57         if (this->weight_filename.isEmpty()) 
    58         { 
    59           if (!this->write_weight) 
     52    if (!this->mode.isEmpty()) 
     53    {  
     54      if (mode_attr::read == this->mode) 
     55      { 
     56         if (this->file.isEmpty()) 
     57         { 
    6058            ERROR("void CInterpolateDomain::checkValid(CDomain* domainSrc)", 
    6159                 << "Read mode is activated but there is no file specified." << std::endl 
    6260                 << "Please define a correct file containing interpolation weights with option 'file'. "); 
    63         } 
    64         else 
    65         { 
    66           weightFile = this->weight_filename; 
    67           ifstream f(weightFile.c_str()); 
    68           if (!f.good()) 
    69             ERROR("void CInterpolateDomain::checkValid(CDomain* domainSrc)", 
    70                   << "Read mode is activated but file "  << weightFile << " doesn't exist." << std::endl 
    71                   << "Please check this file "); 
    72         } 
    73         break; 
    74       case mode_attr::compute: 
    75         break; 
    76       case mode_attr::read_or_compute: 
    77         if (!this->weight_filename.isEmpty() && !this->write_weight) 
    78         { 
    79           weightFile = this->weight_filename; 
    80           ifstream f(weightFile.c_str()); 
    81           if (!f.good()) 
    82             ERROR("void CInterpolateDomain::checkValid(CDomain* domainSrc)", 
    83                   << "read_or_compute mode is activated but file "  << weightFile << " doesn't exist." << std::endl 
    84                   << "Please check this file "); 
    85         } 
    86         break; 
    87       default: 
    88         break; 
     61         } 
     62         else 
     63         { 
     64           weightFile = this->file; 
     65           ifstream f(weightFile.c_str()); 
     66           if (!f.good()) 
     67             ERROR("void CInterpolateDomain::checkValid(CDomain* domainSrc)", 
     68                   << "Read mode is activated but file "  << weightFile << " doesn't exist." << std::endl 
     69                   << "Please check this file "); 
     70         } 
     71      } 
     72      else 
     73      { 
     74        if (file.isEmpty()) 
     75          this->file.setValue(weightFile); 
     76      }    
     77    } 
     78    else 
     79    { 
     80      if (!file.isEmpty()) // set mode read 
     81      { 
     82         weightFile = this->file; 
     83         ifstream f(weightFile.c_str()); 
     84         if (!f.good()) // file doesn't exist 
     85           this->mode.setValue(mode_attr::write); 
     86         else 
     87           this->mode.setValue(mode_attr::read); 
     88      } 
     89      else // only calculate weights() Mode set write but there is no file) 
     90      { 
     91        this->mode.setValue(mode_attr::write); 
     92      } 
    8993    } 
    9094 
Note: See TracChangeset for help on using the changeset viewer.