[Commits] [svn:einsteintoolkit] incoming/PITTNullCode/SphericalHarmonicReconGen/src/ (Rev. 106)

rhaas at tapir.caltech.edu rhaas at tapir.caltech.edu
Fri Dec 27 16:16:05 CST 2013


User: rhaas
Date: 2013/12/27 04:16 PM

Modified:
 /PITTNullCode/SphericalHarmonicReconGen/src/
  startup.cc

Log:
 accept path parameter with or without trailing "/"

File Changes:

Directory: /PITTNullCode/SphericalHarmonicReconGen/src/
=======================================================

File [modified]: startup.cc
Delta lines: +14 -8
===================================================================
--- PITTNullCode/SphericalHarmonicReconGen/src/startup.cc	2013-12-27 22:13:16 UTC (rev 105)
+++ PITTNullCode/SphericalHarmonicReconGen/src/startup.cc	2013-12-27 22:16:05 UTC (rev 106)
@@ -66,8 +66,7 @@
    
    // open database, i.e. scan input file containing the harmonic coefficients
    CCTK_INFO("Opening and scanning file containing harmonic coefficients for the Cauchy variables.");
-   string pathname = path;
-   CCTK_INFO(string(string("Trying to open ASCII files in ")+pathname).c_str());
+   CCTK_VInfo(CCTK_THORNSTRING,"Trying to open ASCII files in \"%s\".", path);
    
    // get all different databases-names
    vector<string> fnames;
@@ -122,17 +121,24 @@
       }
       if (found < 0)
       {
-         CCTK_INFO(string(string("Parsing ")+pathname+fnames[i]).c_str());
+         string fullname = path;
+         if (!fullname.empty() && fullname[fullname.size()-1] != '/') {
+            // an empty string means that the filenames contain full paths
+            fullname.append("/");
+         }
+         fullname.append(fnames[i]);
+
+         CCTK_VInfo(CCTK_THORNSTRING, "Parsing %s", fullname.c_str());
          if (CCTK_EQUALS(format, "ASCII"))
-            SHR::db[i] = new SHR::SPH_db_ASCII(pathname+fnames[i], verbose, cached_timesteps+1, column_time, column_iteration, column_radius);
+            SHR::db[i] = new SHR::SPH_db_ASCII(fullname, verbose, cached_timesteps+1, column_time, column_iteration, column_radius);
          if (CCTK_EQUALS(format, "DAT"))
-            SHR::db[i] = new SHR::SPH_db_DAT(pathname+fnames[i], verbose, cached_timesteps+1, lmaxInFile, column_time, column_iteration, column_radius, column_lmax, column_n_variables, column_data, false);
+            SHR::db[i] = new SHR::SPH_db_DAT(fullname, verbose, cached_timesteps+1, lmaxInFile, column_time, column_iteration, column_radius, column_lmax, column_n_variables, column_data, false);
          if (CCTK_EQUALS(format, "DAT-v2"))
-            SHR::db[i] = new SHR::SPH_db_DAT(pathname+fnames[i], verbose, cached_timesteps+1, lmaxInFile, column_time, column_iteration, column_radius, column_lmax, column_n_variables, column_data, true);
+            SHR::db[i] = new SHR::SPH_db_DAT(fullname, verbose, cached_timesteps+1, lmaxInFile, column_time, column_iteration, column_radius, column_lmax, column_n_variables, column_data, true);
          if (CCTK_EQUALS(format, "SpEC-H5"))
-            SHR::db[i] = new SHR::SPH_db_SpEC_H5(pathname+fnames[i], verbose, cached_timesteps+1);
+            SHR::db[i] = new SHR::SPH_db_SpEC_H5(fullname, verbose, cached_timesteps+1);
          if (CCTK_EQUALS(format, "SpEC-H5-v2"))
-            SHR::db[i] = new SHR::SPH_db_SpEC_H5_v2(pathname+fnames[i], verbose, cached_timesteps+1);
+            SHR::db[i] = new SHR::SPH_db_SpEC_H5_v2(fullname, verbose, cached_timesteps+1);
          
          // check if timestep-size found in file matches characteristic timestep!
          if (fabs(SHR::db[i]->delta_t()-CCTK_DELTA_TIME) > 1e-8)



More information about the Commits mailing list