Skip to content

Commit

Permalink
improvement in input file, when reading simulation time
Browse files Browse the repository at this point in the history
  • Loading branch information
fabricix committed Sep 14, 2024
1 parent c1c4e74 commit 990ad43
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
25 changes: 10 additions & 15 deletions src/Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,17 @@ namespace Input {
}
}

inline const json& Input::getJson() {
inline const json& Input::getJson( ) { return inputFile; }

return inputFile;
}

inline string Input::getFileName() {

return inputFileName;
}
inline string Input::getFileName( ) { return inputFileName; }

void Input::readInputFile(string filename) {


try{
// configures the input file
inputFileName = filename;

if (inputFileName!=""){
if ( inputFileName != "" ) {

// read the file
ifstream i(inputFileName);
Expand All @@ -91,24 +84,26 @@ void Input::readInputFile(string filename) {
}
catch(...)
{
Warning::printMessage("Error in input file name");
Warning::printMessage("Was not possible read the file,\nplease check the input file name...");
throw;
}
}

double Input::getSimulationTime(){

try{
if(inputFile["time"].is_number()) {

return inputFile["time"];
double time = get_number(inputFile,"time",0);

if(time>0)
{
return time;
}
else
throw(0);
}
catch(...)
{
Warning::printMessage("Error in input file name");
Warning::printMessage("Simulation time must be greater than zero");
throw;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace ModelSetup {
bool gravityActive=false; //!< is gravity active

// gravity dafault value
Vector3d gravity(0,0,-9.81); //!< gravity vector
Vector3d gravity(0,0,-10); //!< gravity vector

// axisymmetric model
bool axisymetricActive=false; //!< is axisymmetric model
Expand Down

0 comments on commit 990ad43

Please sign in to comment.