10 using namespace utils;
21 file.open(path.c_str());
25 logger().error(
"Failed to open file: {}", path);
31 while (getline(file, s))
33 std::stringstream input(s);
45 std::vector<double> ¤tLine =
raw_data_.back();
48 currentLine.push_back(temp);
59 assert(
data_.size() == n_primitive);
64 data_.resize(n_primitive);
67 for (
size_t i = 0; i <
raw_ids_.size(); ++i)
74 for (
size_t j = 0; j <
raw_data_[i].size(); ++j)
84 assert(uv.size() ==
vals.size());
86 return (uv.array() *
vals.transpose().array()).sum();
90 :
Problem(name), rhs_(0), is_all_(false)
101 val = Eigen::MatrixXd::Constant(pts.rows(), pts.cols(),
rhs_);
106 val = Eigen::MatrixXd::Zero(pts.rows(), 1);
108 for (
long i = 0; i < uv.rows(); ++i)
110 const int p_id = global_ids(i);
130 void NodeProblem::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
132 val = Eigen::MatrixXd::Zero(pts.rows(), 1);
134 for (
long i = 0; i < uv.rows(); ++i)
136 const int p_id = global_ids(i);
174 if (params.contains(
"rhs"))
176 rhs_ = params[
"rhs"];
179 if (params.contains(
"values"))
181 const std::string path = params[
"values"];
185 if (params.contains(
"dirichlet_boundary"))
195 if (j_boundary[i][
"id"] ==
"all")
206 if (j_boundary[i].contains(
"dimension"))
209 auto &tmp = j_boundary[i][
"dimension"];
210 assert(tmp.is_array());
211 for (
size_t k = 0; k < tmp.size(); ++k)
217 if (params.contains(
"neumann_boundary"))
220 auto j_boundary = params[
"neumann_boundary"];
ElementAssemblyValues vals
std::vector< int > boundary_ids_
std::vector< int > neumann_boundary_ids_
Abstract mesh class to capture 2d/3d conforming and non-conforming meshes.
virtual int get_boundary_id(const int primitive) const
Get the boundary selection of an element (face in 3d, edge in 2d)
virtual bool is_volume() const =0
checks if mesh is volume
virtual int n_faces() const =0
number of faces
virtual int n_edges() const =0
number of edges
void init(const mesh::Mesh &mesh) override
bool is_dimension_dirichet(const int tag, const int dim) const override
NodeProblem(const std::string &name)
void set_parameters(const json ¶ms) 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
std::vector< Eigen::Matrix< bool, 1, 3, Eigen::RowMajor > > dirichlet_dimensions_
void rhs(const assembler::Assembler &assembler, 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
bool all_dimensions_dirichlet_
bool all_dimensions_dirichlet() const override
std::vector< bool > dirichlet_
void load(const std::string &path)
double neumann_interpolate(const int p_id, const Eigen::MatrixXd &uv) const
std::vector< int > raw_ids_
std::vector< bool > raw_dirichlet_
double interpolate(const int p_id, const Eigen::MatrixXd &uv, bool is_dirichlet) const
void init(const mesh::Mesh &mesh)
std::vector< std::vector< double > > raw_data_
double dirichlet_interpolate(const int p_id, const Eigen::MatrixXd &uv) const
std::vector< Eigen::VectorXd > data_
std::vector< T > json_as_array(const json &j)
Return the value of a json object as an array.
spdlog::logger & logger()
Retrieves the current logger.