6 #ifndef _MetadataVDC_h_ 
    7 #define _MetadataVDC_h_ 
   12 #include <vapor/MyBase.h> 
   13 #include <vapor/common.h> 
   14 #include <vapor/Metadata.h> 
   15 #include <vapor/XmlNode.h> 
   16 #include <vapor/ExpatParseMgr.h> 
   18 #pragma warning(disable : 4251) 
   27 #define CHK_TS_REQ(TS, RETVAL) \ 
   28     if (! _rootnode->GetChild(TS)) { \ 
   29         SetErrMsg("Invalid time step : %d", TS); \ 
   32 #define CHK_VAR_REQ(TS, VAR, RETVAL) \ 
   33     if (! _rootnode->GetChild(TS)) { \ 
   34         SetErrMsg("Invalid time step : %d", TS); \ 
   37     if (! _rootnode->GetChild(TS)->GetChild(VAR)) { \ 
   38         SetErrMsg("Invalid variable name : %s", VAR.c_str()); \ 
   46 #define CHK_TS_OPT(TS, RETVAL) \ 
   47     if (! _rootnode->HasChild(TS)) { \ 
   50 #define CHK_VAR_OPT(TS, VAR, RETVAL) \ 
   51     if (! _rootnode->HasChild(TS)) { \ 
   54     if (! _rootnode->GetChild(TS)->HasChild(VAR)) { \ 
  114     const size_t dim[3], 
size_t numTransforms, 
const size_t bs[3],
 
  115     int nFilterCoef = 1, 
int nLiftingCoef = 1, 
int msbFirst =  1,
 
  116     int vdfVersion = VDF_VERSION
 
  130     const size_t dim[3], 
const size_t bs[3], 
const vector <size_t> &cratios,
 
  131     string wname, 
string wmode
 
  193  int Merge(
const MetadataVDC &metadata, 
size_t ts = 0);
 
  206  int Merge(
const string &path, 
size_t ts = 0);
 
  247  int ConstructFullVBase(
size_t ts, 
const string &var, 
string *path) 
const;
 
  248  int ConstructFullAuxBase(
size_t ts, 
string *path) 
const;
 
  256  int Write(
const string &path, 
int relative_path = 1) ;
 
  274     for (
int i=0; i<3; i++) bs[i] = _bs[i];
 
  278     for (
int i=0; i<3; i++) dim[i] = _dim[i];
 
  343  virtual vector <size_t> 
GetCRatios()
 const { 
return(_cratios); }
 
  369  int SetGridType(
const string &value);
 
  378     return(_rootnode->GetElementString(_gridTypeTag));
 
  399  int SetCoordSystemType(
const string &value);
 
  407     return(_rootnode->GetElementString(_coordSystemTypeTag));
 
  430  int SetExtents(
const vector<double> &value);
 
  435  vector<double> GetExtents(
size_t ts = 0) 
const; 
 
  441  int IsValidExtents(
const vector<double> &value) 
const;
 
  448  int SetNumTimeSteps(
long value);
 
  456  long GetNumTimeSteps() 
const;
 
  475     return (SetVariables3D(value));
 
  490  int SetVariables3D(
const vector <string> &value);
 
  499     vector <string> svec;
 
  500     _rootnode->GetElementStringVec(_vars3DTag, svec);
 
  507     vector <string> svec;
 
  508     _rootnode->GetElementStringVec(_coordVarsTag, svec);
 
  522  int SetCoordinateVariables(
const vector <string> &value);
 
  533  int SetVariables2DXY(
const vector <string> &value);
 
  534  int SetVariables2DXZ(
const vector <string> &value);
 
  535  int SetVariables2DYZ(
const vector <string> &value);
 
  544     vector <string> svec;
 
  545     _rootnode->GetElementStringVec(_vars2DXYTag, svec);
 
  549     vector <string> svec;
 
  550     _rootnode->GetElementStringVec(_vars2DXZTag, svec);
 
  554     vector <string> svec;
 
  555     _rootnode->GetElementStringVec(_vars2DYZTag, svec);
 
  567     _rootnode->SetElementString(_commentTag, value);
 
  579     return(_rootnode->GetElementString(_commentTag));
 
  590     _rootnode->SetElementLong(_periodicBoundaryTag, value);
 
  602     return(_rootnode->GetElementLong(_periodicBoundaryTag));
 
  618     _rootnode->SetElementLong(_gridPermutationTag, value);
 
  630     vector <double> valvec; valvec.push_back(value);
 
  631     _rootnode->SetElementDouble(_missingValueTag, valvec);
 
  641     _rootnode->SetElementDouble(_missingValueTag, _emptyDoubleVec);
 
  652     return _rootnode->GetElementDouble(_missingValueTag);
 
  663     return(_rootnode->GetElementLong(_gridPermutationTag));
 
  686     _rootnode->SetElementString(_mapProjectionTag, value);
 
  699  virtual string GetMapProjection() 
const;
 
  708  int SetTSUserTime(
size_t ts, 
const vector<double> &value);
 
  722     if (_rootnode->GetChild(ts)->GetElementDouble(_userTimeTag).size())
 
  723         return(_rootnode->GetChild(ts)->GetElementDouble(_userTimeTag)[0]);
 
  728  int SetTSUserTimeStamp(
size_t ts, 
const string &s);
 
  731     if (! _rootnode->GetChild(ts)) {s.clear(); 
return;}
 
  732     s = _rootnode->GetChild(ts)->GetElementString(_userTimeStampTag);
 
  749     return(_rootnode->GetChild(ts)->GetElementString(_auxBasePathTag));
 
  763     if (! _rootnode->HasChild(ts)) 
return(0);
 
  764     return(_rootnode->GetChild(ts)->HasElementDouble(_userTimeTag));
 
  772     return(value.size() == 1);
 
  793  int SetTSXCoords(
size_t ts, 
const vector<double> &value);
 
  807     return(_rootnode->GetChild(ts)->GetElementDouble(_xCoordsTag));
 
  810  int SetTSYCoords(
size_t ts, 
const vector<double> &value);
 
  814     return(_rootnode->GetChild(ts)->GetElementDouble(_yCoordsTag));
 
  817  int SetTSZCoords(
size_t ts, 
const vector<double> &value);
 
  821     return(_rootnode->GetChild(ts)->GetElementDouble(_zCoordsTag));
 
  831  int SetTSComment(
size_t ts, 
const string &value);
 
  844     return(_rootnode->GetChild(ts)->GetElementString(_commentTag));
 
  858  int SetTSExtents(
size_t ts, 
const vector<double> &value);
 
  871  vector<double> 
GetTSExtents(
size_t ts)
 const {
return (GetExtents(ts)); }
 
  882  int SetTSMissingValue(
size_t ts, 
double v);
 
  888     return(_rootnode->GetChild(ts)->GetElementDouble(_missingValueTag));
 
  899  int SetVComment(
size_t ts, 
const string &var, 
const string &value);
 
  914     return(_rootnode->GetChild(ts)->GetChild(var)->GetElementString(_commentTag));
 
  928  string GetVBasePath(
size_t ts, 
const string &var) 
const;
 
  932     size_t ts, 
const string &var, 
const string &value
 
  945  int SetVDataRange(
size_t ts, 
const string &var, 
const vector<double> &value);
 
  960     return(_rootnode->GetChild(ts)->GetChild(var)->GetElementDouble(_dataRangeTag));
 
  964     return(value.size() == 2);
 
  980  int SetVMissingValue(
size_t ts, 
const string &var, 
double v);
 
  984     return(_rootnode->GetChild(ts)->GetChild(var)->GetElementDouble(_missingValueTag));
 
 1048     _RecordUserDataTags(_userDLTags, tag);
 
 1049     _rootnode->SetElementLong(tag, value);
 
 1067     return(_rootnode->GetElementLong(tag));
 
 1073     _RecordUserDataTags(_userDDTags, tag);
 
 1074     _rootnode->SetElementDouble(tag, value);
 
 1078     return(_rootnode->GetElementDouble(tag));
 
 1084     _RecordUserDataTags(_userDSTags, tag);
 
 1085     _rootnode->SetElementString(tag, value);
 
 1089     return(_rootnode->GetElementString(tag));
 
 1093     _RecordUserDataTags(_userDSTags, tag);
 
 1094     _rootnode->SetElementStringVec(tag, value);
 
 1098     vector <string> vec;
 
 1099     _rootnode->GetElementStringVec(tag, vec);
 
 1125     return(_timeStepUserDLTags); 
 
 1140     _RecordUserDataTags(_timeStepUserDLTags, tag);
 
 1141     _rootnode->GetChild(ts)->SetElementLong(tag, value);
 
 1161     return(_rootnode->GetChild(ts)->GetElementLong(tag));
 
 1165     size_t ts, 
const string &tag, 
const vector<double> &value
 
 1168     _RecordUserDataTags(_timeStepUserDDTags, tag);
 
 1169     _rootnode->GetChild(ts)->SetElementDouble(tag, value);
 
 1175     return(_rootnode->GetChild(ts)->GetElementDouble(tag));
 
 1178     return(_timeStepUserDDTags);
 
 1183     size_t ts, 
const string &tag, 
const string &value
 
 1186     _RecordUserDataTags(_timeStepUserDSTags, tag);
 
 1187     _rootnode->GetChild(ts)->SetElementString(tag, value);
 
 1193     return(_rootnode->GetChild(ts)->GetElementString(tag));
 
 1196     return(_timeStepUserDSTags);
 
 1225     return(_variableUserDLTags); 
 
 1241     size_t ts, 
const string &var, 
const string &tag, 
const vector<long> &value
 
 1244     _RecordUserDataTags(_variableUserDLTags, tag);
 
 1245     _rootnode->GetChild(ts)->GetChild(var)->SetElementLong(tag, value);
 
 1265     size_t ts, 
const string &var, 
const string &tag
 
 1268     return(_rootnode->GetChild(ts)->GetChild(var)->GetElementLong(tag));
 
 1272     return(_variableUserDDTags);
 
 1275     size_t ts, 
const string &var, 
const string &tag, 
const vector<double> &value
 
 1278     _RecordUserDataTags(_variableUserDDTags, tag);
 
 1279     _rootnode->GetChild(ts)->GetChild(var)->SetElementDouble(tag, value);
 
 1284     size_t ts, 
const string &var, 
const string &tag
 
 1287     return(_rootnode->GetChild(ts)->GetChild(var)->GetElementDouble(tag));
 
 1291     size_t ts, 
const string &var, 
const string &tag, 
const string &value
 
 1294     _RecordUserDataTags(_variableUserDSTags, tag);
 
 1295     _rootnode->GetChild(ts)->GetChild(var)->SetElementString(tag, value);
 
 1300     size_t ts, 
const string &var, 
const string &tag
 
 1303     return(_rootnode->GetChild(ts)->GetChild(var)->GetElementString(tag));
 
 1307     return(_variableUserDSTags);
 
 1322  string _metafileDirName;   
 
 1323  string _metafileName;      
 
 1324  string _dataDirName;       
 
 1325  vector <size_t> _cratios;  
 
 1327  vector <double>    _emptyDoubleVec;
 
 1328  vector <long>      _emptyLongVec;
 
 1329  string             _emptyString;
 
 1338  static const string _childrenTag;
 
 1339  static const string _commentTag;
 
 1340  static const string _coordSystemTypeTag;
 
 1341  static const string _dataRangeTag;
 
 1342  static const string _extentsTag;
 
 1343  static const string _gridTypeTag;
 
 1344  static const string _numTimeStepsTag;
 
 1345  static const string _basePathTag;
 
 1346  static const string _auxBasePathTag;
 
 1347  static const string _rootTag;
 
 1348  static const string _userTimeTag;
 
 1349  static const string _userTimeStampTag;
 
 1350  static const string _timeStepTag;
 
 1351  static const string _varNamesTag;
 
 1352  static const string _vars3DTag;
 
 1353  static const string _vars2DXYTag;
 
 1354  static const string _vars2DXZTag;
 
 1355  static const string _vars2DYZTag;
 
 1356  static const string _coordVarsTag;
 
 1357  static const string _xCoordsTag;
 
 1358  static const string _yCoordsTag;
 
 1359  static const string _zCoordsTag;
 
 1360  static const string _periodicBoundaryTag;
 
 1361  static const string _gridPermutationTag;
 
 1362  static const string _mapProjectionTag;
 
 1363  static const string _missingValueTag;
 
 1367  static const string _blockSizeAttr;
 
 1368  static const string _dimensionLengthAttr;
 
 1369  static const string _numTransformsAttr;
 
 1370  static const string _filterCoefficientsAttr;
 
 1371  static const string _liftingCoefficientsAttr;
 
 1372  static const string _msbFirstAttr;
 
 1373  static const string _vdfVersionAttr;
 
 1374  static const string _numChildrenAttr;
 
 1375  static const string _waveletNameAttr;
 
 1376  static const string _waveletBoundaryModeAttr;
 
 1377  static const string _vdcTypeAttr;
 
 1378  static const string _cRatiosAttr;
 
 1383  vector <string> _userDLTags;   
 
 1384  vector <string> _userDDTags;
 
 1385  vector <string> _userDSTags;
 
 1387  vector <string> _timeStepUserDLTags;   
 
 1388  vector <string> _timeStepUserDDTags;
 
 1389  vector <string> _timeStepUserDSTags;
 
 1391  vector <string> _variableUserDLTags;   
 
 1392  vector <string> _variableUserDDTags;
 
 1393  vector <string> _variableUserDSTags;
 
 1395  string _newMapProjection;
 
 1399     const size_t dim[3], 
size_t numTransforms, 
const size_t bs[3],
 
 1400     int nFilterCoef = 1, 
int nLiftingCoef = 1, 
int msbFirst = 1,
 
 1401     int vdfVersion = VDF_VERSION
 
 1404     const size_t dim[3], 
const size_t bs[3], 
const vector <size_t> &cratios,
 
 1405     string wname, 
string wmode, 
int vdfVersion = VDF_VERSION
 
 1408  int _SetNumTimeSteps(
long value);
 
 1409  int _setVariableTypes(
 
 1411     const vector <string> &value,
 
 1412     const vector <string> &delete_tags
 
 1414  int _SetVariables(
XmlNode *node, 
long ts);
 
 1415  int _SetVariableNames(
 
 1417     const vector <string> &delete_tags,
 
 1418     const vector <string> &value
 
 1421  int _RecordUserDataTags(vector <string> &keys, 
const string &tag);
 
 1423 bool elementStartHandler(
ExpatParseMgr*, 
int depth , std::string& tag, 
const char **attr);
 
 1424 bool elementEndHandler(
ExpatParseMgr*, 
int depth , std::string& );
 
 1429  void _startElementHandler0(
ExpatParseMgr*,
const string &tag, 
const char **attrs);
 
 1430  void _startElementHandler1(
ExpatParseMgr*,
const string &tag, 
const char **attrs);
 
 1431  void _startElementHandler2(
ExpatParseMgr*,
const string &tag, 
const char **attrs);
 
 1432  void _startElementHandler3(
ExpatParseMgr*,
const string &tag, 
const char **attrs);
 
 1437  virtual int SetDefaults(); 
 
 1445 #endif  //  _MetadataVDC_h_ 
COMMON_API int StrCmpNoCase(const string &s, const string &t)
Case-insensitive string comparison.