PolyFEM
Loading...
Searching...
No Matches
polyfem::assembler::GenericScalarProblem Class Reference

#include <GenericProblem.hpp>

Inheritance diagram for polyfem::assembler::GenericScalarProblem:
[legend]
Collaboration diagram for polyfem::assembler::GenericScalarProblem:
[legend]

Public Member Functions

 GenericScalarProblem (const std::string &name)
 
void set_units (const assembler::Assembler &assembler, const Units &units) override
 
void rhs (const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
 
bool is_rhs_zero () const override
 
void dirichlet_bc (const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
 
void neumann_bc (const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const Eigen::MatrixXd &normals, const double t, Eigen::MatrixXd &val) const override
 
void initial_solution (const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const override
 
void dirichlet_nodal_value (const mesh::Mesh &mesh, const int node_id, const RowVectorNd &pt, const double t, Eigen::MatrixXd &val) const override
 
void neumann_nodal_value (const mesh::Mesh &mesh, const int node_id, const RowVectorNd &pt, const Eigen::MatrixXd &normal, const double t, Eigen::MatrixXd &val) const override
 
bool is_nodal_dirichlet_boundary (const int n_id, const int tag) override
 
bool is_nodal_neumann_boundary (const int n_id, const int tag) override
 
bool has_nodal_dirichlet () override
 
bool has_nodal_neumann () override
 
void update_nodes (const Eigen::VectorXi &in_node_to_node) override
 
bool has_exact_sol () const override
 
bool is_scalar () const override
 
bool is_time_dependent () const override
 
void set_time_dependent (const bool val)
 
bool is_constant_in_time () const override
 
bool might_have_no_dirichlet () override
 
void set_parameters (const json &params) override
 
void exact (const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
 
void exact_grad (const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
 
void add_dirichlet_boundary (const int id, const double val, const std::shared_ptr< utils::Interpolation > &interp=std::make_shared< utils::NoInterpolation >())
 
void add_neumann_boundary (const int id, const double val, const std::shared_ptr< utils::Interpolation > &interp=std::make_shared< utils::NoInterpolation >())
 
void update_dirichlet_boundary (const int id, const double val, const std::shared_ptr< utils::Interpolation > &interp=std::make_shared< utils::NoInterpolation >())
 
void update_neumann_boundary (const int id, const double val, const std::shared_ptr< utils::Interpolation > &interp=std::make_shared< utils::NoInterpolation >())
 
void add_dirichlet_boundary (const int id, const std::function< double(double x, double y, double z, double t)> &func, const std::shared_ptr< utils::Interpolation > &interp=std::make_shared< utils::NoInterpolation >())
 
void add_neumann_boundary (const int id, const std::function< double(double x, double y, double z, double t)> &func, const std::shared_ptr< utils::Interpolation > &interp=std::make_shared< utils::NoInterpolation >())
 
void update_dirichlet_boundary (const int id, const std::function< double(double x, double y, double z, double t)> &func, const std::shared_ptr< utils::Interpolation > &interp=std::make_shared< utils::NoInterpolation >())
 
void update_neumann_boundary (const int id, const std::function< double(double x, double y, double z, double t)> &func, const std::shared_ptr< utils::Interpolation > &interp=std::make_shared< utils::NoInterpolation >())
 
void add_dirichlet_boundary (const int id, const json &val, const std::string &interp="")
 
void add_neumann_boundary (const int id, const json &val, const std::string &interp="")
 
void update_dirichlet_boundary (const int id, const json &val, const std::string &interp="")
 
void update_neumann_boundary (const int id, const json &val, const std::string &interp="")
 
void clear () override
 
- Public Member Functions inherited from polyfem::assembler::Problem
 Problem (const std::string &name)
 
virtual ~Problem ()
 
virtual void init (const mesh::Mesh &mesh)
 
const std::string & name () const
 
virtual void pressure_bc (const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const Eigen::MatrixXd &normals, const double t, Eigen::MatrixXd &val) const
 
virtual double pressure_cavity_bc (const int boundary_id, const double t) const
 
virtual bool is_boundary_pressure (const int boundary_id) const
 
virtual void initial_velocity (const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const
 
virtual void initial_acceleration (const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const
 
virtual void initial_density (const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const
 
virtual bool is_dimension_dirichet (const int tag, const int dim) const
 
virtual bool is_nodal_dimension_dirichlet (const int n_id, const int tag, const int dim) const
 
virtual bool all_dimensions_dirichlet () const
 
void setup_bc (const mesh::Mesh &mesh, const int n_bases, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &geom_bases, const std::vector< basis::ElementBases > &pressure_bases, std::vector< mesh::LocalBoundary > &local_boundary, std::vector< int > &boundary_nodes, std::vector< mesh::LocalBoundary > &local_neumann_boundary, std::vector< mesh::LocalBoundary > &local_pressure_boundary, std::unordered_map< int, std::vector< mesh::LocalBoundary > > &local_pressure_cavity, std::vector< int > &pressure_boundary_nodes, std::vector< int > &dirichlet_nodes, std::vector< int > &neumann_nodes)
 

Private Attributes

std::vector< ScalarBCValueneumann_
 
std::vector< ScalarBCValuedirichlet_
 
std::vector< std::pair< int, utils::ExpressionValue > > initial_solution_
 
std::map< int, ScalarBCValuenodal_dirichlet_
 
std::map< int, ScalarBCValuenodal_neumann_
 
std::vector< Eigen::MatrixXd > nodal_dirichlet_mat_
 
utils::ExpressionValue rhs_
 
utils::ExpressionValue exact_
 
std::array< utils::ExpressionValue, 3 > exact_grad_
 
bool is_all_
 
bool has_exact_ = false
 
bool has_exact_grad_ = false
 
bool is_time_dept_ = false
 

Additional Inherited Members

- Protected Attributes inherited from polyfem::assembler::Problem
std::vector< int > boundary_ids_
 
std::vector< int > neumann_boundary_ids_
 
std::vector< int > normal_aligned_neumann_boundary_ids_
 
std::vector< int > pressure_boundary_ids_
 
std::vector< int > pressure_cavity_ids_
 
std::vector< int > splitting_pressure_boundary_ids_
 

Detailed Description

Definition at line 151 of file GenericProblem.hpp.

Constructor & Destructor Documentation

◆ GenericScalarProblem()

polyfem::assembler::GenericScalarProblem::GenericScalarProblem ( const std::string &  name)

Definition at line 1183 of file GenericProblem.cpp.

Member Function Documentation

◆ add_dirichlet_boundary() [1/3]

void polyfem::assembler::GenericScalarProblem::add_dirichlet_boundary ( const int  id,
const double  val,
const std::shared_ptr< utils::Interpolation > &  interp = std::make_shared< utils::NoInterpolation >() 
)

◆ add_dirichlet_boundary() [2/3]

void polyfem::assembler::GenericScalarProblem::add_dirichlet_boundary ( const int  id,
const json val,
const std::string &  interp = "" 
)

Definition at line 1666 of file GenericProblem.cpp.

References polyfem::assembler::Problem::boundary_ids_, polyfem::utils::Interpolation::build(), dirichlet_, and val.

Here is the call graph for this function:

◆ add_dirichlet_boundary() [3/3]

void polyfem::assembler::GenericScalarProblem::add_dirichlet_boundary ( const int  id,
const std::function< double(double x, double y, double z, double t)> &  func,
const std::shared_ptr< utils::Interpolation > &  interp = std::make_shared< utils::NoInterpolation >() 
)

◆ add_neumann_boundary() [1/3]

void polyfem::assembler::GenericScalarProblem::add_neumann_boundary ( const int  id,
const double  val,
const std::shared_ptr< utils::Interpolation > &  interp = std::make_shared< utils::NoInterpolation >() 
)

◆ add_neumann_boundary() [2/3]

void polyfem::assembler::GenericScalarProblem::add_neumann_boundary ( const int  id,
const json val,
const std::string &  interp = "" 
)

Definition at line 1677 of file GenericProblem.cpp.

References polyfem::utils::Interpolation::build(), neumann_, polyfem::assembler::Problem::neumann_boundary_ids_, and val.

Here is the call graph for this function:

◆ add_neumann_boundary() [3/3]

void polyfem::assembler::GenericScalarProblem::add_neumann_boundary ( const int  id,
const std::function< double(double x, double y, double z, double t)> &  func,
const std::shared_ptr< utils::Interpolation > &  interp = std::make_shared< utils::NoInterpolation >() 
)

◆ clear()

void polyfem::assembler::GenericScalarProblem::clear ( )
overridevirtual

Reimplemented from polyfem::assembler::Problem.

Definition at line 1734 of file GenericProblem.cpp.

References polyfem::utils::ExpressionValue::clear(), clear(), dirichlet_, exact_, exact_grad_, has_exact_, has_exact_grad_, is_all_, is_time_dept_, neumann_, nodal_dirichlet_, nodal_dirichlet_mat_, nodal_neumann_, and rhs_.

Referenced by clear().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dirichlet_bc()

void polyfem::assembler::GenericScalarProblem::dirichlet_bc ( const mesh::Mesh mesh,
const Eigen::MatrixXi &  global_ids,
const Eigen::MatrixXd &  uv,
const Eigen::MatrixXd &  pts,
const double  t,
Eigen::MatrixXd &  val 
) const
overridevirtual

Implements polyfem::assembler::Problem.

Definition at line 1224 of file GenericProblem.cpp.

References polyfem::assembler::Problem::boundary_ids_, dirichlet_, polyfem::mesh::Mesh::get_boundary_id(), is_all_, and val.

Here is the call graph for this function:

◆ dirichlet_nodal_value()

void polyfem::assembler::GenericScalarProblem::dirichlet_nodal_value ( const mesh::Mesh mesh,
const int  node_id,
const RowVectorNd pt,
const double  t,
Eigen::MatrixXd &  val 
) const
overridevirtual

Reimplemented from polyfem::assembler::Problem.

Definition at line 1331 of file GenericProblem.cpp.

References polyfem::mesh::Mesh::get_node_id(), is_all_, nodal_dirichlet_, nodal_dirichlet_mat_, and val.

Here is the call graph for this function:

◆ exact()

void polyfem::assembler::GenericScalarProblem::exact ( const Eigen::MatrixXd &  pts,
const double  t,
Eigen::MatrixXd &  val 
) const
overridevirtual

Reimplemented from polyfem::assembler::Problem.

Definition at line 1302 of file GenericProblem.cpp.

References exact_, has_exact_sol(), val, x, y, and z.

Here is the call graph for this function:

◆ exact_grad()

void polyfem::assembler::GenericScalarProblem::exact_grad ( const Eigen::MatrixXd &  pts,
const double  t,
Eigen::MatrixXd &  val 
) const
overridevirtual

Reimplemented from polyfem::assembler::Problem.

Definition at line 1315 of file GenericProblem.cpp.

References exact_grad_, has_exact_grad_, val, x, y, and z.

◆ has_exact_sol()

bool polyfem::assembler::GenericScalarProblem::has_exact_sol ( ) const
inlineoverridevirtual

Implements polyfem::assembler::Problem.

Definition at line 172 of file GenericProblem.hpp.

References has_exact_.

Referenced by exact().

Here is the caller graph for this function:

◆ has_nodal_dirichlet()

bool polyfem::assembler::GenericScalarProblem::has_nodal_dirichlet ( )
overridevirtual

Reimplemented from polyfem::assembler::Problem.

Definition at line 1395 of file GenericProblem.cpp.

References nodal_dirichlet_mat_.

◆ has_nodal_neumann()

bool polyfem::assembler::GenericScalarProblem::has_nodal_neumann ( )
overridevirtual

Reimplemented from polyfem::assembler::Problem.

Definition at line 1400 of file GenericProblem.cpp.

◆ initial_solution()

void polyfem::assembler::GenericScalarProblem::initial_solution ( const mesh::Mesh mesh,
const Eigen::MatrixXi &  global_ids,
const Eigen::MatrixXd &  pts,
Eigen::MatrixXd &  val 
) const
overridevirtual

Reimplemented from polyfem::assembler::Problem.

Definition at line 1270 of file GenericProblem.cpp.

References polyfem::mesh::Mesh::get_body_id(), initial_solution_, and val.

Here is the call graph for this function:

◆ is_constant_in_time()

bool polyfem::assembler::GenericScalarProblem::is_constant_in_time ( ) const
inlineoverridevirtual

Reimplemented from polyfem::assembler::Problem.

Definition at line 176 of file GenericProblem.hpp.

References is_time_dept_.

◆ is_nodal_dirichlet_boundary()

bool polyfem::assembler::GenericScalarProblem::is_nodal_dirichlet_boundary ( const int  n_id,
const int  tag 
)
overridevirtual

Reimplemented from polyfem::assembler::Problem.

Definition at line 1373 of file GenericProblem.cpp.

References nodal_dirichlet_, and nodal_dirichlet_mat_.

◆ is_nodal_neumann_boundary()

bool polyfem::assembler::GenericScalarProblem::is_nodal_neumann_boundary ( const int  n_id,
const int  tag 
)
overridevirtual

Reimplemented from polyfem::assembler::Problem.

Definition at line 1390 of file GenericProblem.cpp.

References nodal_neumann_.

◆ is_rhs_zero()

bool polyfem::assembler::GenericScalarProblem::is_rhs_zero ( ) const
inlineoverridevirtual

Implements polyfem::assembler::Problem.

Definition at line 158 of file GenericProblem.hpp.

References polyfem::utils::ExpressionValue::is_zero(), and rhs_.

Referenced by rhs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_scalar()

bool polyfem::assembler::GenericScalarProblem::is_scalar ( ) const
inlineoverridevirtual

Implements polyfem::assembler::Problem.

Definition at line 173 of file GenericProblem.hpp.

◆ is_time_dependent()

bool polyfem::assembler::GenericScalarProblem::is_time_dependent ( ) const
inlineoverridevirtual

Reimplemented from polyfem::assembler::Problem.

Definition at line 174 of file GenericProblem.hpp.

References is_time_dept_.

◆ might_have_no_dirichlet()

bool polyfem::assembler::GenericScalarProblem::might_have_no_dirichlet ( )
inlineoverridevirtual

Reimplemented from polyfem::assembler::Problem.

Definition at line 177 of file GenericProblem.hpp.

References is_all_.

◆ neumann_bc()

void polyfem::assembler::GenericScalarProblem::neumann_bc ( const mesh::Mesh mesh,
const Eigen::MatrixXi &  global_ids,
const Eigen::MatrixXd &  uv,
const Eigen::MatrixXd &  pts,
const Eigen::MatrixXd &  normals,
const double  t,
Eigen::MatrixXd &  val 
) const
overridevirtual

Reimplemented from polyfem::assembler::Problem.

Definition at line 1250 of file GenericProblem.cpp.

References polyfem::mesh::Mesh::get_boundary_id(), neumann_, polyfem::assembler::Problem::neumann_boundary_ids_, val, x, y, and z.

Here is the call graph for this function:

◆ neumann_nodal_value()

void polyfem::assembler::GenericScalarProblem::neumann_nodal_value ( const mesh::Mesh mesh,
const int  node_id,
const RowVectorNd pt,
const Eigen::MatrixXd &  normal,
const double  t,
Eigen::MatrixXd &  val 
) const
overridevirtual

Reimplemented from polyfem::assembler::Problem.

Definition at line 1367 of file GenericProblem.cpp.

References polyfem::log_and_throw_error().

Here is the call graph for this function:

◆ rhs()

void polyfem::assembler::GenericScalarProblem::rhs ( const assembler::Assembler assembler,
const Eigen::MatrixXd &  pts,
const double  t,
Eigen::MatrixXd &  val 
) const
overridevirtual

Implements polyfem::assembler::Problem.

Definition at line 1208 of file GenericProblem.cpp.

References is_rhs_zero(), rhs_, val, x, y, and z.

Here is the call graph for this function:

◆ set_parameters()

void polyfem::assembler::GenericScalarProblem::set_parameters ( const json params)
overridevirtual

◆ set_time_dependent()

void polyfem::assembler::GenericScalarProblem::set_time_dependent ( const bool  val)
inline

Definition at line 175 of file GenericProblem.hpp.

References is_time_dept_, and val.

◆ set_units()

void polyfem::assembler::GenericScalarProblem::set_units ( const assembler::Assembler assembler,
const Units units 
)
overridevirtual

Reimplemented from polyfem::assembler::Problem.

Definition at line 1188 of file GenericProblem.cpp.

References dirichlet_, exact_, exact_grad_, initial_solution_, neumann_, rhs_, and polyfem::utils::ExpressionValue::set_unit_type().

Here is the call graph for this function:

◆ update_dirichlet_boundary() [1/3]

void polyfem::assembler::GenericScalarProblem::update_dirichlet_boundary ( const int  id,
const double  val,
const std::shared_ptr< utils::Interpolation > &  interp = std::make_shared< utils::NoInterpolation >() 
)

◆ update_dirichlet_boundary() [2/3]

void polyfem::assembler::GenericScalarProblem::update_dirichlet_boundary ( const int  id,
const json val,
const std::string &  interp = "" 
)

Definition at line 1688 of file GenericProblem.cpp.

References polyfem::assembler::Problem::boundary_ids_, polyfem::utils::Interpolation::build(), dirichlet_, and val.

Here is the call graph for this function:

◆ update_dirichlet_boundary() [3/3]

void polyfem::assembler::GenericScalarProblem::update_dirichlet_boundary ( const int  id,
const std::function< double(double x, double y, double z, double t)> &  func,
const std::shared_ptr< utils::Interpolation > &  interp = std::make_shared< utils::NoInterpolation >() 
)

◆ update_neumann_boundary() [1/3]

void polyfem::assembler::GenericScalarProblem::update_neumann_boundary ( const int  id,
const double  val,
const std::shared_ptr< utils::Interpolation > &  interp = std::make_shared< utils::NoInterpolation >() 
)

◆ update_neumann_boundary() [2/3]

void polyfem::assembler::GenericScalarProblem::update_neumann_boundary ( const int  id,
const json val,
const std::string &  interp = "" 
)

Definition at line 1711 of file GenericProblem.cpp.

References polyfem::utils::Interpolation::build(), neumann_, polyfem::assembler::Problem::neumann_boundary_ids_, and val.

Here is the call graph for this function:

◆ update_neumann_boundary() [3/3]

void polyfem::assembler::GenericScalarProblem::update_neumann_boundary ( const int  id,
const std::function< double(double x, double y, double z, double t)> &  func,
const std::shared_ptr< utils::Interpolation > &  interp = std::make_shared< utils::NoInterpolation >() 
)

◆ update_nodes()

void polyfem::assembler::GenericScalarProblem::update_nodes ( const Eigen::VectorXi &  in_node_to_node)
overridevirtual

Reimplemented from polyfem::assembler::Problem.

Definition at line 1405 of file GenericProblem.cpp.

References nodal_dirichlet_mat_.

Member Data Documentation

◆ dirichlet_

std::vector<ScalarBCValue> polyfem::assembler::GenericScalarProblem::dirichlet_
private

◆ exact_

utils::ExpressionValue polyfem::assembler::GenericScalarProblem::exact_
private

Definition at line 214 of file GenericProblem.hpp.

Referenced by clear(), exact(), set_parameters(), and set_units().

◆ exact_grad_

std::array<utils::ExpressionValue, 3> polyfem::assembler::GenericScalarProblem::exact_grad_
private

Definition at line 215 of file GenericProblem.hpp.

Referenced by clear(), exact_grad(), set_parameters(), and set_units().

◆ has_exact_

bool polyfem::assembler::GenericScalarProblem::has_exact_ = false
private

Definition at line 217 of file GenericProblem.hpp.

Referenced by clear(), has_exact_sol(), and set_parameters().

◆ has_exact_grad_

bool polyfem::assembler::GenericScalarProblem::has_exact_grad_ = false
private

Definition at line 218 of file GenericProblem.hpp.

Referenced by clear(), exact_grad(), and set_parameters().

◆ initial_solution_

std::vector<std::pair<int, utils::ExpressionValue> > polyfem::assembler::GenericScalarProblem::initial_solution_
private

Definition at line 207 of file GenericProblem.hpp.

Referenced by initial_solution(), set_parameters(), and set_units().

◆ is_all_

bool polyfem::assembler::GenericScalarProblem::is_all_
private

◆ is_time_dept_

bool polyfem::assembler::GenericScalarProblem::is_time_dept_ = false
private

◆ neumann_

std::vector<ScalarBCValue> polyfem::assembler::GenericScalarProblem::neumann_
private

◆ nodal_dirichlet_

std::map<int, ScalarBCValue> polyfem::assembler::GenericScalarProblem::nodal_dirichlet_
private

◆ nodal_dirichlet_mat_

std::vector<Eigen::MatrixXd> polyfem::assembler::GenericScalarProblem::nodal_dirichlet_mat_
private

◆ nodal_neumann_

std::map<int, ScalarBCValue> polyfem::assembler::GenericScalarProblem::nodal_neumann_
private

Definition at line 210 of file GenericProblem.hpp.

Referenced by clear(), and is_nodal_neumann_boundary().

◆ rhs_

utils::ExpressionValue polyfem::assembler::GenericScalarProblem::rhs_
private

Definition at line 213 of file GenericProblem.hpp.

Referenced by clear(), is_rhs_zero(), rhs(), set_parameters(), and set_units().


The documentation for this class was generated from the following files: