mirror of
https://git.gfz-potsdam.de/naaice/tug.git
synced 2025-12-13 09:28:23 +01:00
implemented Boundary
This commit is contained in:
parent
01a589889f
commit
da65be3cca
@ -39,7 +39,7 @@ class Boundary {
|
||||
* @param side
|
||||
* @param values
|
||||
*/
|
||||
void setBoundaryConditionValue(BC_SIDE side, VectorXd values);
|
||||
void setBoundaryConditionValue(BC_SIDE side, VectorXd &values);
|
||||
|
||||
/**
|
||||
* @brief Get the Boundary Condition Value object
|
||||
@ -51,7 +51,6 @@ class Boundary {
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Grid grid;
|
||||
BC_TYPE type;
|
||||
VectorXd left, right, top, bottom;
|
||||
|
||||
@ -51,9 +51,9 @@ class Grid {
|
||||
|
||||
int getDim();
|
||||
|
||||
auto getRow();
|
||||
int getRow();
|
||||
|
||||
auto getCol();
|
||||
int getCol();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
#include <iostream>
|
||||
#include <tug/Boundary.hpp>
|
||||
#include <stdexcept>
|
||||
|
||||
@ -11,10 +12,55 @@ Boundary::Boundary(Grid &grid, BC_TYPE type) : grid(grid) {
|
||||
this->left = VectorXd::Constant(1, 1, 1);
|
||||
this->right = VectorXd::Constant(1, 1, 1);
|
||||
} else if (grid.getDim() == 2) {
|
||||
this->left = VectorXd::Constant(1, 1, 1);
|
||||
this->right = VectorXd::Constant(1, 1, 1);
|
||||
this->left = VectorXd::Constant(grid.getRow(), 1, 1);
|
||||
this->right = VectorXd::Constant(grid.getRow(), 1, 1);
|
||||
this->top = VectorXd::Constant(1, grid.getCol(), 1);
|
||||
this->bottom = VectorXd::Constant(1, grid.getCol(), 1);
|
||||
} else {
|
||||
throw invalid_argument("Dimension must be 1 or 2!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto Boundary::getBoundaryConditionType() {
|
||||
return this->type;
|
||||
}
|
||||
|
||||
void Boundary::setBoundaryConditionValue(BC_SIDE side, VectorXd &values) {
|
||||
if (type != BC_TYPE_CONSTANT) {
|
||||
// TODO check if correct way for handling warning
|
||||
cerr << "Values will not be used, wrong BC_TYPE!";
|
||||
}
|
||||
|
||||
switch (side) {
|
||||
case BC_SIDE_LEFT:
|
||||
this->left = values;
|
||||
break;
|
||||
case BC_SIDE_RIGHT:
|
||||
this->right = values;
|
||||
break;
|
||||
case BC_SIDE_TOP:
|
||||
this->top = values;
|
||||
break;
|
||||
case BC_SIDE_BOTTOM:
|
||||
this->bottom = values;
|
||||
break;
|
||||
default:
|
||||
throw invalid_argument("Invalid side given!");
|
||||
}
|
||||
}
|
||||
|
||||
auto Boundary::getBoundaryConditionValue(BC_SIDE side) {
|
||||
switch (side) {
|
||||
case BC_SIDE_LEFT:
|
||||
return this->left;
|
||||
case BC_SIDE_RIGHT:
|
||||
return this->right;
|
||||
case BC_SIDE_TOP:
|
||||
return this->top;
|
||||
case BC_SIDE_BOTTOM:
|
||||
return this->bottom;
|
||||
default:
|
||||
throw invalid_argument("Invalid side given!");
|
||||
}
|
||||
}
|
||||
@ -39,10 +39,10 @@ int Grid::getDim() {
|
||||
return dim;
|
||||
}
|
||||
|
||||
auto Grid::getRow() {
|
||||
int Grid::getRow() {
|
||||
return row;
|
||||
}
|
||||
|
||||
auto Grid::getCol() {
|
||||
int Grid::getCol() {
|
||||
return col;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user