diff --git a/apps/showcases/ChargedParticles/poisson_solver/ApplyPotentialValidationBoundaryConditions.h b/apps/showcases/ChargedParticles/poisson_solver/ApplyPotentialValidationBoundaryConditions.h index 0fe32b43e5d2516a689edac6f5a51cbb4f03e7e1..5eb2be600eea10e723d7cbda26b05e18264be210 100644 --- a/apps/showcases/ChargedParticles/poisson_solver/ApplyPotentialValidationBoundaryConditions.h +++ b/apps/showcases/ChargedParticles/poisson_solver/ApplyPotentialValidationBoundaryConditions.h @@ -52,14 +52,14 @@ void applyPotentialBoundaryValue(IBlock* block, PdeField* p, const CellInterval& } funcVal = real_c(0); - if (e.getType() == "Dirichlet") { + if (e.isDirichletType()) { real_t distance = real_c(std::sqrt(pow((boundaryCoord_x - domainAABB.center()[0]), 2) + pow((boundaryCoord_y - domainAABB.center()[1]), 2) + pow((boundaryCoord_z - domainAABB.center()[2]), 2))); funcVal = (charge / (4 * math::pi * epsilon * distance)); p->get(x, y, z) = real_c(2) * funcVal - p->get(x + cx, y + cy, z + cz); - } else if (e.getType() == "Neumann") { + } else if (e.isNeumannType()) { funcVal = e.getValue(); if (isIdentical(funcVal, real_t(0))) diff --git a/apps/showcases/ChargedParticles/poisson_solver/BoundaryCondition.h b/apps/showcases/ChargedParticles/poisson_solver/BoundaryCondition.h index 29bd9f25ff11610ec3d677a3b75f6e882111a9b3..77df9ec0366278d359152163b146ba4fc70baa1b 100644 --- a/apps/showcases/ChargedParticles/poisson_solver/BoundaryCondition.h +++ b/apps/showcases/ChargedParticles/poisson_solver/BoundaryCondition.h @@ -10,6 +10,10 @@ public: std::string getType() { return type_; } + bool isDirichletType() { return getType() == "Dirichlet"; } + + bool isNeumannType() { return getType() == "Neumann"; } + real_t getValue() { return value_; } BoundaryCondition(stencil::Direction direction, std::string type, real_t value) diff --git a/apps/showcases/ChargedParticles/poisson_solver/DirichletDomainBoundary.h b/apps/showcases/ChargedParticles/poisson_solver/DirichletDomainBoundary.h index 9156d6c1bdc8da47ef46d8b9f986c1b4b291f638..3ab73bf8a5c1be8a21b5f35100bb1d249a6953c1 100644 --- a/apps/showcases/ChargedParticles/poisson_solver/DirichletDomainBoundary.h +++ b/apps/showcases/ChargedParticles/poisson_solver/DirichletDomainBoundary.h @@ -18,7 +18,7 @@ class DirichletDomainBoundary for (auto e : boundaryConditions) { - if (e.getType() == "Neumann") { this->excludeBoundary(e.getDirection()); } // swap conditions + if (e.isNeumannType()) { this->excludeBoundary(e.getDirection()); } // swap conditions else { this->includeBoundary(e.getDirection()); diff --git a/apps/showcases/ChargedParticles/poisson_solver/Neumann.h b/apps/showcases/ChargedParticles/poisson_solver/Neumann.h index d102aad87d75e379e319962f4c9f7547270f03aa..b441c35fa7ec161bb12b08cad8f55dd5a81a24df 100644 --- a/apps/showcases/ChargedParticles/poisson_solver/Neumann.h +++ b/apps/showcases/ChargedParticles/poisson_solver/Neumann.h @@ -72,7 +72,7 @@ class NeumannDomainBoundary for (auto e : boundaryConditions) { - if (e.getType() == "Dirichlet") { this->excludeBoundary(e.getDirection()); } // swap condtions + if (e.isDirichletType()) { this->excludeBoundary(e.getDirection()); } // swap condtions else { this->includeBoundary(e.getDirection()); diff --git a/apps/showcases/ChargedParticles/poisson_solver/PotentialValidationCustomBoundary.h b/apps/showcases/ChargedParticles/poisson_solver/PotentialValidationCustomBoundary.h index bdec79a051c81c36d136853b7c695c5ed238b719..b0eee9fff5d3c2f3376c2163c33ea3727968e7bb 100644 --- a/apps/showcases/ChargedParticles/poisson_solver/PotentialValidationCustomBoundary.h +++ b/apps/showcases/ChargedParticles/poisson_solver/PotentialValidationCustomBoundary.h @@ -23,7 +23,7 @@ class PotentialCustomBoundary this->includeBoundary(e.getDirection()); this->setValue(e.getDirection(), e.getValue()); - if (e.getType() == "Neumann") + if (e.isNeumannType()) { if (e.getDirection() == stencil::E) { dx_[stencil::D3Q6::idx[stencil::E]] = blocks.dx(); } else if (e.getDirection() == stencil::W) { dx_[stencil::D3Q6::idx[stencil::W]] = blocks.dx(); } @@ -81,7 +81,7 @@ class PotentialCustomBoundary const cell_idx_t cy, const cell_idx_t cz, BoundaryCondition& e, StructuredBlockStorage& blocks, const math::AABB& domainAABB, const real_t charge, const real_t epsilon) { - if (e.getType() == "Neumann") + if (e.isNeumannType()) { dx_[stencil::D3Q6::idx[stencil::E]] = blocks.dx(); dx_[stencil::D3Q6::idx[stencil::W]] = blocks.dx();