Merge branch 'hotfix-domain-size' into 'hannes-philipp'

fix!: domain size can also be real number

See merge request naaice/tug!15
This commit is contained in:
Max Lübke 2023-09-06 09:18:51 +02:00
commit 55509c1934
2 changed files with 10 additions and 10 deletions

View File

@ -121,17 +121,17 @@ class Grid {
/**
* @brief Sets the domain length of a 1D-Grid. Grid must be one dimensional.
*
* @param domainLength An integer of the domain length. Must be positive.
* @param domainLength A double value of the domain length. Must be positive.
*/
void setDomain(int domainLength);
void setDomain(double domainLength);
/**
* @brief Sets the domain size of a 2D-Grid. Grid must be two dimensional.
*
* @param domainRow An integer of the domain size in y-direction. Must be positive.
* @param domainCol An integer of the domain size in x-direction. Must be positive.
* @param domainRow A double value of the domain size in y-direction. Must be positive.
* @param domainCol A double value of the domain size in x-direction. Must be positive.
*/
void setDomain(int domainRow, int domainCol);
void setDomain(double domainRow,double domainCol);
/**
* @brief Gets the delta value for 1D-Grid. Grid must be one dimensional.
@ -160,12 +160,12 @@ class Grid {
int col; // number of grid columns
int row; // number of grid rows
int dim; // 1D or 2D
int domainCol; // number of domain columns
int domainRow; // number of domain rows
double domainCol; // number of domain columns
double domainRow; // number of domain rows
double deltaCol; // delta in x-direction (between columns)
double deltaRow; // delta in y-direction (between rows)
MatrixXd concentrations; // Matrix holding grid concentrations
MatrixXd alphaX; // Matrix holding alpha coefficients in x-direction
MatrixXd alphaY; // Matrix holding alpha coefficients in y-direction
};
};

View File

@ -117,7 +117,7 @@ int Grid::getCol() {
return col;
}
void Grid::setDomain(int domainLength) {
void Grid::setDomain(double domainLength) {
if (dim != 1) {
throw_invalid_argument("Grid is not one dimensional, you should probaly use the 2D domain setter!");
}
@ -129,7 +129,7 @@ void Grid::setDomain(int domainLength) {
this->deltaCol = double(this->domainCol)/double(this->col);
}
void Grid::setDomain(int domainRow, int domainCol) {
void Grid::setDomain(double domainRow, double domainCol) {
if (dim != 2) {
throw_invalid_argument("Grid is not two dimensional, you should probably use the 1D domain setter!");
}