PolyFEM
Loading...
Searching...
No Matches
PeriodicBoundary.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <polyfem/Common.hpp>
5
6#include <vector>
7
8namespace polyfem
9{
10 namespace basis
11 {
12 class ElementBases;
13 }
14
15 namespace mesh
16 {
17 class Mesh;
18 class MeshNodes;
19 class LocalBoundary;
20 }
21}
22
23namespace polyfem::utils
24{
26 {
27 public:
29 const bool is_scalar,
30 const int n_bases,
31 const std::vector<basis::ElementBases> &bases,
32 const std::shared_ptr<mesh::MeshNodes> &mesh_nodes,
33 const Eigen::MatrixXd &affine_matrix,
34 const double tol);
35
37 Eigen::MatrixXd full_to_periodic(const Eigen::MatrixXd &b, bool accumulate) const;
38 std::vector<int> full_to_periodic(const std::vector<int> &boundary_nodes) const;
39
40 inline int n_periodic_dof() const { return full_to_periodic_map_.maxCoeff() + 1; }
41 inline bool is_periodic_dof(const int idx) const { return periodic_mask_[idx]; }
42
43 Eigen::MatrixXd periodic_to_full(const int ndofs, const Eigen::MatrixXd &x_periodic) const;
44
45 bool all_direction_periodic() const;
46 bool has_periodic_bc() const;
47
48 Eigen::MatrixXd get_affine_matrix() const { return affine_matrix_; }
49
50 private:
52 Eigen::VectorXi full_to_periodic_map_;
53 Eigen::VectorXi periodic_mask_;
54
55 Eigen::MatrixXd affine_matrix_; // each column is one periodic direction
56 };
57}
Stores the basis functions for a given element in a mesh (facet in 2d, cell in 3d).
Boundary primitive IDs for a single element.
Abstract mesh class to capture 2d/3d conforming and non-conforming meshes.
Definition Mesh.hpp:39
Eigen::MatrixXd get_affine_matrix() const
Eigen::MatrixXd periodic_to_full(const int ndofs, const Eigen::MatrixXd &x_periodic) const
int full_to_periodic(StiffnessMatrix &A) const
bool is_periodic_dof(const int idx) const
Eigen::SparseMatrix< double, Eigen::ColMajor > StiffnessMatrix
Definition Types.hpp:22