mirror of
https://git.gfz-potsdam.de/naaice/tug.git
synced 2025-12-14 01:48:23 +01:00
Replace copying of output vector by oneliner
This commit is contained in:
parent
f4253f2e6a
commit
8de34ad65b
@ -70,7 +70,8 @@ void BTCSDiffusion::updateInternals() {
|
|||||||
bc.resize(cells, {BTCSDiffusion::BC_CLOSED, 0});
|
bc.resize(cells, {BTCSDiffusion::BC_CLOSED, 0});
|
||||||
}
|
}
|
||||||
|
|
||||||
void BTCSDiffusion::simulate1D(Eigen::Map<Eigen::VectorXd> &c, boundary_condition left,
|
void BTCSDiffusion::simulate1D(Eigen::Map<Eigen::VectorXd> &c,
|
||||||
|
boundary_condition left,
|
||||||
boundary_condition right,
|
boundary_condition right,
|
||||||
const std::vector<double> &alpha, double dx,
|
const std::vector<double> &alpha, double dx,
|
||||||
int size) {
|
int size) {
|
||||||
@ -80,8 +81,8 @@ void BTCSDiffusion::simulate1D(Eigen::Map<Eigen::VectorXd> &c, boundary_conditio
|
|||||||
|
|
||||||
// The sizes for matrix and vectors of the equation system is defined by the
|
// The sizes for matrix and vectors of the equation system is defined by the
|
||||||
// actual size of the input vector and if the system is (partially) closed.
|
// actual size of the input vector and if the system is (partially) closed.
|
||||||
//Then we will need ghost nodes. So this variable will give the count of ghost
|
// Then we will need ghost nodes. So this variable will give the count of
|
||||||
//nodes.
|
// ghost nodes.
|
||||||
int bc_offset = !left_is_constant + !right_is_constant;
|
int bc_offset = !left_is_constant + !right_is_constant;
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -140,10 +141,8 @@ void BTCSDiffusion::simulate1D(Eigen::Map<Eigen::VectorXd> &c, boundary_conditio
|
|||||||
|
|
||||||
x_vector = solver.solve(b_vector);
|
x_vector = solver.solve(b_vector);
|
||||||
|
|
||||||
//fill solution back in place into =c= vector
|
// write back result to input/output vector
|
||||||
for (int i = 0, j = i + !left_is_constant; i < c.size(); i++, j++) {
|
c = x_vector.segment(!left_is_constant, c.size());
|
||||||
c[i] = x_vector[i + !left_is_constant];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BTCSDiffusion::setTimestep(double time_step) {
|
void BTCSDiffusion::setTimestep(double time_step) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user