17 #include <deal.II/base/path_search.h> 18 #include <deal.II/base/logstream.h> 19 #include <deal.II/base/utilities.h> 25 DEAL_II_NAMESPACE_OPEN
35 std::vector<std::string> v;
46 v.push_back(std::string(
".prm"));
59 v.push_back(std::string(
".inp"));
60 v.push_back(std::string(
".xda"));
61 v.push_back(std::string(
".dbmesh"));
62 v.push_back(std::string(
".dat"));
63 v.push_back(std::string(
".plt"));
64 v.push_back(std::string(
".nc"));
65 v.push_back(std::string(
".msh"));
69 std::vector<std::string> &
85 std::vector<std::string> &
102 const unsigned int debug)
105 my_path_list(get_path_list(cls)),
106 my_suffix_list(get_suffix_list(cls)),
113 const std::string &suffix,
114 const char *open_mode)
116 std::vector<std::string>::const_iterator path;
117 const std::vector<std::string>::const_iterator endp =
my_path_list.end();
119 std::string real_name;
122 deallog <<
"PathSearch[" <<
cls <<
"] " 133 real_name = *path + filename;
135 deallog <<
"PathSearch[" <<
cls <<
"] trying " 136 << real_name << std::endl;
137 FILE *fp = fopen(real_name.c_str(), open_mode);
141 deallog <<
"PathSearch[" <<
cls <<
"] opened " 142 << real_name << std::endl;
152 real_name = *path + filename + suffix;
154 deallog <<
"PathSearch[" <<
cls <<
"] trying " 155 << real_name << std::endl;
156 FILE *fp = fopen(real_name.c_str(), open_mode);
160 deallog <<
"PathSearch[" <<
cls <<
"] opened " 161 << real_name << std::endl;
168 return std::string(
"");
173 const char *open_mode)
175 std::vector<std::string>::const_iterator suffix;
176 const std::vector<std::string>::const_iterator ends =
my_suffix_list.end();
179 deallog <<
"PathSearch[" <<
cls <<
"] " 188 return find(filename, *suffix, open_mode);
197 return std::string(
"");
210 std::vector<std::string> v;
223 else if (pos ==
front)
227 std::vector<std::string>::iterator
242 else if (pos ==
front)
246 std::vector<std::string>::iterator
256 DEAL_II_NAMESPACE_CLOSE
Add in path list after empty element.
static std::map< std::string, std::vector< std::string > > path_lists
static void add_class(const std::string &cls)
void add_path(const std::string &path, Position pos=back)
#define AssertThrow(cond, exc)
static std::map< std::string, std::vector< std::string > > suffix_lists
static std::vector< std::string > & get_suffix_list(const std::string &cls)
Add new item at end of list.
std::vector< std::string > & my_suffix_list
static ::ExceptionBase & ExcFileNotFound(std::string arg1, std::string arg2)
static void initialize_classes()
std::vector< std::string > & my_path_list
#define Assert(cond, exc)
std::string find(const std::string &filename, const char *open_mode="r")
std::map< std::string, std::vector< std::string > >::value_type map_type
static std::vector< std::string > & get_path_list(const std::string &cls)
void add_suffix(const std::string &suffix, Position pos=back)
PathSearch(const std::string &cls, const unsigned int debug=0)
Add new item at front of list.
static ::ExceptionBase & ExcInternalError()