Skip to content

Commit

Permalink
progress new bnd segment
Browse files Browse the repository at this point in the history
  • Loading branch information
CyprienBosserelle committed Apr 2, 2024
1 parent d3d4bf7 commit d022b3e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/Forcing.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ class bndsegmentside {
int* blk_g;
float* qmean;
float* qmean_g;
// 8 digit binary where 1 is a mask and 0 is not a mask with the first digit represent the left bottom side the rest is clockwise (i.e.left-bot left-top, top-left, top-right, right-top, right-bot, bot-right, bot-left)
//int* side; // e.g. 11000000 for the entire left side being a mask
};


Expand All @@ -126,8 +128,7 @@ class bndsegment {
int nbnd; // number of forcing bnds along the side (>=1 is side is on)
int nblk = 0; //number of blocks where this bnd applies

// 8 digit binary where 1 is a mask and 0 is not a mask with the first digit represent the left bottom side the rest is clockwise (i.e.left-bot left-top, top-left, top-right, right-top, right-bot, bot-right, bot-left)
int* side; // e.g. 11000000 for the entire left side being a mask



bndTexP GPU;
Expand Down
30 changes: 27 additions & 3 deletions src/ReadInput.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1541,9 +1541,9 @@ std::size_t case_insensitive_compare(std::string s1, std::vector<std::string> ve
}


bndparam readbndlineNew(std::string parametervalue)
bndsegment readbndlineside(std::string parametervalue)
{
bndparam bnd;
bndsegment bnd;

std::vector<std::string> items = split(parametervalue, ',');

Expand All @@ -1552,7 +1552,27 @@ bndparam readbndlineNew(std::string parametervalue)
bnd.type = std::stoi(items[0]);

}

else if (items.size() >= 2)
{
const char* cstr = items[1].c_str();
if (items[1].length() < 2)
{
if (!isdigit(cstr[0]))
{
// Error
//exit?
}
bnd.type = std::stoi(items[1]);
bnd.inputfile = items[0];
bnd.on = true;
}
else
{
bnd.type = std::stoi(items[0]);
bnd.inputfile = items[1];
bnd.on = true;
}
}
return bnd;
}

Expand Down Expand Up @@ -1608,3 +1628,7 @@ bool readparambool(std::string paramstr,bool defaultval)
return out;
}

inline bool fileexists(const std::string& name) {
struct stat buffer;
return (stat(name.c_str(), &buffer) == 0);
}
2 changes: 2 additions & 0 deletions src/ReadInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@ std::size_t case_insensitive_compare(std::string s1, std::vector<std::string> ve
bool readparambool(std::string paramstr, bool defaultval);
bndparam readbndline(std::string parametervalue);

inline bool fileexists(const std::string& name)

// End of global definition
#endif

0 comments on commit d022b3e

Please sign in to comment.