Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Commit

Permalink
Small cleaning (#808)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Cornu authored Apr 28, 2022
1 parent 39f8fb7 commit d07bae0
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
1 change: 0 additions & 1 deletion coreneuron/apps/main1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,6 @@ extern "C" void mk_mech_init(int argc, char** argv) {
}

// reads mechanism information from bbcore_mech.dat

mk_mech((corenrn_param.datpath).c_str());
}

Expand Down
2 changes: 1 addition & 1 deletion coreneuron/io/nrn_filehandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ FileHandler::FileHandler(const std::string& filename)
this->open(filename);
}

bool FileHandler::file_exist(const std::string& filename) const {
bool FileHandler::file_exist(const std::string& filename) {
struct stat buffer;
return (stat(filename.c_str(), &buffer) == 0);
}
Expand Down
2 changes: 1 addition & 1 deletion coreneuron/io/nrn_filehandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class FileHandler {
return F.fail();
}

bool file_exist(const std::string& filename) const;
static bool file_exist(const std::string& filename);

/** nothing more to read */
bool eof();
Expand Down
8 changes: 6 additions & 2 deletions coreneuron/io/nrn_setup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,12 @@ inline void* phase_wrapper_w(NrnThread* nt, UserParams& userParams, bool in_memo
".dat";

// Avoid trying to open the gid_gap.dat file if it doesn't exist when there are no
// gap junctions in this gid
if (P == gap && !userParams.file_reader[i].file_exist(fname)) {
// gap junctions in this gid.
// Note that we still need to close `userParams.file_reader[i]`
// because files are opened in the order of `gid_1.dat`, `gid_2.dat` and `gid_gap.dat`.
// When we open next file, `gid_gap.dat` in this case, we are supposed to close the
// handle for `gid_2.dat` even though file doesn't exist.
if (P == gap && !FileHandler::file_exist(fname)) {
userParams.file_reader[i].close();
} else {
// if no file failed to open or not opened at all
Expand Down
2 changes: 1 addition & 1 deletion coreneuron/mechanism/mech/cfile/cabvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ static void (*mechanism[])(void) = {/* type will start at 3 */
/* extracellular requires special handling and must be type 5 */
extracell_reg_,
#endif
0};
nullptr};

} // namespace coreneuron
Empty file modified tests/integration/ring_gap/mod files/halfgap.mod
100755 → 100644
Empty file.

0 comments on commit d07bae0

Please sign in to comment.