add user input validation

This commit is contained in:
Hannes Signer 2023-08-04 15:39:02 +02:00
parent 2c2851a037
commit 154091e405
2 changed files with 10 additions and 21 deletions

View File

@ -1,3 +1,9 @@
/**
* @file Boundary.hpp
* @brief
*
*
*/
#ifndef BOUNDARY_H_
#define BOUNDARY_H_
@ -43,7 +49,7 @@ class BoundaryElement {
* @param value Value of the constant concentration to be assumed at the
* corresponding boundary element.
*/
BoundaryElement(double value); // TODO negative concentration allowed?
BoundaryElement(double value);
/**
* @brief Allows changing the boundary type of a corresponding
@ -84,26 +90,6 @@ class BoundaryElement {
};
// TODO can be deleted?
// class BoundaryWall {
// public:
// BoundaryWall(int length);
// void setWall(BC_TYPE type, double value = NAN);
// vector<BoundaryElement> getWall();
// void setBoundaryElement(int index, BC_TYPE type, double value = NAN);
// BoundaryElement getBoundaryElement();
// private:
// BC_SIDE side;
// int length;
// vector<BoundaryElement> wall;
// };
/**
* This class implements the functionality and management of the boundary
* conditions in the grid to be simulated.

View File

@ -23,6 +23,9 @@ void BoundaryElement::setType(BC_TYPE type) {
}
void BoundaryElement::setValue(double value) {
if(value < 0){
throw_invalid_argument("No negative concentration allowed.");
}
this->value = value;
}