]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add function to generate a base name usefull to determine the regression test directory
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 20 Sep 2010 16:52:02 +0000 (16:52 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 20 Sep 2010 16:52:02 +0000 (16:52 +0000)
git-svn-id: https://svn.dealii.org/trunk@22087 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/job_identifier.h
deal.II/base/source/job_identifier.cc

index abb7fb3761770818735acb351a6a06c59cdc888e..1a37b4b78e5bd4fb4bdcfd6933908781482ade62 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2010 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -55,6 +55,20 @@ class JobIdentifier
                                      */
     static const char* program_id();
 
+                                    /**
+                                     * Obtain the base name of the
+                                     * file currently being
+                                     * compiled. That is, if the file
+                                     * is <tt>mypath/file.cc</tt>
+                                     * return just
+                                     * <tt>file</tt>. Typically, this
+                                     * can be called from a program
+                                     * with the argument
+                                     * <tt>__FILE__</tt> and is uded
+                                     * in the deal.II test suite.
+                                     */
+    static std::string base_name(const char* filename);
+    
                                     /**
                                      * Return the value of <tt>id</tt>.
                                      */
index 371eaa39166f5885eeb747ae182f19c293395e61..98e1152a696072d3e705e1366aaf2805974860ed 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2009 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2009, 2010 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -48,4 +48,19 @@ JobIdentifier::operator ()() const
   return id;
 }
 
+
+std::string
+JobIdentifier::base_name(const char* filename)
+{
+  std::string name(filename);
+  std::string::size_type pos = name.find(".");
+  name.erase(pos, name.size());
+  pos = name.rfind("/");
+  if (pos < name.size())
+    name.erase(0,pos);
+  return name;
+}
+
+
+
 DEAL_II_NAMESPACE_CLOSE

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.