Skip to content

Commit

Permalink
PDEBase exposes set_dirichlet_bc() to let imposition of boundary cond…
Browse files Browse the repository at this point in the history
…itions after PDE pointer creation
  • Loading branch information
AlePalu committed Sep 14, 2023
1 parent 7e088d4 commit 6dc597a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fdaPDE/pde/pde.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ struct PDEBase {
virtual DMatrix<double> quadrature_nodes() const = 0;
virtual void init() = 0;
virtual void solve() = 0;
virtual void set_dirichlet_bc(const DMatrix<double>&) = 0;
};
typedef std::shared_ptr<PDEBase> pde_ptr;

Expand Down Expand Up @@ -70,14 +71,15 @@ class PDE : public PDEBase {

// minimal constructor, use below setters to complete the construction of a PDE object
PDE(const D& domain) : domain_(domain) { }
PDE(const D& domain, E diff_op) : domain_(domain), diff_op_(diff_op) { };
void set_forcing(const F& forcing_data) { forcing_data_ = forcing_data; }
void set_differential_operator(E diff_op) { diff_op_ = diff_op; }
// full constructors
PDE(const D& domain, E diff_op, const F& forcing_data) :
domain_(domain), diff_op_(diff_op), forcing_data_(forcing_data) { }

// setters
void set_dirichlet_bc(const DMatrix<double>& data) {
virtual void set_dirichlet_bc(const DMatrix<double>& data) {
for (auto it = domain_.boundary_begin(); it != domain_.boundary_end(); ++it) {
boundary_data_[*it] = data.row(*it); // O(1) complexity
}
Expand Down

0 comments on commit 6dc597a

Please sign in to comment.